@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #020406;
  --surface: #0c1721;
  --line: rgba(166, 199, 212, .13);
  --line-strong: rgba(166, 199, 212, .22);
  --text: #eef8f5;
  --soft: #b6c8cb;
  --muted: #7f979f;
  --emerald: #5ee8a6;
  --blue: #79d6ff;
  --xp: #5cc9d6;
}

* { box-sizing: border-box; }

html { min-width: 320px; scroll-behavior: smooth; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.site-shell { min-height: 100vh; }

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 82px;
  padding: 0 clamp(24px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgba(6, 12, 19, .86);
  backdrop-filter: blur(12px);
}

.brand { display: inline-flex; align-items: center; gap: 10px; width: max-content; color: var(--text); font-size: 18px; font-weight: 800; letter-spacing: -.04em; text-decoration: none; }
.brand > span:last-child span { color: var(--emerald); }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid rgba(94, 232, 166, .5); border-radius: 9px; color: var(--emerald); font-family: Georgia, serif; font-size: 20px; }
.brand-mark > span { display: block; line-height: 1; transform: translateY(-2px); }
.topbar-actions { position: relative; display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.save-state { color: #86a19f; font-family: 'DM Mono', monospace; font-size: 10px; }
.status-dot { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 0 3px rgba(94, 232, 166, .1); vertical-align: 1px; }
.avatar { display: grid; place-items: center; width: 31px; height: 31px; padding: 0; border: 1px solid rgba(94, 232, 166, .35); border-radius: 50%; background: rgba(94, 232, 166, .08); color: var(--emerald); cursor: pointer; font: 800 12px/1 'Manrope', system-ui, sans-serif; transition: .18s ease; }
.avatar.is-floating { position: fixed; top: 18px; right: clamp(18px, 4vw, 64px); z-index: 25; background: rgba(8, 24, 28, .94); box-shadow: 0 8px 26px rgba(0, 0, 0, .32), 0 0 0 4px rgba(94, 232, 166, .07); }
.topbar.has-floating-profile { backdrop-filter: none; -webkit-backdrop-filter: none; }
.avatar:hover, .avatar:focus-visible { border-color: var(--emerald); background: rgba(94, 232, 166, .15); box-shadow: 0 0 0 3px rgba(94, 232, 166, .08); outline: none; }
.level-chip { display: flex; align-items: center; width: 142px; min-width: 142px; padding: 9px 11px; border: 1px solid rgba(92,201,214,.26); border-radius: 9px; background: rgba(92,201,214,.055); color: var(--text); cursor: pointer; text-align: left; transition: .18s ease; }
.level-chip:hover, .level-chip:focus-visible { border-color: rgba(92,201,214,.62); background: rgba(92,201,214,.1); outline: none; }
.level-chip-copy { display: grid; gap: 2px; }
.level-chip-copy small { color: var(--muted); font: 10px/1.1 'DM Mono', monospace; }
.level-chip-copy strong { color: var(--text); font-size: 12px; line-height: 1.1; }
.level-chip-xp { color: var(--emerald); font: 10px/1 'DM Mono', monospace; text-align: right; white-space: nowrap; }
.level-chip-bar { display: block; width: 100%; height: 5px; margin: 0; overflow: hidden; border-radius: 5px; background: rgba(166,199,212,.14); }
.level-chip-bar i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--xp); transition: width .25s ease; }
.record-notice { position: absolute; top: 50%; right: 43px; color: var(--xp); font: 10px 'DM Mono', monospace; letter-spacing: .03em; pointer-events: none; white-space: nowrap; }
.record-notice.visible { animation: record-notice-fade 3.6s ease forwards; }
@keyframes record-notice-fade { 0% { opacity: 0; transform: translateY(calc(-50% + 6px)); } 15% { opacity: 1; transform: translateY(-50%); } 72% { opacity: 1; transform: translateY(calc(-50% - 1px)); } 100% { opacity: 0; transform: translateY(calc(-50% - 8px)); } }
.xp-float-layer { position: fixed; top: 34px; right: calc(clamp(18px, 4vw, 64px) + 45px); z-index: 35; pointer-events: none; }
.xp-float { display: block; color: var(--xp); font: 700 12px 'DM Mono', monospace; text-shadow: 0 0 12px rgba(92,201,214,.5); white-space: nowrap; animation: xp-rise 1.7s cubic-bezier(.2,.75,.35,1) forwards; }
@keyframes xp-rise { 0% { opacity: 0; transform: translateY(28px) scale(.92); } 16% { opacity: 1; transform: translateY(17px) scale(1); } 76% { opacity: 1; transform: translateY(-2px) scale(1.02); } 100% { opacity: 0; transform: translateY(-26px) scale(1.03); } }

.page-content { width: 100%; max-width: 1420px; margin: 0 auto; padding: clamp(68px, 8vw, 105px) clamp(24px, 10vw, 150px) 80px; }
.home-view { position: relative; width: 100vw; min-height: calc(100vh - 82px); margin-top: calc(-1 * clamp(68px, 8vw, 105px)); margin-bottom: -80px; margin-left: calc(50% - 50vw); overflow: hidden; background: #020406; }
.map-shell { position: relative; height: calc(100vh - 82px); min-height: calc(100vh - 82px); overflow: hidden; isolation: isolate; background: #020406; }
.map-shell::before { position: absolute; inset: -18%; z-index: 0; content: ''; pointer-events: none; background: radial-gradient(ellipse 82% 70% at 50% 47%, rgba(13, 30, 38, .13) 0%, rgba(6, 14, 20, .08) 38%, rgba(2, 4, 6, 0) 78%), linear-gradient(180deg, #03070a 0%, #020406 100%); }
.map-toolbar { position: absolute; top: 25px; right: clamp(22px, 4vw, 64px); left: clamp(22px, 4vw, 64px); z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 20px; pointer-events: none; }
.map-status { display: flex; align-items: center; gap: 11px; padding: 8px 11px; border: 1px solid rgba(166,199,212,.13); border-radius: 8px; background: rgba(6,12,19,.48); color: var(--muted); font: 10px 'DM Mono', monospace; backdrop-filter: blur(8px); }
.map-kicker { color: var(--emerald); letter-spacing: .08em; text-transform: uppercase; }
#mapSelectionHint { color: #c1d0d3; }
@media (max-width: 600px) { .map-status { flex-wrap: wrap; gap: 5px 9px; } #mapSelectionHint { flex-basis: 100%; } }
.map-progress-toggle { margin-left: auto; padding: 8px 11px; border: 1px solid rgba(166,199,212,.18); border-radius: 8px; background: rgba(6,12,19,.48); color: var(--muted); cursor: pointer; font: 10px 'DM Mono', monospace; pointer-events: auto; transition: .18s ease; }
.map-progress-toggle:hover, .map-progress-toggle:focus-visible { border-color: rgba(94,232,166,.62); color: var(--text); outline: none; }
.map-progress-toggle.is-active { border-color: rgba(94,232,166,.72); background: rgba(28,104,74,.22); color: var(--emerald); box-shadow: 0 0 18px rgba(94,232,166,.12); }
.map-ambient { position: absolute; inset: 0; z-index: 1; overflow: visible; pointer-events: none; transform: translate3d(var(--ambient-pan-x, 0px), var(--ambient-pan-y, 0px), 0) rotate(var(--ambient-rotation, 0deg)) scale(var(--ambient-scale, 1)); transform-origin: 50% 50%; will-change: transform; }
.map-ambient::before { position: absolute; inset: -100%; content: ''; background: radial-gradient(ellipse 22% 11% at 42% 43%, rgba(74, 169, 185, .2) 0%, rgba(44, 104, 122, .09) 34%, transparent 74%), radial-gradient(ellipse 26% 13% at 59% 58%, rgba(137, 102, 194, .16) 0%, rgba(81, 73, 137, .07) 36%, transparent 76%), linear-gradient(119deg, transparent 18%, rgba(92, 201, 214, .032) 47%, transparent 76%); filter: blur(24px); opacity: .94; animation: galaxy-drift 34s ease-in-out infinite alternate; }
.map-ambient::after { position: absolute; inset: -75%; content: ''; background: radial-gradient(ellipse 24% 9% at 52% 47%, rgba(102, 190, 197, .075), transparent 72%), radial-gradient(ellipse 20% 8% at 47% 56%, rgba(179, 120, 203, .055), transparent 70%); opacity: .84; animation: galaxy-breathe 21s ease-in-out infinite alternate; }
.map-particle { position: absolute; left: var(--x); top: var(--y); width: var(--size); height: var(--size); border-radius: 50%; background: rgba(180, 231, 235, .55); opacity: 0; animation: ambient-particle var(--duration) ease-in-out var(--delay) infinite; }
.math-map { position: relative; z-index: 0; display: block; width: 100%; height: 100%; min-height: 0; cursor: grab; touch-action: none; user-select: none; background: transparent; }
.math-map > #mapWorld { will-change: transform; }
.math-map:active { cursor: grabbing; }
.map-background { pointer-events: none; }
.map-nebula { opacity: .11; filter: blur(38px); }
.map-edge { fill: none; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.map-edge-belongs { stroke: var(--edge-color, rgba(94,232,166,.24)); stroke-width: 1.2; }
.map-edge-requires, .map-edge-related, .map-edge-bridge { stroke: #d2d5d8; stroke-width: .65; stroke-dasharray: 2 8; }
.map-node { color: var(--branch-color, #9eabb2); cursor: pointer; outline: none; transition: opacity .28s ease, filter .28s ease; }
.map-star-halo { fill: currentColor; opacity: .045; filter: url(#softGlow); }
.map-star { fill: currentColor; filter: url(#starGlow); transition: transform .18s ease, opacity .18s ease; }
.math-map.is-interacting .map-node { filter: none !important; transition: none; }
.math-map.is-interacting .map-star { filter: none; }
.math-map.is-interacting .map-star-halo { opacity: .035; filter: none; }
.map-node:hover .map-star, .map-node:focus .map-star { transform: scale(1.5); }
.map-node-label { fill: #f4fffc; font: 500 13px 'Manrope', system-ui, sans-serif; letter-spacing: -.01em; text-anchor: middle; pointer-events: none; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .72)); transition: opacity .28s ease, fill .28s ease; }
.map-node-label-hit { cursor: pointer; pointer-events: auto; }
.map-node-domain { color: var(--branch-color, var(--emerald)); }
.map-node-domain .map-star { fill: currentColor; }
.map-node-domain .map-node-label { fill: var(--text); font-weight: 800; font-size: 18px; }
.map-node-course, .map-node-field, .map-node-topic, .map-node-concept { color: var(--branch-color, #9eabb2); }
.map-node-course .map-star, .map-node-field .map-star, .map-node-topic .map-star, .map-node-concept .map-star { fill: currentColor; }
.map-node-concept.map-node-background .map-star, .map-node-concept.map-node-background .map-star-halo { filter: none; }
.map-node-concept.map-node-background .map-star-halo { opacity: .022; }
.map-node-central .map-star { filter: url(#starGlow); }
.map-node-core .map-star { filter: url(#starGlow); }
.map-node-central .map-node-label { fill: var(--text); font-size: 17px; font-weight: 800; }
.map-node-core .map-node-label { fill: var(--text); font-weight: 800; }
.map-node-background .map-node-label { opacity: .68; }
.map-node-focus .map-node-label { opacity: 1; }
.map-concept-label { fill: #f4fffc; font-size: 10px; opacity: .78; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .82)); }
.map-node-draft { opacity: .48; }
.map-node-content-empty .map-star-halo { opacity: .018; }
.map-node-selection-background .map-node-label { display: none; }
.map-node-selected .map-star { transform: scale(1.18); }
.map-hint { position: absolute; right: clamp(22px, 4vw, 64px); bottom: 24px; z-index: 3; color: #58727d; font: 9px 'DM Mono', monospace; letter-spacing: .02em; pointer-events: none; }
@keyframes galaxy-drift { from { transform: translate3d(-2%, -1%, 0) rotate(-1deg) scale(.98); } to { transform: translate3d(2%, 1%, 0) rotate(1deg) scale(1.02); } }
@keyframes galaxy-breathe { from { transform: scale(.97); opacity: .45; } to { transform: scale(1.04); opacity: .85; } }
@keyframes ambient-particle { 0%, 100% { opacity: 0; transform: translate3d(0, 9px, 0) scale(.7); } 35% { opacity: .28; } 62% { opacity: .1; transform: translate3d(var(--dx), -15px, 0) scale(1); } }
@media (prefers-reduced-motion: reduce) { .map-ambient::before, .map-ambient::after, .map-particle { animation: none; } .map-ambient::before, .map-ambient::after { transform: none; } .map-particle { opacity: .12; } }
.theory-page { width: 100%; }
.page-intro { margin-bottom: 29px; }
.eyebrow { color: var(--emerald); font-family: 'DM Mono', monospace; font-size: 10px; font-weight: 500; letter-spacing: .08em; }
.section-label { display: inline-flex; align-items: center; margin-bottom: 20px; padding: 8px 13px; border: 1px solid rgba(94, 232, 166, .14); border-radius: 7px; background: rgba(94, 232, 166, .08); color: var(--emerald); font-family: 'DM Mono', monospace; font-size: 12px; letter-spacing: .04em; }
h1, h2, p { margin-top: 0; }
h1 { max-width: 780px; margin: 11px 0 7px; color: #f4fffc; font-size: clamp(32px, 4vw, 46px); line-height: 1.08; letter-spacing: -.055em; }
.page-intro p { margin-bottom: 0; color: var(--muted); font-size: 14px; }

.theory-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.theory-card { display: flex; flex-direction: column; min-width: 0; min-height: 237px; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, rgba(14, 27, 38, .96), rgba(10, 20, 29, .98)); }
.definition-actions { display: flex; order: 4; align-items: stretch; gap: 8px; width: 100%; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.definition-actions button { display: grid; flex: 1 1 0; place-items: center; width: auto; min-width: 0; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: rgba(255, 255, 255, .025); color: var(--muted); cursor: pointer; font-family: 'Segoe UI Symbol', 'Noto Sans Symbols', sans-serif; font-size: 15px; line-height: 1; transition: .18s ease; }
.definition-actions button[data-action="related"] { border-color: rgba(121, 214, 255, .24); background: rgba(121, 214, 255, .08); color: var(--blue); font-family: Georgia, serif; font-size: 18px; }
.definition-actions button[data-action="needed"] { border-color: rgba(125, 224, 141, .22); background: rgba(125, 224, 141, .08); color: #7de08d; }
.definition-actions button[data-action="learn"] { border-color: rgba(239, 143, 175, .22); background: rgba(239, 143, 175, .08); color: #ef8faf; }
.definition-actions button[data-action="learn"][data-learned="true"] { border-color: rgba(94,232,166,.3); background: rgba(94,232,166,.1); color: var(--emerald); font-family: 'DM Mono', monospace; font-size: 14px; }
.definition-actions button[data-action="practice"] { border-color: rgba(184, 153, 255, .22); background: rgba(184, 153, 255, .08); color: #b899ff; }
.definition-actions button[data-action="reference"] { border-color: rgba(166, 199, 212, .22); background: rgba(166, 199, 212, .07); color: #b7cbd2; }
.definition-actions button[data-action="archive"], .definition-actions button[data-action="restore"] { border-color: rgba(184,153,255,.22); background: rgba(184,153,255,.08); color: #b899ff; font-family: Georgia, serif; font-size: 17px; }
.definition-actions button[data-action="context"] { border-color: rgba(246, 216, 139, .3); background: rgba(246, 216, 139, .08); color: #f6d88b; font-family: 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; font-size: 16px; }
.definition-actions button.forgot-button { border-color: rgba(158, 171, 178, .28); background: rgba(158, 171, 178, .08); color: #9eabb2; }
.definition-actions button.forgot-button:hover { border-color: rgba(185, 197, 202, .46); background: rgba(185, 197, 202, .12); color: #c5d0d4; }
.forgot-icon { display: block; filter: grayscale(1); opacity: .82; }
.definition-actions button:hover { border-color: rgba(94, 232, 166, .48); background: rgba(94, 232, 166, .08); color: var(--emerald); transform: translateX(-1px); }
.tag { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border-radius: 6px; background: rgba(94, 232, 166, .1); color: var(--emerald); font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: .04em; }
.theory-card-heading { display: flex; order: 1; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.theory-card h2 { min-width: 0; margin: 0; color: var(--text); font-size: 17px; letter-spacing: -.025em; }
.review-lock-button { display: grid; flex: 0 0 auto; place-items: center; width: 25px; height: 25px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #7d8a90; cursor: pointer; opacity: .78; line-height: 1; transition: color .18s ease, opacity .18s ease, transform .18s ease; }
.review-lock-button svg { display: block; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.review-lock-button:hover, .review-lock-button:focus-visible { color: #b7cbd2; opacity: 1; outline: none; transform: translateY(-1px); }
.review-lock-button.is-locked { color: var(--emerald); opacity: 1; }
.review-lock-button.is-locked:hover, .review-lock-button.is-locked:focus-visible { color: #8af5bd; }
.practice-review-lock { position: absolute; top: 21px; right: 21px; }
.definition-alias { color: var(--muted); font-size: .72em; font-weight: 500; letter-spacing: 0; }
.definition-term, .definition-keyword { text-decoration-line: underline; text-decoration-thickness: 1px; text-underline-offset: 1px; text-decoration-skip-ink: auto; }
.definition-term { text-decoration-color: var(--emerald); }
.definition-keyword { text-decoration-color: var(--xp); }
.term-symbol { display: inline-block; margin-left: .34em; font-family: Georgia, serif; font-size: .92em; font-style: normal; line-height: 1; text-decoration: none; white-space: nowrap; }
.term-symbol-emerald, .term-symbol-xp { color: #e5f8ff; }
button.definition-keyword { display: inline; margin: 0; padding: 0; border: 0; background: transparent; color: inherit; cursor: pointer; font: inherit; line-height: inherit; }
button.definition-keyword:hover, button.definition-keyword:focus-visible { color: var(--xp); text-decoration-thickness: 2px; outline: none; }
.theory-card p { order: 2; min-height: 58px; margin-bottom: 18px; color: var(--soft); font-size: 12px; line-height: 1.6; }
.formula { order: 3; min-width: 0; max-width: 100%; margin-top: auto; padding-top: 17px; border-top: 1px solid var(--line); color: #e5f8ff; font-family: Georgia, serif; font-size: 19px; line-height: 1.35; text-align: center; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.source-note { margin-top: 17px; color: #657b83; font-family: 'DM Mono', monospace; font-size: 10px; text-align: right; }
.empty-state { padding: 22px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); font-size: 13px; }
.inline-link { color: var(--emerald); font-weight: 800; text-decoration: none; }
.inline-link:hover, .inline-link:focus-visible { color: #8af5bd; text-decoration: underline; outline: none; }

.study-view { width: 100%; }
.subject-view { width: 100%; }
.subject-view h1 { margin: 11px 0 14px; }
.subject-stats { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 24px; color: var(--muted); font: 11px 'DM Mono', monospace; }
.subject-stats strong { color: var(--emerald); font-weight: 500; }
.subject-grid { max-width: 1100px; }
.learned-definition-section { max-width: 1100px; margin-top: 42px; padding-top: 22px; border-top: 1px solid rgba(166,199,212,.12); }
.learned-definition-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; color: #77888d; font: 10px 'DM Mono', monospace; }
.learned-definition-heading .eyebrow { color: #89999d; }
.learned-definition-grid { max-width: 1100px; }
.learned-definition-grid .learned-card-surface { border-color: rgba(135,151,157,.24); background: linear-gradient(145deg, rgba(17,25,30,.9), rgba(11,17,21,.94)); filter: grayscale(.82); opacity: .7; }
.learned-definition-grid .learned-card-surface:hover { opacity: .82; }
.learned-definition-grid .learned-card-surface .theory-card-heading h2, .learned-definition-grid .learned-card-surface p, .learned-definition-grid .learned-card-surface .formula { color: #9aa8ab; }
.view-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.view-heading h1 { margin-bottom: 8px; }
.view-heading p { margin-bottom: 0; color: var(--muted); font-size: 14px; }
.primary-button, .secondary-button { border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 700; transition: .18s ease; white-space: nowrap; }
.primary-button { padding: 11px 15px; border: 1px solid var(--emerald); background: var(--emerald); color: #07150f; }
.primary-button:hover { background: #81f4bd; }
.primary-button span { margin-left: 7px; font-size: 15px; }
.secondary-button { padding: 9px 13px; border: 1px solid var(--line-strong); background: transparent; color: var(--soft); }
.secondary-button:hover { border-color: var(--emerald); color: var(--emerald); }
.practice-progress { position: relative; display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 8px 15px; margin-bottom: 12px; color: var(--muted); font-family: 'DM Mono', monospace; font-size: 10px; }
.practice-progress strong { color: var(--emerald); font-weight: 500; }
.practice-progress > strong:last-child { margin-left: auto; }
.practice-card { position: relative; max-width: 780px; padding: 27px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, rgba(14, 27, 38, .96), rgba(10, 20, 29, .98)); }
.practice-modal-card { width: min(780px, 100%); max-height: min(760px, calc(100vh - 44px)); overflow: auto; margin: 0 auto; }
.practice-card h2 { margin: 12px 0 23px; color: var(--text); font-size: 22px; line-height: 1.35; }
.practice-options { display: grid; gap: 8px; }
.practice-option { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.02); color: var(--soft); cursor: pointer; font-size: 13px; text-align: left; transition: .18s ease; }
.practice-option:hover:not(:disabled) { border-color: rgba(121,214,255,.5); background: rgba(121,214,255,.06); color: var(--text); }
.practice-option.selected { border-color: rgba(121,214,255,.72); background: rgba(121,214,255,.14); color: var(--text); box-shadow: inset 3px 0 0 rgba(121,214,255,.8); }
.practice-option:disabled { cursor: default; }
.practice-option.correct { border-color: rgba(94,232,166,.6); background: rgba(94,232,166,.1); color: #e3fff1; }
.practice-option.incorrect { border-color: rgba(166,199,212,.38); background: rgba(166,199,212,.08); color: var(--soft); }
.practice-next { display: block; min-width: 116px; height: 40px; margin: 18px 0 0 auto; padding: 8px 12px; font-size: 12px; }
.practice-next[hidden] { display: none; }
.practice-next:disabled { border-color: rgba(166,199,212,.18); background: rgba(166,199,212,.1); color: #7f9096; cursor: not-allowed; box-shadow: none; }
.practice-next:disabled:hover { background: rgba(166,199,212,.1); }
.practice-result-copy { margin: 0; color: var(--soft); font-size: 13px; }
.practice-result-actions { display: grid; gap: 9px; margin-top: 17px; }
.practice-result-action { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 44px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.025); color: var(--soft); cursor: pointer; font: 600 13px 'Manrope', system-ui, sans-serif; text-align: left; transition: .18s ease; }
.practice-result-action > span:first-child { display: grid; place-items: center; width: 22px; color: var(--muted); font-size: 18px; line-height: 1; }
.practice-result-action:hover, .practice-result-action:focus-visible { border-color: rgba(94,232,166,.5); background: rgba(94,232,166,.08); color: var(--text); outline: none; transform: translateX(1px); }
.practice-result-action.practice-result-save { border-color: rgba(94,232,166,.32); background: rgba(94,232,166,.07); color: var(--text); }
.practice-result-action.practice-result-save > span:first-child { color: var(--emerald); }

.notebook-panel { max-width: 900px; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, rgba(14, 27, 38, .96), rgba(10, 20, 29, .98)); }
.notebook-panel label { display: block; margin-bottom: 10px; color: var(--text); font-size: 13px; font-weight: 700; }
.notebook-panel textarea { display: block; width: 100%; min-height: 210px; resize: vertical; padding: 14px; border: 1px solid var(--line-strong); border-radius: 9px; outline: none; background: rgba(4,10,15,.35); color: var(--soft); font: 14px/1.7 'Manrope', system-ui, sans-serif; }
.notebook-panel textarea:focus { border-color: rgba(94,232,166,.55); box-shadow: 0 0 0 3px rgba(94,232,166,.07); }
.notebook-status { margin-top: 9px; color: #657b83; font-family: 'DM Mono', monospace; font-size: 10px; }
.notebook-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; max-width: 900px; margin: 27px 0 12px; color: var(--muted); font-size: 11px; }
.notebook-section-heading { margin-top: 4px; }
.notebook-definition-grid { max-width: 1100px; }
.archive-grid { max-width: 1100px; }
.leaderboard-list { display: grid; max-width: 900px; gap: 8px; }
.leaderboard-row { display: grid; grid-template-columns: 43px minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(145deg, rgba(14,27,38,.96), rgba(10,20,29,.98)); }
.leaderboard-rank { color: var(--muted); font: 12px 'DM Mono', monospace; }
.leaderboard-copy { min-width: 0; }
.leaderboard-copy strong, .leaderboard-copy small, .leaderboard-copy em { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-copy strong { color: var(--text); font-size: 13px; }
.leaderboard-copy small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.leaderboard-copy em { margin-top: 5px; color: #657b83; font: 9px 'DM Mono', monospace; font-style: normal; }
.leaderboard-time { color: var(--emerald); font: 16px 'DM Mono', monospace; white-space: nowrap; }
.learned-card-surface { border-color: rgba(94,232,166,.22); }
.learned-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 900px; gap: 13px; }
.learned-card { padding: 17px; border: 1px solid rgba(94,232,166,.18); border-radius: 11px; background: rgba(94,232,166,.045); }
.learned-card h2 { margin-bottom: 8px; color: var(--text); font-size: 16px; }
.learned-card p { margin-bottom: 13px; color: var(--soft); font-size: 12px; line-height: 1.55; }
.learned-card .formula { padding-top: 11px; font-size: 16px; }

.drawer-overlay { position: fixed; inset: 0; z-index: 19; background: rgba(2,7,11,.62); backdrop-filter: blur(3px); }
.concept-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 20; width: min(430px, 92vw); overflow: auto; padding: 27px 22px; border-left: 1px solid var(--line-strong); background: linear-gradient(160deg, #10202b, #09131c); box-shadow: -20px 0 60px rgba(0,0,0,.35); }
.drawer-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.drawer-header h2 { margin: 8px 0 0; color: var(--text); font-size: 21px; line-height: 1.2; }
.close-button { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--soft); cursor: pointer; font-size: 20px; line-height: 1; }
.close-button:hover { border-color: var(--emerald); color: var(--emerald); }
.drawer-body { padding-top: 18px; }
.drawer-intro { margin-bottom: 13px; color: var(--muted); font-size: 12px; }
.drawer-list { display: grid; gap: 7px; }
.drawer-concept { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; width: 100%; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.025); color: var(--soft); cursor: pointer; text-align: left; }
.drawer-concept:hover { border-color: rgba(94,232,166,.4); background: rgba(94,232,166,.06); }
.drawer-symbol { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: rgba(121,214,255,.08); color: var(--blue); font-family: Georgia, serif; font-size: 17px; }
.drawer-concept strong, .drawer-concept small { display: block; }
.drawer-concept strong { color: var(--text); font-size: 12px; }
.drawer-concept small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.drawer-arrow { color: var(--emerald); font-size: 17px; }
.drawer-symbol-notebook { background: rgba(94,232,166,.1); color: var(--emerald); font-family: 'DM Mono', monospace; font-size: 14px; }
.drawer-category { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; width: 100%; padding: 12px 11px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.025); color: var(--soft); cursor: pointer; text-align: left; transition: .18s ease; }
.drawer-category:hover { border-color: rgba(94,232,166,.4); background: rgba(94,232,166,.06); }
.drawer-category strong { color: var(--text); font-size: 14px; font-weight: 700; }
.drawer-symbol-proposition { background: rgba(246,216,139,.1); color: #f6d88b; font-family: Georgia, serif; font-size: 16px; }
.drawer-symbol-theorem { background: rgba(184,153,255,.1); color: #b899ff; font-family: Georgia, serif; font-size: 14px; }
.drawer-symbol-archive { background: rgba(166,199,212,.1); color: #b7cbd2; font-family: Georgia, serif; font-size: 16px; }
.drawer-symbol-leaderboard { background: rgba(121,214,255,.1); color: var(--blue); font-family: Georgia, serif; font-size: 16px; }
.drawer-empty { padding: 14px; border: 1px dashed var(--line-strong); border-radius: 9px; color: var(--muted); font-size: 12px; }
.experience-summary { padding: 15px; border: 1px solid rgba(92,201,214,.22); border-radius: 10px; background: rgba(92,201,214,.045); }
.experience-total { display: flex; align-items: baseline; gap: 8px; }
.experience-total strong { color: var(--text); font-size: 28px; letter-spacing: -.04em; }
.experience-total span { color: var(--xp); font: 10px 'DM Mono', monospace; }
.experience-level-line { display: flex; justify-content: space-between; gap: 12px; margin-top: 15px; color: var(--muted); font: 10px 'DM Mono', monospace; }
.experience-level-line span:first-child { color: var(--text); }
.experience-drawer-bar { height: 7px; margin-top: 8px; overflow: hidden; border-radius: 7px; background: rgba(166,199,212,.14); }
.experience-drawer-bar i { display: block; height: 100%; border-radius: inherit; background: var(--xp); }
.experience-area-list { display: grid; gap: 7px; margin-top: 13px; }
.experience-area-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.018); color: var(--soft); cursor: pointer; font: 11px 'Manrope', system-ui, sans-serif; text-align: left; transition: .18s ease; }
.experience-area-row:hover, .experience-area-row:focus-visible { border-color: rgba(92,201,214,.46); background: rgba(92,201,214,.075); color: var(--text); outline: none; transform: translateX(1px); }
.experience-area-row strong { color: var(--xp); font: 11px 'DM Mono', monospace; white-space: nowrap; }
.subject-level-stat { color: var(--xp); }
.subject-level-stat strong { color: var(--xp); }
.xp-reward-list { display: grid; gap: 7px; margin-top: 7px; }
.xp-reward-list div { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--soft); font-size: 11px; }
.xp-reward-list strong { color: var(--xp); font: 11px 'DM Mono', monospace; white-space: nowrap; }
.modal-backdrop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 22px; background: rgba(2,7,11,.72); backdrop-filter: blur(7px); }
.reference-modal { width: min(480px, 100%); padding: 23px; border: 1px solid var(--line-strong); border-radius: 14px; background: linear-gradient(145deg, #12232e, #0b151e); box-shadow: 0 25px 80px rgba(0,0,0,.42); }
.reference-modal > p:first-of-type { margin: 22px 0 5px; color: var(--text); font-family: Georgia, serif; font-size: 22px; }
.reference-entry { display: grid; gap: 0; }
.reference-entry + .reference-entry { margin-top: 18px; padding-top: 16px; border-top: 1px solid rgba(151,185,194,.14); }
.reference-entry p { margin: 0 0 6px; }
.reference-entry p:last-child { margin-bottom: 0; }
.reference-entry .reference-title { color: var(--text); font-family: Georgia, serif; font-size: 22px; line-height: 1.25; }
.concept-modal { width: min(560px, 100%); max-height: min(680px, calc(100vh - 44px)); overflow: auto; padding: 23px; border: 1px solid rgba(92,201,214,.3); border-radius: 14px; background: linear-gradient(145deg, #12232e, #0b151e); box-shadow: 0 25px 80px rgba(0,0,0,.42); }
.modal-parent-button { display: inline-flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 10px; border: 1px solid rgba(94,232,166,.26); border-radius: 8px; background: rgba(94,232,166,.06); color: var(--emerald); cursor: pointer; font: 10px 'DM Mono', monospace; white-space: nowrap; transition: .18s ease; }
.modal-parent-button:hover, .modal-parent-button:focus-visible { border-color: rgba(94,232,166,.64); background: rgba(94,232,166,.12); outline: none; }
.modal-parent-button:disabled { opacity: .45; cursor: default; }
.keyword-modal-body { padding-top: 19px; }
.keyword-modal-body p { margin: 0; color: var(--soft); font-size: 14px; line-height: 1.65; }
.context-copy { display: grid; gap: 14px; }
.context-copy p { color: var(--soft); font-size: 15px; line-height: 1.72; }
.context-question-group { display: grid; gap: 9px; margin-top: 23px; padding-top: 17px; border-top: 1px solid var(--line); }
.context-section-label, .context-sources-label { color: var(--emerald); font: 10px 'DM Mono', monospace; letter-spacing: .08em; text-transform: uppercase; }
.context-question { border: 1px solid rgba(94,232,166,.18); border-radius: 9px; background: rgba(94,232,166,.045); }
.context-question summary { padding: 12px 13px; color: var(--text); cursor: pointer; font-size: 13px; line-height: 1.45; }
.context-question summary::marker { color: var(--emerald); }
.context-question p { padding: 0 13px 13px; color: var(--muted); font-size: 13px; }
.context-sources { margin-top: 22px; padding-top: 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.55; }
.context-sources-label { display: block; margin-bottom: 6px; }
.context-sources cite { color: var(--soft); }
.keyword-modal-body .definition-actions { margin-top: 20px; }
.keyword-modal-formula { min-width: 0; max-width: 100%; margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line); color: #e5f8ff; font-family: Georgia, serif; font-size: 20px; line-height: 1.35; text-align: center; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.modal-muted { margin-bottom: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 40; max-width: min(360px, calc(100vw - 44px)); padding: 11px 14px; border: 1px solid rgba(94,232,166,.35); border-radius: 9px; background: #122a25; color: #dcfff0; box-shadow: 0 15px 40px rgba(0,0,0,.32); font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
body.drawer-open { overflow: hidden; }
.modal-backdrop[hidden], .concept-drawer[hidden], .drawer-overlay[hidden], .study-view[hidden], .theory-page[hidden], .home-view[hidden] { display: none !important; }

@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr auto; }
  .topbar-actions { grid-column: 2; grid-row: 1; gap: 10px; }
  .theory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .topbar { padding: 0 18px; }
  .save-state { display: none; }
  .level-chip { width: 112px; min-width: 112px; padding: 8px 9px; }
  .level-chip-copy small { display: none; }
  .level-chip-xp { font-size: 9px; }
  .page-content { padding: 49px 18px 56px; }
  h1 { font-size: 34px; }
  .theory-grid { grid-template-columns: 1fr; }
  .theory-card { min-height: 0; }
  .theory-card p { min-height: 0; }
  .view-heading { display: block; }
  .view-heading .secondary-button { margin-top: 20px; }
  .practice-card { padding: 20px; }
  .practice-progress > strong:last-child { margin-left: 0; }
  .learned-grid { grid-template-columns: 1fr; }
  .concept-drawer { width: 100%; padding: 22px 18px; }
  .concept-modal { max-height: calc(100vh - 28px); padding: 18px; }
  .modal-parent-button { max-width: 145px; overflow: hidden; text-overflow: ellipsis; }
  .leaderboard-row { grid-template-columns: 32px minmax(0, 1fr); gap: 10px; }
  .leaderboard-time { grid-column: 2; }
  .source-note { text-align: left; line-height: 1.5; }
  .map-toolbar { top: 18px; right: 18px; left: 18px; }
  /* The mobile graph is twice as large as the desktop overview. Keep a
     taller, scrollable surface behind it so the lower branches are reachable
     instead of ending against the viewport edge. */
  .map-shell { height: max(calc(100svh - 82px), 900px); min-height: 900px; }
  .map-status { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .map-progress-toggle { padding: 8px 9px; }
  .map-hint { right: 18px; bottom: 16px; max-width: calc(100vw - 36px); text-align: right; }
  .map-node-label { font-size: 11px; }
  .map-concept-label { font-size: 8px; }
}

@media (min-width: 601px) {
  .theory-grid.is-density-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .theory-grid.is-density-one { grid-template-columns: 1fr; }
}
