:root {
  --bg: #faf7f5;
  --surface: #ffffff;
  --surface-2: #f1ece9;
  --text: #14162b;
  --text-dim: #6b667e;
  --accent: #ff3e6c;
  --accent-ink: #ffffff;
  --accent-2: #ffc93c;
  --good: #16a34a;
  --good-bg: #e8f9ee;
  --bad: #e11d48;
  --bad-bg: #fdeaee;
  --warn: #d97706;
  --border: #e7dfda;
  --shadow: 0 12px 30px -14px rgba(20, 22, 43, 0.25);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f1a;
    --surface: #171827;
    --surface-2: #1f2133;
    --text: #f5f3ff;
    --text-dim: #9490ac;
    --accent: #ff5079;
    --accent-ink: #14162b;
    --accent-2: #ffd166;
    --good: #4ade80;
    --good-bg: #123422;
    --bad: #fb7185;
    --bad-bg: #3a1620;
    --warn: #fbbf24;
    --border: #2b2d44;
    --shadow: 0 12px 30px -14px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: 'Manrope', system-ui, sans-serif;
  padding-block: max(20px, env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-bottom, 0px));
  padding-inline: 16px;
}

h1, h2, h3 { font-family: 'Unbounded', system-ui, sans-serif; margin: 0; }

.app {
  max-width: 460px;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.view { display: flex; flex-direction: column; gap: 16px; }

/* ---------- landing ---------- */

.hero { text-align: center; padding-block: 12px 4px; display: flex; flex-direction: column; gap: 10px; align-items: center; }

.hero-logo { margin: 0; width: 100%; }
.hero-logo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.hero-tag {
  margin: 0;
  color: var(--text-dim);
  font-size: 15px;
  max-width: 32ch;
  text-wrap: balance;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
}

.field { display: flex; flex-direction: column; gap: 6px; }

.field-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input[type="text"] {
  font-family: 'Manrope', sans-serif;
  font-size: 17px;
  font-weight: 600;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  outline: none;
}

input[type="text"]:focus { border-color: var(--accent); }

.code-input {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 14px;
  border: 1px solid var(--border);
}

.tab-btn {
  border: none;
  background: transparent;
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 14px;
  padding: 10px;
  border-radius: 10px;
  color: var(--text-dim);
  cursor: pointer;
}

.tab-btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 16px;
  padding: 14px 18px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-danger {
  background: var(--bad);
  color: #ffffff;
}

.btn-danger-outline {
  background: transparent;
  color: var(--bad);
  border: 1.5px solid var(--bad);
}

.icon-btn {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

.error {
  color: var(--bad);
  background: var(--bad-bg);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

/* ---------- topbar / shared ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.room-code {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 28px;
  letter-spacing: 0.15em;
  color: var(--accent);
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.round-choice { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.round-choice button {
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  font-size: 16px;
  padding: 12px 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.round-choice button[aria-checked='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.room-settings {
  margin: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  align-self: center;
}

.round-counter {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.landing-top { display: flex; justify-content: flex-end; }

.lang-switch {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2px;
}
.lang-switch button {
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 12px;
  color: var(--text-dim);
  background: none;
  border: none;
  border-radius: 8px;
  padding: 6px 9px;
  cursor: pointer;
}
.lang-switch button.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); }

.room-code.small { font-size: 16px; color: var(--text-dim); letter-spacing: 0.1em; }

.lobby-hint { color: var(--text-dim); font-size: 14px; margin: 0; text-align: center; }

.player-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
}

.player-avatar { display: flex; flex-shrink: 0; }

/* Round avatar frame; size set by the container (default 36px). */
.avatar {
  display: block;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface-2);
}
.avatar svg { display: block; width: 100%; height: 100%; }
.avatar-initials {
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  color: var(--text);
}
.avatar-sm { width: 22px; height: 22px; }
.avatar-sm.avatar-initials { font-size: 9px; }

.rank { width: 28px; text-align: center; font-size: 15px; font-weight: 800; color: var(--text-dim); flex-shrink: 0; display: flex; justify-content: center; }

.avatar-pager {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  gap: 16px;
  padding: 4px 2px;
  margin: -4px -2px;
}
.avatar-pager::-webkit-scrollbar { display: none; }
.avatar-page {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.avatar-nav { display: flex; align-items: center; justify-content: center; gap: 12px; }
.avatar-arrow {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.avatar-arrow .icon { width: 16px; height: 16px; }
.avatar-arrow:disabled { opacity: 0.3; cursor: default; }
.avatar-dots { display: flex; gap: 6px; }
.avatar-dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 999px;
  border: none;
  background: var(--border);
  cursor: pointer;
  transition: width 0.2s, background 0.2s;
}
.avatar-dots button.is-active { width: 22px; background: var(--accent); }
.avatar-hint { margin: -2px 0 0; text-align: center; font-size: 12px; font-weight: 700; color: var(--text-dim); }
.avatar-hint.is-seen { visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .avatar-pager { scroll-behavior: auto; } }
.avatar-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px 6px;
  border-radius: 14px;
  border: 1.5px solid transparent;
  background: var(--surface-2);
  color: var(--text-dim);
  font-family: 'Manrope', sans-serif;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s;
}
.avatar-option .avatar { width: 56px; height: 56px; }
.avatar-option:hover { transform: translateY(-2px); }
.avatar-option[aria-checked='true'] {
  border-color: var(--accent);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
@media (max-width: 340px) {
  .avatar-option .avatar { width: 46px; height: 46px; }
}

.invite-banner {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  border: 1px solid var(--accent);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}
.invite-banner strong { font-family: 'JetBrains Mono', monospace; color: var(--accent); letter-spacing: 0.1em; }

.invite-btn { display: flex; align-items: center; justify-content: center; gap: 6px; }

.player-name { font-weight: 700; flex: 1; }
.player-name.disconnected { color: var(--text-dim); font-style: italic; }
.player-score { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--text-dim); }
.player-crown { font-size: 15px; }

.lobby-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.waiting-note { text-align: center; color: var(--text-dim); font-size: 14px; margin: 0; }

/* ---------- playing ---------- */

/* Fixed to the top of the screen for the whole round. On phones the
   keyboard can shift the visible area; app.js re-pins it (visualViewport). */
.play-bar {
  --bar-gutter: max(16px, calc((100% - 460px) / 2));
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  padding: max(12px, env(safe-area-inset-top, 0px)) var(--bar-gutter) 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  will-change: transform;
}
/* A field scrolled into view (e.g. when tapped) lands below the bar. */
.category-row { scroll-margin-top: calc(var(--play-bar-height, 110px) + 12px); }

/* Holds the bar's space in the page so nothing hides underneath it. */
.play-bar-spacer {
  flex-shrink: 0;
  margin-top: calc(-1 * max(20px, env(safe-area-inset-top, 0px)));
  height: var(--play-bar-height, 110px);
}

.play-bar-left { display: flex; align-items: center; gap: 10px; }

.players-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
}
.players-pill[aria-expanded='true'] { border-color: var(--accent); }
/* Room head's view while the list is hidden from everyone else */
.players-pill.is-off { border-style: dashed; color: var(--text-dim); }

.players-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: var(--bar-gutter);
  width: min(320px, calc(100% - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.players-panel-head { display: flex; flex-direction: column; gap: 8px; }
.players-panel-title { font-weight: 800; font-size: 14px; }
.players-panel-hint { margin: 0; font-size: 12px; color: var(--text-dim); }
.players-panel-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 45vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.players-panel-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 14px;
  font-weight: 700;
}
.players-panel-list li.is-offline { opacity: 0.55; font-style: italic; }
.players-panel-list .pl-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.players-panel-list .pl-progress { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-dim); }
.players-panel-list .pl-progress.is-done { color: var(--good); }

.switch { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: var(--border);
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
}
.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
.switch input:checked + .switch-track { background: var(--good); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.bar-letter {
  font-family: 'Unbounded', sans-serif;
  font-weight: 800;
  font-size: 16px;
  min-width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--accent);
}
.bar-letter:empty { display: none; }

.timer {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 22px;
  min-width: 3.2ch;
  text-align: right;
  transition: color 0.3s;
}

/* Time running low: amber, then red and pulsing. */
.play-bar.is-warning .timer { color: var(--warn); }
.play-bar.is-warning .timer-fill { background: var(--warn); }
.play-bar.is-danger .timer { color: var(--bad); animation: timer-pulse 1s ease-in-out infinite; }
.play-bar.is-danger .timer-fill { background: var(--bad); }
.play-bar.is-danger { border-bottom-color: var(--bad); }

@keyframes timer-pulse {
  50% { transform: scale(1.15); }
}
@media (prefers-reduced-motion: reduce) {
  .play-bar.is-danger .timer { animation: none; }
}

.timer-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.timer-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.25s linear;
}

.letter-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding-block: 6px 2px;
}

.letter-hero-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.letter-hero-letter {
  font-family: 'Unbounded', sans-serif;
  font-weight: 800;
  font-size: 88px;
  line-height: 1;
  color: var(--accent);
}

.progress-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.progress-pip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px 5px 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
}

.progress-pip .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border);
}

.progress-pip.is-done .dot { background: var(--good); }
.progress-pip.is-me { border-color: var(--accent); color: var(--text); }

.category-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.category-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
}

.category-badge {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--accent);
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.category-fields { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.category-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.category-input {
  border: none;
  background: transparent;
  font-family: 'Manrope', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  padding: 0;
  outline: none;
  width: 100%;
}

/* ---------- reveal ---------- */

.reveal-banner {
  background: linear-gradient(155deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  border-radius: 16px;
  padding: 16px;
  font-weight: 800;
  font-size: 15px;
  text-align: center;
  box-shadow: var(--shadow);
}

.reveal-categories { display: flex; flex-direction: column; gap: 12px; }

.reveal-cat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reveal-cat-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.reveal-answers { display: flex; flex-direction: column; gap: 6px; }

.answer-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-2);
}

.answer-chip.valid { background: var(--good-bg); }
.answer-chip.invalid { background: var(--bad-bg); }

.answer-chip-name { font-weight: 700; font-size: 13px; flex-shrink: 0; }
.answer-chip-text {
  flex: 1;
  font-size: 14px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.answer-chip.valid .answer-chip-text { color: var(--good); font-weight: 600; }
.answer-chip.invalid .answer-chip-text { color: var(--bad); text-decoration: line-through; }
.answer-chip-empty { font-style: italic; color: var(--text-dim); }

.answer-chip-points {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.answer-chip.valid .answer-chip-points { color: var(--good); }
.answer-chip.invalid .answer-chip-points { color: var(--bad); }

.checking-note {
  width: 100%;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-dim);
}
.category-input:disabled { opacity: 0.7; }

.sticky-action {
  position: sticky;
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
}
.sticky-action .btn { box-shadow: var(--shadow); }

/* ---------- scores ---------- */

.scores-hero {
  background: linear-gradient(155deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  border-radius: 20px;
  padding: 22px 16px;
  text-align: center;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.scores-hero-label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.85;
}
.scores-hero-winner { font-family: 'Unbounded', sans-serif; font-weight: 800; font-size: 22px; }

.round-points {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--good);
}
.player-row.is-me { border-color: var(--accent); }

.leaderboard { display: flex; flex-direction: column; gap: 8px; }
.leaderboard-title { font-size: 16px; }
.leaderboard-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }

.letter-picker {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.letter-picker-title { margin: 0; font-weight: 700; font-size: 14px; text-align: center; }

.letter-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.letter-btn {
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}

.letter-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
  animation: toast-in 0.25s ease-out;
}
.toast .avatar { width: 26px; height: 26px; margin-left: -8px; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

.credit {
  margin-top: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}
.credit strong { color: var(--text); font-weight: 800; }

/* ---------- about / privacy / terms pages ---------- */

.app.page { max-width: 680px; gap: 20px; }
.page-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-back { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 800; font-size: 14px; text-decoration: none; }
.page-back .icon { width: 18px; height: 18px; }
.page-back:hover { color: var(--accent); }
.page-logo img { display: block; width: 100%; max-width: 340px; height: auto; margin: 0 auto; border-radius: 16px; box-shadow: var(--shadow); }
.page-body { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 22px 20px; line-height: 1.6; font-size: 15px; }
.page-body h1 { font-size: 26px; line-height: 1.2; margin-bottom: 6px; }
.page-body h2 { font-size: 16px; margin: 22px 0 6px; }
.page-body p, .page-body ul, .page-body ol { margin: 0 0 10px; }
.page-body ul, .page-body ol { padding-left: 22px; }
.page-body li { margin-bottom: 6px; }
.page-body a { color: var(--accent); font-weight: 700; }
.page-body a.btn { color: var(--text); text-decoration: none; }
.page-body .lead { font-size: 16px; color: var(--text); }
.page-updated { font-size: 13px; color: var(--text-dim); }

.contact-form { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.contact-form input[type='text'], .contact-form input[type='email'] {
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  width: 100%;
}
.contact-form input:focus { outline: none; border-color: var(--accent); }
.contact-form textarea { font-size: 16px; }
.contact-form .btn .icon { width: 22px; height: 22px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.contact-done { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 12px 0 4px; }
.contact-done > [data-icon] .icon { width: 72px; height: 72px; }
.contact-done h2 { margin: 4px 0 0; }
.contact-done .btn { margin-top: 8px; }

/* ---------- site links ---------- */

.site-links { display: flex; justify-content: center; gap: 10px; font-size: 13px; font-weight: 700; margin-top: 8px; color: var(--text-dim); }
.site-links a { color: var(--text-dim); text-decoration: none; }
.site-links a:hover { color: var(--accent); text-decoration: underline; }
.credit { margin-top: 0; }

/* ---------- admin dashboard ---------- */

.app:has(#view-admin:not([hidden])) { max-width: 1000px; }
.admin-title { font-size: 22px; }
.admin-updated { margin: 0; font-size: 12px; color: var(--text-dim); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); }
.stat-value { font-family: 'Unbounded', sans-serif; font-weight: 800; font-size: 26px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--text-dim); font-weight: 600; }
.stat-tile.is-live .stat-value { color: var(--good); }
.admin-section { display: flex; flex-direction: column; gap: 10px; }
.admin-h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.admin-count { font-family: 'JetBrains Mono', monospace; font-size: 13px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; }
.admin-rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.admin-empty { color: var(--text-dim); font-size: 14px; margin: 0; }
.admin-room { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.admin-room-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.admin-room-code { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 18px; letter-spacing: 0.1em; color: var(--accent); }
.admin-room-meta { font-size: 12px; font-weight: 700; color: var(--text-dim); text-align: right; }
.admin-players { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.admin-players li { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; padding: 4px 6px; border-radius: 10px; background: var(--surface-2); }
.admin-players .ap-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-players .ap-score { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-dim); }
.admin-players .ap-crown .icon { width: 18px; height: 18px; display: block; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); flex-shrink: 0; }
.status-dot.is-on { background: var(--good); }
.admin-note { margin: 0; font-size: 13px; color: var(--text-dim); }
.admin-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.csv-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-sm { font-size: 14px; padding: 10px 14px; border-radius: 12px; }
.delete-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.delete-row .field { flex: 1 1 160px; }
.delete-row select, .delete-row input[type='date'] {
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  width: 100%;
  color-scheme: inherit;
}

.admin-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.admin-table th, .admin-table td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table th:first-child, .admin-table td:first-child { text-align: left; }
.admin-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); background: var(--surface-2); }
.admin-table tr:last-child td { border-bottom: none; }

/* ---------- room closed ---------- */

.closed-card {
  margin-top: 8vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  text-align: center;
  box-shadow: var(--shadow);
}
.closed-art { justify-content: center; margin-bottom: 4px; }
.closed-art .icon { width: 112px; height: 112px; }
.closed-title { font-size: 24px; }
.closed-text { margin: 0 0 10px; color: var(--text-dim); font-size: 15px; line-height: 1.5; }
.closed-text strong { font-family: 'JetBrains Mono', monospace; color: var(--accent); letter-spacing: 0.08em; }

/* ---------- icons (public/icons.js) ---------- */

.icon { display: inline-block; width: 1.3em; height: 1.3em; flex-shrink: 0; vertical-align: -0.28em; }
[data-icon] { display: inline-flex; }
.btn .icon { width: 20px; height: 20px; }
.players-pill .icon { width: 20px; height: 20px; }
.player-crown .icon, .crown-mark .icon, .pl-crown .icon { width: 22px; height: 22px; display: block; }
.modal-subtitle { display: flex; align-items: center; gap: 6px; }
.modal-subtitle .icon { width: 18px; height: 18px; }
.modal-title .icon { width: 26px; height: 26px; margin-left: 6px; vertical-align: -0.2em; }
.rank .icon { width: 28px; height: 28px; display: block; }
.reveal-banner, .scores-hero-winner { display: flex; align-items: center; justify-content: center; gap: 8px; }
.reveal-banner .icon { width: 30px; height: 30px; }
.scores-hero-winner .icon { width: 36px; height: 36px; }
.checking-note { display: flex; align-items: center; justify-content: center; gap: 8px; }
.checking-note .icon { width: 24px; height: 24px; }
.invite-btn .icon { width: 22px; height: 22px; }

/* ---------- feedback ---------- */

.feedback-modal { text-align: center; align-items: stretch; }
.feedback-modal .field { text-align: left; }
.feedback-art { display: flex; justify-content: center; }
.feedback-art .avatar { width: 64px; height: 64px; }
.rating { display: flex; justify-content: center; gap: 4px; }
.rating-star { background: none; border: none; padding: 4px; cursor: pointer; border-radius: 12px; transition: transform 0.12s; }
.rating-star .icon { width: 40px; height: 40px; display: block; }
.rating-star:not(.is-on) .icon { filter: grayscale(1); opacity: 0.35; }
.rating-star:hover { transform: scale(1.12); }
.rating-star:focus-visible { outline: 2px solid var(--accent); }
.rating-label { margin: 0; min-height: 1.3em; font-weight: 800; font-size: 14px; color: var(--accent); }
textarea {
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  resize: vertical;
  width: 100%;
}
textarea:focus { outline: none; border-color: var(--accent); }

/* ---------- admin feedback & messages ---------- */

.admin-h2 .icon { width: 22px; height: 22px; }
.admin-feed { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.feed-item { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.feed-head { display: flex; align-items: center; gap: 8px; }
.admin-h2-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.admin-h2-link .icon-arrow-right { width: 16px; height: 16px; color: var(--text-dim); transition: transform 0.15s; }
.admin-h2-link:hover .icon-arrow-right { transform: translateX(3px); color: var(--accent); }
.view-all { align-self: flex-start; }
.app:has(#view-admin-list:not([hidden])) { max-width: 820px; }
#view-admin-list .page-back { background: none; border: none; padding: 0; cursor: pointer; font-family: 'Manrope', sans-serif; }
.list-head { display: flex; align-items: center; gap: 10px; }
#list-title { display: inline-flex; align-items: center; gap: 10px; }
#list-title .icon { width: 28px; height: 28px; }
.list-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.star-filter { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.star-filter button {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 13px;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}
.star-filter button .icon { width: 15px; height: 15px; }
.star-filter button.is-active { color: var(--text); border-color: var(--accent); background: var(--surface); }
.admin-list { display: flex; flex-direction: column; gap: 10px; }
.admin-list .feed-item { padding: 14px 16px; }
.admin-list .feed-text { font-size: 15px; }
.feed-head > .icon { width: 36px; height: 36px; flex-shrink: 0; }
.feed-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.feed-name { font-weight: 800; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-meta { font-size: 12px; color: var(--text-dim); font-weight: 600; }
.feed-stars { display: flex; }
.feed-stars .icon { width: 16px; height: 16px; }
.feed-stars .off { filter: grayscale(1); opacity: 0.3; }
.feed-text { margin: 0; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.feed-text.is-empty { color: var(--text-dim); font-style: italic; }
.feed-email { font-size: 13px; font-weight: 700; color: var(--accent); overflow-wrap: anywhere; }
.feed-delete { padding: 6px 12px; font-size: 12px; align-self: flex-end; }

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 20, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 20;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
}
.modal-title { font-size: 18px; }
.modal-text { margin: 0; color: var(--text-dim); font-size: 14px; line-height: 1.5; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }

.host-leave { display: flex; flex-direction: column; gap: 8px; }
.modal-subtitle { margin: 4px 0 0; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); }
.crown-list { display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow-y: auto; }
.crown-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}
.crown-option[aria-checked='true'] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.crown-option .crown-mark { margin-left: auto; opacity: 0; }
.crown-option[aria-checked='true'] .crown-mark { opacity: 1; }
.crown-option.is-offline { color: var(--text-dim); font-style: italic; }
.modal-or {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.modal-or::before, .modal-or::after { content: ''; flex: 1; height: 1px; background: var(--border); }

[hidden] { display: none !important; }
