:root {
  /* FotMob 스타일 다크 팔레트 — 앱 client/lib/core/theme/fw_colors.dart 와 동일 토큰 */
  --bg: #131418;
  --surface: #1b1d22;
  --surface2: #22252b;
  --hairline: #2a2d34;
  --ink: #f1f2f4;
  --muted: #9ea3ae;
  --muted2: #6c717b;
  --accent: #4da0ff;
  --accent-soft: rgba(77, 160, 255, .14);
  --live: #f03a47;
  --win: #22c55e;
  --loss: #f47171;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .28);
  --maxw: 720px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Apple SD Gothic Neo",
    "Noto Sans KR", "Malgun Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

body { display: flex; flex-direction: column; min-height: 100vh; }

a { color: var(--accent); text-decoration: none; }

/* ── Top bar ───────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(19, 20, 24, .92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  color: var(--ink);
  padding: env(safe-area-inset-top) 16px 0;
  border-bottom: 1px solid var(--hairline);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--ink);
}
.brand-mark { font-size: 20px; }
.brand-name { font-size: 17px; }

/* ── Layout ────────────────────────────── */
#app {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px;
}

.footer {
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  color: var(--muted2);
  font-size: 12px;
  text-align: center;
}

/* ── States (loading / error) ──────────── */
.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 64px 16px;
  color: var(--muted);
  text-align: center;
}
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--hairline);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Cards ─────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ── Hero / invite ─────────────────────── */
.hero {
  text-align: center;
  padding: 32px 20px;
}
.hero-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.hero h1 {
  font-size: 24px;
  margin: 0 0 6px;
  letter-spacing: -.02em;
  color: var(--ink);
}
.hero p { color: var(--muted); margin: 0 0 8px; }
.hero a { font-weight: 700; }
.hero .code {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--ink);
  background: var(--surface2);
  border: 1px dashed var(--hairline);
  border-radius: 10px;
  padding: 10px 18px;
  margin: 12px 0 4px;
}

/* ── Store buttons ─────────────────────── */
.stores {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 320px;
  margin: 20px auto 0;
}
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  border: 1px solid var(--hairline);
  background: var(--surface2);
  color: var(--ink);
  cursor: pointer;
  transition: transform .06s ease, box-shadow .12s ease, filter .12s ease;
}
.btn:active { transform: scale(.98); }
.btn--primary {
  background: var(--accent);
  color: #0a0d12;
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(77, 160, 255, .32);
}
.btn--primary:hover { filter: brightness(1.06); }
.btn--dark { background: #000; color: #fff; border-color: #000; }

/* ── Tournament header ─────────────────── */
.t-head { padding: 18px 18px 0; }
.t-head h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.02em; color: var(--ink); }
.t-head .sub { color: var(--muted); font-size: 13px; }

.tabs {
  display: flex;
  gap: 4px;
  padding: 14px 14px 0;
  border-bottom: 1px solid var(--hairline);
}
.tab {
  appearance: none;
  border: 0;
  background: none;
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }

.panel { padding: 16px 14px; }

/* ── Stage / round ─────────────────────── */
.stage { margin-bottom: 22px; }
.stage:last-child { margin-bottom: 0; }
.stage-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 4px;
  color: var(--ink);
}
.stage-fmt {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface2);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 2px 8px;
}
.round-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 14px 0 6px;
}

/* ── Match row ─────────────────────────── */
.match {
  display: flex;
  align-items: stretch;
  gap: 12px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: var(--surface);
}
.match-rows { flex: 1; min-width: 0; }
.side {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
}
.side + .side { border-top: 1px dashed var(--hairline); }
.side .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}
.side .name.tbd { color: var(--muted2); font-style: italic; }
.side.win .name { font-weight: 800; }
.side.win .score { color: var(--win); }
.score { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 20px; text-align: right; color: var(--ink); }
.match-meta {
  flex: none;
  align-self: center;
  display: flex;
  align-items: center;
}
.pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.pill--pending { background: var(--surface2); color: var(--muted); border: 1px solid var(--hairline); }
.pill--live { background: rgba(240, 58, 71, .16); color: var(--live); }
.pill--done { background: rgba(34, 197, 94, .14); color: var(--win); }

/* ── Standings table ───────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.standings {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.standings th, .standings td {
  padding: 9px 8px;
  text-align: center;
  white-space: nowrap;
  border-bottom: 1px solid var(--hairline);
  color: var(--ink);
}
.standings th {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
}
.standings td.player, .standings th.player { text-align: left; }
.standings td.rank { font-weight: 800; color: var(--accent); }
.standings td.pts { font-weight: 800; }
.form { display: inline-flex; gap: 3px; }
.form i {
  width: 16px; height: 16px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  font-style: normal;
  color: #0a0d12;
  display: inline-flex; align-items: center; justify-content: center;
}
.form .W { background: var(--win); }
.form .D { background: #b9a23a; }
.form .L { background: var(--loss); }

/* ── App CTA banner (in tournament view) ── */
.app-cta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 14px 16px;
}
.app-cta .txt { flex: 1; }
.app-cta .txt b { display: block; font-size: 14px; color: var(--ink); }
.app-cta .txt span { font-size: 12px; color: var(--muted); }
.app-cta .btn { height: 40px; padding: 0 16px; flex: none; }

@media (min-width: 560px) {
  .stores { flex-direction: row; }
  .stores .btn { flex: 1; }
}
