/* ============================================================
   style.css — 다크 레트로 아케이드 테마
   ============================================================ */

/* ── 폰트 ── */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

@font-face {
  font-family: 'DungGeunMo';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_six@1.2/DungGeunMo.woff') format('woff');
  font-weight: normal;
  font-style: normal;
}

/* ── CSS 변수 ── */
:root {
  --bg-primary: #0a0a2e;
  --bg-secondary: #111140;
  --bg-card: #151545;
  --neon-green: #00ff41;
  --pixel-yellow: #ffd700;
  --text-primary: #e0e0ff;
  --text-secondary: #8888aa;
  --text-dim: #555577;
  --border-color: #333366;
  --danger: #ff4136;
  --font-pixel: 'Press Start 2P', 'DungGeunMo', monospace;
  --font-hangul: 'DungGeunMo', 'Press Start 2P', monospace;
}

/* ── 리셋 ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-hangul);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── CRT 효과 ── */
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.03) 0px,
    rgba(0,0,0,0.03) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 9999;
}

/* ── 화면 컨테이너 ── */
.screen {
  display: none;
  width: 100%;
  min-height: 100vh;
}

.screen.active {
  display: flex;
}

/* ============================================================
   입력 화면
   ============================================================ */
#inputScreen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  gap: 24px;
  position: relative;
  overflow: hidden;
}

/* ── 입력 화면 대기실 스프라이트 ── */
#waitingRoom {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 60px;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

#inputScreen .input-container,
#inputScreen .input-title,
#inputScreen .input-subtitle,
#inputScreen .btn-row {
  z-index: 1;
  position: relative;
}

.input-title {
  font-family: var(--font-pixel);
  font-size: 36px;
  color: var(--neon-green);
  text-shadow: 0 0 20px rgba(0,255,65,0.5);
  text-align: center;
  letter-spacing: 4px;
}

.input-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  font-family: var(--font-hangul);
}

.input-container {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.input-section {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
}

.input-section h3 {
  font-family: var(--font-hangul);
  font-size: 18px;
  color: var(--pixel-yellow);
  margin-bottom: 12px;
}

/* ── 텍스트에어리어 ── */
.pixel-textarea {
  width: 100%;
  min-height: 160px;
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: 4px;
  color: var(--neon-green);
  font-family: var(--font-hangul);
  font-size: 18px;
  padding: 14px;
  resize: vertical;
  outline: none;
  line-height: 1.8;
}

.pixel-textarea:focus {
  border-color: var(--neon-green);
  box-shadow: 0 0 10px rgba(0,255,65,0.2);
}

.pixel-textarea::placeholder {
  color: var(--text-dim);
}

.player-count {
  font-family: var(--font-hangul);
  font-size: 14px;
  color: var(--text-secondary);
  text-align: right;
  margin-top: 6px;
}

/* ── 팀 수 선택기 ── */
.team-count-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.team-count-btn {
  width: 52px;
  height: 52px;
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-pixel);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s;
}

.team-count-btn:hover {
  border-color: var(--pixel-yellow);
  color: var(--pixel-yellow);
}

.team-count-btn.active {
  background: var(--pixel-yellow);
  color: var(--bg-primary);
  border-color: var(--pixel-yellow);
}

/* ── 팀 이름 입력 ── */
#teamNamesContainer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.team-name-input {
  display: flex;
  align-items: center;
  gap: 10px;
}

.team-dot {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  flex-shrink: 0;
}

.pixel-input {
  flex: 1;
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-hangul);
  font-size: 16px;
  padding: 10px 14px;
  outline: none;
}

.pixel-input:focus {
  border-color: var(--neon-green);
}

.pixel-input::placeholder {
  color: var(--text-dim);
}

/* ── 버튼 ── */
.btn-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* 터치 타깃 44px — 하단 컨트롤과 같은 기준을 적용한다 */
.cross-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
  padding: 10px 18px;
  min-height: 44px;
  font-family: var(--font-hangul);
  font-size: 14px;
  color: #00e5ff;
  text-decoration: none;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  background: rgba(0,0,0,0.2);
  transition: all 0.15s;
  text-align: center;
}
.cross-link:hover {
  border-color: #00e5ff;
  background: rgba(0,229,255,0.1);
  text-shadow: 0 0 8px rgba(0,229,255,0.4);
}

/* 버튼 기본형은 PIXEL RACE 의 .btn 과 같은 규칙을 쓴다 — 두 앱을 나란히 열었을 때
   같은 아케이드 조형으로 보여야 한다. 선택자는 draft 것(.pixel-btn)을 유지하는데,
   마크업 13곳과 아래 파생 규칙들을 건드리지 않아야 기능이 그대로 남는다. */
.pixel-btn {
  font-family: var(--font-pixel);
  font-size: 13px;
  padding: 14px 24px;
  border: 3px solid;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.1s;
  background: transparent;
  text-transform: uppercase;
  image-rendering: pixelated;
  /* 터치 타깃 바닥은 draft 규약이라 race 조형과 무관하게 지킨다 */
  min-height: 44px;
}

.pixel-btn:hover { transform: translate(-2px, -2px); }
.pixel-btn:active { transform: translate(1px, 1px); }

/* 주 동작은 노랑. race 의 주 버튼 색이 기준이다 (draft 는 원래 초록이었다) */
.btn-primary {
  color: #000;
  background: var(--pixel-yellow);
  border-color: #b8860b;
  box-shadow: 4px 4px 0 #b8860b;
}
.btn-primary:hover { box-shadow: 6px 6px 0 #b8860b; }

.btn-secondary {
  color: var(--neon-green);
  border-color: var(--neon-green);
  box-shadow: 4px 4px 0 #006b1d;
}
.btn-secondary:hover { box-shadow: 6px 6px 0 #006b1d; }


/* ── 조장 지정 ── */
.captain-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.captain-header h3 {
  margin-bottom: 0;
}

.captain-toggle-label {
  position: relative;
  width: 48px;
  height: 26px;
  cursor: pointer;
  flex-shrink: 0;
}

.captain-toggle-label input {
  opacity: 0;
  width: 0;
  height: 0;
}

.captain-toggle-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border-color);
  border-radius: 13px;
  transition: background 0.2s;
}

.captain-toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.captain-toggle-label input:checked + .captain-toggle-slider {
  background: var(--neon-green);
}

.captain-toggle-label input:checked + .captain-toggle-slider::before {
  transform: translateX(22px);
}

.captain-body {
  margin-top: 12px;
}

.captain-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.captain-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.captain-team-badge {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.captain-team-name {
  font-family: var(--font-hangul);
  font-size: 14px;
  color: var(--text-primary);
  min-width: 60px;
  flex-shrink: 0;
}

.captain-select {
  flex: 1;
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-hangul);
  font-size: 15px;
  padding: 8px 10px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.captain-select:focus {
  border-color: var(--neon-green);
}

/* ── 에러 메시지 ── */
.error-msg {
  display: none;
  font-family: var(--font-hangul);
  font-size: 12px;
  color: var(--danger);
  text-align: center;
  padding: 8px;
  background: rgba(255,65,54,0.1);
  border: 1px solid var(--danger);
  border-radius: 4px;
}

/* ============================================================
   드래프트 화면
   ============================================================ */
#draftScreen {
  flex-direction: row;
  height: 100vh;
}

.draft-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── 아케이드 캐비닛 프레임 ── */
.arcade-cabinet {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 10px;
  background: linear-gradient(180deg, #1a1a3e 0%, #0d0d30 100%);
}

.cabinet-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 16px;
  background: #111133;
  border-radius: 10px 10px 0 0;
  border: 2px solid #2a2a5a;
  border-bottom: none;
}

.cabinet-label {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.cabinet-label.blink {
  animation: cabinetBlink 1.2s infinite;
}

@keyframes cabinetBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.cabinet-title {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--pixel-yellow);
  text-shadow: 0 0 8px rgba(255,215,0,0.4);
}

/* ── Canvas 영역 (브라운관) ── */
.canvas-wrapper {
  flex: 1;
  display: block;
  position: relative;
  overflow: hidden;
  min-height: 0;
  border: 3px solid #2a2a5a;
  border-radius: 6px;
  box-shadow:
    inset 0 0 30px rgba(0,0,0,0.5),
    0 0 15px rgba(0,255,65,0.05),
    0 0 40px rgba(0,100,255,0.03);
}

.canvas-wrapper::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background:
    radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.3) 100%);
  pointer-events: none;
  z-index: 1;
}

#draftCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ── 하단 컨트롤 ── */
.cabinet-bottom {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  background: #111133;
  border-radius: 0 0 10px 10px;
  border: 2px solid #2a2a5a;
  border-top: none;
}

/* 드래프트가 도는 동안에만 쓰는 버튼들이다. 그때 사용자는 프로젝터 앞이거나
   한 손으로 폰을 들고 있으므로 터치 타깃 44px 을 확보한다.
   일시정지는 픽 경계에서만 걸려서 한 번 놓치면 다음 픽까지 기다려야 한다. */
.cabinet-bottom .pixel-btn {
  font-size: 10px;
  padding: 10px 12px;
  min-width: 44px;
  letter-spacing: 0;
  white-space: nowrap;
}

.speed-btn {
  min-width: 96px;
  text-align: center;
}

/* ── 사이드바 (터미널 스타일) ── */
.draft-sidebar {
  width: 300px;
  background:
    linear-gradient(rgba(17,17,64,0.97), rgba(17,17,64,0.97)),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 19px,
      rgba(50,50,100,0.15) 19px,
      rgba(50,50,100,0.15) 20px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 19px,
      rgba(50,50,100,0.15) 19px,
      rgba(50,50,100,0.15) 20px
    );
  border-left: 3px solid #2a2a5a;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: inset 2px 0 10px rgba(0,0,0,0.3);
}

.sidebar-section {
  padding: 12px;
  border-bottom: 2px solid rgba(50,50,100,0.4);
}

.sidebar-section h4 {
  font-family: var(--font-pixel);
  font-size: 12px;
  color: var(--pixel-yellow);
  margin-bottom: 8px;
  text-shadow: 0 0 6px rgba(255,215,0,0.3);
}

.sidebar-section h4::before {
  content: '> ';
  color: var(--neon-green);
}

/* ── 팀 패널 ── */
#teamSidebar {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.team-panel {
  border: 2px solid var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.team-panel-header {
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.team-panel-name {
  font-family: var(--font-hangul);
  font-size: 13px;
  color: #ffffff;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
}

.team-panel-count {
  font-family: var(--font-hangul);
  font-size: 13px;
  color: rgba(255,255,255,0.7);
}

.team-panel-members {
  padding: 8px 12px;
  min-height: 20px;
}

.team-member-entry {
  font-family: var(--font-hangul);
  font-size: 15px;
  color: var(--text-primary);
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: memberSlideIn 0.3s ease-out;
}

.team-member-sprite {
  width: 24px;
  height: 24px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  flex-shrink: 0;
}

@keyframes memberSlideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── 드래프트 로그 ── */
.log-section {
  max-height: 280px;
  overflow-y: auto;
}

#draftLog {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-entry {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 6px 8px;
  background: var(--bg-primary);
  border-radius: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: logFadeIn 0.3s ease-out;
}

.log-entry.log-special {
  border: 1px solid var(--pixel-yellow);
}

@keyframes logFadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.log-round {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--text-dim);
  min-width: 28px;
}

.log-player {
  font-family: var(--font-hangul);
  font-size: 14px;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-arrow {
  color: var(--text-dim);
}

.log-team {
  font-family: var(--font-hangul);
  font-size: 12px;
}

.log-badge {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--pixel-yellow);
  background: rgba(255,215,0,0.15);
  padding: 2px 4px;
  border-radius: 2px;
}

/* ============================================================
   카운트다운 오버레이
   ============================================================ */
.countdown-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(10,10,46,0.9);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.countdown-overlay.active {
  display: flex;
}

.countdown-text {
  font-family: var(--font-pixel);
  font-size: 80px;
  color: var(--neon-green);
  text-shadow: 0 0 40px rgba(0,255,65,0.6);
}

.countdown-pop {
  animation: countdownPop 0.6s ease-out;
}

@keyframes countdownPop {
  0% { transform: scale(2); opacity: 0; }
  50% { transform: scale(0.9); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ============================================================
   결과 화면
   ============================================================ */
#resultConfetti {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 500;
}

#resultScreen {
  flex-direction: column;
  position: relative;
  align-items: center;
  padding: 30px 20px;
  gap: 24px;
  min-height: 100vh;
}

.result-title {
  font-family: var(--font-pixel);
  font-size: 28px;
  color: var(--pixel-yellow);
  text-shadow: 0 0 20px rgba(255,215,0,0.4);
  text-align: center;
}

#resultsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 1000px;
}

.result-card {
  border: 2px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-card);
  animation: cardSlideUp 0.5s ease-out backwards;
}

@keyframes cardSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-card-header {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.result-card-header h3 {
  font-family: var(--font-hangul);
  font-size: 18px;
  color: #ffffff;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
}

.result-card-header span {
  font-family: var(--font-hangul);
  font-size: 16px;
  color: rgba(255,255,255,0.7);
}

.result-card-members {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-member {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: default;
  transition: transform 0.15s;
  min-width: 0;
}

.result-member:hover {
  transform: scale(1.05);
}

.result-sprite {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  transition: transform 0.15s;
}

.result-member:hover .result-sprite {
  transform: scale(1.2);
}

.result-member span {
  font-family: var(--font-hangul);
  font-size: 18px;
  color: var(--text-primary);
  /* 비정상적으로 긴 이름이 카드 밖으로 넘치지 않게 한다 */
  min-width: 0;
  overflow-wrap: anywhere;
}

.result-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================================
   링크 / API 버튼 행 (입력 화면)
   ============================================================ */
.link-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* 주 CTA 를 가리지 않도록 낮은 대비의 보조 버튼 */

/* ============================================================
   API 사용법 문서 오버레이
   ============================================================ */
.doc-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1600;
  background: rgba(6,6,26,0.88);
  padding: 20px;
  overflow-y: auto;
}

.doc-overlay.active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.doc-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 22px 24px 24px;
  width: 100%;
  max-width: 680px;
  margin: auto;
  font-family: var(--font-hangul);
}

.doc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.doc-title {
  font-family: var(--font-pixel);
  font-size: 16px;
  color: var(--neon-green);
  text-shadow: 0 0 10px rgba(0,255,65,0.35);
}

.doc-close {
  background: transparent;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 16px;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  flex-shrink: 0;
}

.doc-close:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.doc-lead {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.doc-lead strong { color: var(--pixel-yellow); }

.doc-h3 {
  font-family: var(--font-hangul);
  font-size: 15px;
  color: var(--pixel-yellow);
  margin: 20px 0 8px;
}

.doc-h3::before {
  content: '> ';
  color: var(--neon-green);
}

.doc-h3-hint {
  font-size: 12px;
  color: var(--text-dim);
}

.doc-code {
  display: block;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--neon-green);
  overflow-x: auto;
  white-space: pre;
}

/* 표는 좁은 화면에서 표 자체만 가로 스크롤한다 (본문은 스크롤되지 않는다) */
.doc-table-wrap {
  overflow-x: auto;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 460px;
}

.doc-table th,
.doc-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

.doc-table th {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: normal;
}

.doc-table td { color: var(--text-primary); }
.doc-table em { color: var(--danger); font-style: normal; font-size: 13px; }

.doc-table code,
.doc-lead code {
  color: var(--neon-green);
  background: var(--bg-primary);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 13px;
}

.doc-examples {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doc-example {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: 4px;
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-hangul);
  min-height: 44px;
  transition: border-color 0.15s;
}

.doc-example:hover {
  border-color: var(--neon-green);
}

.doc-example-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.doc-example-url {
  font-size: 12px;
  color: var(--neon-green);
  word-break: break-all;
}

.doc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-primary);
}

.doc-list li::before {
  content: '· ';
  color: var(--neon-green);
}

.doc-list strong { color: var(--pixel-yellow); }

.doc-foot {
  margin-top: 22px;
  display: flex;
  justify-content: center;
}

@media (max-width: 480px) {
  .doc-card { padding: 16px 14px 20px; }
  .doc-title { font-size: 13px; }
  .doc-lead { font-size: 14px; }
}

/* ============================================================
   PRESS START 오버레이 (URL 파라미터 자동 시작)
   ============================================================ */
.start-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: var(--bg-primary);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  overflow-y: auto;
}

.start-overlay.active {
  display: flex;
}

.start-title {
  font-family: var(--font-pixel);
  font-size: clamp(20px, 6vw, 40px);
  color: var(--neon-green);
  text-shadow: 0 0 20px rgba(0,255,65,0.5);
  letter-spacing: 3px;
}

.start-summary {
  font-family: var(--font-hangul);
  font-size: 18px;
  color: var(--pixel-yellow);
}

.start-players {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 640px;
}

.start-player {
  font-family: var(--font-hangul);
  font-size: 15px;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 4px;
  padding: 5px 10px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.start-note {
  font-family: var(--font-hangul);
  font-size: 13px;
  color: var(--text-secondary);
}

.start-cta {
  font-family: var(--font-pixel);
  font-size: clamp(13px, 3.5vw, 20px);
  color: var(--pixel-yellow);
  text-shadow: 0 0 14px rgba(255,215,0,0.5);
  letter-spacing: 2px;
  margin-top: 6px;
  animation: startBlink 1.1s steps(2, start) infinite;
}

@keyframes startBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.start-hint {
  font-family: var(--font-hangul);
  font-size: 13px;
  color: var(--text-dim);
}

/* 오버레이 자체가 클릭 대상이므로, 이 버튼은 클릭이 위로 새지 않게 막는다 */
.start-edit {
  margin-top: 4px;
  font-size: 11px;
  padding: 12px 18px;
}

/* ============================================================
   접근성 유틸
   ============================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   토스트
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  padding: 12px 20px;
  background: var(--bg-card);
  border: 2px solid var(--neon-green);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-hangul);
  font-size: 14px;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  max-width: min(90vw, 420px);
  text-align: center;
}

.toast.active {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast-error {
  border-color: var(--danger);
  color: var(--danger);
}

/* ============================================================
   명단 프리셋
   ============================================================ */
.preset-save-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  /* 픽셀 폰트 버튼은 한글 버튼보다 넓다 — 좁은 화면에서 입력칸과 나란히 두면
     줄이 넘친다. 넘치는 대신 아래로 내려간다. */
  flex-wrap: wrap;
}

.preset-save-row .pixel-input {
  flex: 1 1 140px;
  min-width: 0;
}

.preset-save-btn {
  font-size: 10px;
  padding: 10px 14px;
  flex-shrink: 0;
}

.share-row {
  display: flex;
  justify-content: center;
  margin-top: 4px;
}

.preset-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.preset-empty {
  font-family: var(--font-hangul);
  font-size: 13px;
  color: var(--text-dim);
}

.preset-row {
  display: flex;
  gap: 6px;
}

.preset-load {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: 4px;
  padding: 10px 12px;
  cursor: pointer;
  font-family: var(--font-hangul);
  transition: border-color 0.15s, color 0.15s;
  min-width: 0;
}

.preset-load:hover {
  border-color: var(--neon-green);
}

.preset-name {
  font-size: 15px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preset-meta {
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.preset-delete {
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-dim);
  font-family: var(--font-hangul);
  font-size: 14px;
  width: 40px;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}

.preset-delete:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* ============================================================
   드래프트 연출 보조
   ============================================================ */
.pause-btn {
  min-width: 84px;
}

/* 픽 카드가 도착하면 팀 패널이 한 번 뛴다 */
@keyframes panelPulse {
  0%   { transform: scale(1);    box-shadow: 0 0 0 rgba(255,255,255,0); }
  35%  { transform: scale(1.045); box-shadow: 0 0 18px rgba(255,255,255,0.35); }
  100% { transform: scale(1);    box-shadow: 0 0 0 rgba(255,255,255,0); }
}

.team-panel.panel-pulse {
  animation: panelPulse 0.55s ease-out;
}

.captain-crown {
  color: var(--pixel-yellow);
  font-size: 12px;
  flex-shrink: 0;
}

.team-member-entry.is-captain span:not(.captain-crown) {
  color: var(--pixel-yellow);
}

/* ============================================================
   스크롤바
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* ============================================================
   반응형
   ============================================================ */
/* ── 모바일 반응형 ── */
@media (max-width: 768px) {
  #draftScreen {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  .draft-main {
    min-height: 50vh;
  }

  .arcade-cabinet {
    padding: 5px;
  }

  .cabinet-top {
    padding: 4px 10px;
  }

  .cabinet-label {
    font-size: 6px;
    letter-spacing: 1px;
  }

  .cabinet-title {
    font-size: 8px;
  }

  .canvas-wrapper {
    min-height: 300px;
  }

  .cabinet-bottom {
    padding: 8px 8px;
    gap: 8px;
  }

  /* 폰트만 줄이고 44px 터치 타깃은 base 의 min-height 가 지킨다 */
  .pixel-btn {
    font-size: 10px;
    padding: 10px 16px;
  }

  .cabinet-bottom .pixel-btn {
    font-size: 9px;
    padding: 10px 8px;
  }

  .speed-btn {
    min-width: 82px;
  }

  .pause-btn {
    min-width: 70px;
  }

  .draft-sidebar {
    width: 100%;
    border-left: none;
    border-top: 2px solid var(--border-color);
    max-height: none;
    overflow: visible;
  }

  #teamSidebar {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px;
  }

  .team-panel {
    flex: 1 1 calc(50% - 6px);
    min-width: 140px;
  }

  .team-panel-header {
    padding: 5px 8px;
  }

  .team-panel-name {
    font-size: 11px;
  }

  .team-panel-count {
    font-size: 11px;
  }

  .team-member-entry {
    font-size: 12px;
    padding: 2px 0;
  }

  .team-member-sprite {
    width: 18px;
    height: 18px;
  }

  .team-panel-members {
    padding: 4px 8px;
  }

  .sidebar-section {
    padding: 8px;
  }

  .sidebar-section h4 {
    font-size: 10px;
    margin-bottom: 4px;
  }

  .log-section {
    max-height: 150px;
    overflow-y: auto;
  }

  .log-entry {
    font-size: 10px;
    padding: 3px 6px;
  }

  .log-round {
    font-size: 7px;
  }

  .log-player {
    font-size: 11px;
  }

  .log-team {
    font-size: 10px;
  }

  .log-badge {
    font-size: 7px;
  }

  .input-title {
    font-size: 16px;
  }

  .countdown-text {
    font-size: 50px;
  }

  #resultsGrid {
    grid-template-columns: 1fr;
  }

  .result-title {
    font-size: 20px;
  }

  .result-buttons {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .input-title {
    font-size: 20px;
  }

  .input-subtitle {
    font-size: 13px;
  }

  .input-section h3 {
    font-size: 15px;
  }

  .pixel-textarea {
    font-size: 16px;
  }

  .pixel-btn {
    font-size: 10px;
    padding: 10px 14px;
  }

  .team-count-btn {
    width: 42px;
    height: 42px;
    font-size: 14px;
  }

  .canvas-wrapper {
    min-height: 250px;
  }

  #teamSidebar {
    flex-direction: column;
  }

  .team-panel {
    flex: 1 1 100%;
  }

  .result-card-header h3 {
    font-size: 15px;
  }

  .result-card-header span {
    font-size: 13px;
  }

  .result-member span {
    font-size: 15px;
  }
}

/* ============================================================
   모션 최소화 선호
   Canvas 쪽 카메라/블러/쉐이크는 S.reducedMotion 이 끈다.
   여기서는 DOM 애니메이션을 정지시킨다.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .cabinet-label.blink,
  .start-cta {
    animation: none;
    opacity: 1;
  }

  .result-member:hover,
  .result-member:hover .result-sprite {
    transform: none;
  }
}
