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

:root {
  color-scheme: light;
  --bg: #f8f7f4;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-muted: #5c5c5c;
  --border: #e2e0da;
  --accent: #2d5a4a;
  --accent-soft: #e8f0ed;
  --correct: #1f6b42;
  --correct-bg: #e6f4ec;
  --incorrect: #9a3412;
  --incorrect-bg: #fef3ec;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Source Code Pro", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121412;
    --surface: #1c1f1c;
    --text: #ececea;
    --text-muted: #a8a8a4;
    --border: #2e332e;
    --accent: #6db896;
    --accent-soft: #1e2e26;
    --correct: #6dd99a;
    --correct-bg: #1a2e22;
    --incorrect: #f0a070;
    --incorrect-bg: #2e2018;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

header {
  margin-bottom: 2rem;
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: 650;
  line-height: 1.2;
  margin: 0 0 0.75rem;
}

.lead {
  color: var(--text-muted);
  margin: 0;
}

.progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.progress-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.progress-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  white-space: nowrap;
}

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

.snippet-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.snippet {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 1rem 1.125rem;
  margin: 0 0 1.5rem;
  border-left: 3px solid var(--accent);
}

.question-prompt {
  font-weight: 600;
  margin: 0 0 1rem;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border: none;
  padding: 0;
  margin: 0;
}

.choice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.choice:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.choice input {
  margin: 0;
  accent-color: var(--accent);
}

.choice span {
  flex: 1;
}

.feedback {
  margin-top: 1.25rem;
  padding: 1rem 1.125rem;
  border-radius: 8px;
  font-size: 0.9375rem;
}

.feedback.correct {
  background: var(--correct-bg);
  color: var(--correct);
  border: 1px solid var(--correct);
}

.feedback.incorrect {
  background: var(--incorrect-bg);
  color: var(--incorrect);
  border: 1px solid var(--incorrect);
}

.feedback[hidden] {
  display: none;
}

.actions {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
}

button {
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button:not(:disabled):hover {
  opacity: 0.9;
}

button:not(:disabled):active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.map-section {
  margin-bottom: 1.5rem;
}

.map-section h3 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.map-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
}

.map-item:last-child {
  border-bottom: none;
}

.map-snippet {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.contract-reveal {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--border);
}

.contract-reveal h2 {
  font-size: 1.125rem;
  margin: 0 0 0.5rem;
}

.contract-reveal p {
  color: var(--text-muted);
  margin: 0 0 1rem;
  font-size: 0.9375rem;
}

.contract-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.5rem 0;
  font-size: 0.9375rem;
  gap: 1rem;
}

.contract-row .responsibility {
  font-weight: 500;
}

.contract-row .contract-name {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent);
  white-space: nowrap;
}

.results-summary {
  text-align: center;
  margin-bottom: 1.5rem;
}

.results-summary .score {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
}

.results-summary .score-label {
  color: var(--text-muted);
  margin: 0.25rem 0 0;
}

.footer-link {
  margin-top: 2rem;
  text-align: center;
}

.footer-link a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.footer-link a:hover {
  text-decoration: underline;
}

.footer-link p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0.5rem 0 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}
