:root {
  --navy-950: #102d3d;
  --navy-900: #17394f;
  --navy-800: #214b62;
  --navy-700: #2a5e73;
  --teal-700: #0e6d66;
  --teal-600: #147d74;
  --teal-100: #dff3ef;
  --blue-100: #e9f2f6;
  --blue-50: #f4f8fa;
  --green-700: #277458;
  --green-100: #e5f4ec;
  --violet-700: #6555a6;
  --violet-100: #efebfa;
  --gold-700: #94651a;
  --gold-100: #f8efd9;
  --red-700: #a23c3f;
  --red-100: #fbe9e9;
  --ink: #162832;
  --muted: #60717b;
  --muted-2: #7d8b93;
  --line: #dce4e8;
  --line-strong: #c9d5db;
  --paper: #ffffff;
  --canvas: #f3f6f7;
  --shadow-sm: 0 3px 12px rgba(20, 48, 63, .06);
  --shadow-md: 0 14px 34px rgba(20, 48, 63, .1);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --content-width: 1040px;
  --header-height: 74px;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
summary {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:not(:disabled),
summary,
[data-route] {
  cursor: pointer;
}

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

a {
  color: var(--teal-700);
}

img,
svg {
  display: block;
  max-width: 100%;
}

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

h1,
h2,
h3 {
  color: var(--navy-950);
  line-height: 1.35;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  letter-spacing: -.025em;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.22rem, 2.6vw, 1.55rem);
}

h3 {
  margin-bottom: 6px;
  font-size: 1.04rem;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid #f2a93b;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--navy-950);
  color: #fff;
  text-decoration: none;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.desktop-only {
  display: inline-flex;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--header-height);
  border-bottom: 1px solid rgba(201, 213, 219, .9);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(14px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1440px, 100%);
  min-height: var(--header-height);
  margin: 0 auto;
  padding: 10px 24px;
}

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

.brand-mark {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  box-shadow: 0 5px 15px rgba(16, 45, 61, .16);
}

.brand-copy {
  display: flex;
  flex-direction: column;
}

.brand-kicker {
  color: var(--teal-700);
  font-size: .69rem;
  font-weight: 800;
  letter-spacing: .14em;
  line-height: 1.25;
}

.brand-name {
  color: var(--navy-950);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: .01em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.save-status {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 11px;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--blue-50);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #36a076;
  box-shadow: 0 0 0 4px rgba(54, 160, 118, .12);
}

.icon-button {
  display: inline-grid;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--blue-50);
}

.app-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  width: min(1440px, 100%);
  margin: 0 auto;
}

.side-nav {
  position: sticky;
  top: var(--header-height);
  align-self: start;
  height: calc(100vh - var(--header-height));
  padding: 28px 16px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #eef3f5;
}

.nav-label {
  margin: 14px 12px 6px;
  color: var(--muted-2);
  font-size: .67rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.nav-label:first-child {
  margin-top: 0;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 46px;
  margin: 2px 0;
  padding: 9px 12px;
  gap: 11px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #4b606b;
  font-size: .9rem;
  font-weight: 700;
  text-align: left;
}

.nav-item img {
  width: 20px;
  height: 20px;
  opacity: .72;
}

.nav-item:hover {
  background: rgba(255, 255, 255, .8);
  color: var(--navy-900);
}

.nav-item.is-active {
  background: #fff;
  color: var(--navy-900);
  box-shadow: var(--shadow-sm);
}

.nav-item.is-active::before {
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--teal-600);
  content: "";
}

.nav-item.is-active img {
  opacity: 1;
}

.nav-badge,
.bottom-badge {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  margin-left: auto;
  padding: 0 5px;
  place-items: center;
  border-radius: 999px;
  background: var(--red-700);
  color: #fff;
  font-size: .67rem;
  font-weight: 800;
}

.nav-local-note {
  display: flex;
  align-items: flex-start;
  margin-top: 24px;
  padding: 13px;
  gap: 9px;
  border: 1px solid #d2e6e0;
  border-radius: 12px;
  background: #f4fbf8;
}

.nav-local-note > span {
  padding-top: 1px;
  color: #45a17e;
  font-size: .62rem;
}

.nav-local-note p {
  margin: 0;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.5;
}

.nav-local-note strong {
  color: var(--green-700);
}

.main-content {
  width: 100%;
  min-width: 0;
  max-width: calc(var(--content-width) + 64px);
  margin: 0 auto;
  padding: 38px 32px 76px;
}

.view {
  width: 100%;
  animation: view-in .25s ease both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 20px;
}

.page-heading h1 {
  margin-bottom: 5px;
}

.page-lead {
  max-width: 700px;
  margin-bottom: 0;
  color: var(--muted);
}

.eyebrow,
.card-kicker {
  margin-bottom: 5px;
  color: var(--teal-700);
  font-size: .69rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.primary-button,
.secondary-button,
.danger-button,
.text-button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 18px;
  gap: 8px;
  border-radius: 11px;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  transition: transform .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.primary-button {
  border: 1px solid var(--teal-600);
  background: var(--teal-600);
  color: #fff;
  box-shadow: 0 6px 16px rgba(20, 125, 116, .16);
}

.primary-button:hover:not(:disabled) {
  border-color: var(--teal-700);
  background: var(--teal-700);
  box-shadow: 0 8px 20px rgba(20, 125, 116, .22);
  transform: translateY(-1px);
}

.primary-button img,
.secondary-button img,
.text-button img,
.danger-button img {
  width: 19px;
  height: 19px;
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--navy-900);
}

.secondary-button:hover:not(:disabled) {
  border-color: #a9bdc7;
  background: var(--blue-50);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 16px;
  border-radius: 10px;
  font-weight: 800;
}

.button--secondary {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--navy-900);
}

.button--secondary:hover {
  border-color: #a9bdc7;
  background: var(--blue-50);
}

.danger-button {
  border: 1px solid #dca9aa;
  background: #fff;
  color: var(--red-700);
}

.danger-button:hover:not(:disabled) {
  background: var(--red-100);
}

.text-button {
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--teal-700);
  font-size: .87rem;
}

.text-button:hover {
  background: rgba(223, 243, 239, .72);
}

.primary-large {
  min-height: 54px;
  padding: 14px 22px;
  border-radius: 13px;
  font-size: 1rem;
}

.compact-button {
  min-height: 42px;
  padding: 8px 15px;
  white-space: nowrap;
}

.button-row,
.form-actions,
.dialog-actions,
.trace-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.continue-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  min-height: 252px;
  margin-bottom: 18px;
  padding: clamp(24px, 4vw, 38px);
  overflow: hidden;
  gap: 26px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 87% 5%, rgba(110, 201, 188, .24) 0, rgba(110, 201, 188, 0) 33%),
    linear-gradient(135deg, var(--navy-950), var(--navy-800));
  box-shadow: var(--shadow-md);
  color: #fff;
}

.continue-card::after {
  position: absolute;
  right: -90px;
  bottom: -140px;
  width: 300px;
  height: 300px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 50%;
  content: "";
}

.continue-card-copy,
.continue-card .primary-button {
  position: relative;
  z-index: 1;
}

.continue-card .card-kicker {
  margin-top: 22px;
  color: #86d6c8;
}

.continue-card h2 {
  margin-bottom: 10px;
  color: #fff;
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.continue-card p {
  max-width: 650px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, .78);
}

.continue-card .primary-button {
  min-width: 250px;
  border-color: #fff;
  background: #fff;
  color: var(--navy-900);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
}

.continue-card .primary-button:hover {
  border-color: #fff;
  background: #f3fbf9;
  color: var(--navy-950);
}

.recommendation-meta,
.continue-details,
.question-meta,
.subject-overview-head,
.practice-progress-copy,
.practice-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.subject-chip,
.quiet-chip,
.source-label,
.lesson-tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 800;
  line-height: 1.25;
}

.subject-a {
  background: #deeff6;
  color: #225f78;
}

.subject-b {
  background: #ece7f8;
  color: #615099;
}

.continue-card .subject-a {
  background: rgba(133, 210, 198, .16);
  color: #b6eee4;
}

.quiet-chip {
  background: rgba(255, 255, 255, .11);
  color: inherit;
}

.continue-details {
  margin-top: 22px;
  color: rgba(255, 255, 255, .7);
  font-size: .8rem;
}

.continue-details span + span::before {
  margin-right: 12px;
  color: rgba(255, 255, 255, .3);
  content: "•";
}

.exam-date-card,
.privacy-strip,
.notice {
  display: flex;
  align-items: center;
  margin-bottom: 28px;
  padding: 16px 18px;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
}

.exam-date-icon,
.route-icon,
.settings-icon,
.feedback-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
}

.exam-date-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--blue-100);
}

.exam-date-icon img,
.notice > img,
.privacy-strip > img {
  width: 22px;
  height: 22px;
}

.exam-date-copy {
  min-width: 0;
  flex: 1;
}

.exam-date-copy h2 {
  margin-bottom: 1px;
  font-size: .91rem;
}

.exam-date-copy p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: .83rem;
}

.dashboard-section,
.content-section {
  margin-top: 32px;
}

.section-heading-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 18px;
}

.section-heading-row h2,
.section-heading-row p {
  margin-bottom: 0;
}

.section-heading-row p:not(.eyebrow) {
  color: var(--muted);
  font-size: .86rem;
}

.progress-card-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 14px;
}

.progress-card,
.subject-overview,
.settings-card,
.content-section,
.help-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.progress-card {
  min-width: 0;
  padding: 19px;
}

.progress-card-overall {
  background: linear-gradient(145deg, #fff, #f2f8f8);
}

.progress-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  margin-bottom: 13px;
  gap: 10px;
}

.progress-card-top.compact {
  align-items: flex-end;
}

.progress-label {
  margin-bottom: 1px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}

.progress-value {
  margin: 0;
  color: var(--navy-950);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.progress-value strong {
  font-size: 2rem;
  letter-spacing: -.04em;
}

.progress-value span {
  margin-left: 2px;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 700;
}

.progress-ring {
  display: grid;
  width: 66px;
  height: 66px;
  padding: 7px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--teal-600) calc(var(--value) * 1%), #dfe9e8 0);
}

.progress-ring::before {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fff;
  content: "";
}

.progress-ring span {
  z-index: 1;
  grid-area: 1 / 1;
  color: var(--muted);
  font-size: .64rem;
  font-weight: 800;
}

.progress-fraction {
  margin: 0;
  color: var(--muted);
  font-size: .76rem;
  font-variant-numeric: tabular-nums;
}

.meter {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3eaed;
}

.meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal-600);
  transition: width .35s ease;
}

.meter-a > span {
  background: #317c9a;
}

.meter-b > span {
  background: var(--violet-700);
}

.progress-caption,
.metric-note {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: .74rem;
}

.metric-note {
  margin-top: 10px;
  text-align: right;
}

.route-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.route-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 92px;
  padding: 16px;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.route-card:hover {
  border-color: #b9c9d0;
  box-shadow: 0 8px 22px rgba(20, 48, 63, .09);
  transform: translateY(-2px);
}

.route-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
}

.route-icon img {
  width: 22px;
  height: 22px;
}

.route-icon-blue { background: var(--blue-100); }
.route-icon-green { background: var(--green-100); }
.route-icon-teal { background: #dff3ef; }
.route-icon-gold { background: var(--gold-100); }
.route-icon-violet { background: var(--violet-100); }

.route-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.route-copy strong {
  color: var(--navy-950);
  font-size: .95rem;
}

.route-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 500;
  line-height: 1.45;
}

.route-arrow {
  color: #91a1a9;
  font-size: 1.7rem;
  line-height: 1;
}

.privacy-strip {
  margin: 30px 0 0;
  background: #f5faf8;
}

.privacy-strip p,
.notice p {
  min-width: 0;
  margin: 0;
  flex: 1;
  color: var(--muted);
  font-size: .81rem;
}

.privacy-strip strong,
.notice strong {
  color: var(--ink);
}

.notice {
  align-items: flex-start;
  box-shadow: none;
}

.notice > img {
  margin-top: 2px;
}

.notice-warning {
  border-color: #e8d4a6;
  background: #fffaf0;
}

.course-intro {
  margin-bottom: 20px;
}

.subject-overview-grid,
.backup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.subject-overview {
  position: relative;
  padding: 23px;
  overflow: hidden;
}

.subject-overview::after {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: #3687a5;
  content: "";
}

.subject-overview-b::after {
  background: var(--violet-700);
}

.subject-overview-head {
  justify-content: space-between;
  margin-bottom: 15px;
}

.subject-overview h2 {
  font-size: 1.2rem;
}

.subject-overview p {
  min-height: 78px;
  color: var(--muted);
  font-size: .88rem;
}

.small-muted {
  color: var(--muted);
  font-size: .75rem;
}

.content-section {
  padding: clamp(18px, 3vw, 25px);
}

.course-list {
  display: grid;
  gap: 9px;
}

.unit-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 106px;
  padding: 16px 17px;
  gap: 2px 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbfcfc;
}

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

.unit-card h3 {
  color: var(--navy-900);
}

.unit-card > p:not(.unit-card__status) {
  color: var(--muted);
  font-size: .8rem;
}

.unit-card__status {
  margin-top: 5px !important;
  color: var(--teal-700);
  font-size: .73rem;
  font-weight: 700;
}

.unit-card .button {
  grid-column: 2;
  grid-row: 1 / span 3;
  min-width: 142px;
}

.lesson-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 88px;
  padding: 13px 14px;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbfcfc;
}

.lesson-row.is-current {
  border-color: #8bc2b8;
  background: #f2faf7;
}

.lesson-number {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-100);
  color: var(--navy-800);
  font-size: .78rem;
  font-weight: 900;
}

.is-current .lesson-number {
  background: var(--teal-600);
  color: #fff;
}

.lesson-copy h3,
.lesson-copy p {
  margin-bottom: 0;
}

.lesson-copy p {
  color: var(--muted);
  font-size: .78rem;
}

.lesson-tag {
  min-height: 21px;
  margin-bottom: 3px;
  padding: 2px 7px;
  background: #edf2f4;
  color: var(--muted);
  font-size: .62rem;
}

.lesson-state {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 700;
  white-space: nowrap;
}

.is-current .lesson-state {
  color: var(--teal-700);
}

.practice-view {
  max-width: 850px;
  margin: 0 auto;
}

.practice-toolbar {
  justify-content: space-between;
  margin-bottom: 14px;
}

.practice-toolbar .quiet-chip {
  background: #e7eef1;
  color: var(--navy-800);
}

.back-button {
  padding-left: 0;
}

.practice-progress {
  margin-bottom: 14px;
}

.practice-progress-copy {
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}

.bridge-lesson-panel,
.official-milestone {
  margin-bottom: 16px;
  border: 1px solid #b9d8d3;
  border-radius: var(--radius-lg);
  background: #f4fbf9;
  box-shadow: var(--shadow-sm);
}

.bridge-lesson-panel summary {
  display: grid;
  gap: 4px;
  padding: 17px 20px;
  cursor: pointer;
  color: var(--navy-900);
}

.bridge-lesson-panel summary span {
  color: var(--teal-700);
  font-size: .76rem;
  font-weight: 800;
}

.bridge-lesson-panel summary strong {
  font-size: 1rem;
}

.bridge-lesson-body {
  padding: 0 20px 20px;
  border-top: 1px solid #d7ebe7;
}

.bridge-lesson-body > p {
  margin: 16px 0;
  line-height: 1.8;
}

.bridge-lesson-body h2 {
  margin: 16px 0 8px;
  font-size: .88rem;
}

.bridge-lesson-body ul {
  margin: 0;
  padding-left: 1.4rem;
  line-height: 1.75;
}

.bridge-worked-example {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: #fff;
}

.bridge-worked-example h2,
.bridge-worked-example p {
  margin: 0;
}

.bridge-worked-example p {
  margin-top: 6px;
  white-space: pre-line;
  line-height: 1.75;
}

.official-milestone {
  display: grid;
  gap: 4px;
  padding: 16px 20px;
  border-color: #e0c98c;
  background: #fffaf0;
}

.official-milestone strong {
  color: #805f10;
}

.official-milestone span {
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.6;
}

.question-card,
.trace-panel,
.feedback-card,
.review-hero,
.danger-zone {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.question-card,
.trace-panel,
.feedback-card {
  padding: clamp(20px, 4vw, 34px);
}

.question-meta {
  margin-bottom: 20px;
}

.source-label {
  min-height: 26px;
  padding: 3px 9px;
  background: #f1f3f4;
  color: var(--muted);
  font-weight: 700;
}

.source-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: -10px 0 18px;
  color: var(--muted);
  font-size: .76rem;
}

.source-detail a {
  color: var(--teal-700);
  font-weight: 700;
}

.source-detail .source-notice {
  flex-basis: 100%;
  color: #5f6870;
}

.question-heading {
  margin-bottom: 14px;
  font-size: 1rem;
  letter-spacing: .08em;
}

.question-stem {
  margin-bottom: 24px;
  color: #172a35;
  font-size: clamp(1.05rem, 2.2vw, 1.22rem);
  font-weight: 650;
  line-height: 1.85;
  white-space: pre-wrap;
}

.question-stem > :last-child {
  margin-bottom: 0;
}

.question-figure {
  margin: 0 0 22px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.question-figure img {
  width: auto;
  max-height: 420px;
  margin: 0 auto;
}

.question-figure figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: .75rem;
  text-align: center;
}

.image-zoom-trigger {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
}

.image-zoom-trigger:focus-visible {
  outline: 3px solid rgba(20, 125, 116, .35);
  outline-offset: 4px;
}

.image-zoom-hint {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(16, 45, 59, .86);
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
  line-height: 1.25;
  pointer-events: none;
}

.answer-choice-item-with-figure {
  display: grid;
}

.answer-choice-item-with-figure .answer-choice {
  border-radius: 12px 12px 0 0;
}

.choice-figure {
  margin: -1px 0 0;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 0 0 12px 12px;
  background: #fbfcfc;
}

.choice-figure img {
  width: 100%;
  max-height: 300px;
  margin: 0 auto;
  object-fit: contain;
}

.choice-figure figcaption {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: .75rem;
  text-align: center;
}

.answer-choices {
  display: grid;
  gap: 10px;
}

.answer-choice {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 10px 15px;
  gap: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 650;
  line-height: 1.55;
  text-align: left;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.answer-choice:hover {
  border-color: #8aaebc;
  background: var(--blue-50);
}

.answer-choice[aria-checked="true"],
.answer-choice.is-selected,
.answer-choice:has(input:checked) {
  border-color: var(--teal-600);
  background: #f1faf8;
  box-shadow: 0 0 0 2px rgba(20, 125, 116, .12);
}

.answer-choice input[type="radio"] {
  width: 21px;
  height: 21px;
  margin: 0 auto;
  accent-color: var(--teal-600);
}

.choice-content {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.choice-text {
  white-space: pre-wrap;
}

.choice-label {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #f6f8f9;
  color: var(--navy-800);
  font-size: .8rem;
  font-weight: 900;
}

.answer-choice[aria-checked="true"] .choice-label,
.answer-choice.is-selected .choice-label,
.answer-choice:has(input:checked) .choice-label {
  border-color: var(--teal-600);
  background: var(--teal-600);
  color: #fff;
}

.question-support-row {
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
  gap: 10px;
}

.hint-panel,
.decision-box,
.selected-reason,
.memory-point,
.status-box,
.trace-prediction {
  margin-top: 14px;
  padding: 15px 17px;
  border-radius: 12px;
}

.hint-panel {
  border: 1px solid #dfd0a6;
  background: #fffaf0;
}

.hint-panel p:last-child,
.decision-box p:last-child,
.selected-reason p:last-child,
.memory-point > :last-child,
.trace-prediction p:last-child,
.status-box {
  margin-bottom: 0;
}

.hint-title,
.decision-label {
  margin-bottom: 4px;
  color: var(--gold-700);
  font-size: .76rem;
  font-weight: 800;
}

.answer-submit {
  width: 100%;
  margin-top: 22px;
}

.trace-panel,
.feedback-card {
  margin-top: 18px;
}

.trace-heading,
.feedback-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 14px;
}

.trace-heading h2,
.feedback-heading h2,
.feedback-heading p {
  margin-bottom: 0;
}

.trace-heading .quiet-chip {
  background: var(--violet-100);
  color: var(--violet-700);
}

.trace-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(250px, .85fr);
  gap: 14px;
}

.trace-layout > * {
  min-width: 0;
}

.trace-code {
  margin: 0;
  padding: 12px 12px 12px 46px;
  overflow-x: auto;
  border-radius: 13px;
  background: #172a35;
  color: #d7e5ea;
  font-size: .86rem;
  line-height: 1.8;
}

.trace-code li {
  padding: 4px 8px;
  border-left: 3px solid transparent;
}

.trace-code li.is-current {
  border-left-color: #70d4c3;
  background: rgba(112, 212, 195, .13);
  color: #fff;
}

.trace-code code {
  color: inherit;
  font-family: "Cascadia Mono", Consolas, "Yu Gothic UI", monospace;
  white-space: pre;
}

.trace-state {
  padding: 15px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--blue-50);
}

.trace-current {
  color: var(--muted);
  font-size: .8rem;
}

.trace-state table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: .78rem;
}

.trace-state caption {
  margin-bottom: 6px;
  color: var(--navy-800);
  font-weight: 800;
  text-align: left;
}

.trace-state th,
.trace-state td {
  padding: 7px;
  border: 1px solid var(--line);
  text-align: center;
}

.changed-value {
  background: var(--teal-100);
  color: var(--teal-700);
  font-weight: 900;
}

.trace-array {
  display: flex;
  flex-wrap: wrap;
  margin-top: 10px;
  gap: 5px;
}

.trace-array__group {
  width: 100%;
}

.trace-array__cells {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.trace-array__cell {
  position: relative;
  min-width: 34px;
  padding: 7px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  text-align: center;
}

.trace-array__cell::before {
  content: attr(data-index);
  position: absolute;
  top: -9px;
  right: 2px;
  padding: 0 2px;
  background: var(--blue-50);
  color: var(--muted);
  font-size: .58rem;
}

.trace-prediction {
  border: 1px solid #d6cfeb;
  background: #f8f6fc;
}

.trace-prediction p {
  color: var(--muted);
  font-size: .82rem;
}

.trace-controls {
  justify-content: flex-end;
  margin-top: 14px;
}

.feedback-heading {
  justify-content: flex-start;
}

.feedback-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--green-100);
}

.feedback-icon img {
  width: 25px;
  height: 25px;
}

.feedback-heading.is-incorrect .feedback-icon {
  background: var(--red-100);
}

.decision-box {
  border-left: 4px solid var(--teal-600);
  background: #f1faf8;
}

.selected-reason {
  border: 1px solid var(--line);
  background: #fafcfc;
}

.selected-reason h3 {
  margin-bottom: 4px;
  font-size: .8rem;
}

.explanation-details {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.explanation-details summary {
  position: relative;
  min-height: 52px;
  padding: 14px 44px 14px 17px;
  color: var(--navy-900);
  font-weight: 800;
  list-style: none;
}

.explanation-details summary::-webkit-details-marker {
  display: none;
}

.explanation-details summary::after {
  position: absolute;
  top: 50%;
  right: 18px;
  color: var(--teal-700);
  font-size: 1.2rem;
  content: "+";
  transform: translateY(-50%);
}

.explanation-details[open] summary::after {
  content: "−";
}

.explanation-body {
  padding: 0 18px 18px;
  border-top: 1px solid var(--line);
}

.explanation-body section {
  padding: 18px 0 3px;
}

.explanation-body section + section {
  border-top: 1px solid #edf1f2;
}

.explanation-body p,
.worked-steps {
  color: #364c58;
  font-size: .9rem;
}

.worked-steps {
  padding-left: 1.4em;
}

.worked-steps li + li {
  margin-top: 6px;
}

.choice-explanations {
  display: grid;
  gap: 8px;
}

.choice-explanations p {
  margin: 0;
  padding: 12px;
  border-radius: 9px;
  background: var(--blue-50);
}

.choice-explanation {
  padding: 13px;
  border-radius: 10px;
  background: var(--blue-50);
}

.choice-explanation strong {
  color: var(--navy-900);
}

.choice-explanation p {
  margin: 4px 0 0;
  padding: 0;
  background: transparent;
}

.correct-text {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--green-100);
  color: var(--green-700);
  font-size: .68rem;
}

.memory-point {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid #d7ca9d;
  background: #fffaf0;
}

.memory-point span {
  flex: 0 0 auto;
  color: var(--gold-700);
  font-size: .72rem;
  font-weight: 900;
}

.feedback-card > .primary-button {
  width: 100%;
  margin-top: 18px;
}

.review-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(22px, 4vw, 34px);
  gap: 24px;
  background: linear-gradient(140deg, #fff, #f1faf7);
}

.review-hero p {
  margin-bottom: 0;
  color: var(--muted);
}

.review-count {
  color: var(--navy-950) !important;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.review-count strong {
  font-size: 3rem;
  letter-spacing: -.05em;
}

.review-count span {
  margin-left: 4px;
  font-size: .9rem;
  font-weight: 800;
}

.empty-state {
  display: grid;
  min-height: 270px;
  padding: 28px;
  place-items: center;
  align-content: center;
  text-align: center;
}

.empty-state img {
  width: 42px;
  height: 42px;
  margin-bottom: 13px;
  opacity: .55;
}

.empty-state p {
  max-width: 540px;
  color: var(--muted);
  font-size: .86rem;
}

.review-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 16px;
  gap: 4px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfc;
  text-align: left;
}

.review-card + .review-card {
  margin-top: 9px;
}

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

.review-card p {
  color: var(--muted);
  font-size: .8rem;
}

.review-card .button {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.mock-setup {
  max-width: 760px;
  margin: 18px auto 0;
  padding: clamp(20px, 4vw, 30px);
}

.mock-setup fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.mock-setup legend {
  margin-bottom: 10px;
  color: var(--navy-900);
  font-weight: 800;
}

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

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

.segmented-options input {
  position: absolute;
  opacity: 0;
}

.segmented-options label > span {
  display: flex;
  min-height: 82px;
  padding: 14px;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
}

.segmented-options input:focus-visible + span {
  outline: 3px solid #f2a93b;
  outline-offset: 3px;
}

.segmented-options input:checked + span {
  border-color: var(--teal-600);
  background: #eff9f7;
  box-shadow: 0 0 0 2px rgba(20, 125, 116, .1);
}

.segmented-options small {
  margin-top: 2px;
  color: var(--muted);
}

.mock-check-list {
  margin: 24px 0;
}

.mock-check-list p {
  display: flex;
  align-items: center;
  margin: 8px 0;
  gap: 9px;
  color: var(--muted);
  font-size: .87rem;
}

.mock-check-list img {
  width: 19px;
  height: 19px;
}

.mock-setup > .primary-button {
  width: 100%;
}

.summary-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.summary-stat-grid article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.summary-stat-grid > p {
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--navy-900);
  box-shadow: var(--shadow-sm);
  font-size: .82rem;
  font-weight: 700;
}

.summary-stat-grid article > span {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 700;
}

.summary-stat-grid strong {
  display: block;
  margin: 6px 0;
  color: var(--navy-950);
  font-size: 1.8rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.summary-stat-grid small {
  margin-left: 3px;
  color: var(--muted);
  font-size: .7rem;
}

.summary-stat-grid p {
  margin: 0;
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.4;
}

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

.topic-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 12px 14px;
  gap: 14px;
  border-radius: 10px;
  background: var(--blue-50);
}

.topic-progress strong {
  color: var(--navy-900);
  font-size: .86rem;
}

.topic-progress span {
  color: var(--muted);
  font-size: .75rem;
  text-align: right;
}

.topic-progress-row {
  display: grid;
  grid-template-columns: minmax(130px, .75fr) minmax(120px, 1fr) 42px;
  align-items: center;
  gap: 14px;
}

.topic-progress-row > div:first-child {
  display: flex;
  flex-direction: column;
}

.topic-progress-row strong {
  font-size: .86rem;
}

.topic-progress-row span {
  color: var(--muted);
  font-size: .72rem;
  text-align: right;
}

.empty-inline {
  padding: 24px;
  border-radius: 11px;
  background: var(--blue-50);
  color: var(--muted);
  font-size: .85rem;
  text-align: center;
}

.backup-grid {
  margin-bottom: 16px;
}

.settings-card {
  padding: clamp(20px, 3vw, 26px);
}

.settings-card-heading {
  display: flex;
  align-items: flex-start;
  margin-bottom: 18px;
  gap: 13px;
}

.settings-card-heading h2,
.settings-card-heading p {
  margin-bottom: 2px;
}

.settings-card-heading p {
  color: var(--muted);
  font-size: .8rem;
}

.settings-icon {
  width: 43px;
  height: 43px;
  border-radius: 12px;
  background: var(--blue-100);
}

.settings-icon img {
  width: 21px;
  height: 21px;
}

.status-box {
  border: 1px solid var(--line);
  background: var(--blue-50);
  color: var(--muted);
  font-size: .8rem;
}

.settings-card > .primary-button {
  width: 100%;
  margin-top: 16px;
}

.file-picker {
  display: grid;
  min-height: 150px;
  padding: 20px;
  place-items: center;
  align-content: center;
  border: 1.5px dashed #aebfc7;
  border-radius: 12px;
  background: var(--blue-50);
  text-align: center;
  cursor: pointer;
}

.file-picker:hover {
  border-color: var(--teal-600);
  background: #f1faf8;
}

.file-picker img {
  width: 27px;
  height: 27px;
  margin-bottom: 8px;
}

.file-picker strong {
  color: var(--navy-900);
}

.file-picker span {
  color: var(--muted);
  font-size: .75rem;
}

.restore-preview {
  margin-top: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.form-stack {
  display: grid;
  max-width: 720px;
  gap: 4px;
}

.field-label {
  margin-top: 12px;
  color: var(--navy-900);
  font-size: .87rem;
  font-weight: 800;
}

.field-label:first-child {
  margin-top: 0;
}

.field-label span {
  margin-left: 5px;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 600;
}

input[type="text"],
input[type="date"],
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

input[type="text"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
  border-color: var(--teal-600);
  outline: 3px solid rgba(20, 125, 116, .13);
}

.field-help {
  margin: 2px 0 8px;
  color: var(--muted);
  font-size: .74rem;
}

.form-actions {
  margin-top: 18px;
}

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 720px;
  margin-top: 18px;
  padding: 20px 24px;
  gap: 20px;
  border-color: #e8c9ca;
  box-shadow: none;
}

.danger-zone h2,
.danger-zone p {
  margin-bottom: 2px;
}

.danger-zone h2 {
  color: var(--red-700);
  font-size: 1rem;
}

.danger-zone p {
  color: var(--muted);
  font-size: .8rem;
}

.help-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.help-card {
  padding: 21px;
}

.help-card > span {
  display: grid;
  width: 30px;
  height: 30px;
  margin-bottom: 14px;
  place-items: center;
  border-radius: 50%;
  background: var(--teal-100);
  color: var(--teal-700);
  font-size: .73rem;
  font-weight: 900;
}

.help-card h2 {
  font-size: 1rem;
}

.help-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: .8rem;
}

.prose-section p,
.prose-section li {
  color: #415661;
}

.source-list {
  padding-left: 1.25em;
}

.source-list li + li {
  margin-top: 8px;
}

.app-dialog {
  width: min(520px, calc(100% - 24px));
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(8, 31, 43, .25);
}

.app-dialog::backdrop {
  background: rgba(12, 31, 41, .55);
  backdrop-filter: blur(2px);
}

.image-modal {
  width: min(1200px, calc(100% - 20px));
  max-width: none;
  height: min(92dvh, 920px);
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(8, 31, 43, .32);
}

.image-modal::backdrop {
  background: rgba(5, 20, 28, .76);
  backdrop-filter: blur(3px);
}

.image-modal[open],
.image-modal.is-fallback-open {
  display: flex;
}

.image-modal-content {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
}

.image-modal-heading {
  display: flex;
  min-height: 64px;
  padding: 10px 12px 10px 18px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.image-modal-heading h2 {
  margin: 0;
  font-size: clamp(.95rem, 2vw, 1.15rem);
}

.image-modal-viewport {
  min-height: 0;
  padding: 16px;
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  background: #f5f7f8;
}

.image-modal-image {
  width: auto;
  min-width: 100%;
  max-width: none;
  height: auto;
  margin: 0 auto;
  background: #fff;
}

.image-modal-caption {
  margin: 0;
  padding: 9px 18px 11px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .78rem;
  text-align: center;
}

.dialog-body {
  padding: clamp(20px, 4vw, 28px);
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 14px;
}

.dialog-heading h2,
.dialog-heading p {
  margin-bottom: 0;
}

.dialog-close {
  display: grid;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: var(--blue-50);
  color: var(--muted);
  font-size: 1.35rem;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 22px;
}

.warning-text {
  color: var(--red-700);
  font-size: .82rem;
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 120;
  display: grid;
  width: min(370px, calc(100% - 36px));
  gap: 8px;
  pointer-events: none;
}

.toast-region:not(:empty) {
  display: block;
  padding: 13px 16px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 11px;
  background: var(--navy-950);
  color: #fff;
  box-shadow: var(--shadow-md);
  font-size: .83rem;
}

.toast-region[data-kind="error"]:not(:empty) {
  background: #7d2f33;
}

.toast-region[data-kind="success"]:not(:empty) {
  background: #1f674e;
}

.toast {
  padding: 13px 16px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 11px;
  background: var(--navy-950);
  color: #fff;
  box-shadow: var(--shadow-md);
  font-size: .83rem;
}

.bottom-nav {
  display: none;
}

/* Standalone manual */
.manual-page {
  background: #edf2f4;
}

.manual-header {
  background: var(--navy-950);
  color: #fff;
}

.manual-header-inner,
.manual-main,
.manual-footer-inner {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
}

.manual-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 18px;
}

.manual-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.manual-brand img {
  width: 40px;
  height: 40px;
}

.manual-header .secondary-button {
  border-color: rgba(255, 255, 255, .35);
  background: transparent;
  color: #fff;
}

.manual-main {
  padding: 36px 0 70px;
}

.manual-hero {
  margin-bottom: 20px;
  padding: clamp(25px, 5vw, 44px);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  box-shadow: var(--shadow-md);
  color: #fff;
}

.manual-hero h1 {
  color: #fff;
}

.manual-hero p {
  max-width: 680px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, .8);
}

.manual-toc {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 20px;
  gap: 9px;
}

.manual-toc a {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--navy-800);
  font-size: .8rem;
  font-weight: 700;
  text-decoration: none;
}

.manual-section {
  margin: 14px 0;
  padding: clamp(20px, 4vw, 30px);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 20px;
}

.manual-section p,
.manual-section li,
.manual-section dd {
  color: #40555f;
}

.manual-steps {
  display: grid;
  gap: 12px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.manual-steps li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
}

.manual-steps li > span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--teal-100);
  color: var(--teal-700);
  font-size: .75rem;
  font-weight: 900;
}

.manual-steps strong {
  display: block;
  color: var(--navy-900);
}

.manual-steps p {
  margin: 2px 0 0;
  font-size: .86rem;
}

.manual-table-wrap {
  overflow-x: auto;
}

.manual-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
}

.manual-table th,
.manual-table td {
  padding: 11px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.manual-table th {
  background: var(--blue-50);
  color: var(--navy-800);
}

.manual-note {
  padding: 15px 17px;
  border-left: 4px solid var(--teal-600);
  border-radius: 8px;
  background: #f2faf8;
}

.manual-note.warning {
  border-left-color: var(--gold-700);
  background: #fffaf0;
}

.manual-faq {
  border-bottom: 1px solid var(--line);
}

.manual-faq summary {
  min-height: 48px;
  padding: 12px 0;
  color: var(--navy-900);
  font-weight: 800;
}

.manual-footer {
  padding: 22px 0 calc(22px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: .75rem;
}

@media (max-width: 1039px) {
  .app-layout {
    display: block;
  }

  .side-nav {
    display: none;
  }

  .main-content {
    padding-bottom: calc(100px + env(safe-area-inset-bottom));
  }

  .bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    min-height: calc(66px + env(safe-area-inset-bottom));
    padding: 5px max(8px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(8px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 -8px 24px rgba(20, 48, 63, .08);
    backdrop-filter: blur(14px);
  }

  .bottom-nav-item {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 56px;
    padding: 6px 3px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-size: .62rem;
    font-weight: 700;
  }

  .bottom-nav-item img {
    width: 22px;
    height: 22px;
    opacity: .7;
  }

  .bottom-nav-item.is-active {
    color: var(--teal-700);
  }

  .bottom-nav-item.is-active img {
    opacity: 1;
  }

  .bottom-nav-item.is-active::before {
    position: absolute;
    top: 1px;
    left: 50%;
    width: 28px;
    height: 3px;
    border-radius: 3px;
    background: var(--teal-600);
    content: "";
    transform: translateX(-50%);
  }

  .bottom-badge {
    position: absolute;
    top: 3px;
    left: calc(50% + 6px);
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    font-size: .55rem;
  }

  .toast-region {
    right: 12px;
    bottom: calc(80px + env(safe-area-inset-bottom));
    width: calc(100% - 24px);
  }
}

@media (max-width: 820px) {
  .progress-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .progress-card-overall {
    grid-column: 1 / -1;
  }

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

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

  .trace-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .header-inner {
    padding: 8px 14px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .brand-kicker {
    display: none;
  }

  .brand-name {
    font-size: .92rem;
  }

  .save-status span:last-child {
    display: none;
  }

  .save-status {
    min-width: 34px;
    min-height: 34px;
    padding: 0;
    justify-content: center;
  }

  .main-content {
    padding: 24px 14px calc(94px + env(safe-area-inset-bottom));
  }

  .official-subject-options {
    grid-template-columns: 1fr;
  }

  .desktop-only {
    display: none !important;
  }

  .home-heading {
    margin-bottom: 18px;
  }

  .page-heading {
    display: block;
  }

  .page-lead {
    font-size: .9rem;
  }

  .continue-card {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 25px 20px;
    gap: 22px;
    border-radius: 18px;
  }

  .continue-card .primary-button {
    width: 100%;
    min-width: 0;
  }

  .continue-details {
    display: grid;
    gap: 3px;
  }

  .continue-details span + span::before {
    content: none;
  }

  .exam-date-card {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    padding: 14px;
  }

  .exam-date-card .secondary-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .progress-card-grid,
  .route-card-grid,
  .subject-overview-grid,
  .backup-grid {
    grid-template-columns: 1fr;
  }

  .progress-card-overall {
    grid-column: auto;
  }

  .metric-note {
    text-align: left;
  }

  .route-card {
    min-height: 86px;
    padding: 14px;
  }

  .privacy-strip {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .privacy-strip .text-button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .subject-overview p {
    min-height: 0;
  }

  .subject-overview .secondary-button {
    width: 100%;
  }

  .lesson-row {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .unit-card,
  .review-card {
    grid-template-columns: 1fr;
  }

  .unit-card .button,
  .review-card .button {
    grid-column: 1;
    grid-row: auto;
    width: 100%;
    margin-top: 10px;
  }

  .lesson-state {
    grid-column: 2;
  }

  .question-card,
  .trace-panel,
  .feedback-card {
    border-radius: 16px;
  }

  .question-support-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .memory-point {
    flex-direction: column;
    gap: 5px;
  }

  .review-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .review-hero .primary-button {
    width: 100%;
  }

  .topic-progress-row {
    grid-template-columns: 1fr 44px;
    gap: 7px 12px;
  }

  .topic-progress-row .meter {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .danger-zone {
    align-items: stretch;
    flex-direction: column;
  }

  .danger-zone .danger-button,
  .form-actions > * {
    width: 100%;
  }

  .manual-header-inner {
    width: calc(100% - 24px);
  }

  .manual-header .secondary-button {
    min-height: 40px;
    padding: 7px 10px;
    font-size: .75rem;
  }

  .manual-main {
    width: calc(100% - 20px);
    padding-top: 14px;
  }

  .manual-toc {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 420px) {
  .header-help {
    display: none;
  }

  .question-support-row,
  .segmented-options {
    grid-template-columns: 1fr;
  }

  .summary-stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .summary-stat-grid article {
    padding: 14px;
  }

  .manual-toc {
    grid-template-columns: 1fr;
  }

  .bottom-nav-item {
    font-size: .58rem;
  }

  .question-figure,
  .choice-figure {
    padding: 8px;
  }

  .choice-figure img {
    max-height: 240px;
  }

  .image-modal {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
  }

  .image-modal-heading {
    min-height: 56px;
    padding: 7px 8px 7px 12px;
  }

  .image-modal-viewport {
    padding: 8px;
  }
}

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

@media print {
  .app-header,
  .side-nav,
  .bottom-nav,
  .text-button,
  .primary-button,
  .secondary-button,
  .danger-button {
    display: none !important;
  }

  body,
  .manual-page {
    background: #fff;
  }

  .main-content,
  .manual-main {
    width: 100%;
    max-width: none;
    padding: 0;
  }

  .manual-section,
  .content-section {
    break-inside: avoid;
    box-shadow: none;
  }
}
