/* TOYbox platform: minimal monochrome, matching toybox.xin */
:root {
  --bg: #efeee9;
  --ink: #111110;
  --mute: #75746e;
  --line: rgba(17, 17, 16, .16);
  --panel: rgba(17, 17, 16, .04);
  --danger: #b3261e;
  --pad: clamp(20px, 4vw, 56px);
  --font: "Helvetica Neue", "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e0d; --ink: #efeee9; --mute: #8a8984;
    --line: rgba(239, 238, 233, .18); --panel: rgba(239, 238, 233, .06); --danger: #f2b8b5;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh; margin: 0; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
::selection { background: var(--ink); color: var(--bg); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* Header */
.site-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px var(--pad);
}
.brand { display: inline-flex; align-items: baseline; gap: 10px; font-weight: 600; font-size: 20px; letter-spacing: -.03em; }
.brand-mark { font-style: normal; }
.brand small { font-family: var(--mono); font-size: 11px; font-weight: 400; letter-spacing: .08em; color: var(--mute); text-transform: uppercase; }
.site-nav { display: flex; gap: clamp(16px, 3vw, 36px); font-size: 14px; }
.site-nav a { position: relative; padding: 2px 0; }
.site-nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right; transition: transform .5s var(--ease);
}
.site-nav a:hover::after, .site-nav a[aria-current="page"]::after { transform: scaleX(1); transform-origin: left; }
.site-nav .ext { color: var(--mute); }

.app-shell { flex: 1; width: 100%; padding: 0 var(--pad); }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }

/* Entrance: lines rise, rows fade in. Pure CSS so there is nothing to wait for. */
@keyframes rise { from { transform: translateY(112%); } to { transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
.line { display: block; overflow: hidden; padding-bottom: .08em; margin-bottom: -.08em; }
.line > span { display: block; animation: rise 1.1s var(--ease) both; animation-delay: calc(.1s + var(--i, 0) * .12s); }
.enter { animation: fade-up .9s var(--ease) both; animation-delay: calc(.25s + var(--i, 0) * .08s); }

/* Hero */
.hero { padding: clamp(48px, 12vh, 130px) 0 clamp(32px, 6vh, 64px); }
.hero .eyebrow { margin-bottom: 28px; }
h1 { font-weight: 600; font-size: clamp(40px, 10vw, 150px); line-height: .98; letter-spacing: -.045em; }
h2 { font-size: clamp(24px, 3.4vw, 40px); font-weight: 600; letter-spacing: -.03em; line-height: 1.15; margin-bottom: 18px; }
h3 { font-size: clamp(22px, 3.6vw, 52px); font-weight: 500; letter-spacing: -.035em; line-height: 1.1; }
.lede { max-width: 44ch; margin-top: 32px; color: var(--mute); font-size: clamp(15px, 1.5vw, 18px); }

/* Index rows: game catalog */
.game-grid { margin: clamp(24px, 6vh, 60px) 0 clamp(48px, 10vh, 110px); border-top: 1px solid var(--line); }
.game-card {
  position: relative; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: baseline; gap: 16px;
  padding: clamp(20px, 3vw, 34px) 0; border-bottom: 1px solid var(--line); overflow: hidden;
}
.game-card::before { content: ""; position: absolute; inset: 0; background: var(--ink); transform: translateY(101%); transition: transform .55s var(--ease); }
.game-card > * { position: relative; transition: color .4s, transform .55s var(--ease); }
.game-num { font-family: var(--mono); font-size: 12px; color: var(--mute); }
.game-icon { display: none; }
.game-body p { margin-top: 8px; max-width: 46ch; color: var(--mute); font-size: 14px; }
.game-card .play { justify-self: end; font-size: 14px; white-space: nowrap; }
.game-card .play::after { content: " ↗"; }
@media (hover: hover) {
  .game-card:hover::before { transform: translateY(0); }
  .game-card:hover > *, .game-card:hover .game-body p { color: var(--bg); }
  .game-card:hover .game-body { transform: translateX(14px); }
}
@media (max-width: 600px) { .game-card { grid-template-columns: 32px minmax(0, 1fr); } .game-card .play { grid-column: 2; justify-self: start; } }

/* Panels: account, leaderboard, player center */
.panel { width: min(680px, 100%); margin: clamp(28px, 7vh, 80px) 0 clamp(48px, 10vh, 100px); }
.panel .eyebrow { margin-bottom: 14px; }
.panel h2 { font-size: clamp(30px, 5vw, 64px); letter-spacing: -.04em; margin-bottom: 28px; }
.auth-switch, .tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 24px; }
.tab, .secondary, .primary {
  min-height: 42px; padding: 8px 20px; border: 1px solid var(--ink); border-radius: 999px; background: transparent;
  cursor: pointer; font-size: 14px; display: inline-flex; align-items: center; justify-content: center;
  transition: background .25s, color .25s, border-color .25s;
}
.tab { border-color: var(--line); color: var(--mute); min-height: 36px; padding: 4px 16px; }
.tab:hover { color: var(--ink); border-color: var(--ink); }
.tab.active, .primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.secondary:hover { background: var(--ink); color: var(--bg); }
.primary:hover { opacity: .85; }
.field { display: grid; gap: 6px; margin: 18px 0; }
.field label { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.field input {
  width: 100%; height: 48px; padding: 0 2px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  background: transparent; font-size: 18px; transition: border-color .3s;
}
.field input:focus { outline: none; border-bottom-color: var(--ink); }
.status { min-height: 24px; margin: 14px 0; color: var(--mute); font-size: 14px; }
.error { color: var(--danger); }

/* Rank rows */
.rank-list { border-top: 1px solid var(--line); }
.rank-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: baseline; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.rank-row.self { background: var(--panel); box-shadow: -14px 0 0 var(--panel), 14px 0 0 var(--panel); }
.rank-number { font-family: var(--mono); font-size: 14px; color: var(--mute); }
.rank-row:nth-child(-n+3) .rank-number { color: var(--ink); font-weight: 700; }
.rank-name { font-size: clamp(18px, 2.4vw, 26px); font-weight: 500; letter-spacing: -.02em; }
.rank-value { font-size: clamp(18px, 2.4vw, 26px); font-weight: 600; font-variant-numeric: tabular-nums; }
.empty { padding: 48px 0; color: var(--mute); }
.me-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }

.site-foot {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 22px var(--pad) calc(26px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 12px; color: var(--mute);
}
.site-foot a:hover { color: var(--ink); }

@media (max-width: 600px) {
  .site-head { padding-top: max(16px, env(safe-area-inset-top)); }
  .brand small { display: none; }
  .rank-row { grid-template-columns: 44px minmax(0, 1fr) auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
