:root {
  color-scheme: light;
  --bg: #eef3f7;
  --panel: #ffffff;
  --ink: #1e2933;
  --muted: #667383;
  --line: #d8e0e7;
  --accent: #176b87;
  --accent-strong: #0f5066;
  --success: #2b7a4b;
  --danger: #b33a3a;
  --warn: #b86b18;
}

* {
  box-sizing: border-box;
}

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

button {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.scenario-panel {
  width: min(960px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 45px rgb(30 41 51 / 10%);
  padding: clamp(20px, 4vw, 40px);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 3vw, 2.5rem);
  line-height: 1.08;
}

.score-box {
  min-width: 108px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  text-align: center;
}

.score-box span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.score-box strong {
  font-size: 1.8rem;
  line-height: 1;
}

.scenario-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.scenario-controls label {
  display: grid;
  gap: 6px;
}

.scenario-controls span,
.scenario-meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.scenario-controls select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 12px;
}

.scenario-meta {
  margin-bottom: 18px;
}

.progress {
  height: 10px;
  background: #dfe7ed;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 28px;
}

#progress-fill {
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 180ms ease;
}

.scene {
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(18px, 3vw, 28px);
  background: #f8fafb;
  margin-bottom: 20px;
}

.scene h2 {
  margin-bottom: 12px;
  font-size: clamp(1.25rem, 2vw, 1.7rem);
}

.scene p {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.6;
  margin-bottom: 0;
}

.actions {
  display: grid;
  gap: 12px;
}

.answer {
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.answer:hover,
.answer:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(23 107 135 / 14%);
  outline: none;
}

.answer:active {
  transform: translateY(1px);
}

.result-panel {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.result-panel h2 {
  margin-bottom: 8px;
}

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

.result-stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

dt {
  color: var(--muted);
  font-size: 0.82rem;
}

dd {
  margin: 4px 0 0;
  font-weight: 800;
}

.passed {
  color: var(--success);
}

.failed {
  color: var(--danger);
}

.partial {
  color: var(--warn);
}

.footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-actions button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 700;
}

#restart {
  background: #e4ebf0;
  color: var(--ink);
}

.sync-note {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--muted);
}

@media (max-width: 640px) {
  .topbar,
  .result-stats,
  .scenario-controls {
    grid-template-columns: 1fr;
    display: grid;
  }

  .score-box {
    width: 100%;
    text-align: left;
  }
}
