:root {
  color-scheme: dark;
  --bg: #101216;
  --panel: #16191f;
  --ink: #e8e6e1;
  --muted: #8f8a80;
  --line: #22262e;
  --up: #ff4d3d;
  --down: #3d7bff;
  --amber: #e8a33d;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, Menlo, monospace;
  --sans: 'Noto Sans KR', system-ui, -apple-system, 'Malgun Gothic', sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--bg); line-height: 1.6; }
a { color: var(--amber); text-underline-offset: 4px; }
button, input, select { font: inherit; }
button, .button {
  display: inline-block; border: 1px solid var(--amber); border-radius: 4px;
  padding: 10px 18px; background: var(--amber); color: #101216; font-weight: 700;
  cursor: pointer; text-decoration: none; text-align: center;
}
button:hover, .button:hover { filter: brightness(1.08); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.secondary, .button.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
button.secondary:hover, .button.secondary:hover { border-color: var(--muted); filter: none; }
button.small { padding: 4px 10px; font-size: .82rem; border-radius: 3px; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
[hidden] { display: none !important; }

header { background: var(--panel); border-bottom: 1px solid var(--line); }
.nav { max-width: 1160px; margin: auto; padding: 14px 24px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.logo { font-weight: 900; font-size: 1.25rem; letter-spacing: -.03em; color: var(--ink); text-decoration: none; margin-right: auto; }
.logo::before { content: ''; display: inline-block; width: 9px; height: 9px; background: var(--amber); margin-right: 8px; }
nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
nav a { color: var(--muted); text-decoration: none; font-size: .9rem; }
nav a:hover { color: var(--ink); }
nav a[aria-current='page'] { color: var(--amber); font-weight: 700; }
.nav-user { font-size: .85rem; color: var(--muted); font-family: var(--mono); }

main { max-width: 1160px; margin: 0 auto; padding: 40px 24px 80px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-weight: 900; font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.25; letter-spacing: -.04em; margin-bottom: 12px; }
h2 { font-weight: 900; font-size: 1.2rem; letter-spacing: -.02em; margin-bottom: 16px; }
h3 { font-size: 1.05rem; }
h3 a { color: var(--ink); text-decoration: none; }
h3 a:hover { color: var(--amber); }
.eyebrow { font-family: var(--mono); font-size: .72rem; letter-spacing: .18em; font-weight: 700; color: var(--amber); text-transform: uppercase; }
.muted, .note { color: var(--muted); }
.note { font-size: .84rem; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.section { margin-top: 32px; }

.hero {
  background-color: #101216;
  background-image: url('/assets/hero.jpg');
  background-size: cover; background-position: center;
  border: 1px solid var(--line); border-radius: 4px;
  padding: clamp(48px, 9vw, 110px) clamp(24px, 6vw, 72px);
  margin-bottom: 36px;
}
.hero-title { font-size: clamp(3rem, 9vw, 6.5rem); font-weight: 900; letter-spacing: -.05em; line-height: 1; margin-bottom: 18px; }
.hero-copy { font-size: clamp(1.05rem, 2.2vw, 1.5rem); font-weight: 700; max-width: 620px; margin-bottom: 28px; }
.hero-note { margin-top: 22px; margin-bottom: 0; }

.panel, .card { padding: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 14px; }
.stat-label { font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.stat-value { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: clamp(1.4rem, 2.5vw, 1.9rem); font-weight: 700; text-align: right; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); }
table { border-collapse: collapse; width: 100%; white-space: nowrap; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); }
th {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); background: #13161c; border-bottom: 1px solid var(--line);
}
tbody tr:hover td { background: #191d25; }
tbody tr:last-child td { border-bottom: 0; }
td.numeric, th.numeric { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
#ranking-body tr:nth-child(-n+3):has(td:nth-child(4)) td:first-child,
#league-ranking tr:nth-child(-n+3):has(td:nth-child(3)) td:first-child { border-left: 3px solid var(--amber); padding-left: 11px; }
.up { color: var(--up); }
.down { color: var(--down); }
.empty { text-align: center; padding: 30px; color: var(--muted); }

.message { margin: 16px 0; padding: 11px 14px; border: 1px solid var(--line); border-left: 3px solid var(--up); border-radius: 3px; background: var(--panel); color: var(--up); font-size: .9rem; }
.message.success { border-left-color: var(--amber); color: var(--amber); }

label { display: grid; gap: 6px; margin-bottom: 16px; font-size: .88rem; color: var(--muted); }
input, select {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 3px;
  background: var(--bg); color: var(--ink); min-width: 0; width: 100%;
}
input:focus, select:focus { border-color: var(--amber); outline: none; }
input[type='number'] { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.auth-panel { max-width: 440px; margin: 10px auto; }
.tabs { display: flex; gap: 6px; margin-bottom: 24px; }
.tabs button { flex: 1; }
.code { font-family: var(--mono); font-weight: 700; font-size: 1.15rem; letter-spacing: .18em; color: var(--amber); }

.comment { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--amber); border-radius: 3px; padding: 18px 22px; margin-top: 24px; }
.comment p { margin-bottom: 0; }

dialog { width: min(440px, calc(100% - 32px)); padding: 26px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--ink); }
dialog::backdrop { background: rgba(0, 0, 0, .72); }
#trade-estimate { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--amber); }

#guest-note { padding: 12px 16px; border: 1px solid var(--line); border-left: 3px solid var(--amber); border-radius: 3px; background: var(--panel); }
.card .eyebrow { margin-bottom: 6px; }
.card .code { display: inline-block; margin-top: 10px; font-size: .95rem; }

footer { border-top: 1px solid var(--line); padding: 20px; text-align: center; color: var(--muted); font-family: var(--mono); font-size: .72rem; letter-spacing: .06em; }

@media (max-width: 480px) {
  .nav { gap: 10px; padding: 12px 16px; }
  nav { width: 100%; gap: 12px; }
  nav a { font-size: .82rem; }
  main { padding: 24px 14px 56px; }
  .hero { padding: 40px 20px; }
  th, td { padding: 8px 10px; }
  .panel, .card { padding: 16px; }
  dialog { padding: 20px; }
}
