/* Pocket Arcade shared styles: fonts, colour tokens (light default + dark), header, buttons, nickname form.
   Every page loads this first. Design reference: docs/DESIGN.md */

/* ===================== Fonts (self-hosted, SIL OFL) ===================== */
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-display: swap; font-weight: 400; src: url(/static/fonts/space-grotesk-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-display: swap; font-weight: 400; src: url(/static/fonts/space-grotesk-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-display: swap; font-weight: 500; src: url(/static/fonts/space-grotesk-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-display: swap; font-weight: 500; src: url(/static/fonts/space-grotesk-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-display: swap; font-weight: 600; src: url(/static/fonts/space-grotesk-latin-ext-600-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-display: swap; font-weight: 600; src: url(/static/fonts/space-grotesk-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-display: swap; font-weight: 700; src: url(/static/fonts/space-grotesk-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-display: swap; font-weight: 700; src: url(/static/fonts/space-grotesk-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-display: swap; font-weight: 400; src: url(/static/fonts/geist-mono-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-display: swap; font-weight: 400; src: url(/static/fonts/geist-mono-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-display: swap; font-weight: 500; src: url(/static/fonts/geist-mono-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-display: swap; font-weight: 500; src: url(/static/fonts/geist-mono-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-display: swap; font-weight: 600; src: url(/static/fonts/geist-mono-latin-ext-600-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-display: swap; font-weight: 600; src: url(/static/fonts/geist-mono-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

/* ===================== Tokens ===================== */
:root {
  --font-ui: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --accent: #E1B77E;
  --on-accent: #0B0B0B;
}
:root, [data-theme="light"] {
  --bg: #F1F4F5;
  --surface: #FFFFFF;
  --border: #DDE3E5;
  --pill-border: #CBD3D6;
  --head: #054E5A;
  --text: #111416;
  --muted: #5A636E;
  --dim: #8A949F;
  --track: #E3E8EA;
  --seg-bg: #EEF2F3;
  --seg-on: #FFFFFF;
  --seg-shadow: 0 1px 2px rgba(17, 20, 22, 0.10);
  --kbd-bg: #FFFFFF;
  --kbd-border: #CBD3D6;
  --mistake: #C03627;
  --accent-text: #054E5A;
  --accent-text-soft: rgba(5, 78, 90, 0.08);
  --you-row: rgba(225, 183, 126, 0.22);
  --shade: rgba(17, 20, 22, 0.22);
  --lift: 0 10px 28px -18px rgba(17, 20, 22, 0.35);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #101517;
  --surface: #171E21;
  --border: #242E31;
  --pill-border: #2F3B3F;
  --head: #DFE4E7;
  --text: #F3F5F6;
  --muted: #A1A9B4;
  --dim: #6E7B80;
  --track: #242E31;
  --seg-bg: #101517;
  --seg-on: #232D30;
  --seg-shadow: none;
  --kbd-bg: #12191B;
  --kbd-border: #34423F;
  --mistake: #F68363;
  --accent-text: #E1B77E;
  --accent-text-soft: rgba(225, 183, 126, 0.14);
  --you-row: rgba(225, 183, 126, 0.12);
  --shade: rgba(0, 0, 0, 0.6);
  --lift: 0 12px 30px -18px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

/* ===================== Base ===================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  transition: background-color 200ms ease, color 200ms ease;
}
button, input { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

.page {
  min-height: 100vh;
  padding: 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; min-width: 0; }

/* ===================== Header ===================== */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; border-radius: 12px; }
.logo {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center;
}
.brand-title { font-size: 19px; font-weight: 600; letter-spacing: -0.015em; color: var(--head); }
a.brand:hover .brand-title { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.crumb-sep { color: var(--pill-border); font-size: 22px; font-weight: 300; }
.crumb { font-size: 19px; font-weight: 500; letter-spacing: -0.015em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  width: 44px; height: 44px; padding: 0; border-radius: 999px;
  border: 1px solid var(--pill-border); background: transparent; color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
[data-theme="light"] .icon-sun, [data-theme="dark"] .icon-moon { display: none; }
.me-name { font-size: 14px; color: var(--muted); }
.avatar {
  width: 36px; height: 36px; border-radius: 999px;
  background: var(--accent-text-soft); color: var(--accent-text);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
}

/* ===================== Shared controls ===================== */
.headline { display: flex; flex-direction: column; gap: 10px; }
.headline h1, .headline h2 { margin: 0; font-size: 34px; font-weight: 600; letter-spacing: -0.025em; color: var(--head); }
.headline p { margin: 0; font-size: 16px; color: var(--muted); min-height: 1.4em; }
kbd {
  min-width: 26px; height: 26px; padding: 0 7px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--kbd-border); border-bottom-width: 2px; border-radius: 6px;
  background: var(--kbd-bg); color: var(--text);
  font-family: var(--font-mono); font-size: 12px;
}
.btn-primary {
  height: 48px; padding: 0 22px; border: 0; border-radius: 12px;
  background: var(--accent); color: var(--on-accent);
  font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 12px; cursor: pointer;
}
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.btn-primary kbd { height: 22px; min-width: 0; padding: 0 6px; background: transparent; color: var(--on-accent); border: 1px solid rgba(11, 11, 11, 0.35); border-radius: 5px; font-size: 11px; }
.btn-secondary {
  height: 48px; padding: 0 18px; border: 1px solid var(--kbd-border); border-radius: 12px;
  background: transparent; color: var(--text); font-size: 15px; font-weight: 500; cursor: pointer;
}

/* ===================== Nickname form ===================== */
.join-form { display: flex; flex-direction: column; gap: 10px; }
.join-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.join-row { display: flex; gap: 12px; }
.join-row input {
  flex: 1; min-width: 0; height: 48px; padding: 0 16px;
  border: 1px solid var(--kbd-border); border-radius: 12px;
  background: var(--kbd-bg); color: var(--text);
  font-size: 18px; font-weight: 500;
}
.join-row input:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 1px; border-color: transparent; }
.join-row .btn-primary { min-width: 104px; }
.join-hint { margin: 0; font-size: 13px; color: var(--muted); }
.join-error { margin: 0; font-size: 14px; font-weight: 500; color: var(--mistake); }

/* ===================== Small screens ===================== */
@media (max-height: 820px) {
  .page { padding: 24px 40px; gap: 20px; }
}
@media (max-height: 760px) {
  .page { padding: 16px 32px; gap: 16px; }
}
@media (max-width: 720px) {
  .page { padding: 20px 16px; }
  .join-row { flex-direction: column; }
  .join-row input { flex: none; }
  .crumb-sep, .crumb { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  body { transition: none; }
}
