/* ============================================================
   2026 북중미 월드컵 · 대한민국 승부예측 — 모바일 우선 스타일
   고시인성: 큰 글자, 높은 대비, 큰 터치 타깃, 다크 네이비 배경
   ============================================================ */
:root {
  --navy:      #0a1a3f;
  --navy-2:    #12275c;
  --card:      #16213e;
  --card-2:    #1d2c52;
  --line:      #2a3a66;
  --text:      #f4f7ff;
  --muted:     #9fb0d6;
  --kr-red:    #cd2e3a;   /* 태극기 적 */
  --kr-blue:   #0047a0;   /* 태극기 청 */
  --accent:    #ffd54a;   /* 골드(우승) */
  --win:       #28c76f;
  --draw:      #ffae42;
  --loss:      #ff5c7c;
  --radius:    18px;
  --shadow:    0 10px 30px rgba(0,0,0,.35);
  --safe-top:  env(safe-area-inset-top, 0px);
  --safe-bot:  env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: radial-gradient(120% 80% at 50% 0%, #163172 0%, var(--navy) 55%, #060f24 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo',
               'Malgun Gothic', 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
  overscroll-behavior-y: none;
}
#app { min-height: 100%; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ── 세로 스와이프(스크롤 스냅) 컨테이너 ── */
.snap {
  height: 100dvh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}
.section {
  min-height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  padding: calc(var(--safe-top) + 16px) 16px calc(var(--safe-bot) + 24px);
  display: flex;
  flex-direction: column;
}

/* ── 헤더 ── */
.hdr { text-align: center; margin-bottom: 14px; }
.hdr .eyebrow {
  font-size: 12px; letter-spacing: .14em; color: var(--accent);
  font-weight: 800; text-transform: uppercase;
}
.hdr h1 { font-size: 19px; margin: 4px 0 0; font-weight: 800; }
.hdr .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ── 카드 ── */
.card {
  background: linear-gradient(160deg, var(--card) 0%, var(--card-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card + .card { margin-top: 14px; }

/* ── 경기 매치업 ── */
.match { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.team { flex: 1; text-align: center; }
.team .flag { font-size: 44px; line-height: 1; }
.team .name { font-weight: 800; font-size: 16px; margin-top: 6px; }
.team.kr .name { color: #ff8a95; }
.vs { font-weight: 900; color: var(--muted); font-size: 15px; padding: 0 2px; }
.match-meta { text-align: center; color: var(--muted); font-size: 13px; margin-top: 4px; }
.stage-badge {
  display: inline-block; background: var(--navy-2); color: var(--accent);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 12px; font-size: 12px; font-weight: 700; margin-bottom: 4px;
}

/* ── 점수 입력 스테퍼 ── */
.score-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 18px 0 6px; }
.stepper { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; max-width: 130px; }
.stepper .lbl { font-size: 13px; font-weight: 700; color: var(--muted); }
.stepper.kr .lbl { color: #ff8a95; }
.stepper-ctrl { display: flex; align-items: center; gap: 10px; }
.stepper-ctrl button {
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--navy-2); color: var(--text);
  font-size: 26px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: transform .08s, background .15s;
}
.stepper-ctrl button:active { transform: scale(.9); background: var(--kr-blue); }
.score-val {
  font-size: 52px; font-weight: 900; min-width: 64px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.colon { font-size: 40px; font-weight: 900; color: var(--muted); padding-top: 20px; }

/* ── 버튼 ── */
.btn {
  display: block; width: 100%; border: none; border-radius: 14px;
  padding: 16px; font-size: 17px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--kr-red), #e8434f);
  box-shadow: 0 8px 20px rgba(205,46,58,.35);
  transition: transform .08s, opacity .15s; margin-top: 14px;
}
.btn:active { transform: translateY(2px) scale(.99); }
.btn:disabled { opacity: .5; box-shadow: none; }
.btn.secondary { background: var(--navy-2); border: 1px solid var(--line); box-shadow: none; }
.btn.gold { background: linear-gradient(135deg, #ffd54a, #ffb300); color: #2a1d00; box-shadow: 0 8px 20px rgba(255,180,0,.3); }
.btn.sm { padding: 10px; font-size: 14px; margin-top: 0; width: auto; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); box-shadow: none; }

/* ── 입력 필드 ── */
.field { margin-top: 14px; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.input, select.input {
  width: 100%; padding: 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--navy);
  color: var(--text); font-size: 16px; outline: none;
}
.input:focus { border-color: var(--kr-blue); }
.help { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ── 내 예측 표시 ── */
.mypick {
  margin-top: 14px; text-align: center; font-size: 14px; color: var(--muted);
  background: var(--navy); border: 1px dashed var(--line); border-radius: 12px; padding: 12px;
}
.mypick b { color: var(--accent); font-size: 18px; }

/* ── 결과 화면 ── */
.result-score { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 14px 0; }
.result-score .num { font-size: 64px; font-weight: 900; font-variant-numeric: tabular-nums; }
.outcome-badge {
  display: inline-block; padding: 6px 18px; border-radius: 999px;
  font-weight: 800; font-size: 15px; margin: 6px auto;
}
.outcome-badge.W { background: rgba(40,199,111,.18); color: var(--win); border: 1px solid var(--win); }
.outcome-badge.D { background: rgba(255,174,66,.18); color: var(--draw); border: 1px solid var(--draw); }
.outcome-badge.L { background: rgba(255,92,124,.18); color: var(--loss); border: 1px solid var(--loss); }

/* ── 통계 ── */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-box { background: var(--navy); border: 1px solid var(--line); border-radius: 12px; padding: 12px 6px; text-align: center; }
.stat-box .v { font-size: 24px; font-weight: 900; }
.stat-box .k { font-size: 11px; color: var(--muted); margin-top: 2px; }
.chart-wrap { position: relative; height: 200px; margin-top: 6px; }
.section-title { font-size: 15px; font-weight: 800; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* ── 리더보드 ── */
.lb { width: 100%; border-collapse: collapse; }
.lb th, .lb td { padding: 10px 8px; text-align: left; font-size: 14px; border-bottom: 1px solid var(--line); }
.lb th { color: var(--muted); font-size: 12px; font-weight: 700; }
.lb td.r { text-align: right; font-variant-numeric: tabular-nums; }
.lb .rank { font-weight: 900; width: 34px; }
.lb tr:nth-child(1) .rank { color: var(--accent); }
.lb tr:nth-child(2) .rank { color: #cdd6f4; }
.lb tr:nth-child(3) .rank { color: #d8a26a; }
.pts { font-weight: 800; color: var(--accent); }
.hit { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; }
.hit.exact { background: rgba(255,213,74,.2); color: var(--accent); }
.hit.outcome { background: rgba(40,199,111,.18); color: var(--win); }
.hit.miss { background: rgba(255,92,124,.15); color: var(--loss); }
.ico { font-size: 14px; margin-left: 2px; }
.score { font-weight: 800; }
.score.win { color: var(--win); }      /* 승리 배팅 — 초록 */
.score.loss { color: var(--loss); }    /* 패배 배팅 — 핑크 */
.score.draw { color: #ffe066; }        /* 무승부 배팅 — 노랑 */
.wdl-count { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.wdl-box { border-radius: 12px; padding: 12px 6px; text-align: center; border: 1px solid var(--line); background: var(--navy); }
.wdl-box .v { font-size: 26px; font-weight: 900; line-height: 1; }
.wdl-box .k { font-size: 11px; margin-top: 4px; font-weight: 700; }
.wdl-box.win { background: rgba(40,199,111,.12); border-color: rgba(40,199,111,.5); }
.wdl-box.win .v { color: var(--win); }
.wdl-box.draw { background: rgba(255,224,102,.12); border-color: rgba(255,224,102,.5); }
.wdl-box.draw .v { color: #ffe066; }
.wdl-box.loss { background: rgba(255,92,124,.12); border-color: rgba(255,92,124,.5); }
.wdl-box.loss .v { color: var(--loss); }
.lb tr.hl td { background: rgba(255,213,74,.07); }
.legend { font-size: 12px; color: var(--text); margin-top: 10px; text-align: center; }
.legend .muted { display: block; margin-top: 2px; }

.award { display: flex; gap: 10px; margin-top: 12px; }
.award .award-card { flex: 1; background: var(--navy); border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; }
.award .emoji { font-size: 28px; }
.award .who { font-weight: 800; font-size: 15px; margin-top: 4px; }
.award .meta { font-size: 12px; color: var(--muted); }

/* ── 게임 선택 칩 ── */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin: 0 -4px 8px; -webkit-overflow-scrolling: touch; }
.chip {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: var(--navy-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.chip.active { background: var(--kr-blue); color: #fff; border-color: var(--kr-blue); }

/* ── 스와이프 힌트 ── */
.swipe-hint { margin-top: auto; text-align: center; color: var(--muted); font-size: 13px; padding-top: 14px; }
.swipe-hint .arrow { display: block; font-size: 22px; animation: bob 1.6s infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); opacity:.5 } 50% { transform: translateY(6px); opacity:1 } }

/* ── 상단 미니 바 ── */
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.topbar .who { display: flex; align-items: center; gap: 6px; }
.topbar a { color: var(--muted); text-decoration: none; }

/* ── 토스트 ── */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-bot)); transform: translateX(-50%) translateY(20px);
  background: #0c1430; border: 1px solid var(--line); color: var(--text);
  padding: 12px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .25s; z-index: 100; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--loss); color: #ffd0d9; }
.toast.ok { border-color: var(--win); color: #c9f7df; }

/* ── 중앙 정렬(게이트/로그인) ── */
.center-wrap { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px 18px; }
.brand { text-align: center; margin-bottom: 22px; }
.brand .trophy { font-size: 56px; }
.brand h1 { font-size: 22px; margin: 8px 0 2px; font-weight: 900; }
.brand p { color: var(--muted); font-size: 14px; margin: 0; }

/* ── 관리자 ── */
.admin-wrap { max-width: 720px; margin: 0 auto; padding: calc(var(--safe-top) + 16px) 14px calc(var(--safe-bot) + 40px); }
.admin-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.admin-head h1 { font-size: 18px; margin: 0; }
.game-item { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.game-item .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.game-item .title { font-weight: 800; font-size: 15px; }
.pill { font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 999px; }
.pill.scheduled { background: #334; color: #aab; }
.pill.open { background: rgba(40,199,111,.2); color: var(--win); }
.pill.closed { background: rgba(255,174,66,.2); color: var(--draw); }
.pill.finished { background: rgba(0,71,160,.3); color: #8ab4ff; }
.row-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.muted { color: var(--muted); }
.loading { text-align: center; color: var(--muted); padding: 40px 0; }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; margin: 0 auto 12px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 14px; }
