:root {
  color-scheme: light;
  --ink: #1d2433;
  --muted: #667085;
  --line: #d8dee9;
  --surface: #ffffff;
  --surface-soft: #f6f7fb;
  --mint: #0f766e;
  --mint-soft: #d8f3ed;
  --coral: #c2410c;
  --coral-soft: #ffedd5;
  --blue: #2454c6;
  --blue-soft: #dbeafe;
  --rose: #be123c;
  --rose-soft: #ffe4e6;
  --green: #15803d;
  --green-soft: #dcfce7;
  --shadow: 0 18px 45px rgba(33, 40, 57, 0.12);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(15, 118, 110, 0.08), transparent 30%),
    linear-gradient(240deg, rgba(194, 65, 12, 0.1), transparent 26%),
    #f4f2ec;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mark {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 18px);
  grid-template-rows: repeat(2, 18px);
  gap: 5px;
  width: 56px;
  height: 56px;
  padding: 7px;
  border: 1px solid rgba(29, 36, 51, 0.16);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.mark span {
  border-radius: 5px;
  background: var(--mint);
}

.mark span:nth-child(2) {
  background: var(--coral);
}

.mark span:nth-child(3) {
  grid-column: 1 / 3;
  background: var(--blue);
}

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

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4.15rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(86px, 1fr));
  gap: 10px;
}

.stats-strip article {
  min-width: 88px;
  padding: 12px 14px;
  border: 1px solid rgba(29, 36, 51, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.84);
}

.stats-strip strong,
.stats-strip span {
  display: block;
}

.stats-strip strong {
  font-size: 1.25rem;
  line-height: 1;
}

.stats-strip span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
}

.control-panel,
.question-card,
.solution-card {
  border: 1px solid rgba(29, 36, 51, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.control-panel {
  align-self: start;
  padding: 16px;
}

.panel-block + .panel-block,
.study-card {
  margin-top: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 800;
}

.segmented {
  display: grid;
  gap: 8px;
}

.segment-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.segment-button:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 118, 110, 0.55);
}

.segment-button[aria-selected="true"] {
  border-color: var(--mint);
  background: var(--mint-soft);
}

.segment-button small {
  color: var(--muted);
  font-weight: 750;
}

.progress-list {
  display: grid;
  gap: 12px;
}

.progress-row {
  display: grid;
  gap: 7px;
}

.progress-row header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8ebf1;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 220ms ease;
}

.study-card {
  padding: 14px;
  border: 1px solid rgba(29, 36, 51, 0.1);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.study-art {
  position: relative;
  height: 116px;
  margin-bottom: 12px;
  overflow: hidden;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(36, 84, 198, 0.12), transparent 55%),
    linear-gradient(45deg, rgba(15, 118, 110, 0.16), rgba(194, 65, 12, 0.12));
}

.paper {
  position: absolute;
  left: 28px;
  top: 18px;
  width: 110px;
  height: 78px;
  padding: 14px;
  border: 1px solid rgba(29, 36, 51, 0.18);
  border-radius: 7px;
  background: #fff;
  transform: rotate(-5deg);
  box-shadow: 0 12px 22px rgba(33, 40, 57, 0.12);
}

.paper span {
  display: block;
  height: 8px;
  margin-bottom: 9px;
  border-radius: 999px;
  background: #dfe5ee;
}

.paper span:nth-child(2) {
  width: 72%;
  background: var(--mint-soft);
}

.paper span:nth-child(3) {
  width: 48%;
  background: var(--coral-soft);
}

.pencil {
  position: absolute;
  right: 38px;
  top: 24px;
  width: 18px;
  height: 78px;
  border-radius: 999px 999px 5px 5px;
  background:
    linear-gradient(#1d2433 0 10px, #f8d24b 10px 58px, #c2410c 58px 78px);
  transform: rotate(21deg);
  box-shadow: 0 12px 24px rgba(33, 40, 57, 0.16);
}

.study-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.question-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.question-card {
  min-height: 610px;
  padding: clamp(18px, 3vw, 30px);
}

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

.subject-chip,
.difficulty,
.skill-label,
.solution-state {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.subject-chip {
  padding: 0 11px;
  color: var(--mint);
  background: var(--mint-soft);
}

.difficulty {
  padding: 0 10px;
  color: var(--coral);
  background: var(--coral-soft);
}

.skill-label {
  margin: 28px 0 10px;
  color: var(--muted);
}

.question-card h2 {
  min-height: 152px;
  margin: 0;
  font-size: clamp(1.45rem, 2.4vw, 2.15rem);
  line-height: 1.24;
  letter-spacing: 0;
}

.option-grid {
  display: grid;
  gap: 11px;
  margin-top: 24px;
}

.loading-lines {
  display: grid;
  gap: 11px;
}

.loading-lines span {
  display: block;
  height: 62px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(90deg, #eef1f6 0%, #ffffff 45%, #eef1f6 90%);
  background-size: 220% 100%;
  animation: loadingSweep 1.15s ease-in-out infinite;
}

@keyframes loadingSweep {
  0% {
    background-position: 120% 0;
  }

  100% {
    background-position: -120% 0;
  }
}

.option-button {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.option-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(36, 84, 198, 0.45);
  background: #f9fbff;
}

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

.option-letter {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 900;
}

.option-text {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
  line-height: 1.35;
}

.option-button.correct {
  border-color: rgba(21, 128, 61, 0.55);
  background: var(--green-soft);
}

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

.option-button.wrong {
  border-color: rgba(190, 18, 60, 0.55);
  background: var(--rose-soft);
}

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

.question-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.primary-button,
.secondary-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.primary-button {
  padding: 0 16px;
  border: 1px solid var(--ink);
  color: #fff;
  background: var(--ink);
  font-weight: 850;
  box-shadow: 0 12px 22px rgba(29, 36, 51, 0.2);
}

.primary-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
  transform: none;
  box-shadow: none;
}

.secondary-button {
  padding: 0 13px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
  font-weight: 800;
}

.secondary-button:hover {
  background: var(--surface-soft);
}

.icon-button {
  width: 38px;
  min-height: 38px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.solution-card {
  min-height: 610px;
  padding: 18px;
}

.solution-state {
  padding: 0 11px;
  color: var(--muted);
  background: var(--surface-soft);
}

.solution-state.good {
  color: var(--green);
  background: var(--green-soft);
}

.solution-state.bad {
  color: var(--rose);
  background: var(--rose-soft);
}

.hint-box {
  display: none;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(36, 84, 198, 0.18);
  border-radius: var(--radius);
  color: #183b8e;
  background: var(--blue-soft);
  font-weight: 700;
  line-height: 1.45;
}

.hint-box.visible {
  display: block;
}

.solution-body {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.solution-step {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(29, 36, 51, 0.1);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.step-index {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #fff;
  background: var(--ink);
  font-weight: 900;
}

.solution-step p {
  margin: 0;
  min-width: 0;
  color: var(--ink);
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.empty-solution {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 980px) {
  .topbar,
  .workspace,
  .question-stage {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .stats-strip {
    grid-template-columns: repeat(3, 1fr);
  }

  .control-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .panel-block + .panel-block,
  .study-card {
    margin-top: 0;
  }

  .study-card {
    grid-column: 1 / -1;
  }

  .question-card,
  .solution-card {
    min-height: 0;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 18px, 1180px);
    padding: 12px 0;
  }

  h1 {
    font-size: 2.25rem;
  }

  .stats-strip {
    grid-template-columns: 1fr;
  }

  .control-panel {
    grid-template-columns: 1fr;
  }

  .question-card h2 {
    min-height: 130px;
    font-size: 1.34rem;
  }

  .question-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }
}
