:root {
  --bg: #171311;
  --panel: rgba(245, 235, 218, 0.96);
  --text: #2e241d;
  --text-soft: #5a4b3f;
  --accent: #7b2f2f;
  --accent-2: #a56a3a;
  --line: rgba(53, 36, 28, 0.16);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.26);
  --radius-lg: 24px;
  --radius-md: 16px;
  --correct-bg: rgba(65, 112, 82, 0.12);
  --correct-border: rgba(65, 112, 82, 0.45);
  --wrong-bg: rgba(141, 58, 58, 0.12);
  --wrong-border: rgba(141, 58, 58, 0.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(165, 106, 58, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(123, 47, 47, 0.18), transparent 24%),
    linear-gradient(180deg, #0e0b0a, #1d1613 35%, #1b1412 100%);
}

.page-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
  color: #f4e6d2;
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1;
}

.eyebrow,
.hero-kicker,
.score-label,
.small-note,
.question-subtitle,
.progress-text,
.settings-grid label,
.primary-button,
.secondary-button,
.ghost-button,
.option-button {
  font-family: Inter, Arial, sans-serif;
}

.eyebrow,
.hero-kicker {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--accent-2);
  margin: 0 0 8px;
}

.hero-kicker { color: var(--accent); }
.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.intro-panel {
  padding: 20px;
}

.cover-stage {
  width: 100%;
  min-height: 58vh;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: calc(var(--radius-lg) - 8px);
  background: rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.cover-image {
  display: block;
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  object-position: center center;
}

.intro-controls {
  width: min(760px, 100%);
  margin: 18px auto 0;
}

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

.settings-grid label {
  display: grid;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-soft);
}

.settings-grid input {
  border: 1px solid rgba(53, 36, 28, 0.12);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
}

.status-box,
.feedback-box {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-top: 16px;
  border: 1px solid rgba(53, 36, 28, 0.1);
  background: rgba(255, 255, 255, 0.55);
}

.status-box.muted { color: var(--text-soft); }
.status-box.error { color: #8d3a3a; background: var(--wrong-bg); border-color: var(--wrong-border); }
.status-box.success { color: #355948; background: var(--correct-bg); border-color: var(--correct-border); }

.progress-wrap { margin-top: 16px; }
.progress-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(53, 36, 28, 0.1);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: inherit;
}
.progress-text {
  margin: 8px 0 0;
  font-size: 0.84rem;
  color: var(--text-soft);
}

.intro-actions,
.finish-actions,
.nav-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.primary-button,
.secondary-button,
.ghost-button,
.option-button {
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.option-button:hover { transform: translateY(-1px); }

.primary-button {
  background: linear-gradient(135deg, var(--accent), #5f2525);
  color: #f8efe3;
  box-shadow: 0 10px 22px rgba(123, 47, 47, 0.28);
}
.secondary-button {
  background: #eadcc8;
  color: var(--text);
  border: 1px solid rgba(53, 36, 28, 0.12);
}
.ghost-button {
  background: transparent;
  color: #f4e6d2;
  border: 1px solid rgba(244, 230, 210, 0.32);
}
.primary-button[disabled],
.secondary-button[disabled],
.option-button[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}
.wide { width: 100%; justify-content: center; }

.game-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 22px;
}

.scoreboard-panel,
.question-panel,
.finish-panel { padding: 22px; }

.score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.score-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 1.08rem;
}
.score-label,
.small-note,
.question-subtitle {
  color: var(--text-soft);
  font-size: 0.84rem;
  line-height: 1.5;
}
.small-note { margin-top: 18px; }
.question-header { margin-bottom: 16px; }
.question-subtitle { margin: 0; }

.case-text {
  max-height: 430px;
  overflow: auto;
  padding: 20px;
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(165, 106, 58, 0.08), rgba(255,255,255,0)),
    rgba(255, 250, 243, 0.92);
  border: 1px solid rgba(53, 36, 28, 0.09);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55);
  line-height: 1.7;
  white-space: pre-wrap;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.option-button {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  text-align: left;
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
  border: 1px solid rgba(53, 36, 28, 0.12);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.05);
}
.option-button:hover { background: rgba(255, 248, 236, 0.98); }
.option-button.correct { background: var(--correct-bg); border-color: var(--correct-border); }
.option-button.wrong { background: var(--wrong-bg); border-color: var(--wrong-border); }
.feedback-box.correct { background: var(--correct-bg); border-color: var(--correct-border); color: #355948; }
.feedback-box.wrong { background: var(--wrong-bg); border-color: var(--wrong-border); color: #7a3434; }
.feedback-box h3 { margin: 0 0 8px; }
.feedback-box p { margin: 0; line-height: 1.65; }

.finish-panel {
  max-width: 760px;
  margin: 0 auto;
}
.finish-scores {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0;
}
.finish-scores > div {
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(53, 36, 28, 0.08);
}
.finish-scores span {
  display: block;
  font-family: Inter, Arial, sans-serif;
  color: var(--text-soft);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.finish-scores strong {
  display: block;
  margin-top: 3px;
  font-size: 1.08rem;
}

@media (max-width: 980px) {
  .game-layout { grid-template-columns: 1fr; }
  .scoreboard-panel { order: 2; }
}

@media (max-width: 720px) {
  .page-shell { padding: 18px 14px 32px; }
  .intro-panel,
  .scoreboard-panel,
  .question-panel,
  .finish-panel { padding: 16px; }
  .settings-grid,
  .options-grid,
  .finish-scores,
  .score-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: stretch; }
  .cover-stage { min-height: auto; }
  .cover-image { max-height: none; }
}
