:root {
  color-scheme: light;
  --paper: #f6f1e7;
  --surface: rgba(255, 253, 248, 0.92);
  --surface-strong: #fffdf8;
  --ink: #17211c;
  --muted: #68706a;
  --line: rgba(23, 33, 28, 0.12);
  --line-strong: rgba(23, 33, 28, 0.24);
  --green: #164b39;
  --green-light: #e7f1ec;
  --saffron: #d56a2a;
  --saffron-light: #faeadc;
  --red: #a43d38;
  --red-light: #f8e8e5;
  --shadow: 0 24px 60px rgba(37, 42, 36, 0.1), 0 3px 10px rgba(37, 42, 36, 0.05);
  --radius-lg: 28px;
  --radius-md: 17px;
  --ui: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --reading: Georgia, Cambria, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 0%, rgba(213, 106, 42, 0.09), transparent 30rem),
    radial-gradient(circle at 95% 86%, rgba(22, 75, 57, 0.08), transparent 32rem),
    var(--paper);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
}

button,
select,
input {
  font: inherit;
}

button,
label,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
select:focus-visible,
input:focus-visible + span {
  outline: 3px solid rgba(213, 106, 42, 0.3);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 420px;
  height: 420px;
  border: 1px solid rgba(23, 33, 28, 0.07);
  border-radius: 50%;
  pointer-events: none;
}

.ambient::after {
  position: absolute;
  inset: 34px;
  border: inherit;
  border-radius: inherit;
  content: "";
}

.ambient-one {
  top: -260px;
  right: -110px;
}

.ambient-two {
  bottom: -330px;
  left: -120px;
  width: 520px;
  height: 520px;
}

.app-shell {
  width: min(1480px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 34px 34px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 92px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  color: #fffdf7;
  background: var(--green);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  font-family: var(--reading);
  font-size: 25px;
  font-weight: 700;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lifetime-stats {
  display: flex;
  align-items: center;
  gap: 20px;
}

.lifetime-stats div:not(.stat-divider) {
  min-width: 66px;
  text-align: right;
}

.lifetime-stats span,
.lifetime-stats small {
  display: block;
}

.lifetime-stats span {
  font-family: var(--reading);
  font-size: 21px;
  font-weight: 700;
}

.lifetime-stats small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.stat-divider {
  width: 1px;
  height: 29px;
  background: var(--line);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  gap: clamp(34px, 5vw, 84px);
  align-items: start;
  padding-top: clamp(34px, 6vw, 76px);
}

.control-panel {
  position: sticky;
  top: 28px;
}

.eyebrow,
.question-kicker,
.field-label {
  color: var(--saffron);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.control-panel h1 {
  max-width: 300px;
  margin: 13px 0 14px;
  font-family: var(--reading);
  font-size: clamp(31px, 3vw, 43px);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.panel-intro {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.filter-form {
  display: grid;
  gap: 20px;
  margin-top: 32px;
}

.filter-form fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field-label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.select-wrap {
  position: relative;
}

.select-wrap::after {
  position: absolute;
  top: 50%;
  right: 15px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  content: "";
  pointer-events: none;
  transform: translateY(-70%) rotate(45deg);
}

select {
  width: 100%;
  height: 46px;
  padding: 0 40px 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  appearance: none;
  background: rgba(255, 253, 248, 0.68);
  cursor: pointer;
  font-size: 13px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 253, 248, 0.68);
}

.segmented label,
.order-options label {
  cursor: pointer;
}

.segmented input,
.order-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.segmented span {
  display: grid;
  min-height: 36px;
  place-items: center;
  border-radius: 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.segmented input:checked + span {
  color: var(--green);
  background: var(--green-light);
  box-shadow: 0 1px 3px rgba(23, 33, 28, 0.08);
}

.order-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.order-options span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.48);
  font-size: 12px;
  font-weight: 700;
}

.order-options i {
  font-style: normal;
  font-weight: 500;
}

.order-options input:checked + span {
  border-color: rgba(22, 75, 57, 0.4);
  color: var(--green);
  background: var(--green-light);
}

.primary-button,
.secondary-button,
.text-button {
  border: 0;
  cursor: pointer;
  font-weight: 750;
}

.primary-button {
  min-height: 48px;
  padding: 0 22px;
  border-radius: 13px;
  color: #fff;
  background: var(--green);
  box-shadow: 0 10px 24px rgba(22, 75, 57, 0.16);
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.primary-button:hover:not(:disabled) {
  box-shadow: 0 12px 28px rgba(22, 75, 57, 0.22);
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  box-shadow: none;
}

.full-width {
  width: 100%;
}

.secondary-button {
  min-height: 42px;
  margin-top: 12px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--ink);
  background: transparent;
}

.text-button {
  min-height: 42px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
}

.text-button:hover {
  color: var(--ink);
}

.session-block {
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.session-heading {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.progress-track {
  height: 5px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 33, 28, 0.09);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--saffron);
  transition: width 240ms ease;
}

.session-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 15px;
}

.session-stats div {
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
  background: rgba(255, 253, 248, 0.4);
}

.session-stats b,
.session-stats span {
  display: block;
}

.session-stats b {
  font-family: var(--reading);
  font-size: 18px;
}

.session-stats span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.danger-button {
  width: 100%;
  margin-top: 9px;
  color: rgba(164, 61, 56, 0.76);
  font-size: 11px;
}

.danger-button:hover {
  color: var(--red);
}

.practice-stage {
  width: 100%;
  max-width: 920px;
  justify-self: center;
}

.state-card,
.question-card {
  border: 1px solid rgba(23, 33, 28, 0.1);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.state-card {
  display: flex;
  min-height: 360px;
  gap: 18px;
  align-items: center;
  justify-content: center;
  padding: 42px;
  text-align: left;
}

.state-card > span {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  border-radius: 50%;
  color: var(--green);
  background: var(--green-light);
  font-family: var(--reading);
  font-size: 22px;
  font-weight: 700;
}

.state-card strong {
  font-family: var(--reading);
  font-size: 21px;
}

.state-card p {
  max-width: 460px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.error-card > span {
  color: var(--red);
  background: var(--red-light);
}

.loader {
  position: relative;
  border: 2px solid rgba(22, 75, 57, 0.15);
  border-top-color: var(--green) !important;
  background: transparent !important;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.question-card {
  position: relative;
  min-height: 620px;
  overflow: hidden;
}

.question-card::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  background: linear-gradient(var(--saffron), #e8ae67 38%, var(--green));
  content: "";
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 clamp(24px, 5vw, 56px);
  border-bottom: 1px solid var(--line);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.year-pill,
.status-pill {
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-light);
}

.status-pill {
  color: #8a501f;
  background: var(--saffron-light);
}

.status-pill.dropped {
  color: var(--red);
  background: var(--red-light);
}

.bookmark-button {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.bookmark-button:hover {
  border-color: var(--line);
  color: var(--ink);
  background: rgba(23, 33, 28, 0.025);
}

.bookmark-button svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.bookmark-button[aria-pressed="true"] {
  color: var(--saffron);
}

.bookmark-button[aria-pressed="true"] svg {
  fill: currentColor;
}

.question-copy {
  padding: clamp(28px, 5vw, 50px) clamp(24px, 6vw, 68px) 24px;
}

.question-kicker {
  margin-bottom: 13px;
}

.question-copy h2 {
  margin: 0;
  font-family: var(--reading);
  font-size: clamp(21px, 2.4vw, 30px);
  font-weight: 500;
  line-height: 1.42;
  letter-spacing: -0.014em;
}

.options-list {
  display: grid;
  gap: 11px;
  padding: 5px clamp(24px, 6vw, 68px) 34px;
}

.option-button {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 13px;
  align-items: center;
  width: 100%;
  min-height: 62px;
  padding: 10px 18px 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.56);
  cursor: pointer;
  text-align: left;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.option-button:hover:not(:disabled) {
  border-color: rgba(22, 75, 57, 0.35);
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
}

.option-letter {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  background: var(--surface-strong);
  font-size: 12px;
  font-weight: 800;
}

.option-text {
  font-family: var(--reading);
  font-size: 16px;
  line-height: 1.45;
}

.option-button.selected {
  border-color: rgba(22, 75, 57, 0.65);
  background: var(--green-light);
}

.option-button.selected .option-letter {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}

.option-button.correct {
  border-color: rgba(22, 109, 68, 0.58);
  background: #e1f2e8;
}

.option-button.correct .option-letter {
  border-color: #236f4a;
  color: #fff;
  background: #236f4a;
}

.option-button.wrong {
  border-color: rgba(164, 61, 56, 0.55);
  background: var(--red-light);
}

.option-button.wrong .option-letter {
  border-color: var(--red);
  color: #fff;
  background: var(--red);
}

.option-button:disabled {
  cursor: default;
}

.option-button.dimmed {
  opacity: 0.58;
}

.feedback {
  display: flex;
  gap: 13px;
  margin: 0 clamp(24px, 6vw, 68px) 28px;
  padding: 16px;
  border: 1px solid rgba(22, 75, 57, 0.15);
  border-radius: 15px;
  color: var(--green);
  background: var(--green-light);
}

.feedback.incorrect {
  border-color: rgba(164, 61, 56, 0.15);
  color: var(--red);
  background: var(--red-light);
}

.feedback.neutral {
  border-color: rgba(213, 106, 42, 0.18);
  color: #845022;
  background: var(--saffron-light);
}

.feedback-icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 850;
}

.feedback strong {
  font-size: 13px;
}

.feedback p {
  margin: 4px 0 0;
  color: var(--muted);
  font-family: var(--reading);
  font-size: 14px;
  line-height: 1.45;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 84px;
  gap: 16px;
  margin-top: auto;
  padding: 16px clamp(24px, 5vw, 56px);
  border-top: 1px solid var(--line);
  background: rgba(246, 241, 231, 0.42);
}

.shortcut-hint,
.action-buttons {
  display: flex;
  align-items: center;
  gap: 14px;
}

.shortcut-hint {
  color: var(--muted);
  font-size: 10px;
}

kbd {
  padding: 2px 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  color: var(--muted);
  background: var(--surface-strong);
  font-family: var(--ui);
  font-size: 9px;
}

.data-note {
  display: flex;
  justify-content: center;
  gap: 8px;
  align-items: center;
  padding: 17px 12px 0;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.02em;
}

.privacy-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2d8c5e;
  box-shadow: 0 0 0 4px rgba(45, 140, 94, 0.1);
}

@media (max-width: 980px) {
  .app-shell {
    padding-inline: 22px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 32px;
  }

  .control-panel > .eyebrow,
  .control-panel > h1,
  .control-panel > .panel-intro {
    grid-column: 1;
  }

  .filter-form {
    grid-row: 1 / span 5;
    grid-column: 2;
    margin-top: 0;
  }

  .session-block,
  .danger-button {
    grid-column: 1;
  }

  .practice-stage {
    max-width: none;
  }
}

@media (max-width: 700px) {
  .app-shell {
    padding: 0 14px 22px;
  }

  .topbar {
    min-height: 74px;
  }

  .brand small,
  .lifetime-stats small {
    display: none;
  }

  .brand-mark {
    width: 37px;
    height: 37px;
    border-radius: 11px;
    font-size: 21px;
  }

  .lifetime-stats {
    gap: 12px;
  }

  .lifetime-stats div:not(.stat-divider) {
    min-width: 45px;
  }

  .lifetime-stats span {
    font-size: 17px;
  }

  .stat-divider {
    height: 22px;
  }

  .workspace {
    gap: 28px;
    padding-top: 28px;
  }

  .control-panel {
    display: block;
  }

  .control-panel h1 {
    font-size: 34px;
  }

  .filter-form {
    margin-top: 24px;
  }

  .question-card {
    min-height: 0;
    border-radius: 22px;
  }

  .question-card::before {
    width: 4px;
  }

  .card-topline {
    min-height: 64px;
    padding-inline: 20px;
  }

  .card-meta {
    gap: 7px;
    font-size: 9px;
  }

  .question-copy {
    padding: 27px 21px 20px;
  }

  .question-copy h2 {
    font-size: 20px;
    line-height: 1.45;
  }

  .options-list {
    gap: 9px;
    padding: 3px 21px 26px;
  }

  .option-button {
    grid-template-columns: 34px 1fr;
    min-height: 57px;
    padding-left: 10px;
    border-radius: 14px;
  }

  .option-letter {
    width: 32px;
    height: 32px;
    border-radius: 9px;
  }

  .option-text {
    font-size: 15px;
  }

  .feedback {
    margin: 0 21px 22px;
  }

  .card-actions {
    align-items: stretch;
    padding: 14px 21px 18px;
  }

  .shortcut-hint {
    display: none;
  }

  .action-buttons {
    width: 100%;
  }

  .action-buttons .primary-button {
    flex: 1;
  }
}

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