/* Programmatica Academy — brand theme (Programmatica.com guide: black / graphite,
   neon green #00FF00, blue #0000FF, fuchsia #FF00FF; PF Videotext Pro + Inter). */

@font-face { font-family: 'PF Videotext'; src: url('/fonts/PFVideotextPro-Reg.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/Inter-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/Inter-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/Inter-SemiBold.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/Inter-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --bg: #0a0a0a;
  --bg-2: #101010;
  --panel: #151515;
  --panel-2: #1c1c1c;
  --panel-3: #242424;
  --line: #2a2a2a;
  --line-2: #3a3a3a;
  --graphite: #525252;
  --ink: #ffffff;
  --ink-2: #c9c9c9;
  --ink-3: #8c8c8c;
  --green: #00ff00;
  --green-2: #3dff3d;
  --green-soft: rgba(0, 255, 0, .1);
  --green-line: rgba(0, 255, 0, .35);
  --blue: #0000ff;
  --blue-2: #7a7aff;
  --blue-soft: rgba(70, 70, 255, .16);
  --fuchsia: #ff00ff;
  --fuchsia-2: #ff5cff;
  --fuchsia-soft: rgba(255, 0, 255, .12);
  --green-text: var(--green);
  --green-text-2: var(--green-2);
  --red: #ff3b3b;
  --dot: rgba(255, 255, 255, .045);
  --topbar-bg: rgba(10, 10, 10, .82);
  --hero-bg: linear-gradient(120deg, #101010 0%, #151515 60%, #0f1a0f 100%);
  --btn-hover: #2c2c2c;
  --placeholder: #5f5f5f;
  --input-hover: #4a4a4a;
  --row-hover: #1a1f1a;
  --article-ink: #e6e6e6;
  --login-bg: #050505;
  --overlay: rgba(0, 0, 0, .7);
  --shadow: 0 10px 30px rgba(0, 0, 0, .5);
  --glow-g: 0 0 30px rgba(0, 255, 0, .45);
  --notch: 14px;
  --pixel: 'PF Videotext', 'Courier New', monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --t: .22s;
  color-scheme: dark;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); line-height: 1.55; min-height: 100vh;
  background-image:
    radial-gradient(circle at 1px 1px, var(--dot) 1px, transparent 0);
  background-size: 22px 22px;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--green); color: #000; }
a { color: var(--green-text); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--green-text-2); text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 400; }
h1 { font-family: var(--pixel); font-size: 30px; letter-spacing: .02em; text-transform: uppercase; }
h2 { font-family: var(--pixel); font-size: 19px; letter-spacing: .03em; text-transform: uppercase; }
h3 { font-size: 16px; font-weight: 600; }
.pixel { font-family: var(--pixel); text-transform: uppercase; letter-spacing: .04em; }
.green { color: var(--green-text); }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.split-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .split, .split-2-1 { grid-template-columns: 1fr; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ----- notched shapes (brand card with a stepped top-right corner) ----- */
.notch { clip-path: polygon(0 0, calc(100% - var(--notch)) 0, calc(100% - var(--notch)) var(--notch), 100% var(--notch), 100% 100%, 0 100%); }
.notch-sm { --notch: 8px; }

/* ----- pixel "×" mark from the guide ----- */
.px-x { display: inline-block; width: 15px; height: 15px; background:
  linear-gradient(currentColor, currentColor) 0 0 / 5px 5px no-repeat,
  linear-gradient(currentColor, currentColor) 10px 0 / 5px 5px no-repeat,
  linear-gradient(currentColor, currentColor) 5px 5px / 5px 5px no-repeat,
  linear-gradient(currentColor, currentColor) 0 10px / 5px 5px no-repeat,
  linear-gradient(currentColor, currentColor) 10px 10px / 5px 5px no-repeat; color: var(--graphite); }
.px-x.g { color: var(--green-text); } .px-x.f { color: var(--fuchsia); }
.px-arrows { display: inline-flex; gap: 6px; color: var(--graphite); font-family: var(--pixel); }
.px-arrows i:last-child { color: var(--green-text); }

/* ----------------------------- header ----------------------------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--topbar-bg); backdrop-filter: blur(12px) saturate(140%); border-bottom: 1px solid var(--line); }
.topbar .inner { max-width: 1240px; margin: 0 auto; padding: 0 24px; height: 64px; display: flex; align-items: center; gap: 22px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); white-space: nowrap; }
.brand:hover { text-decoration: none; color: var(--ink); }
.brand img { height: 15px; width: auto; display: block; }
.brand .tag { font-family: var(--pixel); font-size: 12px; color: #000; background: var(--green); padding: 3px 7px 2px; letter-spacing: .06em; }
.brand .tag.f { background: var(--fuchsia); }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav a { position: relative; padding: 8px 12px; color: var(--ink-3); font-weight: 500; white-space: nowrap; transition: color var(--t); }
.nav a::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; background: var(--green); transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease); }
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a.active { color: var(--ink); }
.nav a.active::after, .nav a:hover::after { transform: scaleX(1); }
.user-chip { display: flex; align-items: center; gap: 10px; color: var(--ink-2); }
.avatar { width: 34px; height: 34px; background: var(--panel-3); color: var(--green-text); display: grid; place-items: center; font-family: var(--pixel); font-size: 13px; flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.nav { flex-shrink: 0; }
@media (max-width: 1080px) {
  .topbar .inner { flex-wrap: wrap; height: auto; padding-top: 10px; row-gap: 4px; }
  .nav { order: 10; width: 100%; flex-shrink: 1; margin: 0 -12px; }
  .read-progress { top: 104px; }
}
@media (max-width: 760px) {
  .topbar .inner { padding: 10px 14px 0; gap: 12px; }
  .brand img { height: 11px; }
  .user-chip .name, .hide-sm { display: none !important; }
}

main { max-width: 1240px; margin: 0 auto; padding: 32px 24px 96px; }
@media (max-width: 760px) { main { padding: 22px 14px 80px; } }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.eyebrow { font-family: var(--pixel); font-size: 12px; color: var(--green-text); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 8px; display: flex; gap: 10px; align-items: center; }
.crumbs { font-size: 13px; color: var(--ink-3); margin-bottom: 10px; }
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--green-text); }

/* ----------------------------- surfaces ---------------------------- */
.panel { position: relative; background: var(--panel); border: 1px solid var(--line); padding: 22px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.notch { border: none; background: var(--panel); }
.panel h2 { margin-bottom: 14px; }
.panel-head { padding: 18px 22px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; }

.hero { position: relative; overflow: hidden; padding: 30px; margin-bottom: 22px; background: var(--hero-bg); border: 1px solid var(--line); }
.hero .glow { position: absolute; width: 380px; height: 380px; right: -120px; top: -160px; background: radial-gradient(circle, rgba(0, 255, 0, .18), transparent 65%); pointer-events: none; animation: drift 9s ease-in-out infinite alternate; }
.hero .glow.f { left: -140px; bottom: -220px; top: auto; right: auto; background: radial-gradient(circle, rgba(255, 0, 255, .12), transparent 65%); animation-duration: 12s; }
@keyframes drift { to { transform: translate(-40px, 30px) scale(1.1); } }
.hero .corner { position: absolute; top: 14px; right: 14px; }
.hero .corner-b { position: absolute; bottom: 14px; right: 14px; }

.module-card { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 22px; background: var(--panel); transition: transform .3s var(--ease), background var(--t); cursor: pointer; }
.module-card::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(135deg, var(--green-soft), transparent 45%); opacity: 0; transition: opacity var(--t); }
.module-card:hover { transform: translateY(-4px); background: var(--panel-2); }
.module-card:hover::before { opacity: 1; }
.module-card .num { width: 40px; height: 40px; background: var(--panel-3); color: var(--green-text); display: grid; place-items: center; font-family: var(--pixel); font-size: 17px; flex: none; transition: background var(--t), color var(--t); }
.module-card:hover .num { background: var(--green); color: #000; }
.module-card.locked { opacity: .55; cursor: default; }
.module-card.locked:hover { transform: none; }
.module-card h3 { font-size: 17px; margin: 0; }
.module-card .bar { margin-top: auto; }
.meta { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; background: var(--panel-3); color: var(--ink-2); font-size: 12.5px; }
.chip svg { width: 13px; height: 13px; }

.kpi { position: relative; padding: 18px 20px; background: var(--panel); }
.kpi .v { font-family: var(--pixel); font-size: 32px; line-height: 1.1; }
.kpi .l { font-size: 13px; color: var(--ink-3); margin-top: 6px; }
.kpi.g .v { color: var(--green-text); } .kpi.f .v { color: var(--fuchsia); } .kpi.b .v { color: var(--blue-2); }

/* ----------------------------- badges ------------------------------ */
.badge { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; letter-spacing: .01em; }
.badge::before { content: ''; width: 6px; height: 6px; background: currentColor; flex: none; }
.badge.ok { background: var(--green-soft); color: var(--green-text); }
.badge.bad { background: var(--fuchsia-soft); color: var(--fuchsia-2); }
.badge.warn { background: transparent; color: var(--fuchsia-2); box-shadow: inset 0 0 0 1px rgba(255, 0, 255, .45); }
.badge.info { background: var(--blue-soft); color: var(--blue-2); }
.badge.info::before { animation: blink 1.2s steps(2) infinite; }
.badge.none { background: var(--panel-3); color: var(--ink-3); }
.badge.plain::before { display: none; }
@keyframes blink { 50% { opacity: 0; } }

/* ----------------------------- buttons ----------------------------- */
.btn { --bg: var(--panel-3); --fg: var(--ink); position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-2); background: var(--bg); color: var(--fg); padding: 10px 18px; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; transition: transform .15s var(--ease), box-shadow .15s var(--ease), background var(--t), border-color var(--t), color var(--t); }
.btn:hover { text-decoration: none; color: var(--fg); border-color: var(--ink-3); background: var(--btn-hover); }
.btn:active { transform: translate(1px, 1px); }
.btn:focus-visible, .icon-btn:focus-visible, .option:focus-visible, a:focus-visible, .tab:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.btn.primary { --bg: var(--green); --fg: #000; border-color: var(--green); box-shadow: 4px 4px 0 0 var(--fuchsia); }
.btn.primary:hover { background: var(--green-2); border-color: var(--green-2); transform: translate(-1px, -1px); box-shadow: 6px 6px 0 0 var(--fuchsia); }
.btn.primary:active { transform: translate(3px, 3px); box-shadow: 0 0 0 0 var(--fuchsia); }
.btn.outline { --bg: transparent; border-color: var(--green-line); color: var(--green-text); }
.btn.outline:hover { background: var(--green-soft); border-color: var(--green); }
.btn.danger { --bg: transparent; --fg: var(--fuchsia-2); border-color: rgba(255, 0, 255, .35); }
.btn.danger:hover { background: var(--fuchsia-soft); border-color: var(--fuchsia); }
.btn.ghost { --bg: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--panel-3); color: var(--ink); }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.sm.primary { box-shadow: 3px 3px 0 0 var(--fuchsia); }
.btn.lg { padding: 14px 26px; font-size: 15px; }
.btn.block { width: 100%; }
.btn:disabled, .btn.loading { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn.loading::after { content: ''; width: 12px; height: 12px; background: currentColor; animation: pxspin .8s steps(4) infinite; }
@keyframes pxspin { 0% { clip-path: inset(0 50% 50% 0); } 25% { clip-path: inset(0 0 50% 50%); } 50% { clip-path: inset(50% 0 0 50%); } 75% { clip-path: inset(50% 50% 0 0); } }
.icon-btn { border: 1px solid var(--line-2); background: var(--panel-3); width: 32px; height: 32px; cursor: pointer; color: var(--ink-2); font-size: 14px; display: inline-grid; place-items: center; transition: background var(--t), color var(--t), border-color var(--t); }
.icon-btn:hover { background: var(--btn-hover); color: var(--green-text); border-color: var(--green-line); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.handle { cursor: grab; color: var(--ink-3); user-select: none; padding: 4px; font-family: var(--pixel); }
.handle:active { cursor: grabbing; }

/* ------------------------------ forms ------------------------------ */
label.field { display: block; }
label.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 7px; text-transform: uppercase; letter-spacing: .05em; }
label.field > small { display: block; color: var(--ink-3); font-size: 12.5px; margin-top: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line-2); padding: 10px 12px; font: inherit; background: var(--bg-2); color: var(--ink);
  transition: border-color var(--t), box-shadow var(--t); border-radius: 0;
}
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input:hover, select:hover, textarea:hover { border-color: var(--input-hover); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--green) 50%), linear-gradient(135deg, var(--green) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
textarea { resize: vertical; min-height: 90px; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.6; min-height: 560px; tab-size: 2; }
.check { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; padding: 4px 0; }
.check input { appearance: none; width: 18px; height: 18px; margin: 2px 0 0; border: 1px solid var(--line-2); background: var(--bg-2); display: grid; place-items: center; cursor: pointer; flex: none; transition: background var(--t), border-color var(--t); }
.check input::after { content: ''; width: 8px; height: 8px; background: #000; transform: scale(0); transition: transform .18s var(--ease); }
.check input:checked { background: var(--green); border-color: var(--green); }
.check input:checked::after { transform: scale(1); }
.check b { font-weight: 600; }
.switch { appearance: none; width: 40px; height: 22px; background: var(--panel-3); border: 1px solid var(--line-2); position: relative; cursor: pointer; flex: none; transition: background var(--t); }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; background: var(--ink-3); transition: transform .25s var(--ease), background var(--t); }
.switch:checked { background: var(--green-soft); border-color: var(--green); }
.switch:checked::after { transform: translateX(18px); background: var(--green); }
.matrix-check { appearance: none; width: 22px; height: 22px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; display: inline-grid; place-items: center; transition: background var(--t), border-color var(--t), transform .15s; }
.matrix-check::after { content: ''; width: 10px; height: 10px; background: #000; transform: scale(0); transition: transform .2s var(--ease); }
.matrix-check:checked { background: var(--green); border-color: var(--green); }
.matrix-check:checked::after { transform: scale(1); }
.matrix-check:active { transform: scale(.88); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 18px; }
.error-box { background: var(--fuchsia-soft); color: var(--fuchsia-2); padding: 11px 14px; font-size: 14px; animation: shake .4s; }
.search { position: relative; }
.search input { padding-left: 36px; }
.search::before { content: '⌕'; position: absolute; left: 12px; top: 50%; transform: translateY(-52%); color: var(--green-text); font-size: 18px; }

/* ------------------------------ tabs ------------------------------- */
.tabs { position: relative; display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; scrollbar-width: none; }
.tab { padding: 11px 16px; color: var(--ink-3); font-weight: 600; white-space: nowrap; transition: color var(--t); }
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.active { color: var(--green-text); }
.tabs .ink-bar { position: absolute; bottom: -1px; height: 2px; background: var(--green); transition: left .35s var(--ease), width .35s var(--ease); box-shadow: 0 0 12px var(--green); }

/* ------------------------------ tables ----------------------------- */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-family: var(--pixel); font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 400; background: var(--bg-2); }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--t); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--row-hover); }
tr.dragging { opacity: .35; }
tr.drop-target td { box-shadow: inset 0 2px 0 var(--green); }
.table-wrap { overflow-x: auto; }
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; position: sticky; left: 0; background: var(--panel); z-index: 1; }
.matrix th:first-child { background: var(--bg-2); }

/* ---------------------------- progress ----------------------------- */
.bar { height: 6px; background: var(--panel-3); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--green); transition: width .9s var(--ease); }
.bar.bad > i { background: var(--fuchsia); }
.bar.warn > i { background: linear-gradient(90deg, var(--green), var(--fuchsia)); }
.bar.blue > i { background: var(--blue-2); }
.bar.seg { height: 10px; background: repeating-linear-gradient(90deg, var(--panel-3) 0 8px, transparent 8px 10px); }
.bar.seg > i { -webkit-mask: repeating-linear-gradient(90deg, #000 0 8px, transparent 8px 10px); mask: repeating-linear-gradient(90deg, #000 0 8px, transparent 8px 10px); }
.read-progress { position: fixed; top: 64px; left: 0; height: 2px; background: var(--green); z-index: 19; width: 0; box-shadow: 0 0 10px var(--green); transition: width .1s linear; }

/* ----------------------------- article ----------------------------- */
.article { max-width: 820px; color: var(--article-ink); line-height: 1.72; font-size: 15.5px; }
.article h1 { font-size: 26px; color: var(--ink); }
.article h2 { font-size: 19px; margin-top: 2.2em; padding-top: .6em; color: var(--green-text); scroll-margin-top: 90px; }
.article h3 { font-size: 16.5px; margin-top: 1.6em; color: var(--ink); }
.article strong { color: var(--ink); }
.article code { background: var(--panel-3); padding: 2px 6px; font-size: 13.5px; color: var(--green-text); }
.article table { margin: 14px 0 22px; font-size: 14px; display: block; overflow-x: auto; border: 1px solid var(--line); }
.article th { font-family: var(--sans); text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.article td, .article th { border: 1px solid var(--line); vertical-align: top; }
.article blockquote { margin: 16px 0; padding: 14px 20px; background: var(--green-soft); border-left: 3px solid var(--green); color: var(--ink); }
.article blockquote p { margin: .35em 0; }
.article hr { border: none; height: 1px; margin: 40px 0; background: repeating-linear-gradient(90deg, var(--graphite) 0 6px, transparent 6px 12px); }
.article li { margin: 5px 0; }
.article li::marker { color: var(--green-text); }
.article img { max-width: 100%; }
.toc { position: sticky; top: 90px; font-size: 13.5px; max-height: calc(100vh - 110px); overflow: auto; }
.toc button { display: block; width: 100%; text-align: left; padding: 7px 12px; color: var(--ink-3); background: none; border: none; border-left: 2px solid var(--line); font: inherit; cursor: pointer; transition: color var(--t), border-color var(--t), background var(--t); }
.toc button:hover { color: var(--ink); background: var(--panel-2); }
.toc button.active { color: var(--green-text); border-left-color: var(--green); background: var(--green-soft); }
.layout-2 { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 28px; align-items: start; }
@media (max-width: 980px) { .layout-2 { grid-template-columns: 1fr; } .toc { display: none; } }

/* ------------------------------ exam ------------------------------- */
.exam { max-width: 800px; margin: 0 auto; }
.exam-head { display: flex; align-items: center; gap: 18px; margin-bottom: 8px; }
.ring { position: relative; width: 74px; height: 74px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; }
.ring .track { stroke: var(--panel-3); }
.ring .val { stroke: var(--green); stroke-linecap: butt; transition: stroke-dashoffset 1s linear, stroke .3s; filter: drop-shadow(0 0 6px rgba(0, 255, 0, .5)); }
.ring .num { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--pixel); font-size: 22px; }
.ring.low .val { stroke: var(--fuchsia); filter: drop-shadow(0 0 8px rgba(255, 0, 255, .7)); }
.ring.low .num { color: var(--fuchsia); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.question { font-size: 21px; font-weight: 600; margin: 22px 0 22px; line-height: 1.4; }
.options { display: grid; gap: 10px; }
.option { display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; padding: 15px 16px; border: 1px solid var(--line-2); cursor: pointer; background: var(--panel-2); color: var(--ink); font: inherit; font-size: 15px; transition: border-color var(--t), background var(--t), transform .18s var(--ease); animation: rise .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms + 120ms); }
.option:hover { border-color: var(--green-line); background: var(--row-hover); transform: translateX(3px); }
.option .key { width: 30px; height: 30px; background: var(--panel-3); display: grid; place-items: center; font-family: var(--pixel); font-size: 14px; flex: none; color: var(--ink-2); transition: background var(--t), color var(--t), transform .2s var(--ease); }
.option.selected { border-color: var(--green); background: var(--green-soft); }
.option.selected .key { background: var(--green); color: #000; transform: scale(1.08); }
.option.correct { border-color: var(--green); background: var(--green-soft); animation: flash-g .6s; }
.option.correct .key { background: var(--green); color: #000; }
.option.wrong { border-color: var(--fuchsia); background: var(--fuchsia-soft); animation: shake .4s; }
.option.wrong .key { background: var(--fuchsia); color: #000; }
.option:disabled { cursor: default; }
@keyframes flash-g { 0% { box-shadow: 0 0 0 0 rgba(0, 255, 0, .6); } 100% { box-shadow: 0 0 0 14px rgba(0, 255, 0, 0); } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.feedback { margin-top: 18px; padding: 15px 18px; animation: rise .35s var(--ease); }
.feedback.ok { background: var(--green-soft); border-left: 3px solid var(--green); }
.feedback.bad { background: var(--fuchsia-soft); border-left: 3px solid var(--fuchsia); }
.feedback.info { background: var(--blue-soft); border-left: 3px solid var(--blue-2); }
.steps { display: flex; gap: 3px; flex-wrap: wrap; }
.steps i { width: 10px; height: 10px; background: var(--panel-3); transition: background .3s; }
.steps i.done { background: var(--green); }
.steps i.wrong { background: var(--red); }
.steps i.now { background: var(--ink); animation: blink 1s steps(2) infinite; }

.result-hero { position: relative; overflow: hidden; text-align: center; padding: 44px 22px; }
.result-hero .score { font-family: var(--pixel); font-size: 88px; line-height: 1; margin: 18px 0 14px; }
.result-hero.pass .score { color: var(--green-text); text-shadow: var(--glow-g); }
.result-hero.fail .score { color: var(--fuchsia); text-shadow: 0 0 30px rgba(255, 0, 255, .35); }
.result-hero.prac .score { color: var(--blue-2); }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; }

.review-item { border: 1px solid var(--line); padding: 16px 18px; background: var(--panel); animation: rise .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
.review-item .opt { padding: 5px 0 5px 28px; position: relative; color: var(--ink-2); }
.review-item .opt::before { content: ''; position: absolute; left: 6px; top: 12px; width: 8px; height: 8px; background: var(--panel-3); }
.review-item .opt.is-correct { color: var(--green-text); font-weight: 600; }
.review-item .opt.is-correct::before { background: var(--green); }
.review-item .opt.is-wrong { color: var(--fuchsia-2); text-decoration: line-through; }
.review-item .opt.is-wrong::before { background: var(--fuchsia); }

/* ------------------------------ login ------------------------------ */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { position: relative; overflow: hidden; background: var(--login-bg); border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; padding: 44px; }
.login-art canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.login-art > * { position: relative; }
.login-art .claim { font-family: var(--pixel); font-size: clamp(28px, 3.6vw, 50px); line-height: 1.1; text-transform: uppercase; max-width: 560px; }
.login-art .claim em { font-style: normal; color: var(--green-text); }
.caret { display: inline-block; width: .55em; height: .9em; background: var(--green); vertical-align: -0.08em; margin-left: 4px; animation: blink 1s steps(2) infinite; }
.login-side { display: grid; place-items: center; padding: 28px; }
.login { width: 100%; max-width: 400px; animation: rise .6s var(--ease) both; }
@media (max-width: 900px) { .login-wrap { grid-template-columns: 1fr; } .login-art { min-height: 260px; padding: 28px; } }

/* -------------------------- modal & toast -------------------------- */
.modal-back { position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; z-index: 50; animation: fade .2s ease; }
.modal { background: var(--panel); border: 1px solid var(--line-2); width: 100%; max-width: 640px; max-height: 90vh; overflow: auto; box-shadow: 8px 8px 0 0 var(--green); animation: pop .28s var(--ease); }
.modal.wide { max-width: 880px; }
.modal header { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; position: sticky; top: 0; background: var(--panel); z-index: 1; }
.modal header h2 { margin: 0; font-size: 17px; }
.modal .body { padding: 22px; }
.modal footer { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; background: var(--panel); }
.modal-back.closing { animation: fade .18s ease reverse forwards; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes fade { from { opacity: 0; } }
#toast-root { position: fixed; bottom: 22px; right: 22px; display: grid; gap: 10px; z-index: 80; }
.toast { display: flex; gap: 10px; align-items: center; background: var(--panel-2); border: 1px solid var(--line-2); border-left: 3px solid var(--green); color: var(--ink); padding: 12px 16px; font-size: 14px; max-width: 400px; box-shadow: var(--shadow); animation: slide-in .35s var(--ease); }
.toast.err { border-left-color: var(--fuchsia); }
.toast.out { animation: slide-out .3s var(--ease) forwards; }
@keyframes slide-in { from { opacity: 0; transform: translateX(40px); } }
@keyframes slide-out { to { opacity: 0; transform: translateX(40px); } }

/* ---------------------------- motion ------------------------------ */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.view { animation: rise .45s var(--ease) both; }
.stagger > * { animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms); }
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.loader { display: flex; gap: 6px; justify-content: center; padding: 90px 0; }
.loader i { width: 12px; height: 12px; background: var(--green); animation: loader 1s infinite steps(1); }
.loader i:nth-child(2) { animation-delay: .15s; } .loader i:nth-child(3) { animation-delay: .3s; } .loader i:nth-child(4) { animation-delay: .45s; }
@keyframes loader { 0%, 100% { opacity: .15; } 30% { opacity: 1; } }
.glitch:hover { animation: glitch .35s steps(2) 1; }
@keyframes glitch { 0% { text-shadow: 2px 0 var(--fuchsia), -2px 0 var(--green); } 50% { text-shadow: -2px 0 var(--fuchsia), 2px 0 var(--green); transform: translateX(1px); } 100% { text-shadow: none; } }

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


/* ------------------------------ light theme ------------------------------ */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f4f1;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #f7f7f5;
  --panel-3: #ececea;
  --line: #e2e2de;
  --line-2: #cfcfca;
  --graphite: #a3a3a3;
  --ink: #0a0a0a;
  --ink-2: #3d3d3d;
  --ink-3: #6f6f6f;
  --green-soft: rgba(0, 200, 0, .12);
  --green-line: rgba(0, 160, 0, .45);
  --green-text: #008a00;
  --green-text-2: #006b00;
  --blue-2: #2b2bff;
  --blue-soft: rgba(0, 0, 255, .08);
  --fuchsia-2: #c000c0;
  --fuchsia-soft: rgba(255, 0, 255, .1);
  --red: #e01e1e;
  --dot: rgba(0, 0, 0, .07);
  --topbar-bg: rgba(255, 255, 255, .85);
  --hero-bg: linear-gradient(120deg, #ffffff 0%, #fafaf7 55%, #eefce9 100%);
  --btn-hover: #e2e2de;
  --placeholder: #a5a5a0;
  --input-hover: #b5b5af;
  --row-hover: #f1fbef;
  --article-ink: #1c1c1c;
  --login-bg: #ffffff;
  --overlay: rgba(20, 20, 20, .35);
  --shadow: 0 10px 30px rgba(0, 0, 0, .12);
  --glow-g: none;
}
:root[data-theme="light"] .btn.primary:hover { --bg: #3dff3d; }
:root[data-theme="light"] .module-card, :root[data-theme="light"] .kpi, :root[data-theme="light"] .panel.notch { box-shadow: 0 1px 0 var(--line); }
:root[data-theme="light"] .ring .val { filter: none; }
:root[data-theme="light"] .tabs .ink-bar { box-shadow: none; }
:root[data-theme="light"] .modal { box-shadow: 8px 8px 0 0 var(--green); }
:root[data-theme="light"] .option.selected .key, :root[data-theme="light"] .option.correct .key { color: #000; }
.logo-light { display: none !important; }
:root[data-theme="light"] .logo-dark { display: none !important; }
:root[data-theme="light"] .logo-light { display: block !important; }

/* theme toggle */
.theme-toggle { position: relative; width: 34px; height: 34px; border: 1px solid var(--line-2); background: var(--panel-3); cursor: pointer; display: grid; place-items: center; color: var(--ink-2); transition: background var(--t), border-color var(--t), transform .2s var(--ease); flex: none; }
.theme-toggle:hover { border-color: var(--green-line); color: var(--green-text); }
.theme-toggle:active { transform: scale(.92); }
.theme-toggle svg { width: 16px; height: 16px; transition: transform .5s var(--ease); }
.theme-toggle:hover svg { transform: rotate(45deg); }
html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after { transition: background-color .35s ease, color .35s ease, border-color .35s ease, fill .35s ease !important; }

/* ------------------------------ misc ------------------------------- */
.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.empty .px-x { display: block; margin: 0 auto 14px; }
.files { list-style: none; padding: 0; margin: 0; }
.files li { display: flex; gap: 14px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); transition: background var(--t); }
.files li:last-child { border-bottom: none; }
.files li.dragging { opacity: .35; }
.files li.drop-target { box-shadow: inset 0 2px 0 var(--green); }
.file-ico { width: 42px; height: 42px; background: var(--panel-3); color: var(--green-text); display: grid; place-items: center; font-family: var(--pixel); font-size: 11px; flex: none; }
.dropzone { display: block; border: 1px dashed var(--line-2); padding: 30px 18px; text-align: center; cursor: pointer; transition: border-color var(--t), background var(--t); background: var(--bg-2); }
.dropzone:hover, .dropzone.over { border-color: var(--green); background: var(--green-soft); }
.dropzone .big { font-family: var(--pixel); font-size: 15px; color: var(--green-text); text-transform: uppercase; display: block; margin-bottom: 6px; }
.q-card { transition: border-color var(--t), transform .2s var(--ease); }
.q-card:hover { border-color: var(--line-2); }
.q-card.dragging { opacity: .35; }
.q-card.drop-target { box-shadow: inset 0 3px 0 var(--green); }
.q-edit-opt { display: grid; grid-template-columns: 30px 1fr 32px; gap: 8px; align-items: center; margin-bottom: 8px; animation: rise .25s var(--ease); }
.q-edit-opt .ok-toggle { width: 30px; height: 30px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; color: transparent; font-weight: 700; transition: all var(--t); }
.q-edit-opt .ok-toggle.on { background: var(--green); border-color: var(--green); color: #000; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); }
.legend i { display: inline-block; width: 9px; height: 9px; margin-right: 6px; }
.stackbar { display: flex; height: 10px; gap: 2px; background: var(--panel-3); }
.stackbar span { display: block; height: 100%; transition: flex-grow .9s var(--ease); flex-grow: 0; }

/* FAQ */
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary { list-style: none; cursor: pointer; padding: 17px 22px; display: flex; gap: 14px; align-items: center; font-weight: 600; transition: background var(--t), color var(--t); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; margin-left: auto; font-family: var(--pixel); color: var(--green-text); font-size: 20px; transition: transform .3s var(--ease); }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item summary:hover { background: var(--panel-2); color: var(--green-text); }
.faq-item .faq-body { padding: 0 22px 20px 58px; color: var(--ink-2); line-height: 1.7; animation: rise .3s var(--ease); }
.faq-item .faq-body code { background: var(--panel-3); color: var(--green-text); padding: 1px 6px; font-size: 13px; }
.faq-item .faq-body pre { background: var(--bg-2); border: 1px solid var(--line); padding: 14px; overflow-x: auto; font-size: 12.5px; color: var(--ink-2); }
.faq-item .faq-body ol, .faq-item .faq-body ul { padding-left: 20px; }
.faq-n { font-family: var(--pixel); color: var(--ink-3); font-size: 13px; width: 22px; flex: none; }
.faq-cat { display: flex; gap: 10px; align-items: center; padding: 22px 22px 10px; font-family: var(--pixel); color: var(--green-text); text-transform: uppercase; letter-spacing: .06em; font-size: 13px; }
.kbd { display: inline-block; border: 1px solid var(--line-2); border-bottom-width: 2px; padding: 0 6px; font-size: 12px; font-family: ui-monospace, monospace; color: var(--ink-2); }
mark { background: var(--green); color: #000; }
textarea.code.drop-over { border-color: var(--green); background: var(--green-soft); box-shadow: 0 0 0 3px var(--green-soft); }
.seg-filter { display: flex; flex-wrap: wrap; gap: 2px; background: var(--panel-3); padding: 2px; }
.seg-filter button { border: none; background: transparent; color: var(--ink-3); font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 10px; cursor: pointer; transition: background var(--t), color var(--t); }
.seg-filter button b { font-family: var(--pixel); font-weight: 400; margin-left: 4px; }
.seg-filter button:hover { color: var(--ink); }
.seg-filter button.on { background: var(--panel); color: var(--green-text); box-shadow: 0 0 0 1px var(--line-2); }
