:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #edf3f1;
  --ink: #16201c;
  --muted: #63706a;
  --line: #d8ded9;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --accent: #b45309;
  --danger: #b42318;
  --success: #137333;
  --shadow: 0 18px 45px rgba(27, 35, 31, 0.12);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

button {
  min-height: 44px;
}

.app-shell {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 2px 12px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--brand-dark);
  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: 1.5rem;
  line-height: 1.15;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  white-space: nowrap;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 0 14px;
  background: var(--bg);
}

.tab {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.tab.is-active {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.panel {
  display: none;
}

.panel.is-active {
  display: block;
}

.question-card,
.exam-card,
.progress-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card-header,
.progress-card {
  padding: 16px;
}

.card-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.topic {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.prompt {
  margin-bottom: 0;
  font-size: 1.28rem;
  font-weight: 850;
  line-height: 1.45;
}

.sign-image {
  display: flex;
  justify-content: center;
  padding: 18px 16px 0;
}

.sign-image img {
  width: min(190px, 52vw);
  max-height: 190px;
  object-fit: contain;
  image-rendering: auto;
}

.options {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.option {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.option:disabled {
  cursor: default;
  opacity: 1;
}

.option-letter {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--brand-dark);
  font-weight: 900;
}

.option.is-selected {
  border-color: var(--brand);
  background: #ecfdf5;
}

.option.is-correct {
  border-color: var(--success);
  background: #ecfdf3;
}

.option.is-wrong {
  border-color: var(--danger);
  background: #fff1f0;
}

.feedback {
  margin: 0 16px 16px;
  padding: 12px;
  border-radius: 8px;
  font-weight: 800;
}

.feedback.success {
  background: #ecfdf3;
  color: var(--success);
}

.feedback.danger {
  background: #fff1f0;
  color: var(--danger);
}

.actions {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 12px 0 4px;
  background: linear-gradient(180deg, rgba(246, 247, 244, 0), var(--bg) 28%);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
}

.button.primary {
  flex: 1;
  background: var(--brand);
  color: #ffffff;
}

.button.primary:hover {
  background: var(--brand-dark);
}

.button.secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.button.danger {
  border-color: #ffd0ca;
  background: #fff1f0;
  color: var(--danger);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.exam-toolbar,
.exam-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.exam-list {
  display: grid;
  gap: 14px;
}

.exam-card {
  box-shadow: none;
}

.exam-card .prompt {
  font-size: 1.05rem;
}

.result-banner {
  margin-bottom: 14px;
  padding: 16px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.result-banner.pass {
  border-color: #a7f3d0;
  background: #ecfdf3;
}

.result-banner.fail {
  border-color: #ffd0ca;
  background: #fff1f0;
}

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

.stat {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.stat strong {
  display: block;
  font-size: 1.4rem;
  line-height: 1.1;
}

.stat span,
.muted {
  color: var(--muted);
}

.progress-bar {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: var(--line);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.empty-state {
  padding: 22px 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: center;
}

@media (min-width: 720px) {
  .app-shell {
    padding: 24px;
  }

  h1 {
    font-size: 2rem;
  }

  .prompt {
    font-size: 1.5rem;
  }

  .options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .actions {
    position: static;
    justify-content: flex-end;
    background: transparent;
  }

  .button.primary {
    flex: 0 0 auto;
  }

  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
