/* Drop a subset woff2 at this path and the whole site picks it up. No code
   change required. See public/assets/fonts/README.md. */
@font-face {
  font-family: 'QRcade Display';
  src: url('/assets/fonts/display.woff2') format('woff2');
  font-weight: 400 900;
  font-display: swap;
}

:root {
  --bg: #0a0a14;
  --fg: #f0f0f0;
  --accent: #39ff14;
  --dim: #20242e;
  --font-display: 'QRcade Display', 'Arial Black', 'Helvetica Neue', system-ui, sans-serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --tap: 48px;
  --pad: max(16px, env(safe-area-inset-left));
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

button { font-family: inherit; color: inherit; cursor: pointer; }

/* ---------- play shell ---------- */

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

#hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) var(--pad) 10px;
  pointer-events: none;
  z-index: 2;
}

#hud .readout { display: flex; flex-direction: column; line-height: 1; }
#hud .label {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--fg);
  opacity: 0.55;
  margin-bottom: 5px;
}
#hud .value {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 34px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
#hud .status {
  font-family: var(--font-mono);
  font-size: 15px;
  opacity: 0.8;
  align-self: center;
}

#mute {
  pointer-events: auto;
  background: none;
  border: 0;
  padding: 8px;
  width: var(--tap);
  height: var(--tap);
  opacity: 0.5;
  font-size: 20px;
  line-height: 1;
}
#mute[aria-pressed='false'] { opacity: 0.9; }

/* ---------- full-screen states (never a modal) ---------- */

#overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding: calc(20px + env(safe-area-inset-top)) var(--pad) calc(20px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: fade 0.18s ease-out;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.stateTitle {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(26px, 9vw, 44px);
  letter-spacing: 0.06em;
  text-align: center;
  margin: 4px 0 0;
  color: var(--accent);
}

.bigScore {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(64px, 26vw, 130px);
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  margin: 10px 0 2px;
}

.scoreLabel,
.hint {
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.22em;
  opacity: 0.55;
}

.projected {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.08em;
  margin-top: 14px;
  min-height: 20px;
  color: var(--accent);
}

/* everything the thumb needs lives in the bottom 60% */
.thumbZone { margin-top: auto; padding-top: 24px; }

.slots {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 8px 0 4px;
}
.slot {
  width: 22vw;
  max-width: 86px;
  height: 22vw;
  max-height: 86px;
  border: 3px solid var(--dim);
  border-radius: 8px;
  background: transparent;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(30px, 11vw, 52px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.slot[aria-selected='true'] {
  border-color: var(--accent);
  color: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.45; } }

.keys {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 16px;
}
.keys button {
  min-height: var(--tap);
  border: 1px solid var(--dim);
  border-radius: 6px;
  background: #ffffff0a;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
}
.keys button:active { background: var(--accent); color: var(--bg); }
.keys .wide { grid-column: span 2; font-size: 15px; }

.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.btn {
  min-height: 58px;
  border: 2px solid var(--dim);
  border-radius: 8px;
  background: transparent;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.14em;
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  min-height: 68px;
  font-size: 22px;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}
.btn.shirt { border-style: dashed; }
.btn[disabled] { opacity: 0.4; }

/* ---------- leaderboard ---------- */

.tabs { display: flex; gap: 8px; margin: 14px 0 10px; }
.tab {
  flex: 1;
  min-height: 42px;
  border: 1px solid var(--dim);
  border-radius: 6px;
  background: transparent;
  font-size: 12px;
  letter-spacing: 0.16em;
}
.tab[aria-selected='true'] { background: var(--fg); color: var(--bg); border-color: var(--fg); }

.board { font-family: var(--font-mono); font-size: 15px; width: 100%; border-collapse: collapse; }
.board td { padding: 5px 4px; border-bottom: 1px solid #ffffff10; white-space: nowrap; }
.board .rank { width: 3.2em; opacity: 0.5; font-variant-numeric: tabular-nums; }
.board .who { letter-spacing: 0.14em; }
.board .pts { text-align: right; font-variant-numeric: tabular-nums; }
.board tr.me td { color: var(--accent); border-bottom-color: var(--accent); }
.board tr.pinned td { border-top: 2px solid var(--accent); }
.boardNote { font-size: 12px; opacity: 0.55; margin: 10px 0 0; text-align: center; line-height: 1.5; }
.boardEmpty { text-align: center; padding: 22px 0; opacity: 0.5; font-family: var(--font-mono); font-size: 14px; }

/* ---------- pause / rotate ---------- */

#pause, #rotate {
  position: fixed;
  inset: 0;
  z-index: 8;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 24px;
}
#pause .stateTitle, #rotate .stateTitle { color: var(--fg); }

#rotate { display: none; }
@media (orientation: landscape) and (max-height: 520px) {
  body.play #rotate { display: flex; }
}

/* optional, off unless the skin asks for it */
body.scanlines::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, #0000 0 2px, #00000026 2px 3px);
}

/* ---------- hub ---------- */

body.hub { overflow-y: auto; height: auto; min-height: 100%; }

.hubHead {
  padding: calc(28px + env(safe-area-inset-top)) var(--pad) 8px;
  text-align: center;
}
.hubHead h1 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(34px, 13vw, 64px);
  letter-spacing: 0.1em;
  margin: 0;
  color: var(--accent);
}
.hubHead p { margin: 10px auto 0; max-width: 26em; font-size: 14px; line-height: 1.55; opacity: 0.7; }
.hubHead .reset { margin-top: 12px; font-family: var(--font-mono); font-size: 12px; opacity: 0.5; letter-spacing: 0.1em; }

.lineup {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  padding: 20px var(--pad) calc(40px + env(safe-area-inset-bottom));
  max-width: 1100px;
  margin: 0 auto;
}

.cabinet {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--dim);
  border-radius: 10px;
  padding: 12px;
  background: #ffffff06;
}
.cabinet:active { border-color: var(--accent); }
.cabinet img, .cabinet svg { width: 100%; height: auto; display: block; }
.cabinet .meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.cabinet .champ { opacity: 0.7; letter-spacing: 0.08em; }
.cabinet .champ b { color: var(--accent); font-weight: 400; }
.shirtLink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 6px;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--fg);
  opacity: 0.75;
  text-decoration: none;
  border: 1px dashed var(--dim);
  border-radius: 6px;
  justify-content: center;
}
.hubFoot { text-align: center; padding: 0 var(--pad) 40px; font-size: 12px; opacity: 0.4; line-height: 1.6; }
