:root {
  --paper: #f7f2e7;
  --paper-deep: #eee5d4;
  --card: #fffdf8;
  --card-soft: #fbf7ee;
  --ink: #183328;
  --ink-soft: #41564c;
  --muted: #6e7c73;
  --faint: #8b978e;
  --line: #dfd5c3;
  --line-strong: #c9bba3;
  --forest: #255c43;
  --forest-dark: #173f2f;
  --forest-soft: #e3ece4;
  --gold: #a97425;
  --gold-soft: #f4e6cb;
  --blue: #2e6379;
  --blue-soft: #e4eef1;
  --green: #426c4c;
  --green-soft: #e7efe3;
  --orange: #9b5a2c;
  --orange-soft: #f6e8da;
  --violet: #65527e;
  --violet-soft: #ece7f2;
  --rose: #94515b;
  --rose-soft: #f5e5e6;
  --danger: #9a3f45;
  --success: #2f6b48;
  --shadow-sm: 0 10px 28px -22px rgba(24, 51, 40, 0.5);
  --shadow-md: 0 22px 60px -36px rgba(24, 51, 40, 0.55);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", "PT Serif", serif;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(1100px 560px at 88% -12%, rgba(169, 116, 37, 0.12), transparent 62%),
    radial-gradient(900px 540px at -8% 16%, rgba(37, 92, 67, 0.09), transparent 60%),
    var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.4;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 31px,
    rgba(24, 51, 40, 0.035) 31px,
    rgba(24, 51, 40, 0.035) 32px
  );
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 70%);
}

a {
  color: var(--forest);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--forest-dark);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

svg {
  display: block;
}

::selection {
  background: rgba(37, 92, 67, 0.18);
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.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;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--forest-dark);
  color: #fff;
  transform: translateY(-160%);
  transition: transform 0.18s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid rgba(201, 187, 163, 0.65);
  background: rgba(247, 242, 231, 0.9);
  backdrop-filter: blur(14px);
}

.header-inner {
  width: min(1180px, 100% - 40px);
  min-height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  color: var(--ink);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--forest);
  color: #f7f2e7;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.brand-mark svg {
  width: 25px;
  height: 25px;
}

.brand-copy {
  display: grid;
  line-height: 1.22;
}

.brand-copy strong {
  font-family: var(--serif);
  font-size: 1.06rem;
  letter-spacing: 0.01em;
}

.brand-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.main-nav a {
  padding: 9px 14px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.16s ease, color 0.16s ease;
}

.main-nav a:hover {
  background: rgba(37, 92, 67, 0.07);
  color: var(--forest-dark);
}

.main-nav a.is-active {
  background: var(--forest);
  color: #fffdf8;
}

.profile-switch {
  display: inline-flex;
  flex-shrink: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.75);
}

.profile-switch button {
  padding: 7px 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.16s ease, color 0.16s ease;
}

.profile-switch button:hover {
  color: var(--forest-dark);
}

.profile-switch button.is-active {
  background: var(--forest-dark);
  color: #fffdf8;
  box-shadow: 0 4px 12px -8px rgba(23, 63, 47, 0.8);
}

/* Layout */

.site-main {
  width: min(1180px, 100% - 40px);
  margin: 0 auto;
  padding-bottom: 84px;
}

.loading-card {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 55vh;
  color: var(--muted);
}

.loading-mark {
  font-family: var(--serif);
  font-size: 2.2rem;
  color: var(--forest);
}

.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(238, 229, 212, 0.55);
}

.footer-inner {
  width: min(1180px, 100% - 40px);
  margin: 0 auto;
  padding: 34px 0 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 32px;
  color: var(--muted);
  font-size: 0.8rem;
}

.footer-brand {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 0.98rem;
}

.footer-inner p {
  margin: 0 0 6px;
  max-width: 62ch;
}

.footer-notes {
  justify-self: end;
  text-align: right;
}

.noscript {
  position: fixed;
  inset: auto 20px 20px;
  z-index: 100;
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--danger);
  color: #fff;
  text-align: center;
}

/* Shared type */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: currentColor;
  opacity: 0.65;
}

.hero h1,
.trainer-intro h1 {
  margin: 14px 0 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.5rem, 5.4vw, 4.25rem);
  line-height: 1.02;
  letter-spacing: -0.028em;
}

.hero h1 .accent {
  color: var(--forest);
  font-style: italic;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.section-head h2 {
  margin: 7px 0 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.section-head p {
  max-width: 56ch;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.section-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 650;
  font-size: 0.9rem;
  line-height: 1.25;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--forest);
  color: #fffdf8;
  box-shadow: 0 10px 24px -18px rgba(23, 63, 47, 0.9);
}

.btn-primary:hover {
  background: var(--forest-dark);
  color: #fffdf8;
}

.btn-secondary {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
}

.btn-secondary:hover {
  border-color: var(--forest);
  background: rgba(37, 92, 67, 0.05);
  color: var(--forest-dark);
}

.btn-ghost {
  min-height: 36px;
  padding: 7px 12px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.btn-ghost:hover {
  background: rgba(37, 92, 67, 0.07);
  color: var(--forest-dark);
}

.btn-small {
  min-height: 36px;
  padding: 7px 13px;
  font-size: 0.8rem;
}

.btn[disabled],
.btn.is-disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
  pointer-events: none;
}

/* Hero */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(300px, 0.68fr);
  gap: clamp(30px, 5vw, 70px);
  align-items: center;
  padding: clamp(42px, 7vw, 84px) 0 36px;
}

.hero-lead {
  max-width: 61ch;
  margin: 22px 0 0;
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.5vw, 1.1rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 36px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.hero-stats li {
  padding: 16px 16px 0 0;
}

.hero-stats li + li {
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.stat-value {
  display: block;
  font-family: var(--serif);
  font-size: clamp(1.5rem, 2.4vw, 1.9rem);
  line-height: 1;
  color: var(--forest-dark);
}

.stat-label {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 28px 26px 26px;
  border-radius: 26px;
  background:
    radial-gradient(220px 180px at 100% 0%, rgba(244, 230, 203, 0.2), transparent 70%),
    var(--forest-dark);
  color: #f7f2e7;
  box-shadow: var(--shadow-md);
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(247, 242, 231, 0.12);
  border-radius: 19px;
  pointer-events: none;
}

.hero-glyphs {
  position: absolute;
  right: 18px;
  top: 4px;
  color: rgba(247, 242, 231, 0.055);
  font-family: var(--serif);
  font-size: 7.4rem;
  line-height: 1;
  letter-spacing: -0.1em;
  pointer-events: none;
  user-select: none;
}

.hero-card-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #d9c8a8;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-card-top .pill {
  padding: 4px 9px;
  border: 1px solid rgba(217, 200, 168, 0.35);
  border-radius: 999px;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
}

.threshold-pair {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0 14px;
}

.threshold {
  display: flex;
  align-items: end;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(247, 242, 231, 0.16);
}

.threshold-number {
  font-family: var(--serif);
  font-size: 3.8rem;
  line-height: 0.82;
  letter-spacing: -0.06em;
}

.threshold.is-ten .threshold-number {
  color: #ead6ae;
}

.threshold-label {
  padding-bottom: 6px;
  color: rgba(247, 242, 231, 0.72);
  font-size: 0.74rem;
  line-height: 1.3;
}

.threshold-bar {
  position: relative;
  z-index: 1;
  height: 6px;
  margin: 12px 0 8px;
  border-radius: 999px;
  background: rgba(247, 242, 231, 0.14);
}

.threshold-bar span {
  display: block;
  width: 25%;
  height: 100%;
  border-radius: inherit;
  background: #d5b57e;
}

.threshold-mark {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 12px;
  border-radius: 2px;
  background: rgba(247, 242, 231, 0.48);
  transform: translateX(-50%);
}

.threshold-mark.is-ten {
  background: #ead6ae;
}

.hero-card p {
  position: relative;
  z-index: 1;
  margin: 12px 0 0;
  color: rgba(247, 242, 231, 0.72);
  font-size: 0.84rem;
  line-height: 1.55;
}

.hero-scale {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 20px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(247, 242, 231, 0.14);
}

.hero-scale span {
  padding: 8px 6px;
  background: rgba(23, 63, 47, 0.82);
  color: rgba(247, 242, 231, 0.74);
  text-align: center;
  font-size: 0.66rem;
  line-height: 1.25;
}

.hero-scale strong {
  display: block;
  color: #f7f2e7;
  font-size: 0.82rem;
  font-weight: 700;
}

.hero-scale span.is-goal {
  background: rgba(213, 181, 126, 0.18);
  color: #efdfc0;
}

.hero-scale span.is-goal strong {
  color: #fbf1dc;
}

/* Home overview */

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.mode-card {
  --tone: var(--forest);
  --tone-soft: var(--forest-soft);
  display: flex;
  flex-direction: column;
  min-height: 238px;
  padding: 19px 18px 16px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--tone);
  border-radius: var(--radius-md);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.mode-card:hover {
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.mode-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mode-card-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--tone);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.mode-card-tab .tone-dot {
  transform: none;
}

.mode-card h3 {
  margin: 11px 0 7px;
  font-family: var(--serif);
  font-size: 1.26rem;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.012em;
}

.mode-card p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.79rem;
  line-height: 1.5;
}

.mode-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  margin-top: auto;
  padding-top: 13px;
  border-top: 1px dashed var(--line);
  color: var(--tone);
  font-size: 0.66rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.mode-card-meta span:not(:last-child)::after {
  content: "·";
  margin: 0 8px;
  color: var(--faint);
  font-weight: 400;
}

/* Grade goals */

.goal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.goal-card {
  --goal-tone: var(--green);
  --goal-soft: var(--green-soft);
  display: flex;
  flex-direction: column;
  padding: 24px 23px 20px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--goal-tone);
  border-radius: var(--radius-md);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.goal-card.is-ten {
  --goal-tone: var(--gold);
  --goal-soft: var(--gold-soft);
}

.goal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.goal-kicker {
  display: block;
  color: var(--goal-tone);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.goal-card h3 {
  margin: 7px 0 0;
  font-family: var(--serif);
  font-size: 1.52rem;
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.015em;
}

.goal-badge {
  display: grid;
  flex: none;
  justify-items: center;
  min-width: 70px;
  padding: 9px 10px 7px;
  border-radius: 12px;
  background: var(--goal-soft);
  color: var(--goal-tone);
}

.goal-badge strong {
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 400;
  line-height: 0.85;
}

.goal-badge span {
  margin-top: 3px;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.goal-lead {
  margin: 15px 0 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.55;
}

.goal-block {
  margin-top: 18px;
}

.goal-block-title {
  display: block;
  color: var(--faint);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.goal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.goal-chip {
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card-soft);
  color: var(--ink-soft);
  font-size: 0.69rem;
  line-height: 1.4;
  text-decoration: none;
}

a.goal-chip:hover {
  border-color: var(--goal-tone);
  background: var(--goal-soft);
  color: var(--goal-tone);
}

.goal-chip.is-static {
  color: var(--muted);
}

.goal-scope {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.goal-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.goal-facts dt {
  color: var(--faint);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.goal-facts dd {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
}

.goal-warning {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--goal-tone);
  border-radius: 0 9px 9px 0;
  background: var(--goal-soft);
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.5;
}

.goal-tip {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.goal-tip strong {
  color: var(--goal-tone);
}

.goal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 18px;
}

.goal-footnote {
  margin: 14px 0 0;
  color: var(--faint);
  font-size: 0.7rem;
  line-height: 1.5;
}

/* Sections and panels */

.section-block {
  margin-top: clamp(48px, 7vw, 74px);
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 318px;
  gap: 20px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.map-panel {
  overflow: hidden;
}

.map-table-wrap {
  overflow-x: auto;
  scrollbar-width: thin;
}

.map-scroll-hint {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.7rem;
}

.map-scroll-hint span {
  color: var(--forest);
  font-size: 0.9rem;
}

.map-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.86rem;
}

.map-table th {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.map-table th:first-child {
  width: 86px;
}

.map-table th:nth-child(2) {
  width: 78px;
}

.map-table td {
  padding: 13px 12px;
  border-top: 1px solid rgba(223, 213, 195, 0.62);
  vertical-align: top;
}

.map-table tbody tr {
  transition: background 0.16s ease;
}

.map-table tbody tr:hover {
  background: rgba(37, 92, 67, 0.035);
}

.map-row.is-planned {
  background: linear-gradient(90deg, rgba(37, 92, 67, 0.075), rgba(37, 92, 67, 0.018) 62%, transparent);
}

.map-row.is-planned td:first-child {
  box-shadow: inset 3px 0 0 var(--forest);
}

.map-check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.map-check input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--forest);
  cursor: pointer;
}

.map-num {
  font-family: var(--serif);
  font-size: 1.02rem;
}

.map-points {
  color: var(--ink-soft);
  font-size: 0.8rem;
  white-space: nowrap;
}

.map-points small {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 0.62rem;
}

.map-topic {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.82rem;
  line-height: 1.45;
  text-align: left;
  text-decoration: none;
}

.map-topic span:last-child {
  overflow-wrap: break-word;
}

.map-topic:hover {
  color: var(--forest-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.map-topic.is-static {
  cursor: default;
  color: var(--muted);
}

.map-topic.is-static:hover {
  color: var(--muted);
  text-decoration: none;
}

.tone-dot {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tone, var(--forest));
  transform: translateY(-2px);
}

.map-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.7rem;
}

.map-caption span {
  max-width: 60ch;
}

/* Planner */

.planner-card {
  position: sticky;
  top: 96px;
  padding: 22px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(160px 130px at 100% 0%, rgba(169, 116, 37, 0.12), transparent 65%),
    var(--forest-dark);
  color: #f7f2e7;
  box-shadow: var(--shadow-md);
}

.planner-card .eyebrow {
  color: #d5b57e;
  font-size: 0.62rem;
}

.planner-card h2 {
  margin: 8px 0 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.6rem;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.planner-score {
  display: flex;
  align-items: end;
  gap: 8px;
  margin-top: 18px;
}

.planner-score strong {
  font-family: var(--serif);
  font-size: 3.2rem;
  font-weight: 400;
  line-height: 0.85;
  letter-spacing: -0.04em;
}

.planner-score span {
  padding-bottom: 4px;
  color: rgba(247, 242, 231, 0.6);
  font-size: 0.75rem;
}

.planner-bar {
  position: relative;
  height: 5px;
  margin-top: 13px;
  border-radius: 999px;
  background: rgba(247, 242, 231, 0.13);
}

.planner-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #d5b57e;
  transition: width 0.28s ease;
}

.planner-bar-mark {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 11px;
  border-radius: 2px;
  background: rgba(247, 242, 231, 0.5);
  transform: translateX(-50%);
}

.planner-bar-mark.is-ten {
  background: #ead6ae;
}

.planner-status {
  margin: 10px 0 0;
  color: rgba(247, 242, 231, 0.72);
  font-size: 0.78rem;
  line-height: 1.45;
}

.planner-status.is-reached {
  color: #ead6ae;
}

.planner-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 26px;
  margin-top: 14px;
}

.planner-chip {
  padding: 3px 8px;
  border: 1px solid rgba(247, 242, 231, 0.2);
  border-radius: 999px;
  color: rgba(247, 242, 231, 0.78);
  font-size: 0.65rem;
  line-height: 1.4;
}

.planner-chip.is-empty {
  border-color: transparent;
  color: rgba(247, 242, 231, 0.42);
  padding-left: 0;
}

.planner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(247, 242, 231, 0.14);
}

.planner-actions .btn {
  min-height: 32px;
  padding: 6px 11px;
  border-color: rgba(247, 242, 231, 0.26);
  background: transparent;
  color: #f7f2e7;
  font-size: 0.7rem;
}

.planner-actions .btn:hover {
  background: rgba(247, 242, 231, 0.09);
}

.grade-mini {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin: 15px 0 0;
}

.grade-mini span {
  padding: 5px 4px;
  border-radius: 6px;
  background: rgba(247, 242, 231, 0.065);
  color: rgba(247, 242, 231, 0.46);
  text-align: center;
  font-size: 0.6rem;
  line-height: 1.25;
}

.grade-mini span.is-goal {
  background: rgba(213, 181, 126, 0.1);
  box-shadow: inset 0 0 0 1px rgba(213, 181, 126, 0.32);
  color: rgba(247, 242, 231, 0.82);
}

.grade-mini span.is-reached {
  background: rgba(213, 181, 126, 0.24);
  box-shadow: inset 0 0 0 1px rgba(234, 214, 174, 0.55);
  color: #ead6ae;
}

.grade-mini strong {
  display: block;
  font-size: 0.72rem;
}

.planner-note {
  margin: 13px 0 0;
  color: rgba(247, 242, 231, 0.42);
  font-size: 0.64rem;
  line-height: 1.4;
}

/* Topic tones and shared theory pieces */

.tone-blue {
  --tone: var(--blue);
  --tone-soft: var(--blue-soft);
}

.tone-green {
  --tone: var(--green);
  --tone-soft: var(--green-soft);
}

.tone-orange {
  --tone: var(--orange);
  --tone-soft: var(--orange-soft);
}

.tone-violet {
  --tone: var(--violet);
  --tone-soft: var(--violet-soft);
}

.tone-rose {
  --tone: var(--rose);
  --tone-soft: var(--rose-soft);
}

.family-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--tone);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.family-kicker .sep {
  opacity: 0.35;
}

.variant-list {
  display: grid;
  gap: 7px;
  margin: 0 0 17px;
  padding: 0;
  list-style: none;
}

.variant-list li {
  padding-left: 12px;
  border-left: 2px solid var(--line-strong);
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.5;
}

.variant-note {
  margin: -6px 0 12px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.variant-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.variant-list.is-links {
  gap: 6px;
  max-height: 430px;
  overflow: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

.variant-list.is-links li {
  padding-left: 0;
  border-left: 0;
}

.variant-link {
  display: grid;
  gap: 4px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.55);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.variant-link:hover {
  border-color: var(--tone);
  background: var(--card);
}

.variant-link:focus-visible {
  outline: 2px solid var(--tone);
  outline-offset: 2px;
}

.variant-link-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.variant-link strong {
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
}

.know-item {
  min-width: 0;
  padding: 13px 14px;
  border-radius: 11px;
  background: var(--tone-soft);
}

.know-item h4 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
}

.rule-formula {
  margin: 7px 0;
  overflow-x: auto;
  color: var(--ink);
  font-size: 0.92rem;
}

.rule-formula mjx-container[display="true"] {
  margin: 0.2em 0 !important;
}

.know-item p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.79rem;
  line-height: 1.55;
}

.trap {
  margin-top: 13px;
  padding: 11px 13px;
  border-left: 3px solid var(--rose);
  border-radius: 0 9px 9px 0;
  background: rgba(148, 81, 91, 0.07);
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.55;
}

.trap strong {
  color: var(--rose);
}

.empty-state {
  padding: 42px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

/* Trainer intro */

.trainer-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 36px;
  align-items: end;
  padding: clamp(38px, 6vw, 66px) 0 26px;
}

.trainer-intro h1 {
  font-size: clamp(2.2rem, 4.4vw, 3.4rem);
}

.trainer-intro p {
  max-width: 62ch;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.trainer-progress-card {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.progress-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--faint);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.progress-number {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 9px;
}

.progress-number strong {
  font-family: var(--serif);
  font-size: 2.5rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.04em;
}

.progress-number span {
  color: var(--muted);
  font-size: 0.8rem;
}

.progress-bar {
  height: 5px;
  margin: 12px 0 9px;
  border-radius: 999px;
  background: var(--paper-deep);
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--forest);
  transition: width 0.3s ease;
}

.progress-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.grade-targets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.grade-target {
  --target-tone: var(--green);
  --target-soft: var(--green-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 8px;
  border-radius: 9px;
  background: var(--card-soft);
}

.grade-target.is-ten {
  --target-tone: var(--gold);
  --target-soft: var(--gold-soft);
}

.grade-target.is-reached {
  background: var(--target-soft);
}

.grade-target-grade {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--target-soft);
  color: var(--target-tone);
  font-family: var(--serif);
  font-size: 0.98rem;
  line-height: 1;
}

.grade-target.is-reached .grade-target-grade {
  background: var(--target-tone);
  color: #fffdf8;
}

.grade-target-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.grade-target-copy strong {
  color: var(--target-tone);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.grade-target-copy small {
  color: var(--muted);
  font-size: 0.61rem;
  line-height: 1.25;
}

/* Trainer layout */

.trainer-shell {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.task-sidebar {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 118px);
  padding: 0 14px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 253, 248, 0.82);
  box-shadow: var(--shadow-sm);
  overflow: auto;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 5px 11px;
}

.sidebar-controls {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 -14px 4px;
  padding: 14px 14px 0;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.sidebar-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.04rem;
  font-weight: 400;
}

.sidebar-head span {
  color: var(--faint);
  font-size: 0.72rem;
}

.task-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.task-group {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 5px 3px;
  color: var(--faint);
  font-size: 0.59rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.task-group:first-child {
  padding-top: 2px;
}

.task-group small {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0;
}

.task-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 9px;
  border-radius: 10px;
  color: var(--ink-soft);
  text-decoration: none;
  transition: background 0.14s ease, color 0.14s ease;
}

.task-nav:hover {
  background: rgba(37, 92, 67, 0.06);
  color: var(--ink);
}

.task-nav.is-current {
  background: var(--forest-dark);
  color: #fffdf8;
}

.task-num {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 8px;
  background: var(--paper-deep);
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 0.8rem;
  line-height: 1;
}

.task-nav.is-current .task-num {
  background: rgba(247, 242, 231, 0.14);
  color: #fffdf8;
}

.task-nav.is-solved .task-num {
  background: var(--forest-soft);
  color: var(--forest);
}

.task-nav.is-current.is-solved .task-num {
  background: rgba(213, 181, 126, 0.22);
  color: #ead6ae;
}

.task-nav-body {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}

.task-nav-body strong {
  overflow: hidden;
  font-size: 0.76rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-nav-body small {
  margin-top: 2px;
  color: var(--faint);
  font-size: 0.62rem;
}

.task-nav.is-current .task-nav-body small {
  color: rgba(247, 242, 231, 0.55);
}

.nav-dot {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--forest);
  opacity: 0;
}

.task-nav.is-solved .nav-dot {
  opacity: 1;
}

.task-nav.is-current .nav-dot {
  background: #d5b57e;
}

.sidebar-note {
  margin: 12px 5px 3px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.63rem;
  line-height: 1.45;
}

/* Task panel */

.task-panel {
  --tone: var(--forest);
  --tone-soft: var(--forest-soft);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.task-head {
  padding: 25px 28px 22px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(380px 180px at 100% 0%, var(--tone-soft), transparent 74%),
    linear-gradient(145deg, rgba(255, 253, 248, 0.8), rgba(251, 247, 238, 0.4));
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--faint);
  font-size: 0.66rem;
  letter-spacing: 0.02em;
}

.task-meta .meta-tag {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.6);
}

.task-meta .meta-points {
  border-color: color-mix(in srgb, var(--tone) 28%, var(--line));
  color: var(--tone);
  font-weight: 700;
}

.task-title {
  margin: 12px 0 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.55rem, 2.7vw, 2rem);
  line-height: 1.12;
  letter-spacing: -0.018em;
}

.task-section {
  padding: 24px 28px;
}

.task-section + .task-section {
  border-top: 1px solid var(--line);
}

.task-statement {
  font-size: 0.96rem;
  line-height: 1.72;
}

.task-statement mjx-container[display="true"] {
  margin: 0.75em 0 !important;
}

.task-figure {
  display: flex;
  justify-content: center;
  max-width: 560px;
  margin: 18px auto 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}

.task-figure img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 340px;
}

.example-figure {
  margin-top: 16px;
}

.task-sub {
  display: inline-block;
  margin-top: 7px;
  color: var(--faint);
  font-size: 0.78rem;
}

.task-instruction {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 0;
  padding-top: 13px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.76rem;
}

.task-instruction::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--tone);
}

/* Rules */

.rules-panel {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card-soft);
}

.rules-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 650;
  user-select: none;
}

.rules-summary::-webkit-details-marker {
  display: none;
}

.rules-summary::after {
  content: "";
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-right: 1.7px solid var(--faint);
  border-bottom: 1.7px solid var(--faint);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.rules-summary:hover::after {
  border-color: var(--ink);
}

.rules-panel[open] .rules-summary::after {
  border-color: var(--tone, var(--forest));
  transform: translateY(1px) rotate(225deg);
}

.rule-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--tone-soft);
  color: var(--tone);
  font-size: 0.62rem;
  font-weight: 700;
}

.rules-body {
  padding: 0 14px 14px;
}

.rules-source {
  margin: 0 2px 12px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

.rules-source a {
  color: var(--tone, var(--forest));
  font-weight: 650;
}

.rule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 8px;
}

.rule-grid.is-theory {
  grid-template-columns: minmax(0, 1fr);
}

.rule-item {
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}

.rule-item .rule-title {
  margin: 0;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
}

.rule-item .rule-formula {
  margin: 6px 0 0;
  font-size: 0.82rem;
}

.rule-item .rule-text {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.73rem;
  line-height: 1.45;
}

/* Hints */

.hints-section {
  border: 1px solid rgba(169, 116, 37, 0.26);
  border-radius: 14px;
  background: linear-gradient(150deg, rgba(244, 230, 203, 0.5), rgba(255, 253, 248, 0.3));
}

.hints-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 17px;
}

.hints-head h3 {
  flex-shrink: 0;
  margin: 0;
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 400;
}

.hint-counter {
  flex-shrink: 0;
  color: var(--gold);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hints-head .btn {
  flex-shrink: 0;
  margin-left: auto;
}

.hint-list {
  display: grid;
  gap: 8px;
  padding: 0 17px;
}

.hint-list:not(:empty) {
  padding-bottom: 14px;
}

.hint-item {
  display: flex;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 9px;
  background: rgba(255, 253, 248, 0.82);
  animation: hint-in 0.22s ease;
}

.hint-index {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--gold);
  color: #fffdf8;
  font-size: 0.64rem;
  font-weight: 700;
}

.hint-body {
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.58;
}

@keyframes hint-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hint-note {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--faint);
  font-size: 0.68rem;
  line-height: 1.4;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Answer form */

.answer-form {
  margin-top: 18px;
}

.answer-fields {
  display: grid;
  gap: 12px;
}

.answer-fields.is-multiple {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 6px;
}

.field-label {
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.answer-input {
  width: 100%;
  height: 50px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--card-soft);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.98rem;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.answer-input::placeholder {
  color: #a6afa8;
  font-family: var(--sans);
  font-size: 0.82rem;
}

.answer-input:focus {
  border-color: var(--forest);
  outline: none;
  background: var(--card);
  box-shadow: 0 0 0 3px rgba(37, 92, 67, 0.1);
}

.answer-input.is-wrong {
  border-color: var(--danger);
  background: rgba(154, 63, 69, 0.05);
  box-shadow: 0 0 0 3px rgba(154, 63, 69, 0.08);
}

.answer-input.is-right {
  border-color: var(--success);
  background: rgba(47, 107, 72, 0.04);
}

.answer-input[readonly] {
  opacity: 0.8;
}

.answer-helper {
  margin: 9px 0 0;
  color: var(--faint);
  font-size: 0.68rem;
}

.answer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.feedback {
  margin-top: 12px;
  padding: 11px 14px;
  border-radius: 9px;
  font-size: 0.8rem;
  line-height: 1.55;
}

.feedback.is-error {
  border: 1px solid rgba(154, 63, 69, 0.26);
  background: rgba(154, 63, 69, 0.06);
  color: #743238;
}

.feedback.is-success {
  border: 1px solid rgba(47, 107, 72, 0.26);
  background: rgba(47, 107, 72, 0.07);
  color: #24583a;
}

.success-answer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 9px;
  margin-top: 7px;
  color: var(--ink);
}

.success-label {
  color: var(--success);
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.solution-section {
  padding: 24px 28px 28px;
  border-top: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(238, 229, 212, 0.35), rgba(255, 253, 248, 0.2));
}

.solution-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.solution-head h3 {
  margin: 5px 0 0;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 400;
}

.solution-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.solution-steps li {
  position: relative;
  padding: 0 0 14px 34px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.65;
  counter-increment: step;
}

.solution-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 0.68rem;
}

.solution-steps li:last-child {
  padding-bottom: 0;
}

.solution-steps mjx-container[display="true"] {
  margin: 0.55em 0 !important;
}

.solution-answer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding: 14px 17px;
  border-radius: 11px;
  background: var(--forest-dark);
  color: #f7f2e7;
}

.solution-answer span {
  color: #d5b57e;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.solution-answer div {
  color: #fffdf8;
  font-size: 1.1rem;
}

.solution-answer mjx-container {
  color: #fffdf8;
}

.solution-note {
  margin: 13px 0 0;
  color: var(--faint);
  font-size: 0.72rem;
}

/* Pager */

.task-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 18px 28px 24px;
  border-top: 1px solid var(--line);
}

.pager-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-soft);
  color: var(--ink-soft);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.pager-link:hover {
  border-color: var(--forest);
  background: var(--card);
  color: var(--ink);
}

.pager-link.is-next {
  flex-direction: row-reverse;
  text-align: right;
}

.pager-link .pager-arrow {
  flex-shrink: 0;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 1.15rem;
}

.pager-copy {
  display: grid;
  min-width: 0;
}

.pager-label {
  color: var(--faint);
  font-size: 0.61rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pager-title {
  overflow: hidden;
  font-size: 0.76rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pager-link.is-empty {
  visibility: hidden;
  pointer-events: none;
}

/* MathJax */

mjx-container {
  color: inherit;
}

mjx-container svg {
  display: inline-block;
}

/* Keep MathJax's screen-reader MathML from widening the page */
mjx-container mjx-assistive-mml {
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

mjx-container[jax="SVG"][display="true"] {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0;
}

/* Responsive */

/* Topics and tickets */

.mode-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 38px;
  align-items: end;
  padding: clamp(38px, 6vw, 66px) 0 30px;
}

.mode-hero-copy {
  max-width: 70ch;
}

.mode-hero h1 {
  margin: 10px 0 0;
  font-family: var(--serif);
  font-size: clamp(2.2rem, 4.6vw, 3.5rem);
  font-weight: 400;
  line-height: 1.06;
  letter-spacing: -0.03em;
}

.mode-hero h1 .accent {
  color: var(--forest);
  font-style: italic;
}

.mode-hero p {
  max-width: 62ch;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.mode-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.topic-index {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.topic-index-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.topic-index-chip:hover {
  border-color: var(--tone);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.topic-index-chip .tone-dot {
  transform: none;
}

.topic-index-chip strong {
  color: var(--tone);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

button.topic-index-chip {
  cursor: pointer;
  font-family: var(--sans);
}

/* Topic theory */

.theory-roadmap-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 14px;
  padding: 0;
  list-style: none;
}

.theory-roadmap-list li {
  display: flex;
  align-items: center;
  gap: 11px;
}

.theory-roadmap-list li > span {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--forest-soft);
  color: var(--forest);
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.theory-roadmap-list div {
  display: grid;
  gap: 1px;
}

.theory-roadmap-list strong {
  font-size: 0.83rem;
}

.theory-roadmap-list small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.theory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 12px;
}

.theory-goal-bar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-top: 20px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.72);
}

.theory-goal-switch {
  display: inline-flex;
  flex: none;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
}

.theory-goal-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px 7px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease;
}

.theory-goal-btn::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--forest);
}

.theory-goal-btn.is-five::before {
  background: var(--green);
}

.theory-goal-btn span {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--card-soft);
  color: var(--muted);
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
}

.theory-goal-btn:hover {
  color: var(--forest-dark);
}

.theory-goal-btn.is-active {
  background: var(--forest-dark);
  color: #fffdf8;
}

.theory-goal-btn.is-five.is-active {
  background: var(--green);
}

.theory-goal-btn.is-active::before {
  background: currentColor;
}

.theory-goal-btn.is-active span {
  background: rgba(255, 253, 248, 0.18);
  color: #fffdf8;
}

.theory-goal-note {
  width: 100%;
  margin: 0;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.theory-goal-note strong {
  color: var(--ink);
}

.theory-goal-note.is-five strong {
  color: var(--green);
}

.theory-goal-hint {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.theory-goal-hint-label {
  color: var(--ink-soft);
  font-weight: 600;
}

@media (max-width: 560px) {
  .theory-goal-bar {
    align-items: stretch;
    gap: 9px;
    padding: 8px;
  }

  .theory-goal-switch {
    width: 100%;
    padding: 3px;
  }

  .theory-goal-btn {
    flex: 1;
    justify-content: center;
    gap: 5px;
    padding: 6px;
    font-size: 0.72rem;
  }

  .theory-goal-btn span {
    min-width: 18px;
    height: 18px;
    font-size: 0.62rem;
  }
}

.theory-card {
  --tone: var(--forest);
  --tone-soft: var(--forest-soft);
  display: flex;
  flex-direction: column;
  padding: 18px 18px 15px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--tone);
  border-radius: var(--radius-md);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.theory-card:hover {
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.theory-card-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.theory-card-top .family-kicker {
  max-width: calc(100% - 24px);
}

.theory-card-title {
  margin: 9px 0 6px;
  font-family: var(--serif);
  font-size: 1.18rem;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.012em;
}

.theory-card-desc {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.5;
}

.theory-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: auto;
  padding-top: 14px;
  color: var(--tone);
  font-size: 0.66rem;
  font-weight: 600;
}

.theory-card-footer {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
}

.theory-card-footer .mini-progress {
  flex: 1;
}

.theory-card-footer small {
  color: var(--faint);
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.back-link {
  display: flex;
  width: fit-content;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration: none;
}

.back-link:hover {
  color: var(--forest);
}

.theory-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 20px;
  align-items: start;
  margin-top: 22px;
}

.theory-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.theory-panel,
.theory-example {
  padding: clamp(20px, 3vw, 30px);
}

.theory-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.theory-section-head h2 {
  margin: 6px 0 0;
  font-family: var(--serif);
  font-size: clamp(1.45rem, 2.5vw, 1.8rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.theory-section-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.theory-rule-list {
  display: grid;
}

.theory-rule {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 14px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.theory-rule:first-child {
  padding-top: 0;
  border-top: 0;
}

.theory-rule:last-child {
  padding-bottom: 0;
}

.theory-rule-num {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--tone-soft);
  color: var(--tone);
  font-size: 0.66rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.theory-rule h3 {
  margin: 3px 0 0;
  font-size: 0.92rem;
  font-weight: 700;
}

.theory-rule p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.6;
}

.theory-rule .rule-formula {
  margin: 9px 0 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card-soft);
}

.theory-rule-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 4px 20px;
}

.theory-rule-main {
  flex: 1 1 410px;
  min-width: 0;
}

.theory-rule-figure {
  flex: 0 0 220px;
  width: 220px;
  max-width: 100%;
  margin: 9px 0 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--card);
}

.theory-rule-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.example-statement {
  padding: 17px 19px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--tone, var(--forest));
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--card-soft);
  font-size: 0.95rem;
}

.example-statement > :first-child {
  margin-top: 0;
}

.example-statement > :last-child {
  margin-bottom: 0;
}

.example-note {
  margin: 16px 0 -4px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.example-steps {
  margin-top: 20px;
}

.example-answer {
  margin-top: 18px;
}


.num-hit {
  color: var(--num-color, var(--tone, var(--forest)));
  fill: currentColor;
}

.letter-hit {
  color: var(--letter-color, var(--tone, var(--forest)));
  fill: currentColor;
}

.num-pill {
  fill: currentColor;
  opacity: 0.15;
  pointer-events: none;
}

.num-text-hit {
  margin: 0 -0.02em;
  padding: 0 0.1em;
  border-radius: 4px;
  color: var(--num-color, var(--tone, var(--forest)));
  background-color: color-mix(in srgb, var(--num-color, var(--tone, var(--forest))) 12%, transparent);
}

.example-answer .num-hit {
  color: color-mix(in srgb, var(--num-color, var(--tone, var(--forest))) 45%, #fffdf8);
}

.example-answer .letter-hit {
  color: color-mix(in srgb, var(--letter-color, var(--tone, var(--forest))) 45%, #fffdf8);
}

.solution-answer .num-hit {
  color: color-mix(in srgb, var(--num-color, var(--tone, var(--forest))) 45%, #fffdf8);
}

.solution-answer .letter-hit {
  color: color-mix(in srgb, var(--letter-color, var(--tone, var(--forest))) 45%, #fffdf8);
}

.solution-answer .num-text-hit {
  background-color: rgba(255, 253, 248, 0.14);
}

.example-answer .num-text-hit {
  background-color: rgba(255, 253, 248, 0.14);
}

@media (max-width: 640px) {
  .theory-rule-figure {
    flex: 0 0 100%;
    width: 100%;
    max-width: 320px;
  }

  .theory-example mjx-container:not([display="true"]) {
    display: inline-block;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
  }

  .theory-example .example-step mjx-container:not([display="true"]),
  .theory-example .example-statement mjx-container:not([display="true"]) {
    max-width: calc(100% - 0.6em);
  }

  .theory-example mjx-container.is-scrollable {
    border-radius: 3px;
    box-shadow: inset -18px 0 14px -14px rgba(24, 51, 40, 0.55);
  }

  .theory-example mjx-container.is-scrollable.has-scroll-right {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent);
  }

  .theory-example mjx-container.is-scrollable.has-scroll-left {
    -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 20px), transparent);
    mask-image: linear-gradient(to left, #000 calc(100% - 20px), transparent);
  }

  .theory-example mjx-container.is-scrollable.has-scroll-left.has-scroll-right {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 20px, #000 calc(100% - 20px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 20px, #000 calc(100% - 20px), transparent);
  }
}

@media print {
  .theory-example mjx-container.is-scrollable {
    -webkit-mask-image: none;
    mask-image: none;
  }

  .num-hit,
  .num-text-hit,
  .example-answer .num-hit,
  .example-answer .num-text-hit,
  .solution-answer .num-hit,
  .solution-answer .num-text-hit {
    color: var(--num-color, var(--tone, var(--forest)));
  }

  .letter-hit,
  .example-answer .letter-hit,
  .solution-answer .letter-hit {
    color: var(--letter-color, var(--tone, var(--forest)));
  }

  .num-text-hit,
  .example-answer .num-text-hit {
    background: transparent;
  }
}

.theory-sidebar {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 16px;
}

.theory-variants-panel {
  padding: 20px 22px;
}

.theory-variants-panel h2 {
  margin: 6px 0 14px;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.2;
}

.theory-variants-panel .variant-list {
  margin-bottom: 0;
}

.theory-sidebar .trap {
  margin-top: 0;
}

.theory-finish {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: clamp(28px, 4vw, 44px);
  padding: clamp(22px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(420px 200px at 100% 0, rgba(169, 116, 37, 0.13), transparent 65%),
    var(--card);
  box-shadow: var(--shadow-sm);
}

.theory-finish h2 {
  margin: 6px 0 0;
  font-family: var(--serif);
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.theory-finish p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.mode-progress-card {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.marathon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 12px;
}

.marathon-card {
  --tone: var(--forest);
  --tone-soft: var(--forest-soft);
  display: flex;
  flex-direction: column;
  min-height: 198px;
  padding: 18px 17px 15px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--tone);
  border-radius: var(--radius-md);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.marathon-card:hover {
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.marathon-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--tone);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.marathon-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.marathon-count {
  display: grid;
  place-items: center;
  min-width: 25px;
  height: 25px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--tone-soft);
  color: var(--tone);
  font-size: 0.68rem;
}

.marathon-card h3 {
  margin: 12px 0 6px;
  font-family: var(--serif);
  font-size: 1.22rem;
  font-weight: 400;
}

.marathon-card p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.mini-progress {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: var(--paper-deep);
  overflow: hidden;
}

.mini-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--tone, var(--forest));
  transition: width 0.3s ease;
}

.marathon-card .mini-progress {
  margin-top: auto;
}

.marathon-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 9px;
  color: var(--faint);
  font-size: 0.66rem;
}

.marathon-arrow {
  color: var(--tone);
  font-size: 1rem;
  line-height: 1;
}

.topic-groups {
  display: grid;
  gap: 14px;
}

.topic-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 253, 248, 0.78);
  box-shadow: var(--shadow-sm);
}

.topic-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--card-soft);
  color: var(--faint);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.topic-group-head small {
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.topic-rows {
  display: grid;
}

.topic-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 20px;
  align-items: center;
  gap: 16px;
  padding: 13px 16px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  transition: background 0.14s ease;
}

.topic-row:first-child {
  border-top: 0;
}

.topic-row:hover {
  background: rgba(37, 92, 67, 0.045);
  color: var(--ink);
}

.topic-row-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.topic-row-main strong {
  font-size: 0.9rem;
  font-weight: 600;
}

.topic-row-main small {
  color: var(--faint);
  font-size: 0.7rem;
}

.topic-row-progress {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--faint);
  font-size: 0.68rem;
}

.topic-row-progress .mini-progress {
  width: 74px;
}

.topic-row-progress small {
  min-width: 30px;
  text-align: right;
  font-size: 0.66rem;
}

.topic-row-arrow {
  color: var(--forest);
  text-align: right;
  font-size: 1rem;
}

.topic-row.is-complete .topic-row-arrow {
  color: var(--gold);
}

.ticket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.ticket-card {
  display: flex;
  flex-direction: column;
  min-height: 230px;
  padding: 20px 21px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.ticket-card.is-official {
  border-color: rgba(169, 116, 37, 0.45);
  background: linear-gradient(160deg, rgba(244, 230, 203, 0.55), var(--card) 55%);
}

.ticket-card.is-complete {
  border-color: rgba(37, 92, 67, 0.4);
}

.ticket-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ticket-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--paper-deep);
  color: var(--ink-soft);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ticket-card.is-official .ticket-badge {
  background: var(--gold-soft);
  color: var(--gold);
}

.ticket-badge.is-random {
  background: var(--blue-soft);
  color: var(--blue);
}

.ticket-tag {
  color: var(--faint);
  font-size: 0.64rem;
}

.ticket-card h3 {
  margin: 13px 0 6px;
  font-family: var(--serif);
  font-size: 1.34rem;
  font-weight: 400;
  line-height: 1.15;
}

.ticket-desc {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.76rem;
}

.ticket-card .progress-bar {
  margin-top: auto;
}

.ticket-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0 12px;
  color: var(--faint);
  font-size: 0.66rem;
}

.ticket-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.ticket-note {
  margin: 0;
  color: var(--faint);
  font-size: 0.68rem;
  line-height: 1.4;
}

.ticket-footer .btn {
  flex-shrink: 0;
}

.ticket-card.is-random {
  border-style: dashed;
  background: rgba(251, 247, 238, 0.6);
}

.ticket-card.is-random .ticket-note {
  margin-bottom: 14px;
}

.ticket-card.is-random .btn {
  align-self: flex-start;
  margin-top: auto;
}

.ticket-disclaimer {
  margin: 14px 0 0;
  color: var(--faint);
  font-size: 0.7rem;
}

.session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.session-hint {
  margin: 14px 0 0;
  padding: 10px 13px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.55);
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.session-hint a {
  font-weight: 600;
}

.sidebar-session-note {
  margin: 0;
  padding: 0 5px 10px;
  color: var(--faint);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.session-complete {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin: 0 0 18px;
  padding: 20px 22px;
  border: 1px solid rgba(47, 107, 72, 0.35);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--forest-soft), var(--card));
  box-shadow: var(--shadow-sm);
}

.session-complete-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--forest);
  color: #fffdf8;
  font-size: 1.2rem;
}

.session-complete-copy h2 {
  margin: 2px 0 4px;
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 400;
}

.session-complete-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.session-complete-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

@media (max-width: 960px) {
  .mode-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding-top: 38px;
  }

  .mode-progress-card {
    max-width: 420px;
  }

  .theory-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .theory-sidebar {
    position: static;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    align-items: start;
  }

  .variant-list.is-links {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}

@media (max-width: 760px) {
  .marathon-grid {
    grid-template-columns: repeat(auto-fit, minmax(156px, 1fr));
  }

  .ticket-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .session-complete {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .session-complete-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .theory-sidebar {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 480px) {
  .main-nav a {
    padding: 7px 6px;
    font-size: 0.72rem;
  }

  .mode-hero-actions .btn {
    width: 100%;
  }

  .mode-hero h1 {
    font-size: clamp(2rem, 9vw, 2.7rem);
  }

  .theory-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .theory-rule {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 10px;
  }

  .theory-section-head .btn,
  .theory-finish .btn {
    width: 100%;
  }

  .topic-row {
    grid-template-columns: minmax(0, 1fr) 20px;
    gap: 9px;
  }

  .topic-row-progress {
    grid-column: 1 / -1;
    grid-row: 2;
    padding-top: 2px;
  }

  .topic-row-progress .mini-progress {
    width: 92px;
  }

  .topic-row-arrow {
    grid-column: 2;
    grid-row: 1;
  }

  .session-complete {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .session-complete-mark {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
}

@media (max-width: 1060px) {
  .mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-layout {
    grid-template-columns: minmax(0, 1fr) 286px;
  }

  .trainer-shell {
    grid-template-columns: 254px minmax(0, 1fr);
  }
}

@media (max-width: 960px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 30px;
  }

  .hero-card {
    max-width: 470px;
  }

  .hero-stats {
    max-width: 620px;
  }

  .goal-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .map-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .planner-card {
    position: static;
    order: -1;
  }

  .trainer-intro {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
  }

  .trainer-progress-card {
    max-width: 420px;
  }

  .trainer-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .task-sidebar {
    position: static;
    max-height: none;
    padding-top: 14px;
    overflow: visible;
  }

  .sidebar-controls {
    position: static;
    margin: 0;
    padding: 0;
    border-bottom: 0;
    background: transparent;
  }

  .task-list {
    grid-auto-flow: column;
    grid-auto-columns: minmax(172px, 0.8fr);
    grid-template-columns: none;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .task-group {
    display: none;
  }

  .task-nav {
    align-items: start;
    height: 100%;
    border: 1px solid var(--line);
  }

  .task-nav.is-current {
    border-color: var(--forest-dark);
  }

  .sidebar-note {
    display: none;
  }
}

@media (max-width: 880px) {
  .header-inner {
    width: min(100% - 28px, 1180px);
    min-height: auto;
    padding: 12px 0;
    flex-wrap: wrap;
    gap: 10px 18px;
  }

  .brand {
    margin-right: auto;
  }

  .brand-copy small {
    display: none;
  }

  .profile-switch {
    order: 2;
  }

  .profile-switch button {
    padding: 6px 10px;
    font-size: 0.73rem;
  }

  .main-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    gap: 2px;
  }

  .main-nav a {
    flex: 1;
    padding: 7px 10px;
    text-align: center;
    font-size: 0.8rem;
  }
}

@media (max-width: 760px) {
  .site-main,
  .footer-inner {
    width: min(100% - 28px, 1180px);
  }

  .map-scroll-hint {
    display: flex;
  }

  .hero {
    padding-top: 38px;
  }

  .hero h1 {
    font-size: clamp(2.15rem, 9.4vw, 3rem);
  }

  .hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 16px;
  }

  .hero-stats li:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }

  .hero-stats li:nth-child(n + 3) {
    padding-top: 14px;
    border-top: 1px solid var(--line);
  }

  .section-head {
    align-items: start;
    flex-direction: column;
    gap: 8px;
  }

  .section-tools {
    white-space: normal;
  }

  .task-head,
  .task-section,
  .solution-section {
    padding-left: 18px;
    padding-right: 18px;
  }

  .task-pager {
    padding-left: 18px;
    padding-right: 18px;
  }

  .answer-fields.is-multiple {
    grid-template-columns: minmax(0, 1fr);
  }

  .task-pager {
    grid-template-columns: minmax(0, 1fr);
  }

  .pager-link.is-empty {
    display: none;
  }

  .footer-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .footer-notes {
    justify-self: start;
    text-align: left;
  }
}

@media (max-width: 560px) {
  .mode-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .mode-card {
    min-height: 0;
  }

  .goal-card {
    padding: 20px 18px 18px;
  }

  .goal-card h3 {
    font-size: 1.34rem;
  }

  .goal-badge {
    min-width: 62px;
    padding: 8px 9px 6px;
  }

  .goal-badge strong {
    font-size: 2.1rem;
  }

  .goal-facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .goal-facts > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
  }

  .goal-facts > div + div {
    border-top: 1px dashed var(--line);
  }

  .goal-facts dd {
    margin: 0;
    text-align: right;
  }

  .goal-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .brand-copy strong {
    font-size: 0.95rem;
  }

  .brand-mark {
    width: 35px;
    height: 35px;
  }

  .profile-switch {
    order: 2;
    width: 100%;
  }

  .profile-switch button {
    flex: 1;
    padding: 7px 8px;
  }

  .main-nav {
    order: 3;
  }

  .threshold-number {
    font-size: clamp(3.2rem, 18vw, 4.5rem);
  }

  .planner-card {
    padding: 19px;
  }

  .rule-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .task-figure {
    margin-top: 14px;
    padding: 10px;
  }

  .task-figure img {
    max-height: 280px;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .hint-note {
    display: none;
  }

  .hint-counter {
    display: none;
  }

  .hints-head {
    gap: 9px;
    padding: 12px 14px;
  }

  .hints-head h3 {
    font-size: 1rem;
  }

  .hints-head .btn {
    padding: 8px 13px;
  }

  .pager-link {
    padding: 9px 11px;
  }

  .task-nav-body strong {
    font-size: 0.72rem;
  }
}

@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;
  }
}
