:root {
  color-scheme: light;
  --bg: #fff8f1;
  --surface: rgba(255, 255, 255, 0.8);
  --surface-strong: #ffffff;
  --ink: #1d1833;
  --muted: #61587a;
  --border: rgba(113, 87, 170, 0.16);
  --purple: #7c3aed;
  --purple-soft: #f1e8ff;
  --teal: #14b8a6;
  --teal-soft: #dbfffb;
  --orange: #f97316;
  --orange-soft: #fff0df;
  --pink: #ec4899;
  --shadow: 0 20px 45px rgba(91, 53, 168, 0.12);
}

* {
  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;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(124, 58, 237, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(20, 184, 166, 0.16), transparent 28%),
    linear-gradient(180deg, #fff9f4 0%, #fff2fc 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(124, 58, 237, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 184, 166, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: -1;
}

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

.hero-panel,
.question-panel,
.solver-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.hero-panel {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
  padding: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--pink);
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.05;
}

.hero-text {
  max-width: 60ch;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.hero-metrics {
  display: grid;
  gap: 14px;
  align-content: stretch;
}

.metric-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 112px;
  padding: 18px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(20, 184, 166, 0.12));
  border: 1px solid rgba(124, 58, 237, 0.12);
}

.metric-label {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
}

.metric-card strong {
  font-size: 1.2rem;
  line-height: 1.3;
}

.reset-card {
  justify-content: flex-start;
  gap: 10px;
}

.reset-input,
.reset-button {
  width: 100%;
  border-radius: 8px;
  font: inherit;
}

.reset-input {
  border: 1px solid rgba(124, 58, 237, 0.18);
  padding: 12px 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
}

.reset-input:focus {
  outline: none;
  border-color: rgba(124, 58, 237, 0.5);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}

.reset-button {
  border: 0;
  min-height: 44px;
  padding: 12px 14px;
  color: #ffffff;
  font-weight: 700;
  background: linear-gradient(135deg, #ef4444, #f97316);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.reset-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(239, 68, 68, 0.2);
}

.reset-feedback {
  margin: 0;
  min-height: 44px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.reset-feedback.is-error {
  color: #c2410c;
}

.reset-feedback.is-success {
  color: #0f8c7d;
}

.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;
}

.question-panel {
  margin-top: 18px;
  padding: 24px 28px;
}

.question-header {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
  align-items: start;
}

.topic-chip {
  display: inline-flex;
  margin: 0 0 12px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--orange-soft);
  color: var(--orange);
  font-size: 0.82rem;
  font-weight: 700;
}

.question-header h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  line-height: 1.35;
}

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

.choice-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid rgba(124, 58, 237, 0.12);
  background: rgba(255, 255, 255, 0.88);
}

.choice-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.14), rgba(20, 184, 166, 0.14));
  color: var(--purple);
  font-weight: 800;
}

.choice-text {
  color: var(--ink);
  line-height: 1.55;
}

.question-footer p,
.peer-attempt,
.solution-copy {
  margin: 0;
  line-height: 1.6;
  white-space: pre-wrap;
}

.question-footer {
  margin-top: 16px;
  color: var(--muted);
}

.solver-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.solver-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.choice-button {
  min-height: 46px;
  border: 1px solid rgba(124, 58, 237, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease, background 140ms ease;
}

.choice-button:hover {
  transform: translateY(-1px);
  border-color: rgba(124, 58, 237, 0.42);
}

.choice-button.is-selected {
  color: #ffffff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  box-shadow: 0 12px 24px rgba(124, 58, 237, 0.18);
}

.solver-header,
.peer-header,
.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.name-label,
.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.solver-name {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
}

.attempt-input {
  width: 100%;
  border: 1px solid rgba(113, 87, 170, 0.18);
  border-radius: 8px;
  font: inherit;
  color: var(--ink);
  background: var(--surface-strong);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.attempt-input {
  min-height: 196px;
  padding: 16px;
  resize: vertical;
  line-height: 1.6;
}

.attempt-input:focus {
  outline: none;
  border-color: rgba(124, 58, 237, 0.5);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}

.status-badge,
.peer-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  padding: 9px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.status-idle {
  background: #efeafc;
  color: #6d46d7;
}

.status-attempted {
  background: #defcf7;
  color: #0f8c7d;
}

.status-viewed {
  background: #fff0df;
  color: #c16015;
}

.reveal-button {
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.reveal-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(124, 58, 237, 0.22);
}

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

.solution-panel,
.peer-panel {
  border-radius: 8px;
  padding: 16px;
}

.solution-panel {
  background: linear-gradient(135deg, rgba(255, 240, 223, 0.92), rgba(255, 255, 255, 0.98));
  border: 1px solid rgba(249, 115, 22, 0.16);
}

.solution-panel h3,
.peer-panel h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.peer-panel {
  margin-top: auto;
  background: linear-gradient(135deg, rgba(241, 232, 255, 0.85), rgba(255, 255, 255, 0.96));
  border: 1px solid rgba(124, 58, 237, 0.12);
}

.peer-choice {
  margin-bottom: 12px;
  color: var(--purple);
  font-size: 0.9rem;
  font-weight: 700;
}

.peer-attempt {
  min-height: 96px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(124, 58, 237, 0.08);
  color: var(--muted);
}

.hidden {
  display: none;
}

@media (max-width: 920px) {
  .hero-panel,
  .choice-list,
  .solver-grid {
    grid-template-columns: 1fr;
  }

  .hero-panel,
  .question-panel,
  .solver-card {
    padding: 20px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 16px;
  }

  .hero-copy h1 {
    font-size: 1.8rem;
  }

  .hero-text,
  .question-header h2,
  .choice-text,
  .question-footer p,
  .reset-feedback,
  .attempt-input,
  .peer-attempt,
  .solution-copy {
    font-size: 0.96rem;
  }

  .question-panel,
  .solver-card {
    padding: 18px;
  }

  .solver-header,
  .peer-header,
  .action-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .attempt-input {
    min-height: 160px;
  }

  .answer-grid {
    grid-template-columns: repeat(5, minmax(44px, 1fr));
  }

  .status-badge,
  .peer-status {
    min-width: 0;
  }
}
