@import url('');
:root {
  color-scheme: light;
  --ink: #262338;
  --muted: #676578;
  --paper: #faf9f6;
  --surface: #ffffff;
  --line: #e8e5ee;
  --primary: #5547c8;
  --primary-dark: #40339f;
  --primary-soft: #efedff;
  --amber: #f5b83d;
  --amber-soft: #fff4d7;
  --green: #147a53;
  --green-soft: #e5f6ee;
  --orange: #a6550b;
  --orange-soft: #fff0dc;
  --red: #a92f2f;
  --red-soft: #fff0ee;
  --blue: #225c9b;
  --blue-soft: #eaf3ff;
  --shadow: 0 12px 34px rgba(48, 39, 94, .08);
  --shadow-soft: 0 4px 16px rgba(48, 39, 94, .07);
  --radius: 22px;
  --font-scale: 1;
}
* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: calc(16px * var(--font-scale)); line-height: 1.55; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: var(--primary-dark); }
:focus-visible { outline: 3px solid #e49b18; outline-offset: 3px; }
.skip-link { position: fixed; z-index: 200; top: 8px; left: 8px; transform: translateY(-150%); padding: 10px 14px; border-radius: 10px; background: #fff; color: #222; box-shadow: var(--shadow); }
.skip-link:focus { transform: translateY(0); }
.app-shell { min-height: 100vh; padding-bottom: 90px; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 18px; min-height: 76px; padding: 12px max(20px, calc((100vw - 1180px) / 2)); background: rgba(250,249,246,.94); border-bottom: 1px solid rgba(232,229,238,.9); backdrop-filter: blur(14px); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 850; font-size: 1.17rem; letter-spacing: -.04em; white-space: nowrap; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 15px; background: var(--primary); color: white; font-size: 1.35rem; box-shadow: 0 6px 15px rgba(85,71,200,.25); }
.topbar-spacer { flex: 1; }
.profile-select { min-width: 150px; max-width: 210px; padding: 10px 38px 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: white; color: var(--ink); font-weight: 700; }
.top-stat { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; background: white; border: 1px solid var(--line); color: var(--ink); font-size: .9rem; font-weight: 750; white-space: nowrap; }
.icon-button { width: 44px; height: 44px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: white; cursor: pointer; font-size: 1.15rem; transition: transform .15s, box-shadow .15s; }
.icon-button:hover { transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.main-nav { position: fixed; z-index: 40; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 6px; width: min(620px, calc(100% - 24px)); padding: 8px; border: 1px solid rgba(232,229,238,.95); border-radius: 20px; background: rgba(255,255,255,.96); box-shadow: 0 10px 34px rgba(33, 27, 72, .16); backdrop-filter: blur(16px); }
.nav-item { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 52px; padding: 7px 8px; border: 0; border-radius: 14px; background: transparent; color: var(--muted); font-size: .78rem; font-weight: 720; cursor: pointer; }
.nav-item .nav-icon { font-size: 1.1rem; }
.nav-item.active { color: var(--primary-dark); background: var(--primary-soft); }
.container { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 26px 0 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h1, h1 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.35rem); line-height: 1.14; letter-spacing: -.045em; }
.page-head p { margin: 8px 0 0; color: var(--muted); max-width: 690px; }
h2 { margin: 0; font-size: 1.34rem; line-height: 1.25; letter-spacing: -.025em; }
h3 { margin: 0; font-size: 1.07rem; line-height: 1.35; }
p { margin: 0 0 12px; }
.eyebrow { color: var(--primary-dark); font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 850; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.tiny { font-size: .78rem; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 12px; }
.section-title p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-soft); }
.card.flat { box-shadow: none; }
.card-header { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.card-header .icon-bubble { flex: 0 0 auto; }
.card-header > div:last-child { flex: 1; min-width: 0; }
.card-header h2, .card-header h3 { margin-bottom: 3px; }
.icon-bubble { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 16px; background: var(--primary-soft); font-size: 1.45rem; }
.icon-bubble.amber { background: var(--amber-soft); }
.icon-bubble.green { background: var(--green-soft); }
.icon-bubble.blue { background: var(--blue-soft); }
.icon-bubble.orange { background: var(--orange-soft); }
.icon-bubble.rose { background: #fff0f5; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 48px; padding: 11px 18px; border: 1px solid transparent; border-radius: 14px; background: var(--primary); color: #fff; font-weight: 800; text-align: center; text-decoration: none; cursor: pointer; transition: transform .15s, background .15s, box-shadow .15s; }
.btn:hover { background: var(--primary-dark); box-shadow: 0 5px 15px rgba(85,71,200,.2); transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.secondary { background: white; color: var(--primary-dark); border-color: #d9d5fa; }
.btn.secondary:hover { background: var(--primary-soft); }
.btn.tertiary { min-height: 42px; padding: 8px 12px; border-color: var(--line); background: #fff; color: var(--ink); }
.btn.tertiary:hover { background: #f7f6fb; }
.btn.success { background: var(--green); }
.btn.danger { background: #a63737; }
.btn.text { background: transparent; border-color: transparent; color: var(--primary-dark); box-shadow: none; }
.btn.text:hover { background: var(--primary-soft); }
.btn.small-btn { min-height: 40px; padding: 7px 12px; font-size: .9rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn-row.end { justify-content: flex-end; }
.btn-row.between { justify-content: space-between; }
.hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0,1.4fr) minmax(210px,.6fr); align-items: center; gap: 26px; padding: clamp(24px, 4vw, 42px); border-radius: 30px; background: linear-gradient(120deg, #584bd1 0%, #6e62db 55%, #8a7feb 100%); color: white; box-shadow: 0 18px 40px rgba(85,71,200,.22); }
.hero::before, .hero::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255,255,255,.09); pointer-events: none; }
.hero::before { width: 230px; height: 230px; right: 12%; top: -130px; }
.hero::after { width: 145px; height: 145px; right: -30px; bottom: -78px; }
.hero-content, .hero-art { position: relative; z-index: 1; }
.hero h1 { max-width: 660px; margin: 6px 0 12px; font-size: clamp(1.8rem, 4vw, 2.8rem); }
.hero p { color: rgba(255,255,255,.88); max-width: 600px; }
.hero .eyebrow { color: #f6dc94; }
.hero .btn { margin-top: 5px; background: #fff; color: var(--primary-dark); box-shadow: none; }
.hero .btn:hover { background: #fff7dc; }
.hero-art { display: grid; place-items: center; min-height: 165px; }
.hero-orbit { width: 155px; height: 155px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; font-size: 5rem; background: rgba(255,255,255,.11); box-shadow: inset 0 0 0 15px rgba(255,255,255,.045); }
.hero-orbit::after { content: '✦'; position: absolute; margin: -132px 0 0 130px; color: #ffe29a; font-size: 1.55rem; }
.quick-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-top: 18px; }
.quick-card { position: relative; display: flex; flex-direction: column; gap: 10px; min-height: 158px; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: white; color: var(--ink); text-align: left; cursor: pointer; box-shadow: var(--shadow-soft); transition: transform .16s, box-shadow .16s; }
.quick-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.quick-card .quick-icon { font-size: 1.6rem; }
.quick-card h3 { font-size: 1.03rem; }
.quick-card p { margin: 0; color: var(--muted); font-size: .86rem; }
.quick-card .counter { align-self: flex-start; padding: 3px 8px; border-radius: 99px; background: var(--orange-soft); color: #85420d; font-size: .74rem; font-weight: 800; }
.quick-card.purple { border-top: 4px solid #7c6de2; }
.quick-card.amber { border-top: 4px solid var(--amber); }
.quick-card.green { border-top: 4px solid #46b47d; }
.quick-card.blue { border-top: 4px solid #4a8ade; }
.two-column { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(280px,.9fr); gap: 16px; align-items: start; }
.subject-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.subject-card { display: flex; gap: 14px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: white; cursor: pointer; text-align: left; transition: transform .15s, border .15s; }
.subject-card:hover { transform: translateY(-2px); border-color: #c5bef6; }
.subject-card .subject-emoji { width: 48px; height: 48px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 16px; background: #f1efff; font-size: 1.55rem; }
.subject-card h3 { margin-bottom: 4px; }
.subject-card .subject-meta { color: var(--muted); font-size: .82rem; }
.progress-line { width: 100%; height: 9px; overflow: hidden; margin-top: 10px; border-radius: 99px; background: #eeedf2; }
.progress-line > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#5d50d1,#8c82ed); transition: width .3s; }
.progress-line.green > span { background: linear-gradient(90deg,#36a66f,#76d09e); }
.progress-line.amber > span { background: linear-gradient(90deg,#d98925,#f5c65d); }
.stats-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.stat-card { padding: 15px; border: 1px solid var(--line); border-radius: 17px; background: white; }
.stat-card .stat-value { display: block; margin: 7px 0 2px; font-size: 1.65rem; font-weight: 850; letter-spacing: -.04em; }
.stat-card .stat-label { color: var(--muted); font-size: .82rem; }
.stat-icon { font-size: 1.15rem; }
.tree-wrap { overflow: hidden; padding: 15px; border-radius: 20px; background: linear-gradient(180deg,#f3f5ff,#f5fbf6); }
.tree-svg { display: block; width: 100%; max-height: 330px; }
.tree-leaf { cursor: pointer; stroke: rgba(40,48,45,.22); stroke-width: 2; transition: transform .16s, filter .16s; transform-box: fill-box; transform-origin: center; }
.tree-leaf:hover, .tree-leaf:focus { transform: scale(1.16); filter: drop-shadow(0 4px 3px rgba(0,0,0,.2)); outline: none; }
.tree-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; color: var(--muted); font-size: .79rem; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 11px; height: 11px; display: inline-block; border: 1px solid rgba(0,0,0,.08); border-radius: 50%; }
.list { display: grid; gap: 10px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.list-row .list-main { flex: 1; min-width: 0; }
.list-row h3 { font-size: .98rem; }
.list-row p { margin: 3px 0 0; color: var(--muted); font-size: .84rem; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 99px; background: #f1f0f4; color: #55525f; font-size: .76rem; font-weight: 780; white-space: nowrap; }
.status-pill.mastered { background: var(--green-soft); color: #116744; }
.status-pill.almost { background: #e8f5ef; color: #28694c; }
.status-pill.in_progress { background: var(--orange-soft); color: #85420d; }
.status-pill.discovered { background: #fff6db; color: #765b09; }
.status-pill.review { background: var(--red-soft); color: #8b2f2f; }
.status-pill.undiscovered { background: #f1f0f4; color: #575462; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 99px; background: #f2f0ff; color: var(--primary-dark); font-size: .76rem; font-weight: 750; }
.tag.success { background: var(--green-soft); color: #116744; }
.tag.warning { background: var(--amber-soft); color: #76500a; }
.tag.neutral { background: #f1f0f4; color: #575462; }
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 13px 15px; border: 1px solid #ead59b; border-radius: 15px; background: #fff9e9; color: #55400d; }
.notice.info { border-color: #c9daf3; background: #f1f7ff; color: #24476e; }
.notice.success { border-color: #bfe2cc; background: #f0faf4; color: #174d34; }
.notice.danger { border-color: #edc7c3; background: #fff4f2; color: #762e28; }
.notice p:last-child { margin-bottom: 0; }
.empty-state { padding: 32px 20px; border: 1px dashed #cac6d9; border-radius: 20px; background: rgba(255,255,255,.7); text-align: center; }
.empty-state .empty-icon { display: block; margin-bottom: 8px; font-size: 2.2rem; }
.empty-state p { max-width: 510px; margin: 8px auto 16px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label, .field-label { font-size: .88rem; font-weight: 780; }
.field small, .help-text { color: var(--muted); font-size: .8rem; }
input[type="text"], input[type="number"], input[type="password"], input[type="search"], select, textarea { width: 100%; min-height: 48px; padding: 11px 13px; border: 1.5px solid #d9d6e1; border-radius: 12px; background: #fff; color: var(--ink); }
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: 3px solid rgba(85,71,200,.14); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 18px; height: 18px; vertical-align: middle; }
.checkbox-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.check-option { display: flex; align-items: center; gap: 9px; min-height: 46px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; }
.check-option:has(input:checked) { border-color: #aaa1ed; background: #f7f5ff; }
.avatar-grid { display: grid; grid-template-columns: repeat(8,minmax(0,1fr)); gap: 8px; }
.avatar-option { display: grid; place-items: center; aspect-ratio: 1; border: 2px solid transparent; border-radius: 16px; background: #f3f1fa; font-size: 1.55rem; cursor: pointer; }
.avatar-option[aria-pressed="true"] { border-color: var(--primary); background: #eae7ff; box-shadow: 0 0 0 3px rgba(85,71,200,.12); }
.step-indicator { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.step-dot { width: 10px; height: 10px; border-radius: 50%; background: #d8d5e3; }
.step-dot.active { width: 26px; border-radius: 99px; background: var(--primary); }
.step-dot.done { background: #54aa7d; }
.setup-shell { min-height: 100vh; display: grid; place-items: center; padding: 22px; background: radial-gradient(circle at 14% 14%,#f1edff 0,transparent 27%), radial-gradient(circle at 90% 90%,#fff0d5 0,transparent 28%),var(--paper); }
.setup-card { width: min(710px,100%); padding: clamp(22px,5vw,42px); border: 1px solid var(--line); border-radius: 30px; background: white; box-shadow: 0 24px 70px rgba(45,37,88,.12); }
.setup-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.setup-brand .brand-mark { width: 50px; height: 50px; }
.setup-card h1 { margin-bottom: 10px; }
.setup-card > p { color: var(--muted); }
.setup-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 24px; }
.setup-footnote { margin-top: 14px; color: var(--muted); font-size: .78rem; }
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; color: var(--muted); font-size: .84rem; margin-bottom: 12px; }
.learning-shell { width: min(850px,calc(100% - 32px)); margin: 20px auto 50px; }
.learning-top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.learning-progress { flex: 1; }
.learning-card { padding: clamp(20px,4vw,34px); border: 1px solid var(--line); border-radius: 26px; background: white; box-shadow: var(--shadow); }
.learning-card h1 { margin: 7px 0 14px; }
.objective-banner { padding: 13px 16px; border-left: 4px solid var(--amber); border-radius: 0 14px 14px 0; background: var(--amber-soft); color: #523c0c; font-weight: 750; }
.explanation-body { max-width: 720px; font-size: 1.06rem; line-height: 1.8; white-space: pre-line; }
.callout { margin: 17px 0; padding: 15px 17px; border-radius: 15px; background: #f5f3ff; border: 1px solid #e4e0ff; }
.callout strong { display: block; margin-bottom: 4px; }
.example-step { display: flex; align-items: flex-start; gap: 12px; padding: 14px; margin-top: 10px; border: 1px solid var(--line); border-radius: 15px; background: #fbfbfd; }
.example-step .step-number { width: 29px; height: 29px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark); font-weight: 850; }
.question-box { margin: 12px 0 16px; padding: 16px; border: 1px solid #e9e5f4; border-radius: 17px; background: #faf9ff; }
.question-box .question { font-size: 1.16rem; font-weight: 780; line-height: 1.45; }
.question-box .statement { margin-top: 12px; padding: 12px; border-radius: 12px; background: white; font-weight: 720; }
.answer-options { display: grid; gap: 10px; margin: 14px 0; }
.answer-option { display: flex; align-items: flex-start; gap: 10px; min-height: 50px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: white; text-align: left; cursor: pointer; }
.answer-option:hover { border-color: #b4acec; background: #faf9ff; }
.answer-option.selected { border-color: var(--primary); background: #f2f0ff; box-shadow: 0 0 0 2px rgba(85,71,200,.08); }
.answer-option.correct { border-color: #89c9a5; background: var(--green-soft); }
.answer-option.incorrect { border-color: #e6a29d; background: var(--red-soft); }
.answer-option input { flex: 0 0 auto; margin-top: 4px; }
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: center; margin-top: 10px; }
.match-label { padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-weight: 700; }
.order-list { display: grid; gap: 8px; margin-top: 12px; }
.order-row { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.order-row span { flex: 1; }
.feedback-panel { margin: 16px 0; padding: 15px 16px; border-radius: 15px; border: 1px solid #bfe2cc; background: var(--green-soft); color: #164d34; }
.feedback-panel.incorrect { border-color: #edc7c3; background: var(--red-soft); color: #762e28; }
.feedback-panel.partial { border-color: #ead59b; background: #fff9e9; color: #55400d; }
.feedback-panel h3 { margin-bottom: 5px; }
.hint-box { margin: 12px 0; padding: 13px 15px; border-radius: 13px; background: var(--blue-soft); color: #1e4b78; }
.confidence-picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.confidence-btn { min-height: 45px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 13px; background: white; cursor: pointer; }
.confidence-btn[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); font-weight: 800; }
.summary-hero { padding: 22px; border-radius: 22px; background: linear-gradient(130deg,#eaf8ef,#f2fbf4); border: 1px solid #cde8d6; }
.summary-hero h1 { font-size: 1.8rem; margin-bottom: 8px; }
.badge-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; }
.badge-card { min-height: 125px; padding: 14px 12px; border: 1px solid var(--line); border-radius: 17px; background: white; text-align: center; }
.badge-card.locked { opacity: .57; filter: grayscale(1); }
.badge-card .badge-icon { display: block; margin-bottom: 6px; font-size: 1.8rem; }
.badge-card strong { display: block; font-size: .9rem; }
.badge-card small { color: var(--muted); }
.history-list { display: grid; gap: 8px; }
.history-item { display: grid; grid-template-columns: 1.1fr .8fr .7fr; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid #efedf2; font-size: .86rem; }
.history-item:last-child { border-bottom: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.tab-button { min-height: 42px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--muted); font-weight: 760; cursor: pointer; }
.tab-button[aria-selected="true"] { border-color: #b9b1f0; background: var(--primary-soft); color: var(--primary-dark); }
.guardian-card-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.profile-card { display: flex; align-items: center; gap: 13px; padding: 15px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.profile-card .avatar-large { width: 55px; height: 55px; display: grid; place-items: center; border-radius: 18px; background: #f4f1ff; font-size: 1.9rem; }
.profile-card .profile-main { flex: 1; min-width: 0; }
.profile-card h3 { margin-bottom: 2px; }
.profile-card p { margin: 0; color: var(--muted); font-size: .82rem; }
.profile-card .profile-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.data-drop { padding: 20px; border: 1px dashed #c5bfd8; border-radius: 17px; background: #fbfaff; }
.file-input { width: 100%; min-height: 48px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 15px; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 11px 13px; text-align: left; border-bottom: 1px solid #efedf2; vertical-align: top; }
th { background: #f8f7fb; color: var(--muted); font-size: .8rem; }
tr:last-child td { border-bottom: 0; }
.auth-shell { width: min(480px,calc(100% - 32px)); margin: 7vh auto; }
.pin-dots { display: flex; justify-content: center; gap: 12px; margin: 12px 0; }
.pin-dot { width: 14px; height: 14px; border: 2px solid #aaa5bc; border-radius: 50%; }
.pin-dot.filled { background: var(--primary); border-color: var(--primary); }
.toast-region { position: fixed; z-index: 120; right: 16px; bottom: 90px; display: grid; gap: 8px; width: min(380px,calc(100% - 32px)); pointer-events: none; }
.toast { padding: 13px 16px; border: 1px solid #cfc9ed; border-radius: 15px; background: #fff; color: var(--ink); box-shadow: var(--shadow); animation: toast-in .18s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.hidden { display: none !important; }
.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; }
.avatar-inline { display: inline-grid; place-items: center; width: 35px; height: 35px; margin-right: 6px; border-radius: 12px; background: #f2efff; font-size: 1.2rem; vertical-align: middle; }
.focus-mode .topbar, .focus-mode .main-nav { display: none; }
.focus-mode .app-shell { padding-bottom: 0; }
.high-contrast { --ink: #111; --muted: #333; --paper: #fff; --surface: #fff; --line: #5c5c5c; --primary: #29217e; --primary-dark: #21195f; --primary-soft: #e9e6ff; --green: #07532e; --orange: #713400; --red: #7a1010; }
.high-contrast .card, .high-contrast .quick-card, .high-contrast .subject-card { border-width: 2px; }
.dyslexic-mode { font-family: Verdana, Arial, sans-serif; letter-spacing: .015em; word-spacing: .08em; }
.theme-dark { --ink: #f5f2fb; --muted: #c2bece; --paper: #1e1b28; --surface: #292535; --line: #484456; --primary-soft: #36314f; --amber-soft: #4a3a1d; --green-soft: #183c2d; --orange-soft: #45301b; --red-soft: #492626; --blue-soft: #202f47; --shadow: 0 12px 34px rgba(0,0,0,.25); --shadow-soft: 0 4px 16px rgba(0,0,0,.2); }
.theme-dark .topbar { background: rgba(30,27,40,.94); }
.theme-dark .main-nav, .theme-dark .card, .theme-dark .quick-card, .theme-dark .subject-card, .theme-dark .stat-card, .theme-dark .list-row, .theme-dark .profile-card, .theme-dark .learning-card, .theme-dark .setup-card, .theme-dark .answer-option, .theme-dark .example-step, .theme-dark input, .theme-dark select, .theme-dark textarea, .theme-dark .match-label, .theme-dark .order-row, .theme-dark .tab-button, .theme-dark .data-drop { background: #292535; color: var(--ink); }
.theme-dark .brand, .theme-dark .top-stat, .theme-dark .profile-select { color: var(--ink); background: #292535; }
.theme-dark .nav-item.active { background: #36314f; }
.theme-dark .question-box, .theme-dark .callout, .theme-dark .tree-wrap { background: #282537; }
.theme-dark .match-label { border-color: var(--line); }
@media (max-width: 900px) {
  .quick-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .hero { grid-template-columns: minmax(0,1fr) 175px; }
}
@media (max-width: 680px) {
  .topbar { min-height: 68px; padding: 10px 14px; gap: 8px; }
  .brand { font-size: 1rem; gap: 7px; }
  .brand-mark { width: 38px; height: 38px; border-radius: 13px; }
  .top-stat { padding: 7px 9px; font-size: .78rem; }
  .profile-select { min-width: 0; width: min(135px,30vw); padding: 9px 8px; font-size: .83rem; }
  .icon-button { width: 40px; height: 40px; }
  .container { width: min(100% - 28px, 600px); padding-top: 21px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .hero { grid-template-columns: 1fr; gap: 8px; padding: 25px 22px; border-radius: 24px; }
  .hero-art { position: absolute; right: 18px; bottom: 16px; opacity: .26; }
  .hero-orbit { width: 115px; height: 115px; font-size: 3.5rem; }
  .hero-content { max-width: 100%; }
  .hero p { max-width: 380px; }
  .quick-card { min-height: 152px; padding: 15px; }
  .two-column { grid-template-columns: 1fr; }
  .subject-grid { grid-template-columns: 1fr; }
  .guardian-card-grid { grid-template-columns: 1fr; }
  .badge-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .avatar-grid { grid-template-columns: repeat(6,minmax(0,1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .setup-footer { align-items: stretch; flex-direction: column-reverse; }
  .setup-footer .btn { width: 100%; }
  .learning-shell { width: calc(100% - 24px); margin-top: 13px; }
  .learning-top { align-items: flex-start; flex-wrap: wrap; }
  .learning-card { border-radius: 21px; }
  .history-item { grid-template-columns: 1fr .8fr; }
  .history-item span:last-child { grid-column: 1/-1; }
  .profile-card { align-items: flex-start; flex-wrap: wrap; }
  .profile-card .profile-actions { width: 100%; padding-left: 68px; }
}
@media (max-width: 390px) {
  .topbar { gap: 6px; }
  .brand-name { display: none; }
  .top-stat { gap: 3px; padding: 6px 7px; }
  .quick-grid { gap: 9px; }
  .quick-card { min-height: 145px; padding: 12px; }
  .nav-item { flex-direction: column; gap: 0; padding: 5px 3px; font-size: .68rem; }
  .main-nav { bottom: max(8px,env(safe-area-inset-bottom)); }
  .container { width: calc(100% - 24px); }
  .checkbox-grid { grid-template-columns: 1fr; }
  .match-grid { grid-template-columns: 1fr 1fr; gap: 7px; }
  .btn-row .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
