:root {
  --bg: #eff3f9;
  --surface: #ffffff;
  --surface-soft: #f4f7fd;
  --text: #1a2438;
  --muted: #5b6780;
  --heading: #0e1a2f;
  --primary: #2e66d4;
  --primary-press: #2557bb;
  --primary-text: #ffffff;
  --primary-border: #2a5ec4;
  --border: #d4deec;
  --border-strong: #9eacc2;
  --ghost-bg: #f2f5fa;
  --ghost-bg-hover: #e8eef7;
  --shadow: 0 10px 24px rgba(26, 44, 76, 0.1);
  --card-shadow: 0 16px 36px rgba(24, 41, 70, 0.16);
}

:root[data-theme="dark"] {
  --bg: #0a1120;
  --surface: #121b2d;
  --surface-soft: #19253a;
  --text: #eaf0ff;
  --muted: #a7b2c8;
  --heading: #f5f8ff;
  --primary: #78b0ff;
  --primary-press: #67a2f6;
  --primary-text: #051124;
  --primary-border: #6ca8f8;
  --border: #2a3a55;
  --border-strong: #455c81;
  --ghost-bg: #142035;
  --ghost-bg-hover: #1a2840;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  --card-shadow: 0 18px 40px rgba(0, 0, 0, 0.36);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  padding: 2rem 1.25rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 1.25rem 0 0.65rem;
}

.hero {
  margin-bottom: 1.6rem;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 0.6rem;
  font-size: 0.74rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 700;
}

h1 {
  margin: 0 0 0.8rem;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 800;
  color: var(--heading);
}

.intro {
  margin: 0;
  max-width: 64ch;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.45;
}

.card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 16px;
  padding: 1.15rem;
  box-shadow: var(--shadow);
}

.controls {
  display: block;
}

.field-label {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.topic-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.48rem;
}

.topic-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.42rem 0.72rem;
  background: var(--ghost-bg);
  color: var(--text);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.topic-chip[aria-checked="true"] {
  background: var(--primary);
  border-color: var(--primary-border);
  color: var(--primary-text);
}

.topic-chip:hover {
  border-color: var(--border-strong);
}

.topic-chip:focus-visible,
.btn:focus-visible,
.theme-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.muted {
  margin: 0.52rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.deck-wrap {
  margin-top: 1rem;
}

.deck-stack {
  position: relative;
  min-height: 214px;
  padding: 6px 0 0;
}

.deck-layer {
  position: absolute;
  left: 50%;
  width: min(100%, 760px);
  height: 188px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  transform: translateX(-50%);
}

.deck-layer:nth-child(1) {
  top: 10px;
  opacity: 0.75;
}

.deck-layer:nth-child(2) {
  top: 5px;
  opacity: 0.9;
}

.question-card {
  position: relative;
  z-index: 1;
  border: 1px solid var(--border);
  border-radius: 16px;
  min-height: 200px;
  padding: 1rem 1.2rem 1.15rem;
  background: var(--surface);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.question-card.dealing {
  animation: deal-card 360ms ease;
}

@keyframes deal-card {
  from {
    transform: translate(24px, -12px) rotate(3.8deg);
    opacity: 0.32;
  }
  to {
    transform: translate(0, 0) rotate(0deg);
    opacity: 1;
  }
}

#questionText {
  margin: 0;
  font-size: clamp(1.12rem, 2.7vw, 1.65rem);
  line-height: 1.4;
  text-align: center;
  font-weight: 500;
  max-width: 30ch;
  align-self: center;
}

.actions {
  margin-top: 0.62rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
}

.deal-row {
  margin-top: 0.55rem;
  display: flex;
  justify-content: center;
}

.deal-row .btn {
  min-width: 190px;
}

.btn {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.68rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

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

.btn.primary {
  color: var(--primary-text);
  background: var(--primary);
  border-color: var(--primary-border);
}

.btn.primary:hover {
  background: var(--primary-press);
  border-color: var(--primary-press);
}

.btn.ghost {
  color: var(--text);
  background: var(--ghost-bg);
}

.btn.ghost:hover {
  background: var(--ghost-bg-hover);
}

footer {
  margin: 1.15rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.theme-toggle {
  margin-top: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.24rem;
  background: var(--surface);
}

.theme-label {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0 0.3rem 0 0.46rem;
}

.theme-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.26rem 0.6rem;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}

.theme-btn[aria-pressed="true"] {
  color: var(--text);
  background: var(--ghost-bg);
  border-color: var(--border);
}

@media (max-width: 720px) {
  body {
    padding: 1rem 0.86rem;
  }

  .container {
    padding: 0.72rem 0 0.4rem;
  }

  .btn.primary {
    width: 100%;
  }

  .actions {
    justify-content: flex-start;
  }

  .question-card {
    min-height: 215px;
    padding-inline: 0.95rem;
  }
}
