:root {
  --bg: #f4f1ea;
  --bg-accent: linear-gradient(180deg, #f7f4ee 0%, #f1ede6 100%);
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --surface-soft: #f7f5f1;
  --text: #18201d;
  --muted: #6d746f;
  --line: rgba(24, 32, 29, 0.1);
  --brand: #2a322f;
  --brand-dark: #1c2321;
  --brand-ink: #1c2321;
  --ok: #215d48;
  --error: #a33f2d;
  --shadow: 0 12px 32px rgba(30, 34, 32, 0.06);
  --shadow-soft: 0 4px 14px rgba(30, 34, 32, 0.04);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background: var(--bg-accent);
}

body::before,
body::after {
  display: none;
}

button,
input,
select,
fieldset,
legend {
  font: inherit;
}

button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 0.9rem 1.1rem;
  background: var(--brand);
  color: #f7f5f1;
  font-weight: 700;
  letter-spacing: 0;
  box-shadow: none;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, opacity 140ms ease;
}

button:hover {
  background: #343d39;
}

button:active {
  background: #222927;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

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

button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  box-shadow: none;
}

input,
select {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 0.75rem;
  font-weight: 700;
  color: var(--text);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: 1.2rem 1.1rem 2.4rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.25rem;
  align-items: center;
  margin-bottom: 1rem;
}

.hero-copy-block {
  display: grid;
  gap: 0.2rem;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 12ch;
  font-size: clamp(2.8rem, 7vw, 4.8rem);
  line-height: 0.92;
  letter-spacing: -0.05em;
  margin-bottom: 0.6rem;
}

h2 {
  font-size: clamp(1.9rem, 4vw, 2.35rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin-bottom: 0.4rem;
}

h3 {
  font-size: 1.15rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.hero-copy {
  max-width: 52rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

.hero-side {
  display: grid;
  justify-items: end;
  gap: 0.9rem;
}

.hero-token {
  width: clamp(120px, 18vw, 190px);
  height: auto;
  display: block;
  filter: saturate(1.02);
}

.hero-badge {
  justify-self: end;
  padding: 0.8rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  box-shadow: none;
  backdrop-filter: blur(6px);
}

.session-action {
  width: 100%;
}

.hidden {
  display: none !important;
}

.panel {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(24, 32, 29, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.panel::before {
  display: none;
}

.panel-grid {
  display: grid;
  gap: 1rem;
}

.stack {
  display: grid;
  gap: 1rem;
}

.toolbar,
.chips,
.actions,
.stats-grid,
.subject-grid,
.module-grid,
.choices {
  display: grid;
  gap: 0.8rem;
}

.toolbar {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.subject-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

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

.resume-list {
  display: grid;
  gap: 0.85rem;
}

.resume-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 1rem;
  align-items: center;
}

.resume-card-body {
  display: grid;
  gap: 0.45rem;
}

.subject-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, max-content));
  gap: 0.7rem;
}

.subject-tab {
  min-height: 2.75rem;
  padding: 0.8rem 1rem;
}

.dashboard-focus {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
  gap: 1rem;
  align-items: start;
}

.review-column {
  display: grid;
}

.subject-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: end;
}

.feature-panel,
.review-panel {
  padding: 1.15rem;
}

.section-heading {
  display: grid;
  gap: 0.3rem;
}

.section-heading .muted {
  max-width: 42rem;
}

.course-list {
  display: grid;
  gap: 0.85rem;
}

.course-card {
  padding: 1rem;
}

.course-card h3 {
  margin-bottom: 0.35rem;
}

.module-card {
  display: grid;
  gap: 0.9rem;
  padding: 0.9rem;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 243, 237, 0.98));
  border: 2px solid rgba(36, 43, 40, 0.14);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.8),
    0 4px 14px rgba(24, 32, 29, 0.05);
}

.locked-module {
  opacity: 0.74;
  background: linear-gradient(180deg, rgba(249, 247, 243, 0.98), rgba(242, 238, 231, 0.98));
}

.module-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid rgba(24, 32, 29, 0.08);
}

.module-card-top .eyebrow {
  color: var(--brand-dark);
}

.module-level {
  display: inline-flex;
  align-items: center;
  min-height: 1.9rem;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: #eef1ee;
  color: var(--muted);
  border: 1px solid rgba(24, 32, 29, 0.08);
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

.module-card-body {
  display: grid;
  gap: 0.35rem;
}

.module-chapter {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.module-card .chips {
  grid-template-columns: repeat(2, minmax(120px, max-content));
}

.module-card .chip {
  background: #f1f3f0;
  color: #4f5852;
}

.module-card .actions {
  margin-top: 0.1rem;
}

.module-card .open-module {
  min-height: 3rem;
  border-radius: 14px;
}

.review-panel {
  background: linear-gradient(180deg, #fcfcfb 0%, #f7f5f1 100%);
}

.card {
  position: relative;
  padding: 1rem;
  border-radius: 18px;
  background: var(--surface-strong);
  border: 1px solid rgba(24, 32, 29, 0.08);
  box-shadow: none;
}

.card h3,
.card p:last-child {
  margin-bottom: 0;
}

.chips {
  grid-template-columns: repeat(auto-fit, minmax(110px, max-content));
  align-items: start;
}

.chip {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  border: 1px solid rgba(24, 32, 29, 0.08);
  font-weight: 600;
  box-shadow: none;
}

.question-card {
  position: relative;
  overflow: hidden;
  padding: 1.6rem;
}

.question-card::after {
  display: none;
}

.question-header {
  display: grid;
  gap: 0.65rem;
  margin: 0.4rem 0 0.6rem;
}

.question-header h2 {
  max-width: 20ch;
  font-size: clamp(2.1rem, 5vw, 4.2rem);
  line-height: 0.92;
  margin-bottom: 0;
}

.choices {
  margin: 0.4rem 0 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.choice {
  text-align: left;
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 1.15rem 1.1rem;
  box-shadow: none;
  min-height: 84px;
  display: flex;
  align-items: center;
}

.choice.selected {
  background: #f4f6f5;
  border-color: #8d9791;
  color: var(--text);
}

.feedback {
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid transparent;
}

.feedback.correct {
  background: rgba(33, 93, 72, 0.12);
  border-color: rgba(33, 93, 72, 0.18);
}

.feedback.wrong {
  background: rgba(163, 63, 45, 0.1);
  border-color: rgba(163, 63, 45, 0.15);
}

.stat-value {
  font-size: clamp(1.9rem, 4vw, 2.4rem);
  font-weight: 700;
  line-height: 0.9;
  margin-bottom: 0.2rem;
  letter-spacing: -0.04em;
}

.muted {
  color: var(--muted);
  line-height: 1.45;
}

.error-text {
  color: var(--error);
  font-weight: 700;
}

.profile-picker {
  display: grid;
  gap: 0.75rem;
}

.profile-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.9rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
}

.profile-option input {
  width: auto;
  margin: 0;
  accent-color: var(--brand);
}

.profile-option strong,
.profile-option small {
  display: block;
}

.profile-option strong {
  font-size: 1rem;
}

.profile-option small {
  color: var(--muted);
}

.actions {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.inline-actions {
  align-self: center;
}

.subject-btn,
.open-module,
#startReview,
#refreshDashboard,
#submitAnswer,
#submitReview,
#backDashboard,
#backHome {
  min-height: 2.9rem;
}

.subject-btn small {
  display: block;
  opacity: 0.82;
  margin-top: 0.15rem;
}

.toolbar button,
.actions button {
  width: 100%;
}

.subject-grid .card,
.stats-grid .card {
  align-content: start;
}

.subject-grid .actions {
  margin-top: 0.3rem;
}

.empty-state {
  min-height: 180px;
  align-content: center;
  background: #faf8f4;
  border-style: dashed;
}

.summary-panel {
  padding: 1.5rem;
}

.encouragement-card {
  background: linear-gradient(180deg, #f7f5f1 0%, #f1ede6 100%);
  border-color: rgba(24, 32, 29, 0.06);
}

.encouragement-card h3 {
  font-size: 1.4rem;
  line-height: 1.2;
}

@media (max-width: 720px) {
  .app-shell {
    padding: 1rem 0.85rem 2rem;
  }

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

  .hero-side {
    justify-items: start;
  }

  .hero-badge {
    justify-self: start;
  }

  h1 {
    font-size: 3rem;
    max-width: 8ch;
  }

  .panel {
    padding: 1rem;
    border-radius: 18px;
  }

  .toolbar,
  .stats-grid,
  .subject-grid,
  .actions {
    grid-template-columns: 1fr;
  }

  .subject-picker,
  .dashboard-focus {
    grid-template-columns: 1fr;
  }

  .subject-header {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .resume-card {
    grid-template-columns: 1fr;
  }

  .inline-actions {
    align-self: stretch;
  }

  .module-card .chips {
    grid-template-columns: 1fr;
  }

  .question-card {
    padding: 1.15rem;
  }

  .question-header h2 {
    font-size: 2.4rem;
    max-width: none;
  }

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