/* ==========================================================================
   GuessASAP — Minimalist Editorial & Mobile-First Design System
   Warm alabaster (light) & obsidian charcoal (dark) with amber accent
   ========================================================================== */

:root {
  --bg: #f8f7f4;
  --bg-glass: rgba(248, 247, 244, 0.92);
  --surface: #ffffff;
  --surface-subtle: #f2f0eb;
  --border: #e5e2da;
  --border-strong: #cfc9bc;
  --fg: #161614;
  --fg-muted: #68665e;
  --placeholder: #9a978e;

  --accent: #b45309;
  --accent-fg: #ffffff;
  --accent-soft: rgba(180, 83, 9, 0.08);
  --accent-border: rgba(180, 83, 9, 0.38);

  --success: #15803d;
  --success-soft: rgba(21, 128, 61, 0.08);
  --success-border: rgba(21, 128, 61, 0.34);

  --warning: #b45309;
  --error: #b91c1c;
  --error-soft: rgba(185, 28, 28, 0.07);
  --error-border: rgba(185, 28, 28, 0.32);

  --track: #e6e3db;
  --track-active: rgba(180, 83, 9, 0.16);
  --shadow-sm: 0 1px 2px rgba(22, 22, 20, 0.04);
  --shadow-dock: 0 -6px 24px rgba(22, 22, 20, 0.06);
  --shadow-focus: 0 0 0 3px rgba(180, 83, 9, 0.22);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

[data-theme='dark'] {
  --bg: #0f1011;
  --bg-glass: rgba(15, 16, 17, 0.92);
  --surface: #161719;
  --surface-subtle: #1c1d20;
  --border: #26282c;
  --border-strong: #3a3d44;
  --fg: #f3f2ee;
  --fg-muted: #989790;
  --placeholder: #62625d;

  --accent: #f59e0b;
  --accent-fg: #111110;
  --accent-soft: rgba(245, 158, 11, 0.11);
  --accent-border: rgba(245, 158, 11, 0.42);

  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.1);
  --success-border: rgba(34, 197, 94, 0.36);

  --warning: #f59e0b;
  --error: #f87171;
  --error-soft: rgba(248, 113, 113, 0.09);
  --error-border: rgba(248, 113, 113, 0.34);

  --track: #25272b;
  --track-active: rgba(245, 158, 11, 0.18);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-dock: 0 -8px 28px rgba(0, 0, 0, 0.45);
  --shadow-focus: 0 0 0 3px rgba(245, 158, 11, 0.24);
}

/* Base Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  background-color: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 180ms ease, color 180ms ease;
}

::selection {
  background-color: var(--accent);
  color: var(--accent-fg);
}

.hidden {
  display: none !important;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.icon-sm {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.icon-md {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Layout Shell */
.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background-color: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.header-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 18px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: none;
  border: none;
  padding: 6px 0;
  cursor: pointer;
  color: var(--fg);
  touch-action: manipulation;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background-color: var(--accent);
  transition: transform 150ms ease;
}

.brand-btn:hover .brand-dot {
  transform: scale(1.15);
}

.brand-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stats-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.stat-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.stat-label {
  color: var(--fg-muted);
}

.stat-value {
  font-weight: 600;
  color: var(--fg);
}

.header-divider {
  width: 1px;
  height: 16px;
  background-color: var(--border);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Buttons */
button {
  font-family: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-md);
  background-color: var(--accent);
  color: var(--accent-fg);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 150ms ease, transform 120ms ease;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.92;
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

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

.btn-lg {
  height: 48px;
  padding: 0 22px;
}

.btn-md {
  height: 42px;
  padding: 0 18px;
  font-size: 14px;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.btn-ghost:hover:not(:disabled) {
  color: var(--fg);
  background-color: var(--surface);
  border-color: var(--border-strong);
}

.btn-ghost:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-compact {
  height: 34px;
  padding: 0 10px;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
}

.btn-xs {
  height: 32px;
  padding: 0 11px;
  font-size: 12px;
}

/* Main Stage */
.main-stage {
  flex: 1;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 22px 18px 24px;
  display: flex;
  flex-direction: column;
}

/* Start View */
.start-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 620px;
  width: 100%;
  margin: 0 auto;
  padding: 12px 0 20px;
}

.start-stack {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.hero-title {
  margin: 0;
  font-size: clamp(26px, 6vw, 40px);
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--fg);
}

.hero-subtitle {
  margin: 0;
  font-size: 15px;
  line-height: 1.58;
  color: var(--fg-muted);
}

/* Preview Card */
.preview-card {
  padding: 15px 16px;
  border-radius: var(--radius-lg);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-top,
.preview-bottom {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--fg-muted);
}

.preview-bars {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
}

.preview-seg {
  height: 7px;
  border-radius: 999px;
  background-color: var(--track);
}

.preview-seg.filled {
  background-color: var(--accent);
}

.preview-seg.filled-mid {
  background-color: var(--accent);
  opacity: 0.72;
}

.preview-seg.filled-soft {
  background-color: var(--accent);
  opacity: 0.4;
}

/* Multi-Select Section Pills */
.category-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

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

.selected-summary {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-group.compact {
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 38px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background-color: var(--surface);
  color: var(--fg-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background-color 140ms ease, transform 100ms ease;
}

.pill:active {
  transform: scale(0.97);
}

.pill.compact {
  min-height: 32px;
  padding: 5px 11px;
  font-size: 12px;
}

.pill:hover {
  color: var(--fg);
  border-color: var(--border-strong);
}

.pill.selected {
  background-color: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

.pill-count {
  opacity: 0.72;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.pill.selected .pill-count {
  opacity: 0.88;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding-top: 2px;
}

.shortcut-hint {
  font-size: 12px;
  color: var(--fg-muted);
}

kbd {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background-color: var(--surface);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg);
}

/* Gameplay View */
.game-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 50-Second Master Timeline Card */
.timeline-card {
  padding: 15px 18px;
  border-radius: var(--radius-lg);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.timeline-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.timeline-meta-left,
.timeline-meta-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.clue-counter {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg);
}

.active-clue-label {
  font-weight: 500;
  color: var(--fg-muted);
}

.segment-countdown {
  font-weight: 600;
  color: var(--fg);
}

.total-clock {
  font-family: var(--font-mono);
  color: var(--fg-muted);
}

.sep {
  color: var(--border-strong);
}

.timeline-track-wrapper {
  position: relative;
  padding: 4px 0;
}

.timeline-segments {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
}

.timeline-seg {
  position: relative;
  height: 11px;
  border-radius: 3px;
  overflow: hidden;
  background-color: var(--track);
  transition: background-color 200ms ease;
}

.timeline-seg.is-active {
  background-color: var(--track-active);
}

.timeline-seg-tick {
  pointer-events: none;
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background-color: var(--bg);
  opacity: 0.35;
  z-index: 2;
}

.timeline-seg-fill {
  height: 100%;
  width: 0%;
  background-color: var(--accent);
  will-change: width;
}

.timeline-playhead {
  pointer-events: none;
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  border-radius: 999px;
  background-color: var(--fg);
  z-index: 3;
  transition: background-color 200ms ease;
}

.timeline-ruler {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  font-size: 12px;
  color: var(--fg-muted);
  user-select: none;
}

.ruler-cell {
  display: flex;
  justify-content: space-between;
}

/* Latest Clue Spotlight Banner inside timeline card */
.latest-spotlight {
  padding: 10px 13px;
  border-radius: var(--radius-md);
  background-color: var(--accent-soft);
  border: 1px solid var(--accent-border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.spotlight-tag {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.spotlight-value {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--fg);
}

.paused-banner {
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--fg-muted);
}

.inline-link {
  background: none;
  border: none;
  padding: 4px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}

.inline-link:hover {
  text-decoration: underline;
}

/* Result Card */
.result-card {
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.result-card.is-won {
  background-color: var(--success-soft);
  border-color: var(--success-border);
}

.result-card.is-lost {
  background-color: var(--error-soft);
  border-color: var(--error-border);
}

.result-body {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.result-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.result-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.result-status {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-meta {
  color: var(--fg-muted);
}

.result-name {
  margin: 0;
  font-size: clamp(22px, 5vw, 28px);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--fg);
}

.result-summary {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg-muted);
}

.result-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.result-score-box {
  text-align: right;
}

.result-points {
  font-size: 20px;
  font-weight: 650;
  color: var(--fg);
}

.result-points-sub {
  font-size: 12px;
  color: var(--fg-muted);
}

/* Clues Dossier Grid */
.dossier-section {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding-bottom: 8px;
}

.dossier-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pool-indicator {
  font-size: 12px;
  color: var(--fg-muted);
  text-align: right;
}

.clues-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.clue-card {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background-color: var(--surface-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  transition: background-color 200ms ease, border-color 200ms ease, opacity 200ms ease;
}

.clue-card.is-revealed {
  background-color: var(--surface);
  box-shadow: var(--shadow-sm);
}

.clue-card.is-latest {
  background-color: var(--accent-soft);
  border-color: var(--accent-border);
}

.clue-card.is-next {
  background-color: transparent;
  border-style: dashed;
}

.clue-card.is-locked {
  opacity: 0.48;
}

.clue-card.is-unseen {
  opacity: 0.72;
}

.clue-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.clue-card-title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.clue-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
  flex-shrink: 0;
}

.clue-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clue-time {
  font-size: 12px;
  color: var(--fg-muted);
  flex-shrink: 0;
}

.clue-time.is-active {
  font-weight: 600;
  color: var(--accent);
}

.clue-value {
  font-size: 14px;
  line-height: 1.4;
  color: var(--fg-muted);
}

.clue-value.is-revealed {
  font-weight: 500;
  color: var(--fg);
}

.clue-value.is-paused {
  font-style: italic;
}

/* Sticky Phone-Friendly Guess Dock */
.guess-dock {
  position: sticky;
  bottom: 0;
  z-index: 25;
  margin: auto -18px -24px;
  padding: 12px 18px max(14px, env(safe-area-inset-bottom));
  background-color: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow-dock);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guess-form {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.guess-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.guess-input {
  width: 100%;
  height: 48px;
  padding: 0 38px 0 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-strong);
  background-color: var(--surface);
  color: var(--fg);
  font-family: inherit;
  /* 16px minimum prevents iOS Safari auto-zoom on focus */
  font-size: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.guess-input::placeholder {
  color: var(--placeholder);
}

.guess-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
}

.guess-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.clear-input-btn {
  position: absolute;
  right: 6px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 999px;
  background-color: var(--surface-subtle);
  color: var(--fg-muted);
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.clear-input-btn:hover {
  color: var(--fg);
}

.guess-submit {
  height: 48px;
  padding: 0 20px;
  flex-shrink: 0;
  font-size: 15px;
}

.guess-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
}

.feedback-message {
  font-size: 12px;
  line-height: 1.35;
  color: var(--fg-muted);
  min-width: 0;
}

.feedback-message.is-warn {
  color: var(--warning);
  font-weight: 500;
}

.feedback-message.is-error {
  color: var(--error);
  font-weight: 500;
}

.quick-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.attempts-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.attempts-label {
  font-size: 12px;
  color: var(--fg-muted);
  margin-right: 2px;
}

.attempts-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.attempt-pill {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--fg-muted);
  text-decoration: line-through;
}

/* Result Footer */
.result-footer {
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12px;
  color: var(--fg-muted);
}

.result-filter {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

/* Micro-Animations */
@keyframes clueReveal {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes subtleShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

.clue-reveal {
  animation: clueReveal 340ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.fade-in {
  animation: fadeIn 300ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.shake {
  animation: subtleShake 320ms ease-in-out;
}

/* Mobile Phone Polish (< 640px) */
@media (max-width: 640px) {
  .header-inner {
    padding: 0 14px;
    height: 50px;
  }

  .main-stage {
    padding: 14px 14px 20px;
  }

  .stat-best,
  .hide-xs,
  .ruler-hide-mobile {
    display: none;
  }

  .cta-start {
    width: 100%;
  }

  .timeline-card {
    padding: 13px 14px;
    gap: 9px;
  }

  .timeline-segments {
    gap: 3px;
  }

  .timeline-seg {
    height: 10px;
  }

  .clues-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .clue-card {
    padding: 11px 13px;
  }

  .result-body {
    flex-direction: column;
    gap: 14px;
  }

  .result-side {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .result-score-box {
    text-align: left;
  }

  .guess-dock {
    margin: auto -14px -20px;
    padding: 10px 14px max(12px, env(safe-area-inset-bottom));
  }

  .guess-submit {
    padding: 0 16px;
  }

  .pill {
    min-height: 40px;
    padding: 8px 13px;
  }
}

/* ==========================================================================
   Section Time Limits UI (Desktop Dialog + Mobile Bottom Sheet)
   ========================================================================== */

.timers-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background-color: var(--accent);
  display: inline-block;
}

.section-tools-row {
  display: flex;
  align-items: center;
  padding-top: 2px;
}

.inline-timer-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
  background-color: transparent;
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.inline-timer-btn:hover {
  color: var(--fg);
  border-color: var(--accent);
  background-color: var(--accent-soft);
}

.inline-timer-btn.has-custom {
  color: var(--accent);
  border-style: solid;
  border-color: var(--accent-border);
  background-color: var(--accent-soft);
}

.pill-timer-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background-color: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.pill.selected .pill-timer-tag {
  background-color: rgba(255, 255, 255, 0.2);
  color: var(--accent-fg);
}

.round-timer-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background-color: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.result-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Modal Backdrop & Sheet */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background-color: rgba(10, 10, 10, 0.54);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-sheet {
  width: 100%;
  max-width: 540px;
  max-height: min(86vh, 720px);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn 200ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.modal-handle {
  display: none;
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background-color: var(--border-strong);
  margin: 10px auto 2px;
  flex-shrink: 0;
}

.modal-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--fg);
}

.modal-subtitle {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--fg-muted);
}

.timers-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timer-row {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background-color: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.timer-row.is-default-row {
  background-color: var(--surface-subtle);
}

.timer-row.is-custom {
  border-color: var(--accent-border);
  background-color: var(--accent-soft);
}

.timer-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.timer-row-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.timer-row-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}

.timer-row-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg-muted);
}

.timer-row.is-custom .timer-row-badge {
  background-color: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.timer-row-readout {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
}

.timer-row-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.timer-presets {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.timer-preset-btn {
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background-color: var(--surface);
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background-color 120ms ease;
}

.timer-preset-btn:hover {
  color: var(--fg);
  border-color: var(--border-strong);
}

.timer-preset-btn.active {
  background-color: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
}

.timer-stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.stepper-btn {
  width: 32px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--surface);
  color: var(--fg);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.stepper-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.stepper-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.timer-reset-link {
  background: none;
  border: none;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
}

.timer-reset-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.modal-footer {
  padding: 14px 20px max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

@media (max-width: 640px) {
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-sheet {
    max-width: 100%;
    max-height: 88dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: none;
  }

  .modal-handle {
    display: block;
  }

  .modal-header {
    padding: 10px 16px 12px;
  }

  .timers-list {
    padding: 10px 16px;
  }

  .timer-preset-btn {
    min-height: 34px;
    padding: 5px 11px;
  }

  .stepper-btn {
    width: 36px;
    height: 34px;
  }

  .modal-footer {
    padding: 12px 16px max(14px, env(safe-area-inset-bottom));
  }
}

/* Modal Tab Bar (By Section / By Clue) */
.modal-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 10px 20px 0;
  background-color: var(--surface);
}

.modal-tab {
  min-height: 36px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--bg);
  color: var(--fg-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}

.modal-tab:hover {
  color: var(--fg);
  border-color: var(--border-strong);
}

.modal-tab.active {
  background-color: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.clue-pacing-summary {
  padding: 11px 14px;
  border-radius: var(--radius-md);
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.clue-pacing-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.clue-pacing-total {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--fg);
}

.clue-pacing-note {
  font-size: 12px;
  color: var(--fg-muted);
}

.clue-timer-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
}

@media (max-width: 640px) {
  .modal-tabs {
    padding: 8px 16px 0;
  }

  .modal-tab {
    min-height: 40px;
  }
}

/* ==========================================================================
   Mobile Keyboard-Proof Gameplay Layout (Timer + Clues + Input Always Visible)
   ========================================================================== */

.icon-xs {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.mobile-inline-pause {
  display: none;
  width: 26px;
  height: 26px;
  padding: 0;
  margin-left: 2px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background-color: var(--bg);
  color: var(--fg-muted);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

@media (max-width: 640px) {
  html.mobile-play-lock,
  body.mobile-play-lock {
    overflow: hidden;
    overscroll-behavior: none;
    height: 100%;
  }

  body.mobile-play-lock .app-shell {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--vv-top, 0px);
    height: var(--vv-height, 100dvh);
    min-height: 0;
    overflow: hidden;
  }

  body.mobile-play-lock .site-header {
    position: relative;
    flex-shrink: 0;
  }

  body.mobile-play-lock .main-stage {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 8px 12px 0;
  }

  body.mobile-play-lock .game-view {
    flex: 1;
    min-height: 0;
    gap: 8px;
    overflow: hidden;
  }

  /* 1. Top Fixed Zone: Compact 50s Timeline — NEVER scrolls away */
  body.mobile-play-lock .timeline-card {
    flex-shrink: 0;
    padding: 10px 12px;
    gap: 6px;
    border-radius: var(--radius-md);
  }

  /* Latest clue is already pinned at top of the clue list below — avoid duplication */
  body.mobile-play-lock .latest-spotlight {
    display: none;
  }

  /* 2. Middle Scrollable Zone: Revealed Clues newest-first */
  body.mobile-play-lock .dossier-section {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    gap: 6px;
    padding-bottom: 8px;
  }

  body.mobile-play-lock .clues-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  body.mobile-play-lock .clue-card {
    order: var(--mobile-order, 0);
    padding: 9px 12px;
    gap: 3px;
  }

  body.mobile-play-lock .clue-card.is-locked,
  body.mobile-play-lock .clue-card.is-next {
    display: none;
  }

  /* 3. Bottom Fixed Zone: Typing Bar pinned directly above phone keyboard */
  body.mobile-play-lock .guess-dock {
    position: static;
    flex-shrink: 0;
    margin: 0 -12px;
    padding: 8px 12px max(8px, env(safe-area-inset-bottom));
    gap: 6px;
  }

  body.mobile-play-lock .attempts-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  body.mobile-play-lock .attempts-list {
    flex-wrap: nowrap;
  }

  body.mobile-play-lock .attempt-pill {
    white-space: nowrap;
  }

  /* Extra-compact mode automatically engaged when software keyboard is open */
  body.mobile-play-lock.keyboard-open .site-header {
    display: none;
  }

  body.mobile-play-lock.keyboard-open .mobile-inline-pause {
    display: inline-flex;
  }

  body.mobile-play-lock.keyboard-open .timeline-ruler,
  body.mobile-play-lock.keyboard-open .dossier-header {
    display: none;
  }

  body.mobile-play-lock.keyboard-open .timeline-card {
    padding: 8px 11px;
    gap: 5px;
  }

  body.mobile-play-lock.keyboard-open .guess-input,
  body.mobile-play-lock.keyboard-open .guess-submit {
    height: 42px;
  }

  body.mobile-play-lock.keyboard-open .guess-dock {
    padding: 6px 12px 6px;
    gap: 5px;
  }
}



