:root {
  color-scheme: dark;
  --bg: var(--tg-theme-bg-color, #0d1422);
  --surface: var(--tg-theme-secondary-bg-color, #151f31);
  --text: var(--tg-theme-text-color, #f5f7fb);
  --muted: color-mix(in srgb, var(--text) 70%, var(--bg));
  --surface-2: color-mix(in srgb, var(--surface) 92%, var(--text));
  --line: color-mix(in srgb, var(--bg) 78%, var(--text));
  --blue: var(--tg-theme-link-color, #73a9ff);
  --blue-strong: var(--tg-theme-button-color, #356dcc);
  --type-note: .8125rem;
  --type-label: .875rem;
  --motion-press: 120ms;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --green: #55d49b;
  --red: #ff7f88;
  --amber: #ffc66d;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  --blue: var(--tg-theme-link-color, #245ea8);
  --blue-strong: var(--tg-theme-button-color, #2869c9);
}

*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; background: var(--tg-theme-bg-color, var(--bg)); }
body { margin: 0; min-height: 100%; background: var(--tg-theme-bg-color, var(--bg)); color: var(--tg-theme-text-color, var(--text)); }
body.theory-open { overflow: hidden; }
button, textarea, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, textarea:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
.direction-picker { display: grid; gap: 8px; margin-bottom: 20px; }
.direction-picker label { font-size: var(--type-label); font-weight: 600; }
.direction-picker select { width: 100%; min-height: 48px; background: var(--surface); color: var(--text); }
.direction-picker option { color: var(--text); background: var(--surface); }
.direction-picker .form-error:empty { display: none; }
:root[data-theme="light"] .direction-picker .form-error,
:root[data-theme="light"] .sd-workspace .form-error { color: color-mix(in srgb, var(--red) 55%, #000); }
.sd-workspace { min-width: 0; }
.sd-workspace h1 { font-size: 26px; line-height: 1.2; }
.sd-workspace h2 { font-size: 20px; line-height: 1.3; margin-bottom: 14px; }
.sd-workspace h3 { font-size: 16px; line-height: 1.4; margin: 24px 0 8px; }
.sd-workspace p, .sd-workspace li { max-width: 72ch; line-height: 1.6; overflow-wrap: anywhere; }
.sd-workspace .muted { color: var(--muted); }
.sd-panel { margin: 20px 0; box-shadow: none; }
.sd-lesson-section + .sd-lesson-section { margin-top: 28px; }
.sd-editor { display: block; width: 100%; min-height: 240px; resize: vertical; padding: 14px; margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--bg); font: inherit; font-size: 16px; line-height: 1.6; caret-color: var(--blue); }
.sd-editor::selection { background: var(--blue-strong); color: var(--action-ink, #fff); }
.sd-storage { font-size: var(--type-label); margin: 10px 0; }
.sd-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 18px 0 0; }
.sd-actions > button { flex: 1 1 220px; min-height: 48px; }
.sd-workspace .text-button, .sd-workspace summary { min-height: 44px; }
.sd-workspace summary { padding: 12px 0; cursor: pointer; }
.sd-own-answer { white-space: pre-wrap; }
.sd-rubric-label { display: grid; gap: 8px; margin: 18px 0; line-height: 1.5; }
.sd-rubric-label select { min-height: 48px; width: 100%; color: var(--text); background: var(--bg); }
.sd-history-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.sd-panel > a { display: block; padding: 10px 0; overflow-wrap: anywhere; }
.sd-hints { margin: 24px 0; }
.busy { cursor: progress; }

.shell { width: min(100%, 820px); min-height: 100vh; margin: 0 auto; padding: 18px clamp(16px, 4vw, 34px) calc(98px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 28px; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand > span:last-child { display: flex; flex-direction: column; }
.brand strong { font-size: 17px; line-height: 1.15; }
.brand small { color: var(--tg-theme-hint-color, var(--muted)); font-size: 11px; margin-top: 2px; }
.mark { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 13px; background: linear-gradient(145deg, #477dcc, #284c81); font-weight: 900; letter-spacing: -1px; box-shadow: 0 8px 25px #08101e80; }
.mark span { color: #8dd5ff; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.connection, .level-pill { border: 1px solid var(--line); border-radius: 999px; color: var(--tg-theme-hint-color, var(--muted)); font-size: 11px; padding: 7px 10px; white-space: nowrap; }
.mini-profile { position: relative; isolation: isolate; flex: 0 0 43px; width: 43px; height: 43px; display: grid; place-items: center; overflow: hidden; border: 2px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, #263650, #101827); padding: 0; color: var(--text); font-size: 11px; font-weight: 900; cursor: pointer; box-shadow: inset 0 0 0 1px #ffffff0a, 0 7px 20px #050a1266; }
.mini-profile > span { position: relative; z-index: 2; }
.mini-profile:disabled { cursor: default; opacity: 1; }
.mini-profile { flex-basis: 44px; width: 44px; height: 44px; }
.mark, .mini-profile, .profile-avatar, .frame-choice .frame-preview { color: #f5f7fb; }

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(25px, 7vw, 38px); line-height: 1.12; letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 19px; }
.eyebrow { margin-bottom: 7px; color: var(--blue); font-size: 11px; font-weight: 850; letter-spacing: .13em; }
.muted, .instructions, .hero > p:last-child, .panel > p { color: var(--tg-theme-hint-color, var(--muted)); }
.hero { padding: 14px 2px 10px; }
.hero > p:last-child { max-width: 540px; line-height: 1.55; }
.home-hero { padding: 5px 2px 2px; }
.home-hero h1 { margin: 0; font-size: clamp(26px, 6vw, 34px); line-height: 1.2; overflow-wrap: anywhere; }
.section-label { margin: 0 0 5px; color: var(--muted); font-size: var(--type-note); font-weight: 600; letter-spacing: .01em; }
#home .muted { color: var(--muted); }

.panel { border: 1px solid var(--line); border-radius: 22px; background: var(--tg-theme-secondary-bg-color, var(--surface)); padding: clamp(20px, 5vw, 30px); box-shadow: 0 20px 70px #050a1240; }
#home .panel { box-shadow: none; }
.coding-entry { margin: 14px 0; }
.coding-entry > p { line-height: 1.5; color: var(--muted); }
.coding-entry #coding-availability { margin: 10px 0 0; font-size: var(--type-label); }
#coding { min-width: 0; }
.coding-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.coding-heading .text-button { min-height: 44px; }
#coding .text-button { min-height: 44px; }
.coding-heading .muted { font-size: var(--type-label); }
#coding h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.02em; }
#coding p, #coding li { line-height: 1.55; overflow-wrap: anywhere; }
#coding p { max-width: 72ch; }
#coding .muted, .coding-note { color: var(--muted); }
.coding-contract { margin: 20px 0; }
.coding-contract summary { min-height: 44px; padding: 10px 0; cursor: pointer; }
.coding-contract code { overflow-wrap: anywhere; }
.coding-label { display: block; margin: 20px 0 10px; font-weight: 600; }
.coding-editor { display: block; resize: vertical; width: 100%; min-height: 250px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); caret-color: var(--blue); font: 14px/1.6 ui-monospace, "Cascadia Code", Consolas, monospace; tab-size: 2; }
.coding-editor::selection { background: var(--blue-strong); color: var(--action-ink, #fff); }
.coding-size { text-align: right; font-size: var(--type-note); margin: 6px 0; font-variant-numeric: tabular-nums; }
.coding-storage { font-size: var(--type-label); color: var(--muted); }
.coding-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0 14px; align-items: stretch; }
.coding-actions .primary { margin: 0; }
.coding-actions button { min-height: 48px; }
.coding-note { font-size: var(--type-label); }
.coding-check { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.coding-check h2 { margin-bottom: 12px; }
.coding-check h3 { margin: 22px 0 10px; font-size: 16px; }
.coding-check > a { display: inline-block; min-height: 44px; padding: 12px 0; color: var(--blue); overflow-wrap: anywhere; }
.coding-check input[type="file"] { display: block; min-height: 44px; width: 100%; max-width: 100%; }
.coding-check button { min-height: 44px; }
#coding-check-package, #coding-check-report { min-height: 150px; font-size: 16px; }
#coding-check-status { min-height: 24px; margin: 12px 0; }
#coding-check-result { margin-top: 24px; }
#coding-check-result:empty { margin: 0; }
#coding-check-result .code-block { white-space: pre-wrap; overflow-wrap: anywhere; }
.coding-assistance { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.coding-assistance h2 { margin-bottom: 12px; }
#coding .code-block { overflow: auto; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); font: 14px/1.6 ui-monospace, "Cascadia Code", Consolas, monospace; white-space: pre-wrap; }
.coding-assistance a { display: inline-block; padding: 12px 12px 12px 0; color: var(--blue); }
.coding-assistance > div { margin-top: 18px; }
@media (max-width: 520px) { .coding-actions { grid-template-columns: 1fr; } #coding h1 { font-size: 24px; } }
.center { min-height: 320px; display: grid; place-content: center; justify-items: center; text-align: center; }
.center p { max-width: 440px; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--blue); border-radius: 50%; margin-bottom: 18px; animation: spin .9s linear infinite; }
.state-icon, .result-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; margin-bottom: 16px; background: var(--surface-2); color: var(--blue); font-size: 28px; font-weight: 800; }
.state-icon.success, .result-icon.correct { color: var(--green); background: #15382e; }
.result-icon.wrong { color: var(--red); background: #3e222a; }
.result-icon.retry { color: var(--amber); background: #3a3120; }

.next-action { display: grid; grid-template-columns: minmax(0, 1fr) minmax(210px, .85fr); gap: 18px 24px; align-items: center; margin: 20px 0 14px; border-color: color-mix(in srgb, var(--blue) 30%, var(--line)); background: color-mix(in srgb, var(--blue-strong) 7%, var(--surface)); }
.next-action h2 { font-size: 23px; line-height: 1.25; }
.next-action-copy p:last-child { margin: 7px 0 0; color: var(--muted); line-height: 1.45; }
.home-actions { display: grid; gap: 9px; }
.home-primary { margin-top: 0 !important; }
#open-settings { background: transparent; border-color: transparent; color: var(--blue); font-size: var(--type-label); font-weight: 650; }
.secondary { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); color: var(--text); padding: 10px 14px; font-weight: 750; cursor: pointer; }
.home-error { grid-column: 1 / -1; min-height: 0 !important; margin: -5px 0 0 !important; }
.home-error:empty { display: none; }
.reward-progress { width: 100%; min-height: 44px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 14px; border: 0; border-radius: 12px; background: transparent; margin: 0 0 18px; padding: 8px 4px; text-align: left; cursor: pointer; }
.reward-progress > div:first-child { min-width: 0; display: flex; flex-direction: column; }
.reward-progress strong { overflow: hidden; text-overflow: ellipsis; font-size: 13px; white-space: nowrap; }
.reward-label { margin-bottom: 3px; color: var(--muted); font-size: var(--type-note); }
.reward-progress > .muted { align-self: center; font-size: var(--type-note); }
.rewards-complete .reward-label { display: none; }
.rewards-complete strong { font-size: 12px; font-weight: 500; color: var(--muted); white-space: normal; }
.reward-track { grid-column: 1 / -1; height: 6px; overflow: hidden; border-radius: 99px; background: var(--surface-2); }
.reward-fill { width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue-strong), var(--green)); transform: scaleX(0); transform-origin: left; }
.reward-notice { display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid color-mix(in srgb, var(--green) 55%, var(--line)); border-radius: 17px; background: color-mix(in srgb, var(--green) 12%, var(--surface)); padding: 13px 15px; }
.reward-notice > div { display: flex; align-items: center; gap: 11px; }
.reward-notice > div > span { font-size: 22px; }
.reward-notice p { display: flex; flex-direction: column; margin: 0; }
.reward-notice small { margin-top: 2px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 18px 0 6px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); overflow: hidden; }
.stats article { min-width: 0; padding: 15px; display: flex; flex-direction: column; gap: 4px; }
.stats article + article { border-left: 1px solid var(--line); }
.stats strong { font-size: 23px; font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: var(--type-note); line-height: 1.4; }
.saved-trainings, .learning-route { margin-top: 14px; }
.daily-task { margin-top: 14px; }
.daily-task .section-heading { align-items: center; margin-bottom: 10px; }
.daily-task h2 { font-size: 17px; line-height: 1.35; }
.daily-task > p { margin-bottom: 12px; color: var(--muted); line-height: 1.5; }
.daily-task .secondary { width: auto; min-height: 44px; }
.daily-task .text-button { min-height: 44px; text-align: left; }
.daily-task .form-error { min-height: 0; margin: 10px 0 0; color: var(--text); }
.daily-details { color: var(--muted); font-size: var(--type-note); line-height: 1.5; }
.daily-details summary { min-height: 44px; padding: 12px 0; cursor: pointer; }
.daily-details p { margin-bottom: 8px; overflow-wrap: anywhere; }
.daily-details p:last-child { margin-bottom: 0; }
.saved-trainings .section-heading { align-items: center; }
.saved-trainings h2 { font-size: 17px; line-height: 1.35; }
.section-count { flex: 0 0 auto; display: grid; place-items: center; min-width: 27px; height: 27px; border-radius: 9px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.saved-training { width: 100%; min-height: 72px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; border: 0; border-radius: 12px; background: transparent; padding: 12px 4px; text-align: left; cursor: pointer; }
.saved-training + .saved-training { border-top: 1px solid var(--line); border-radius: 0; }
.saved-training-copy { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.saved-training-title { font-size: .9375rem; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.saved-training-detail { color: var(--muted); font-size: var(--type-note); line-height: 1.45; }
.saved-training-action { color: var(--blue); font-size: var(--type-note); font-weight: 650; }
.saved-training:disabled { cursor: default; }
.saved-training:disabled .saved-training-action { color: var(--muted); }
.learning-route .section-heading { align-items: center; }
.optional-label { color: var(--muted); font-size: var(--type-note); white-space: nowrap; }
.route-step { border-left: 2px solid color-mix(in srgb, var(--blue) 55%, var(--line)); padding: 2px 0 2px 12px; margin: 5px 0 16px; }
.route-step .section-label { font-size: var(--type-note); }
#learning-route-next { margin: 0; font-size: 15px; line-height: 1.45; }
#start-learning-route:not(:disabled) { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 35%, var(--line)); background: transparent; }
.route-details { margin-top: 6px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.route-details > summary, .map-explainer > summary { min-height: 44px; padding: 12px 0; cursor: pointer; color: var(--muted); font-size: var(--type-note); }
.route-details ol { padding-left: 20px; }
.route-details li + li { margin-top: 6px; }
.learning-route .form-error:empty { display: none; }
.map-explainer { margin-top: 14px; }
.map-explainer .skill-map-note { margin-top: 3px; }
.skill-map-panel { margin-top: 14px; overflow: hidden; }
.skill-map-layout { display: grid; grid-template-columns: minmax(230px, 1.15fr) minmax(190px, .85fr); gap: clamp(12px, 4vw, 30px); align-items: center; }
.skill-map-chart { width: 100%; max-width: 390px; margin: 0 auto; }
.skill-map-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.radar-ring, .radar-axis { fill: none; stroke: color-mix(in srgb, var(--line) 82%, transparent); }
.radar-ring { stroke-width: 1; }
.radar-axis { stroke-width: 1.15; }
.radar-evidence-area { fill: color-mix(in srgb, var(--amber) 7%, transparent); stroke: var(--amber); stroke-width: 1.7; stroke-dasharray: 5 4; stroke-linejoin: round; }
.radar-evidence-point { fill: var(--surface); stroke: var(--amber); stroke-width: 1.7; }
.radar-area { fill: color-mix(in srgb, var(--blue-strong) 25%, transparent); stroke: var(--blue); stroke-width: 2.2; stroke-linejoin: round; }
.radar-point { fill: var(--green); stroke: var(--surface); stroke-width: 2; }
.radar-label { fill: var(--text); font-size: 11px; font-weight: 750; }
.radar-value { fill: var(--muted); font-size: 9px; font-weight: 600; }
.radar-empty { fill: var(--muted); font-size: 11px; }
.skill-map-legend { display: grid; gap: 10px; }
.skill-legend-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 12px; align-items: center; }
.skill-legend-row strong { overflow: hidden; text-overflow: ellipsis; font-size: var(--type-label); white-space: nowrap; }
.skill-legend-row span { color: var(--muted); font-size: var(--type-note); font-variant-numeric: tabular-nums; }
.skill-legend-row .skill-legend-detail { grid-column: 1 / -1; white-space: normal; line-height: 1.35; }
.skill-composition { grid-column: 1 / -1; min-width: 0; font-size: 12px; line-height: 1.45; }
.skill-composition-list { padding-left: 18px; overflow-wrap: anywhere; }
.skill-composition .text-button { display: block; text-align: left; white-space: normal; }
.route-selection { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 12px; margin: 16px 0; }
.route-selection > div { min-width: 0; }
.route-selection label { display: block; margin-bottom: 6px; color: var(--muted); font-size: var(--type-note); }
.route-selection select { width: 100%; max-width: 100%; min-height: 44px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--text); font: inherit; }
#learning-route-title { margin: 0 0 12px; font-size: 16px; line-height: 1.4; }
.skill-legend-track { position: relative; grid-column: 1 / -1; height: 8px; overflow: hidden; border-radius: 99px; background: var(--surface-2); }
.skill-legend-evidence-fill, .skill-legend-fill { position: absolute; left: 0; height: 3px; border-radius: 99px; }
.skill-legend-evidence-fill { top: 0; background: color-mix(in srgb, var(--amber) 65%, var(--surface-2)); }
.skill-legend-fill { bottom: 0; background: linear-gradient(90deg, var(--blue-strong), var(--green)); }
.skill-map-key { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px 18px; margin-top: 7px; color: var(--muted); font-size: 11px; }
.skill-map-key span { display: inline-flex; align-items: center; gap: 6px; }
.skill-map-key i { display: inline-block; width: 17px; height: 8px; border-radius: 99px; }
.map-key-evidence { border: 1.5px dashed var(--amber); background: color-mix(in srgb, var(--amber) 8%, transparent); }
.map-key-confirmed { background: linear-gradient(90deg, var(--blue-strong), var(--green)); }
.skill-map-note { margin: 18px 0 0; color: var(--muted); font-size: var(--type-note); line-height: 1.45; }
.setup { margin-top: 14px; }
.setup > summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 52px; cursor: pointer; list-style: none; }
.setup > summary::-webkit-details-marker { display: none; }
.setup > summary > span:first-child { display: flex; min-width: 0; flex-direction: column; }
.setup > summary strong { font-size: 17px; }
.setup > summary .eyebrow { margin-bottom: 3px; }
.summary-hint { color: var(--blue); font-size: 12px; font-weight: 750; }
.setup[open] > summary { border-bottom: 1px solid var(--line); padding-bottom: 17px; }
.setup[open] .summary-hint { color: var(--muted); }
.setup-body { padding-top: 22px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-heading .eyebrow { margin-bottom: 3px; }
.setup-heading { margin-top: 28px; }
.text-button { border: 0; background: none; color: var(--tg-theme-link-color, var(--blue)); padding: 5px; cursor: pointer; }
.level-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 9px; margin-bottom: 10px; }
.level-card { position: relative; display: flex; flex-direction: column; gap: 3px; min-height: 70px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); padding: 12px; cursor: pointer; }
.level-card input { position: absolute; opacity: 0; pointer-events: none; }
.level-card:has(input:checked) { border-color: var(--blue); background: color-mix(in srgb, var(--blue-strong) 34%, var(--surface)); box-shadow: inset 0 0 0 1px var(--blue); }
.level-card:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 3px; }
.level-card.locked { opacity: .5; cursor: default; }
.level-number { font-size: 18px; font-weight: 850; }
.level-detail, .level-help { color: var(--muted); font-size: var(--type-note); }
.level-help { margin: 0 0 28px; line-height: 1.45; }
.chip-grid { display: flex; flex-wrap: wrap; gap: 9px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: block; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); padding: 10px 13px; font-size: var(--type-label); }
.chip input:checked + span { border-color: var(--blue); background: color-mix(in srgb, var(--blue-strong) 38%, var(--surface)); box-shadow: inset 0 0 0 1px var(--blue); }
.chip input:focus-visible + span, .answer-option:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 3px; }
.topics .chip span { padding: 8px 11px; font-size: 12px; }
.preset-list { display: grid; gap: 9px; }
.preset-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); padding: 12px 14px; }
.preset-card > div:first-child { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.preset-name { width: 100%; min-width: 0; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text); padding: 5px 7px; font-size: 13px; font-weight: 800; }
.preset-name:hover, .preset-name:focus { border-color: var(--line); background: color-mix(in srgb, var(--surface) 72%, transparent); }
.preset-name::placeholder { color: var(--muted); font-weight: 650; opacity: .85; }
.preset-card small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.preset-card.locked { opacity: .58; }
.preset-actions { display: flex; align-items: center; gap: 5px; }
.preset-actions .text-button { font-size: 11px; font-weight: 750; }
.preset-actions .text-button:disabled { color: var(--muted); cursor: default; }
.preset-status { min-height: 18px; margin: 8px 0 0; color: var(--green); font-size: 12px; }
.primary { width: 100%; min-height: 50px; border: 0; border-radius: 14px; margin-top: 20px; background: var(--tg-theme-button-color, var(--blue-strong)); color: var(--action-ink, var(--tg-theme-button-text-color, white)); font-weight: 800; cursor: pointer; }
.primary, .secondary, .saved-training { transition: transform var(--motion-press) var(--ease-out); }
.primary:not(:disabled):active:not(:focus-visible), .secondary:not(:disabled):active:not(:focus-visible), .saved-training:not(:disabled):active:not(:focus-visible) { transform: translateY(1px); }
.primary:focus-visible, .secondary:focus-visible, .saved-training:focus-visible { transition: none; transform: none; }
.primary:disabled { opacity: .55; cursor: default; box-shadow: none; }
.form-error, .error-text { color: var(--red); }
.form-error { min-height: 20px; margin: 12px 0 0; font-size: 13px; }
.topic-progress { margin: 28px 2px 0; }
.topic-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.topic-row div { display: flex; flex-direction: column; }
.topic-row small { margin-top: 3px; color: var(--muted); }

.session-head { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.icon-button { flex: 0 0 44px; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 25px; cursor: pointer; }
.session-progress { flex: 1; min-width: 0; }
.session-progress > div:first-child { display: flex; justify-content: space-between; color: var(--muted); font-size: var(--type-note); margin-bottom: 7px; }
.progress-track { height: 7px; overflow: hidden; border-radius: 99px; background: var(--surface-2); }
.progress-fill { width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue-strong), var(--green)); transform: scaleX(0); transform-origin: left; }
.question-card { border: 1px solid var(--line); border-radius: 22px; background: var(--tg-theme-secondary-bg-color, var(--surface)); padding: clamp(20px, 5vw, 31px); }
.question-meta { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 13px; color: var(--blue); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.question-card h1 { font-size: clamp(22px, 6vw, 31px); line-height: 1.23; }
.question-card pre { overflow: auto; margin: 18px 0; border: 1px solid #34435c; border-radius: 14px; background: #090f1b; padding: 15px; color: #d9e8ff; font: 13px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; }
.instructions { font-size: 13px; margin-bottom: 15px; }
.answer-list { display: grid; gap: 10px; }
.answer-option { position: relative; display: grid; grid-template-columns: 29px 1fr; gap: 11px; align-items: center; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); padding: 13px; cursor: pointer; }
.answer-option input { position: absolute; opacity: 0; }
.answer-marker { width: 27px; height: 27px; border: 1.5px solid #53627a; border-radius: 8px; background: #111a29; }
.answer-option:has(input[type="radio"]) .answer-marker { border-radius: 50%; }
.answer-option:has(input:checked) { border-color: var(--blue); background: color-mix(in srgb, var(--blue-strong) 28%, var(--surface)); }
.answer-option input:checked + .answer-marker { border: 7px solid var(--blue); background: white; }
.answer-text { line-height: 1.4; }
textarea { width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); color: var(--text); padding: 14px; }
textarea.code-answer { font-family: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, monospace; tab-size: 2; }
#short-answer[inputmode="numeric"] { box-sizing: border-box; width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); color: var(--text); padding: 14px; font-variant-numeric: tabular-nums; }
.explanation p.step-trace { white-space: pre-line; }
.bug-hunter { min-width: 0; margin: 0 0 18px; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
.bug-code-line { display: grid; grid-template-columns: 22px minmax(0, 1fr) 20px; gap: 8px; align-items: start; min-width: 0; padding: 6px 4px; }
.bug-line-number { color: var(--muted); text-align: right; font: 13px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; font-variant-numeric: tabular-nums; }
.bug-line-code { min-width: 0; color: var(--text); font: 13px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2; }
.bug-code-choice { min-height: 44px; align-items: center; margin: 3px 0; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.bug-code-choice input { width: 18px; height: 18px; margin: 0; accent-color: var(--blue); }
.bug-code-choice:has(input:checked) { border-color: var(--blue); background: color-mix(in srgb, var(--blue-strong) 16%, var(--bg)); }
.bug-code-choice:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.bug-code-choice:hover { border-color: var(--blue); }
.bug-code-choice:has(input:disabled) { cursor: wait; }

.matching-summary { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 13px; color: var(--muted); font-size: 12px; }
.matching-columns { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 12px; }
.match-column h2 { margin: 0 0 8px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
.match-option { width: 100%; min-height: 56px; display: flex; align-items: flex-start; gap: 9px; margin-bottom: 9px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); padding: 11px; text-align: left; cursor: pointer; }
.match-marker { flex: 0 0 25px; height: 25px; display: grid; place-items: center; border: 1px solid #53627a; border-radius: 7px; color: var(--muted); font-size: 11px; font-weight: 800; }
.match-option.selected { border-color: var(--blue); background: color-mix(in srgb, var(--blue-strong) 28%, var(--surface)); }
.match-option.selected .match-marker { background: var(--blue); color: #0a1423; }
.match-option.matched { opacity: .42; border-color: var(--green); }
.match-option.matched .match-marker { color: var(--green); border-color: var(--green); }

.feedback-card { max-width: 680px; margin: 0 auto; }
.feedback-card h1 { font-size: clamp(25px, 7vw, 36px); }
.card-report-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 12px; }
.card-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.share-button { min-height: 44px; padding: 8px; font-size: 14px; }
.share-status { margin: 0 0 12px; color: var(--muted); }
.share-message { display: block; line-height: 1.5; }
.share-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; }
.share-tools .text-button { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; text-align: left; }
.share-tools .text-button:disabled { color: var(--muted); cursor: default; }
.share-link { width: 100%; min-width: 0; min-height: 44px; margin-top: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--text); font-size: 14px; }
.share-status.error-text { color: var(--red); }
:root[data-theme="light"] .share-status.error-text,
:root[data-theme="light"] .challenge-entry .form-error { color: color-mix(in srgb, var(--red) 55%, #000); }
.challenge-entry { max-width: 640px; margin: 24px auto; }
.challenge-entry h1 { font-size: 26px; }
.challenge-entry p { line-height: 1.55; }
.challenge-entry .form-error:empty { display: none; }
.challenge-entry .secondary, #completed #back-home { margin-top: 12px; }
.card-number { color: var(--muted); font-size: 12px; letter-spacing: .06em; font-variant-numeric: tabular-nums; }
.report-button { display: grid; place-items: center; min-width: 44px; min-height: 44px; border: 0; border-radius: 12px; background: transparent; color: #ff777b; font-size: 23px; cursor: pointer; }
.report-button:hover, .report-button:focus-visible { background: #ff777b18; outline: 2px solid #ff777b80; }
.report-dialog { width: min(92vw, 560px); max-height: 90dvh; overflow: auto; color: var(--text); border: 1px solid var(--line); border-radius: 22px; background: var(--surface); padding: clamp(18px, 5vw, 28px); }
.report-dialog::backdrop { background: #050a12d9; backdrop-filter: blur(6px); }
.report-dialog label, .review-form label { display: block; margin: 18px 0 8px; font-size: 14px; }
.report-dialog select, .report-dialog textarea, .review-form select, .review-form textarea, .review-form input, .editorial-controls select { box-sizing: border-box; width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface-2); color: var(--text); font: inherit; }
/* Match Telegram's palette instead of depending on native OS control painting.
   Use a solid background rather than relying on color-mix() support here. */
select, #learning-section-select, #learning-route-select, .report-dialog select, .review-form select, .editorial-controls select {
  -webkit-appearance: none;
  appearance: none;
  background-color: var(--surface);
  color: var(--text);
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text) 50%), linear-gradient(135deg, var(--text) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}
select option, select optgroup { background-color: var(--surface); color: var(--text); }
@media (forced-colors: active) {
  select, #learning-section-select, #learning-route-select, .report-dialog select, .review-form select, .editorial-controls select {
    -webkit-appearance: menulist;
    appearance: auto;
    background-image: none;
  }
}
.report-dialog textarea, .review-form textarea { resize: vertical; }
.report-note { font-size: 12px; line-height: 1.5; }
.report-success { color: var(--green); line-height: 1.5; }
.editorial-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.editorial-controls select { flex: 1; min-width: 150px; }
.editorial-controls button { width: auto; margin: 0; }
.review-card { margin: 16px 0; overflow-wrap: anywhere; }
.review-card h2 { font-size: 18px; }
.review-card .muted { font-size: 12px; line-height: 1.5; }
.review-comment, .review-content p { white-space: pre-wrap; line-height: 1.6; }
.review-content { padding: 12px 0; border-block: 1px solid var(--line); }
.review-content summary { color: var(--blue); cursor: pointer; font-size: 13px; }
.review-content pre { overflow: auto; border-radius: 12px; padding: 12px; background: #090f1b; font-size: 12px; white-space: pre-wrap; }
.review-content h3 { margin-top: 16px; }
.review-reference-history pre { color: #d9e8ff; }
.tabbar.with-editorial { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tabbar.with-editorial .tab-button { flex-direction: column; gap: 2px; padding: 8px 2px; font-size: 11px; }
.statistics-table-wrap { overflow-x: auto; }
.statistics-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.statistics-table th, .statistics-table td { text-align: right; padding: 9px 5px; border-bottom: 1px solid var(--line); }
.statistics-table th:first-child, .statistics-table td:first-child { text-align: left; }
.statistics-values { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; }
.statistics-values dt { color: var(--muted); }
.statistics-values dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.answer-line { border-left: 3px solid var(--blue); padding: 3px 0 3px 12px; color: var(--muted); overflow-wrap: anywhere; }
.level-change { margin: 16px 0; border-radius: 12px; background: #203650; padding: 11px 13px; color: #bcd9ff; font-size: 13px; }
.explanation { margin-top: 23px; border-top: 1px solid var(--line); padding-top: 20px; }
.explanation h2 { margin-bottom: 8px; }
.explanation p { color: var(--muted); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.explanation a { color: var(--tg-theme-link-color, var(--blue)); text-decoration: none; }
.theory-button { margin-top: 20px; border-color: color-mix(in srgb, var(--amber) 55%, var(--line)); }
.theory-note { margin: 10px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.theory-dialog { position: fixed; z-index: 50; inset: 0; overflow-y: auto; background: #050a12d9; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); backdrop-filter: blur(8px); }
.theory-sheet { width: min(100%, 700px); margin: 0 auto; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); padding: clamp(20px, 5vw, 30px); box-shadow: 0 25px 90px #000a; }
.theory-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.theory-head > div { min-width: 0; }
.theory-head h1 { font-size: clamp(24px, 6vw, 34px); }
.theory-sheet section { margin-top: 23px; }
.theory-sheet section h2 { margin-bottom: 8px; font-size: 16px; }
.theory-sheet section p { margin-bottom: 0; color: var(--muted); line-height: 1.6; white-space: pre-wrap; }
.theory-sheet pre { overflow: auto; margin: 0; border: 1px solid #34435c; border-radius: 14px; background: #090f1b; padding: 15px; color: #d9e8ff; font: 13px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; }
.theory-mistake { border-left: 3px solid var(--amber); padding-left: 14px; }
.theory-sources { display: flex; flex-wrap: wrap; gap: 9px; }
.theory-sources a { border: 1px solid var(--line); border-radius: 10px; color: var(--blue); padding: 8px 10px; font-size: 12px; text-decoration: none; }
footer { display: grid; gap: 5px; margin-top: 30px; color: var(--tg-theme-hint-color, var(--muted)); font-size: 11px; text-align: center; }
footer a { color: var(--tg-theme-link-color, var(--blue)); overflow-wrap: anywhere; text-decoration: none; }

.achievements-hero { padding-bottom: 18px; }
.profile-card { display: flex; align-items: center; gap: 18px; }
.profile-avatar { position: relative; isolation: isolate; flex: 0 0 72px; width: 72px; height: 72px; display: grid; place-items: center; overflow: hidden; border: 3px solid var(--line); border-radius: 24px; background: linear-gradient(145deg, #263650, #101827); font-size: 20px; font-weight: 900; box-shadow: inset 0 0 0 1px #ffffff0a, 0 9px 28px #050a1255; }
.profile-avatar > span { position: relative; z-index: 2; }
.profile-avatar.frame-cpp_blue,
.mini-profile.frame-cpp_blue,
.frame-choice.frame-cpp_blue .frame-preview {
  border-color: transparent;
  background: linear-gradient(145deg, #173968, #0b172b 72%) padding-box,
              linear-gradient(135deg, #d5f2ff 0%, #65aaff 30%, #265fae 65%, #bce6ff 100%) border-box;
  box-shadow: inset 0 0 18px #3786df30, 0 8px 26px #2677d94d;
}
.profile-avatar.frame-cpp_blue::before,
.mini-profile.frame-cpp_blue::before,
.frame-choice.frame-cpp_blue .frame-preview::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 8%;
  border: 1px solid #b8e5ff73;
  border-radius: 26%;
  clip-path: polygon(0 0, 38% 0, 38% 4%, 4% 4%, 4% 38%, 0 38%, 0 0, 100% 0, 100% 38%, 96% 38%, 96% 4%, 62% 4%, 62% 0, 100% 0, 100% 100%, 62% 100%, 62% 96%, 96% 96%, 96% 62%, 100% 62%, 100% 100%, 0 100%, 0 62%, 4% 62%, 4% 96%, 38% 96%, 38% 100%, 0 100%);
}
.profile-avatar.frame-cpp_blue::after,
.mini-profile.frame-cpp_blue::after,
.frame-choice.frame-cpp_blue .frame-preview::after {
  content: "++";
  position: absolute;
  z-index: 3;
  right: 5%;
  bottom: 4%;
  border-radius: 4px;
  background: #89c6ff;
  padding: 1px 3px;
  color: #071729;
  font-size: 7px;
  font-weight: 950;
  letter-spacing: -1px;
}
.profile-avatar.frame-memory_green,
.mini-profile.frame-memory_green,
.frame-choice.frame-memory_green .frame-preview {
  border-color: transparent;
  background: radial-gradient(circle at 24% 24%, #a1ffd0 0 2px, transparent 2.5px),
              radial-gradient(circle at 76% 70%, #58dca0 0 2px, transparent 2.5px),
              linear-gradient(145deg, #153e35, #091d1b 72%) padding-box,
              linear-gradient(135deg, #b0ffda 0%, #45d693 35%, #177355 68%, #8cf4bd 100%) border-box;
  box-shadow: inset 0 0 18px #48d89a2b, 0 8px 26px #26976b45;
}
.profile-avatar.frame-memory_green::before,
.mini-profile.frame-memory_green::before,
.frame-choice.frame-memory_green .frame-preview::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 10%;
  border: 1px solid #84eeba66;
  border-radius: 24%;
  background: linear-gradient(90deg, transparent 47%, #64e6aa59 48% 52%, transparent 53%),
              linear-gradient(0deg, transparent 47%, #64e6aa59 48% 52%, transparent 53%);
}
.profile-avatar.frame-memory_green::after,
.mini-profile.frame-memory_green::after,
.frame-choice.frame-memory_green .frame-preview::after {
  content: "";
  position: absolute;
  z-index: 3;
  right: 8%;
  bottom: 8%;
  width: 14%;
  aspect-ratio: 1;
  border: 1px solid #b0ffda;
  border-radius: 2px;
  background: #42d391;
  box-shadow: -5px 0 0 -3px #b0ffda, 0 -5px 0 -3px #b0ffda;
}
.profile-copy { min-width: 0; }
.profile-copy h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-copy p { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 7px 0 0; color: var(--muted); }
#profile-badge { border: 1px solid color-mix(in srgb, var(--amber) 60%, var(--line)); border-radius: 999px; background: color-mix(in srgb, var(--amber) 13%, transparent); color: var(--amber); padding: 4px 8px; font-size: 10px; }
.achievements-panel { margin-top: 14px; }
.reward-list, .achievement-list { display: grid; gap: 10px; }
.reward-card, .achievement-card { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 12px; align-items: start; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-2); padding: 13px; }
.reward-icon, .achievement-icon { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); font-weight: 850; }
.reward-card.unlocked { border-color: color-mix(in srgb, var(--green) 48%, var(--line)); }
.reward-card.unlocked .reward-icon, .achievement-card.completed .achievement-icon { border-color: var(--green); background: #15382e; color: var(--green); }
.reward-card.planned { opacity: .7; }
.reward-card-copy, .achievement-card > div { min-width: 0; }
.reward-card strong, .achievement-card strong { display: block; font-size: 14px; }
.reward-card p, .achievement-card p { margin: 4px 0 6px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.reward-card small, .achievement-card small { color: var(--blue); font-size: 11px; }
.frame-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.frame-choice { position: relative; min-width: 0; display: grid; justify-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); padding: 13px 8px; cursor: pointer; text-align: center; }
.frame-choice input { position: absolute; opacity: 0; }
.frame-choice:has(input:checked) { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.frame-choice.locked { opacity: .48; cursor: default; }
.frame-choice .frame-preview { position: relative; isolation: isolate; width: 43px; height: 43px; display: grid; place-items: center; overflow: hidden; border: 2px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, #263650, #101827); font-size: 11px; font-weight: 900; box-shadow: inset 0 0 0 1px #ffffff0a; }
.frame-choice strong { overflow: hidden; max-width: 100%; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.frame-choice small { color: var(--muted); font-size: 10px; }
.achievement-track { height: 5px; overflow: hidden; margin: 8px 0 4px; border-radius: 99px; background: color-mix(in srgb, var(--line) 65%, transparent); }
.achievement-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue-strong), var(--green)); }
.tabbar { position: fixed; z-index: 20; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); width: min(calc(100% - 28px), 520px); display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; transform: translateX(-50%); border: 1px solid var(--line); border-radius: 18px; background: color-mix(in srgb, var(--surface) 94%, transparent); padding: 6px; box-shadow: 0 16px 45px #03070dcc; backdrop-filter: blur(14px); }
.tab-button { min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 7px; border: 0; border-radius: 13px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 750; cursor: pointer; }
.tab-button span { font-size: 18px; }
.tab-button svg { flex: 0 0 20px; width: 20px; height: 20px; }
.tab-button.active { background: color-mix(in srgb, var(--blue-strong) 30%, var(--surface)); color: var(--text); }

@media (hover: hover) and (pointer: fine) {
  #open-settings:hover, .saved-training:not(:disabled):hover, .reward-progress:hover { background: color-mix(in srgb, var(--blue) 7%, var(--surface)); }
}

@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 600px) {
  .brand small { display: none; }
  .connection { max-width: 108px; overflow: hidden; text-overflow: ellipsis; }
  .next-action { grid-template-columns: 1fr; }
  .home-error, .reward-progress { grid-column: 1; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats article { padding: 12px 10px; }
  .stats article:nth-child(3) { border-left: 0; }
  .stats article:nth-child(n+3) { border-top: 1px solid var(--line); }
  .stats strong { font-size: 21px; }
  .skill-map-panel > .section-heading { flex-direction: column; align-items: flex-start; gap: 8px; }
  #skill-map-total { font-size: 12px; }
  .skill-map-layout { grid-template-columns: 1fr; }
  .skill-map-chart { max-width: 350px; }
  .skill-map-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .matching-columns { grid-template-columns: 1fr; }
  .match-column + .match-column { margin-top: 6px; }
  .preset-card { grid-template-columns: 1fr; }
  .preset-actions { justify-content: flex-start; }
}
@media (max-width: 430px) {
  .connection { display: none; }
}
@media (max-width: 390px) {
  .skill-map-legend { grid-template-columns: 1fr; }
  .frame-list { grid-template-columns: 1fr; }
  .frame-choice { grid-template-columns: 43px minmax(0, 1fr) auto; justify-items: start; align-items: center; text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
  .primary:active, .secondary:active, .saved-training:active { transform: none !important; }
}
.reference-help { margin: 1rem 0; padding: 0.8rem; border: 1px solid var(--muted); border-radius: 12px; }
.reference-help summary { cursor: pointer; color: var(--blue); }
#reference-links { display: grid; gap: 0.5rem; margin-top: 0.7rem; }
#reference-links button { text-align: left; white-space: normal; overflow-wrap: anywhere; }
#saved-training-list { display: grid; }
#saved-training-list button { text-align: left; white-space: normal; overflow-wrap: anywhere; }
