:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --ink: #171b22;
  --muted: #5c6676;
  --panel: #ffffff;
  --line: #d9e0ea;
  --teal: #15866f;
  --coral: #d65f42;
  --indigo: #4f58b8;
  --gold: #b98220;
  --shadow: 0 18px 45px rgba(28, 36, 52, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1120px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  align-items: center;
  padding: 28px 0;
}

.screen {
  width: 100%;
}

.screen[hidden] {
  display: none;
}

.brand-row,
.play-header,
.results-header,
.section-heading,
.score-row,
.action-row {
  display: flex;
  align-items: center;
}

.brand-row {
  gap: 22px;
  margin-bottom: 26px;
}

.brand-mark {
  width: clamp(78px, 12vw, 118px);
  flex: 0 0 auto;
}

.brand-mark svg {
  display: block;
  width: 100%;
  filter: drop-shadow(0 18px 18px rgba(41, 53, 76, 0.18));
}

.mark-card {
  stroke: #171b22;
  stroke-width: 4;
}

.mark-card-back {
  fill: #efad44;
}

.mark-card-front {
  fill: #ffffff;
}

.mark-spark {
  fill: #15866f;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(3.25rem, 8vw, 7rem);
  line-height: 0.88;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
}

h3 {
  margin-bottom: 0;
  font-size: 1.1rem;
}

.setup-grid,
.results-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.results-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 22px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.section-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.pill {
  min-width: 72px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

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

.deck-option {
  min-height: 96px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 16px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  transition:
    border-color 150ms ease,
    transform 150ms ease,
    box-shadow 150ms ease;
}

.deck-option:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(28, 36, 52, 0.12);
}

.deck-option[aria-pressed="true"] {
  border-color: var(--deck-accent, var(--teal));
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--deck-accent, var(--teal)) 22%, transparent);
}

.deck-dot {
  width: 18px;
  height: 54px;
  border-radius: 999px;
  background: var(--deck-accent, var(--teal));
}

.deck-name {
  display: block;
  margin-bottom: 4px;
  font-size: 1.05rem;
  font-weight: 900;
}

.deck-meta {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.control-panel {
  position: sticky;
  top: 28px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

select {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.primary-action,
.secondary-action,
.success-action,
.icon-button {
  min-height: 54px;
  border: 0;
  border-radius: 8px;
  font-weight: 950;
}

.primary-action {
  width: 100%;
  margin-top: 16px;
  background: var(--ink);
  color: #ffffff;
}

.secondary-action {
  background: #e8edf4;
  color: #27303d;
}

.success-action {
  background: var(--teal);
  color: #ffffff;
}

.play-screen {
  min-height: calc(100vh - 56px);
  display: grid;
  grid-template-rows: auto auto auto minmax(260px, 1fr) auto;
  gap: 18px;
}

.play-header,
.results-header {
  justify-content: space-between;
  gap: 16px;
}

.icon-button {
  width: 54px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font-size: 2rem;
  line-height: 1;
}

.timer-bar {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbe2ec;
}

.timer-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--gold), var(--coral));
  transition: width 250ms linear;
}

.score-row {
  justify-content: space-between;
  gap: 14px;
}

.score-row > div {
  min-width: 0;
  flex: 1;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(28, 36, 52, 0.08);
}

.stat-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.score-row strong {
  display: block;
  font-size: clamp(2rem, 7vw, 4.5rem);
  line-height: 0.95;
}

.clue-card {
  min-height: 280px;
  display: grid;
  place-items: center;
  padding: clamp(20px, 5vw, 56px);
  border: 3px solid var(--ink);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.8)),
    repeating-linear-gradient(45deg, rgba(21, 134, 111, 0.12) 0 18px, rgba(214, 95, 66, 0.12) 18px 36px);
  box-shadow: var(--shadow);
}

.clue-card p {
  max-width: 900px;
  margin: 0;
  font-size: clamp(3rem, 10vw, 8rem);
  font-weight: 1000;
  line-height: 0.95;
  text-align: center;
  text-wrap: balance;
}

.action-row {
  gap: 14px;
}

.action-row button {
  flex: 1;
  min-width: 0;
  font-size: clamp(1.05rem, 2.5vw, 1.55rem);
}

.results-header {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.final-score {
  min-width: 138px;
  padding: 14px 18px;
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  text-align: center;
}

.final-score span {
  display: block;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.final-score strong {
  display: block;
  font-size: clamp(2.4rem, 7vw, 4.75rem);
  line-height: 0.95;
}

.result-list {
  min-height: 160px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.result-list li,
.empty-result {
  padding: 8px 10px;
  border-radius: 999px;
  background: #edf2f7;
  color: #27303d;
  font-size: 0.94rem;
  font-weight: 800;
}

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

.results-actions {
  margin-top: 18px;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100vw - 22px, 680px);
    align-items: start;
    padding: 14px 0;
  }

  .brand-row {
    align-items: flex-start;
    gap: 14px;
  }

  .setup-grid,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
  }

  .play-screen {
    min-height: calc(100vh - 28px);
    grid-template-rows: auto auto auto minmax(220px, 1fr) auto;
    touch-action: manipulation;
    user-select: none;
  }

  .clue-card p {
    font-size: clamp(2.8rem, 16vw, 5.5rem);
  }

  .play-screen .action-row {
    display: none;
  }
}

@media (max-width: 560px) {
  .deck-grid,
  .score-row,
  .action-row {
    grid-template-columns: 1fr;
  }

  .deck-grid {
    display: grid;
  }

  .score-row,
  .action-row {
    display: grid;
  }

  .play-header,
  .results-header {
    align-items: flex-start;
  }

  h1 {
    font-size: clamp(2.8rem, 18vw, 4.25rem);
  }
}
