/* Rap Challenge — direction B "Reflektor": one word in a spotlight, stage tinted per genre.
   Single dark look by design; genre tokens are swapped at runtime from main.js. */

@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url(../fonts/unbounded-latin-ext-wght-normal.woff2) format('woff2-variations');
  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: 'Unbounded';
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url(../fonts/unbounded-latin-wght-normal.woff2) format('woff2-variations');
  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: 'Inter Tight';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(../fonts/inter-tight-latin-ext-wght-normal.woff2) format('woff2-variations');
  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: 'Inter Tight';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(../fonts/inter-tight-latin-wght-normal.woff2) format('woff2-variations');
  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;
}

:root {
  /* genre tokens (grime by default; main.js swaps them) */
  --ground: #08171C;
  --spot: #123039;
  --spot-hit: #1C4A57;
  --accent: #62E3F2;
  --muted: #8FB0B8;
  --fg: #F4EFE9;
  --display: 'Unbounded', 'Arial Black', sans-serif;
  --body: 'Inter Tight', 'Helvetica Neue', Arial, sans-serif;
  --gutter: 24px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--ground);
  color: var(--fg);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  transition: background 240ms ease;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; margin: 0; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
[hidden] { display: none !important; }
.display { font-family: var(--display); }
.accent { color: var(--accent); }
.grow { flex: 1 1 auto; }
.noscript { padding: 24px; }

.app {
  position: relative;
  max-width: 480px;
  height: 100%;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.screen { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

.label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------------- home */
.home { overflow-x: hidden; overflow-y: auto; }
.home-spot {
  position: absolute;
  width: 520px;
  height: 520px;
  right: -250px;
  top: 60px;
  border-radius: 50%;
  background: var(--spot);
  transition: background 240ms ease;
  pointer-events: none;
}
.home > :not(.home-spot) { position: relative; }
.home-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top, 0px)) max(16px, calc(var(--gutter) - 10px)) 0 var(--gutter);
}
.wordmark { margin: 0; font-family: var(--display); font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.icon-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { color: var(--fg); }
.question { margin: 32px var(--gutter) 12px; font-size: 16px; color: var(--muted); }
.genres { display: flex; flex-direction: column; gap: 2px; }
.genre {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px var(--gutter);
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--muted);
}
.genre[aria-pressed='true'] { color: var(--accent); }
.genre-name { font-family: var(--display); font-size: clamp(40px, 12.8vw, 54px); line-height: 1; font-weight: 900; letter-spacing: -0.03em; }
.genre-meta { font-size: 14px; font-weight: 500; color: var(--fg); }
.genre:not([aria-pressed='true']) .genre-meta { display: none; }

.sheet {
  margin-top: 24px;
  background: var(--spot);
  border-radius: 28px 28px 0 0;
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: background 240ms ease;
}
.row { display: flex; flex-direction: column; gap: 8px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 20px;
  border: 1.5px solid var(--muted);
  background: transparent;
  color: var(--fg);
  font-size: 14px;
  font-weight: 600;
}
.pill[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: var(--ground); }
.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 60px;
  margin-top: 4px;
  border: 0;
  border-radius: 30px;
  background: var(--accent);
  color: var(--ground);
  font-family: var(--display);
  font-size: 17px;
  font-weight: 700;
}
.cta:active { transform: scale(0.98); }
.cta.small { height: 52px; font-size: 15px; }

/* ---------------- game */
.game-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: calc(22px + env(safe-area-inset-top, 0px)) var(--gutter) 12px;
  font-size: 14px;
}
.game-genre { font-weight: 500; color: var(--muted); }
.game-genre .accent { font-weight: 700; }
.game-bar { font-weight: 600; font-variant-numeric: tabular-nums; }
.progress { margin: 0 var(--gutter); height: 4px; border-radius: 2px; background: var(--spot); overflow: hidden; }
.progress-fill { height: 4px; border-radius: 2px; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }

.stage-row { flex: 1 1 auto; min-height: 0; display: flex; align-items: stretch; gap: 12px; padding: 0 var(--gutter); }
.stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.stage > :not(.spot) { position: relative; }
.spot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 230px;
  height: 230px;
  margin: -115px 0 0 -115px;
  border-radius: 50%;
  background: var(--spot);
  transition: transform 90ms ease-out, background 90ms ease-out;
}
.stage.hit .spot { background: var(--spot-hit); transform: scale(1.12); }
.prev { font-family: var(--display); font-size: 20px; font-weight: 500; color: var(--muted); min-height: 1.2em; text-align: center; }
.word {
  font-family: var(--display);
  font-size: 48px;
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: -0.03em;
  text-align: center;
  max-width: 100%;
  overflow-wrap: break-word;
  color: var(--fg);
}
.word.hidden-word { color: var(--muted); letter-spacing: 0.1em; }
.stage.hit .word { color: var(--accent); }
.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 12px;
  border-radius: 15px;
  border: 1.5px solid var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
.chip-tag { font-family: var(--display); color: var(--accent); }
.next { font-size: 15px; color: var(--muted); text-align: center; }
.next b { color: var(--fg); font-weight: 600; }

.upcoming {
  flex: 0 0 92px;
  margin: 0;
  padding: 0 0 0 12px;
  list-style: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  border-left: 1px solid var(--spot);
}
.upcoming li { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.up-tag { flex: none; font-family: var(--display); font-size: 10px; font-weight: 700; color: var(--accent); }
.up-word { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }

.meter { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 0 var(--gutter); }
.cell {
  height: 64px;
  border-radius: 14px;
  border: 2px solid var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}
.cell.passed { background: var(--spot); border-color: var(--spot); }
.cell.active { background: var(--accent); border-color: var(--accent); color: var(--ground); }
.cell-num { font-family: var(--display); font-size: 18px; font-weight: 700; }
.cell-label { font-size: 11px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px var(--gutter) calc(30px + env(safe-area-inset-bottom, 0px));
}
.ghost-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
}
.round-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: var(--ground);
  display: flex;
  align-items: center;
  justify-content: center;
}
.round-btn .ico-play { display: none; }
.round-btn.paused .ico-play { display: block; }
.round-btn.paused .ico-pause { display: none; }

/* ---------------- results */
.results { padding: calc(24px + env(safe-area-inset-top, 0px)) var(--gutter) calc(24px + env(safe-area-inset-bottom, 0px)); gap: 16px; overflow-y: auto; }
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.results-head h2 { margin: 0; font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }
.tag-pill { min-height: 30px; display: flex; align-items: center; padding: 0 12px; border-radius: 15px; background: var(--spot); font-size: 13px; font-weight: 600; white-space: nowrap; }
.big { display: flex; flex-direction: column; gap: 4px; }
.big-num { font-size: clamp(110px, 36vw, 140px); line-height: 0.9; font-weight: 900; letter-spacing: -0.05em; color: var(--accent); font-variant-numeric: tabular-nums; }
.big-cap { font-size: 20px; font-weight: 500; }
.streak { background: var(--spot); border-radius: 20px; padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.streak-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.streak-title { font-size: 16px; font-weight: 700; }
.streak-sub { font-size: 13px; color: var(--muted); }
.days { display: flex; gap: 5px; flex: none; }
.day { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10px; color: var(--muted); }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); }
.day.done .dot { background: var(--accent); border-color: var(--accent); }
.day.today .dot { box-shadow: 0 0 0 2px var(--spot), 0 0 0 3.5px var(--fg); }
.rhymes { display: flex; flex-direction: column; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rchip { min-height: 32px; display: flex; align-items: center; padding: 4px 12px; border-radius: 16px; border: 1.5px solid var(--accent); font-size: 13px; font-weight: 600; }
.rchip.fill { background: var(--accent); color: var(--ground); }
.empty-note { font-size: 14px; color: var(--muted); margin: 0; }
.results-actions { display: flex; flex-direction: column; gap: 10px; }
.results-actions .cta { height: 56px; font-size: 16px; margin: 0; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.outline-btn { min-height: 48px; border-radius: 24px; border: 1.5px solid var(--muted); background: transparent; font-size: 15px; font-weight: 600; }

/* ---------------- settings dialog */
.dialog {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: var(--spot);
  color: var(--fg);
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.dialog-body { display: flex; flex-direction: column; gap: 14px; padding: 24px; }
.dialog h2 { margin: 0; font-size: 22px; font-weight: 700; }
.dialog h3 { margin: 6px 0 0; font-size: 15px; font-weight: 700; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; }
.field output { color: var(--accent); font-variant-numeric: tabular-nums; }
.field input[type='range'] { width: 100%; accent-color: var(--accent); min-height: 32px; }
.hint { margin: 0; font-size: 13px; line-height: 1.45; color: var(--muted); }

@media (max-height: 700px) {
  .question { margin-top: 18px; }
  .cell { height: 54px; }
  .controls { padding-top: 14px; padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
  .upcoming { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .spot, .home-spot, .sheet, body { transition: none; }
  .stage.hit .spot { transform: none; }
}
