/* 2026 월드컵 예측 — 밝고 차분한 단일 액센트 테마
   원칙: 하나의 액센트(블루), 타이트한 타이포(음수 자간), 그라데이션 배제,
        헤어라인·면(surface)으로 구분, 넉넉한 여백, pill 액션. */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --surface-sunken: #f0f0f3;

  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #8e8e93;

  --hairline: rgba(0, 0, 0, .10);
  --hairline-2: rgba(0, 0, 0, .16);

  --accent: #0071e3;
  --accent-press: #0058b9;
  --accent-tint: rgba(0, 113, 227, .10);

  --live: #ff3b30;
  --gold: #b07d12;
  --gold-tint: rgba(214, 162, 48, .14);

  --r-card: 18px;
  --r-input: 12px;
  --r-pill: 980px;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 20px rgba(0, 0, 0, .05);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, .18);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Pretendard",
          "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- 헤더 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--hairline);
  background: rgba(255, 255, 255, .72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { font-size: 28px; }
.brand h1 { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
.brand-sub { font-size: 11px; color: var(--ink-3); letter-spacing: 0; }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.lang-switch {
  display: flex; border: 1px solid var(--hairline); border-radius: var(--r-pill);
  overflow: hidden; background: var(--surface);
}
.lang-switch button {
  border: none; background: none; color: var(--ink-2); cursor: pointer;
  font-size: 12px; font-weight: 600; padding: 6px 13px; letter-spacing: -0.01em;
  transition: color .15s;
}
.lang-switch button.active { background: var(--accent); color: #fff; }

.user-area { display: flex; align-items: center; gap: 10px; }
.user-name { font-size: 13px; font-weight: 600; color: var(--ink); }

.btn {
  border: 1px solid var(--hairline); background: var(--surface); color: var(--ink);
  padding: 8px 16px; border-radius: var(--r-pill); cursor: pointer;
  font-size: 13px; font-weight: 600; letter-spacing: -0.01em;
  transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover { background: var(--surface-sunken); }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-press); border-color: var(--accent-press); }
.btn.small { padding: 6px 13px; font-size: 12px; }

/* ---------- 탭 ---------- */
.tabs {
  display: flex; gap: 4px; padding: 16px 22px 0; max-width: 980px; margin: 0 auto;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: none; background: none; color: var(--ink-2); font-size: 14px; font-weight: 600;
  padding: 9px 15px; cursor: pointer; border-radius: var(--r-pill); white-space: nowrap;
  letter-spacing: -0.01em; transition: background .15s, color .15s;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); background: var(--surface); box-shadow: 0 0 0 1px var(--hairline); }

main { max-width: 980px; margin: 0 auto; padding: 22px 22px 64px; }
.view { display: none; }
.view.active { display: block; }
.loading { text-align: center; color: var(--ink-3); padding: 64px 0; font-size: 15px; }
.muted { color: var(--ink-3); font-weight: 400; font-size: .85em; letter-spacing: 0; }

/* ---------- 필터 칩 ---------- */
.filterbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  border: 1px solid var(--hairline); background: var(--surface); color: var(--ink-2);
  padding: 7px 15px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600;
  cursor: pointer; letter-spacing: -0.01em; transition: all .15s;
}
.chip:hover { border-color: var(--hairline-2); color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- 경기 카드 ---------- */
.date-header {
  font-size: 13px; font-weight: 700; color: var(--ink-2); letter-spacing: -0.01em;
  margin: 26px 0 12px; padding-left: 2px;
}
.match-card {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-card);
  padding: 16px 20px; margin-bottom: 12px; box-shadow: var(--shadow-card);
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center;
}
.match-meta {
  grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--ink-3); margin-bottom: 6px; letter-spacing: 0;
}
.badge {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: var(--r-pill);
  letter-spacing: -0.01em; white-space: nowrap;
}
.badge.scheduled { background: var(--surface-sunken); color: var(--ink-2); }
.badge.live { background: rgba(255, 59, 48, .12); color: var(--live); }
.badge.finished { background: var(--surface-sunken); color: var(--ink-3); }
.badge.pt3 { background: var(--accent); color: #fff; }
.badge.pt1 { background: var(--accent-tint); color: var(--accent); }
.badge.pt0 { background: var(--surface-sunken); color: var(--ink-3); }

.team { display: flex; align-items: center; gap: 11px; min-width: 0; }
.team.away { flex-direction: row-reverse; text-align: right; }
.team img {
  width: 28px; height: 28px; border-radius: 5px; object-fit: cover; flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--hairline);
}
.team .name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team .name.tbd { color: var(--ink-3); font-weight: 500; font-size: 13px; }

.score-area { display: flex; align-items: center; gap: 8px; justify-content: center; }
.score-area input {
  width: 46px; height: 44px; text-align: center; font-size: 19px; font-weight: 700;
  background: var(--surface-sunken); border: 1px solid transparent; border-radius: var(--r-input);
  color: var(--ink); transition: border-color .15s, background .15s;
  -moz-appearance: textfield;
}
.score-area input::-webkit-outer-spin-button,
.score-area input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.score-area input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-tint); }
.score-area input:disabled { opacity: .5; }
.score-area .vs { color: var(--ink-3); font-weight: 600; }
.final-score { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.final-score .pen { font-size: 12px; color: var(--ink-3); font-weight: 600; letter-spacing: 0; }
.my-pred { grid-column: 1 / -1; text-align: center; font-size: 12px; color: var(--ink-3); margin-top: 6px; letter-spacing: -0.01em; }
.my-pred .badge { margin-left: 4px; }

/* ---------- 테이블 ---------- */
table {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border-radius: var(--r-card); overflow: hidden;
  border: 1px solid var(--hairline); box-shadow: var(--shadow-card);
}
th, td { padding: 13px 15px; text-align: left; font-size: 14px; letter-spacing: -0.01em; }
th {
  background: var(--surface-2); color: var(--ink-3); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .02em; border-bottom: 1px solid var(--hairline);
}
tbody tr { border-bottom: 1px solid var(--hairline); }
tbody tr:last-child { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.rank { font-weight: 700; width: 44px; color: var(--ink-2); }
.player { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.player img { width: 26px; height: 26px; border-radius: 50%; box-shadow: 0 0 0 1px var(--hairline); }
.winner-row { background: var(--gold-tint); }
.crown { font-size: 16px; }
.points-cell { font-weight: 700; color: var(--ink); }

.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.panel-head h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
select {
  background: var(--surface); color: var(--ink); border: 1px solid var(--hairline);
  border-radius: var(--r-pill); padding: 8px 14px; font-size: 13px; font-weight: 600;
  letter-spacing: -0.01em; cursor: pointer;
}

.winner-banner {
  background: var(--gold-tint); border: 1px solid rgba(214, 162, 48, .28);
  border-radius: var(--r-card); padding: 16px 20px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 14px;
}
.winner-banner .trophy { font-size: 34px; }
.winner-banner b { color: var(--gold); font-weight: 700; }

/* ---------- 그룹 ---------- */
.group-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 28px; }
.card {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-card);
  padding: 20px; box-shadow: var(--shadow-card);
}
.card h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 6px; }
.card p { margin-bottom: 14px; }
.row { display: flex; gap: 8px; }
.row input {
  flex: 1; background: var(--surface-sunken); border: 1px solid transparent; border-radius: var(--r-input);
  padding: 10px 13px; color: var(--ink); font-size: 14px; letter-spacing: -0.01em;
}
.row input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-tint); }
.section-title { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 12px; }
.group-item {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-card);
  padding: 15px 20px; margin-bottom: 10px; box-shadow: var(--shadow-card);
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.group-item .g-name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.group-item .g-meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.code-pill {
  font-family: ui-monospace, "SF Mono", monospace; background: var(--accent-tint);
  color: var(--accent); padding: 6px 12px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 700; cursor: pointer; letter-spacing: 0;
  transition: background .15s;
}
.code-pill:hover { background: rgba(0, 113, 227, .18); }

.login-prompt { text-align: center; padding: 64px 20px; color: var(--ink-3); font-size: 15px; }
.login-prompt .big { font-size: 40px; margin-bottom: 14px; }

footer {
  max-width: 980px; margin: 0 auto; padding: 22px 22px 48px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-3); border-top: 1px solid var(--hairline); letter-spacing: -0.01em;
}
footer b { color: var(--ink-2); font-weight: 600; }

/* ---------- 로그인/회원가입 모달 ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, .32); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  position: relative; width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 22px;
  padding: 28px 26px; box-shadow: var(--shadow-pop);
}
.modal-close {
  position: absolute; top: 16px; right: 16px; border: none; background: none;
  color: var(--ink-3); font-size: 16px; cursor: pointer; padding: 4px; line-height: 1;
}
.modal-close:hover { color: var(--ink); }
.auth-tabs { display: flex; gap: 4px; margin-bottom: 22px; background: var(--surface-sunken); padding: 4px; border-radius: 12px; }
.auth-tab {
  flex: 1; border: none; background: none; color: var(--ink-2);
  font-size: 14px; font-weight: 600; padding: 9px; border-radius: 9px; cursor: pointer;
  letter-spacing: -0.01em; transition: all .15s;
}
.auth-tab.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.auth-form { display: flex; flex-direction: column; gap: 15px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: -0.01em; }
.field input {
  background: var(--surface-sunken); border: 1px solid transparent; border-radius: var(--r-input);
  padding: 12px 14px; color: var(--ink); font-size: 15px; letter-spacing: -0.01em;
}
.field input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-tint); }
.auth-hint { font-size: 12px; color: var(--ink-3); margin: -4px 0 2px; letter-spacing: -0.01em; }
.auth-submit { width: 100%; padding: 13px; font-size: 15px; margin-top: 4px; }

/* ---------- 토스트 ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--ink); border: none; color: #fff;
  padding: 12px 22px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600;
  opacity: 0; transition: all .25s; z-index: 100; box-shadow: var(--shadow-pop);
  letter-spacing: -0.01em;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--live); }

@media (max-width: 640px) {
  .group-actions { grid-template-columns: 1fr; }
  .team .name { font-size: 13px; }
  .brand-sub { display: none; }
  main, .topbar, .tabs, footer { padding-left: 16px; padding-right: 16px; }
}
