@font-face { font-family: 'Vazirmatn'; src: url('/fonts/Vazirmatn.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #f2f5f4; --surface: #ffffff; --surface-2: #eaf0ee; --surface-3: #dfe7e4;
  --ink: #132120; --ink-2: #4a5755; --ink-3: #6f7c79; --line: #d3dcd8;
  --accent: #0d6e63; --accent-ink: #ffffff; --accent-2: #0a5148; --accent-soft: #d8eee9;
  --good: #1c7a3e; --good-bg: #e0f2e5; --good-mark: #0ca30c;
  --warn: #8a5a0b; --warn-bg: #fbefd6; --warn-mark: #fab219;
  --bad: #b4322a; --bad-bg: #fbe3df; --bad-mark: #d03b3b;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #6250d6;
  --seq-1: #cde2fb; --seq-2: #86b6ef; --seq-3: #3987e5; --seq-4: #1c5cab;
  --shadow: 0 1px 2px rgba(19, 33, 32, .06), 0 6px 20px rgba(19, 33, 32, .06);
  --radius: 14px; --radius-sm: 9px;
  --font: 'Vazirmatn', Tahoma, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1615; --surface: #172120; --surface-2: #1d2a28; --surface-3: #253533;
    --ink: #eaf2f0; --ink-2: #aebdb9; --ink-3: #85948f; --line: #2f403d;
    --accent: #3fbfab; --accent-ink: #062320; --accent-2: #6fd6c5; --accent-soft: #1b3a35;
    --good: #63c583; --good-bg: #173324; --warn: #e0ac53; --warn-bg: #3a2c14; --bad: #ef8f7f; --bad-bg: #3c1f19;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #9085e9;
    --seq-1: #1c3554; --seq-2: #1c5cab; --seq-3: #3987e5; --seq-4: #86b6ef;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1615; --surface: #172120; --surface-2: #1d2a28; --surface-3: #253533;
  --ink: #eaf2f0; --ink-2: #aebdb9; --ink-3: #85948f; --line: #2f403d;
  --accent: #3fbfab; --accent-ink: #062320; --accent-2: #6fd6c5; --accent-soft: #1b3a35;
  --good: #63c583; --good-bg: #173324; --warn: #e0ac53; --warn-bg: #3a2c14; --bad: #ef8f7f; --bad-bg: #3c1f19;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #9085e9;
  --seq-1: #1c3554; --seq-2: #1c5cab; --seq-3: #3987e5; --seq-4: #86b6ef;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); direction: rtl; line-height: 1.75; font-size: 15.5px; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.4; margin: 0 0 .5rem; text-wrap: balance; }
h1 { font-size: 1.45rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 800; }
h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.en { direction: ltr; unicode-bidi: isolate; font-family: var(--font); }
.mono { font-family: var(--mono); direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--ink-2); }
.small { font-size: .85rem; }
.tiny { font-size: .76rem; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- layout ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem; padding: .55rem 1rem; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; color: var(--ink); min-width: 0; }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 900; font-size: .8rem; flex: none; letter-spacing: -.02em; }
.brand .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .95rem; }
.topbar .spacer { flex: 1; }
.chip-xp { font-size: .8rem; padding: .2rem .6rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent-2); font-weight: 700; white-space: nowrap; }
.iconbtn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer; flex: none; }
.iconbtn:hover { border-color: var(--accent); }

main#view { max-width: 1080px; margin: 0 auto; padding: 1rem 1rem 6.5rem; }
.bottomnav { position: fixed; inset: auto 0 0 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding: .25rem .25rem calc(.25rem + env(safe-area-inset-bottom)); }
.bottomnav a { display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .35rem 0; color: var(--ink-2); font-size: .72rem; border-radius: 10px; text-decoration: none; }
.bottomnav a .i { font-size: 1.25rem; line-height: 1; }
.bottomnav a.on { color: var(--accent); font-weight: 800; background: var(--accent-soft); }
.bottomnav a.live-on .i { animation: pulse 1.2s infinite; }
@media (min-width: 900px) { .bottomnav { inset: auto 50% 1rem auto; transform: translateX(50%); width: 560px; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); } }

.grid { display: grid; gap: .85rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: .85rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card.soft { background: var(--surface-2); box-shadow: none; }
.card.link { cursor: pointer; transition: transform .15s, border-color .15s; display: block; color: inherit; text-decoration: none; }
.card.link:hover { transform: translateY(-2px); border-color: var(--accent); text-decoration: none; }
.card.locked { opacity: .55; }
.section-title { display: flex; align-items: baseline; gap: .6rem; margin: 1.4rem 0 .6rem; }
.section-title h2 { margin: 0; }
.section-title .muted { font-size: .85rem; }

.hero { background: linear-gradient(135deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 70%, #1c5cab) 100%); color: #fff; border-radius: 18px; padding: 1.2rem 1.25rem; position: relative; overflow: hidden; }
.hero h1 { color: #fff; margin-bottom: .2rem; }
.hero p { color: rgba(255, 255, 255, .88); margin: 0; }
.hero .btn { background: #fff; color: var(--accent-2); border-color: #fff; }
.hero::after { content: ''; position: absolute; inset: auto -40px -60px auto; width: 180px; height: 180px; border-radius: 50%; background: rgba(255, 255, 255, .09); }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); padding: .55rem 1rem; border-radius: 11px; font-weight: 700; cursor: pointer; text-decoration: none; transition: filter .15s, transform .05s; min-height: 42px; }
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.subtle { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.btn.small { padding: .3rem .7rem; min-height: 34px; font-size: .88rem; }
.btn.block { width: 100%; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
label.field { display: block; font-size: .86rem; font-weight: 700; color: var(--ink-2); }
input[type=text], input[type=tel], input[type=number], input[type=password], input:not([type]), select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: .55rem .7rem; outline: none; min-height: 42px;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input.num, input[type=number] { direction: ltr; text-align: center; font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 11px; padding: 3px; background: var(--surface-2); gap: 3px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: .35rem .75rem; border-radius: 8px; cursor: pointer; color: var(--ink-2); font-weight: 600; }
.seg button.on { background: var(--surface); color: var(--accent-2); box-shadow: var(--shadow); }
.tabs { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .2rem; margin-bottom: .9rem; scrollbar-width: thin; }
.tabs button { flex: none; border: 1px solid var(--line); background: var(--surface); padding: .4rem .85rem; border-radius: 999px; cursor: pointer; color: var(--ink-2); font-weight: 600; }
.tabs button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border-radius: 99px; transition: background .2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(-18px); }

/* ---------- badges, progress ---------- */
.badge { display: inline-flex; align-items: center; gap: .25rem; padding: .12rem .55rem; border-radius: 999px; font-size: .76rem; font-weight: 700; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.accent { background: var(--accent-soft); color: var(--accent-2); }
.bar { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.ring { --p: 0; width: 76px; height: 76px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-3) 0); display: grid; place-items: center; flex: none; }
.ring::before { content: attr(data-label); width: 60px; height: 60px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 800; font-size: .95rem; }
.hero .ring { background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255, 255, 255, .25) 0); }
.hero .ring::before { background: color-mix(in srgb, var(--accent) 80%, #000); color: #fff; }

.unit-card { display: flex; gap: .8rem; align-items: center; }
.unit-card .ic { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); display: grid; place-items: center; font-size: 1.35rem; flex: none; }
.unit-card .body { flex: 1; min-width: 0; }
.unit-card .t { font-weight: 800; font-size: .96rem; }
.unit-card .en { font-size: .76rem; color: var(--ink-3); }
.pill-fund { font-size: .68rem; padding: .05rem .45rem; border-radius: 99px; background: var(--warn-bg); color: var(--warn); font-weight: 800; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .6rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .65rem .8rem; }
.kpi .l { font-size: .75rem; color: var(--ink-2); font-weight: 700; }
.kpi .v { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; direction: ltr; text-align: right; }
.kpi .s { font-size: .74rem; }
.kpi.good { border-color: color-mix(in srgb, var(--good-mark) 50%, var(--line)); }
.kpi.bad { border-color: color-mix(in srgb, var(--bad-mark) 50%, var(--line)); }
.kpi.warn { border-color: color-mix(in srgb, var(--warn-mark) 60%, var(--line)); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { padding: .45rem .55rem; border-bottom: 1px solid var(--line); text-align: right; vertical-align: middle; }
th { background: var(--surface-2); font-size: .78rem; color: var(--ink-2); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: center; font-variant-numeric: tabular-nums; direction: ltr; }
td input { min-height: 34px; padding: .25rem .4rem; }
tr.crit td { background: color-mix(in srgb, var(--bad-mark) 9%, transparent); }

/* ---------- flashcards ---------- */
.flash-wrap { perspective: 1200px; max-width: 560px; margin: 0 auto; }
.flash { position: relative; min-height: 300px; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.2, .8, .2, 1); cursor: pointer; }
.flash.flipped { transform: rotateY(180deg); }
.flash .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 18px; padding: 1.3rem; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow-y: auto; }
.flash .front { align-items: center; justify-content: center; text-align: center; background: linear-gradient(160deg, var(--surface) 0%, var(--accent-soft) 100%); }
.flash .front .term { font-size: 1.6rem; font-weight: 800; direction: ltr; }
.flash .front .fa { font-size: 1.2rem; color: var(--ink-2); margin-top: .3rem; }
.flash .back { transform: rotateY(180deg); }
.flash .back .def { font-size: 1.02rem; }
.flash .back .den { direction: ltr; text-align: left; color: var(--ink-2); font-size: .9rem; border-top: 1px dashed var(--line); padding-top: .5rem; margin-top: .4rem; }
.flash .trap { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: .4rem .6rem; font-size: .86rem; margin-top: .5rem; }
.flash .ex { background: var(--surface-2); border-radius: 10px; padding: .4rem .6rem; font-size: .86rem; margin-top: .5rem; }
.grade-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: .45rem; max-width: 560px; margin: .9rem auto 0; }
.grade-btns button { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: .5rem .2rem; cursor: pointer; font-weight: 700; display: flex; flex-direction: column; align-items: center; font-size: .86rem; }
.grade-btns button small { font-weight: 500; color: var(--ink-3); font-size: .7rem; }
.grade-btns .again { border-color: color-mix(in srgb, var(--bad-mark) 50%, var(--line)); }
.grade-btns .easy { border-color: color-mix(in srgb, var(--good-mark) 50%, var(--line)); }

/* ---------- practice engines ---------- */
.pool { display: flex; flex-wrap: wrap; gap: .45rem; min-height: 48px; padding: .6rem; border: 1px dashed var(--line); border-radius: 12px; background: var(--surface-2); }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: .4rem .7rem; cursor: pointer; font-size: .9rem; line-height: 1.5; transition: transform .12s, border-color .12s, background .2s; user-select: none; touch-action: manipulation; }
.chip:hover { border-color: var(--accent); }
.chip.sel { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-2px); box-shadow: 0 0 0 3px var(--accent-soft); }
.chip.ok { border-color: var(--good-mark); background: var(--good-bg); color: var(--good); }
.chip.no { border-color: var(--bad-mark); background: var(--bad-bg); color: var(--bad); }
.chip.done { opacity: .5; pointer-events: none; }
.buckets { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.bucket { border: 2px dashed var(--line); border-radius: 14px; padding: .55rem; min-height: 96px; background: var(--surface); transition: border-color .15s, background .15s; cursor: pointer; }
.bucket.ready { border-color: var(--accent); background: var(--accent-soft); }
.bucket .h { font-weight: 800; font-size: .88rem; margin-bottom: .4rem; display: flex; justify-content: space-between; gap: .3rem; }
.bucket .h .en { font-weight: 500; color: var(--ink-3); font-size: .74rem; }
.bucket .items { display: flex; flex-wrap: wrap; gap: .35rem; }
.order-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.order-list li { display: flex; align-items: center; gap: .5rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .45rem .6rem; transition: transform .2s; }
.order-list li .n { width: 26px; height: 26px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; font-weight: 800; font-size: .8rem; flex: none; }
.order-list li .t { flex: 1; }
.order-list li.ok { border-color: var(--good-mark); background: var(--good-bg); }
.order-list li.no { border-color: var(--bad-mark); background: var(--bad-bg); }
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.match-col { display: grid; gap: .45rem; align-content: start; }
.match-col .chip { font-size: .84rem; }
.match-col .chip.left { font-weight: 700; }
.tf-card { text-align: center; padding: 1.6rem 1.2rem; font-size: 1.1rem; min-height: 170px; display: grid; place-items: center; }
.tf-btns { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.tf-btns button { min-height: 64px; font-size: 1.1rem; }
.timer-bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.timer-bar i { display: block; height: 100%; background: var(--accent); transition: width 1s linear; }

.opts { display: grid; gap: .5rem; }
.opt { text-align: right; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: .65rem .8rem; cursor: pointer; display: flex; gap: .55rem; align-items: flex-start; transition: border-color .15s, background .2s; }
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt .k { width: 26px; height: 26px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; font-weight: 800; flex: none; font-size: .82rem; }
.opt.ok { border-color: var(--good-mark); background: var(--good-bg); }
.opt.no { border-color: var(--bad-mark); background: var(--bad-bg); }
.opt:disabled { cursor: default; }
.opt.picked { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-soft); }
.explain { border-radius: 12px; padding: .65rem .8rem; background: var(--surface-2); border-inline-start: 4px solid var(--accent); font-size: .92rem; }
.q-en { direction: ltr; text-align: left; }

.result-banner { display: flex; gap: .8rem; align-items: center; padding: .9rem 1rem; border-radius: 14px; background: var(--accent-soft); }
.result-banner .big { font-size: 1.8rem; font-weight: 900; direction: ltr; }
.result-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.result-list li { display: flex; gap: .5rem; align-items: baseline; padding: .35rem .6rem; border-radius: 10px; background: var(--surface-2); font-size: .9rem; }
.result-list li.ok::before { content: '✓'; color: var(--good); font-weight: 900; }
.result-list li.no::before { content: '✗'; color: var(--bad); font-weight: 900; }
.result-list .exp { margin-inline-start: auto; font-size: .82rem; color: var(--ink-2); direction: ltr; }

/* ---------- puzzle ---------- */
.matrix { display: grid; gap: 3px; font-size: .72rem; }
.matrix .hd { font-weight: 800; color: var(--ink-2); padding: .2rem; text-align: center; background: var(--surface-2); border-radius: 6px; display: grid; place-items: center; min-height: 30px; }
.matrix .cell { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; min-height: 30px; display: flex; align-items: center; justify-content: center; gap: 2px; flex-wrap: wrap; padding: 2px; }
.matrix .cell .dot { width: 9px; height: 9px; border-radius: 3px; background: var(--surface-3); transition: background .3s, transform .3s; }
.matrix .cell .dot.on { background: var(--accent); transform: scale(1.15); }
.matrix .cell.flash { animation: cellflash .8s; }
.choice-grid { display: grid; gap: .4rem; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.choice-grid button { min-height: 44px; border: 1px solid var(--line); background: var(--surface); border-radius: 11px; cursor: pointer; font-weight: 700; font-size: .86rem; padding: .3rem; }
.choice-grid button:hover { border-color: var(--accent); }
.choice-grid button.ok { background: var(--good-bg); border-color: var(--good-mark); }
.choice-grid button.no { background: var(--bad-bg); border-color: var(--bad-mark); animation: shake .35s; }
.process-card { text-align: center; padding: 1.2rem; border-radius: 16px; background: linear-gradient(160deg, var(--surface), var(--accent-soft)); border: 1px solid var(--line); }
.process-card .en { font-size: 1.2rem; font-weight: 800; direction: ltr; }

/* ---------- live ---------- */
.live-opts { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.live-opt { min-height: 96px; border: 0; border-radius: 16px; color: #fff; font-weight: 800; font-size: 1rem; padding: .7rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; cursor: pointer; text-align: center; }
.live-opt .shape { font-size: 1.6rem; line-height: 1; }
.live-opt:nth-child(1) { background: #2a78d6; }
.live-opt:nth-child(2) { background: #c4521f; }
.live-opt:nth-child(3) { background: #13805a; }
.live-opt:nth-child(4) { background: #6250d6; }
.live-opt.dim { opacity: .35; }
.live-opt.chosen { outline: 4px solid var(--ink); outline-offset: 2px; }
.countdown { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 1.3rem; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-3) 0); position: relative; }
.countdown span { position: relative; z-index: 1; width: 50px; height: 50px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font); fill: var(--ink-2); font-size: 11.5px; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis line, .chart .axis path { stroke: var(--ink-3); }
.legend { display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .8rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 12px; height: 4px; border-radius: 2px; margin-inline-end: .35rem; vertical-align: middle; }
.tooltip { position: fixed; z-index: 100; pointer-events: none; background: var(--ink); color: var(--bg); border-radius: 9px; padding: .35rem .6rem; font-size: .8rem; box-shadow: var(--shadow); max-width: 260px; transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; }
.net-node rect { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; rx: 8; transition: stroke .3s, fill .3s; }
.net-node.crit rect { stroke: var(--bad-mark); stroke-width: 2.5; }
.net-node.active rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 3; }
.net-node text { fill: var(--ink); font-size: 11px; }
.net-node .id { font-weight: 900; font-size: 13px; }
.net-node .val { font-family: var(--mono); font-size: 10.5px; opacity: 0; transition: opacity .35s; }
.net-node .val.show { opacity: 1; }
.net-edge { fill: none; stroke: var(--ink-3); stroke-width: 1.6; }
.net-edge.crit { stroke: var(--bad-mark); stroke-width: 2.6; }
.net-edge-label { font-size: 9.5px; fill: var(--ink-2); font-family: var(--mono); }

/* ---------- misc ---------- */
.toast-wrap { position: fixed; z-index: 200; inset: 1rem 1rem auto 1rem; display: grid; justify-items: center; gap: .4rem; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: .55rem .9rem; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; animation: toastin .25s ease-out; pointer-events: auto; max-width: 520px; }
.toast.good { background: var(--good); color: #fff; }
.toast.bad { background: var(--bad); color: #fff; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--ink-2); }
.empty .i { font-size: 2.4rem; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 12px; min-height: 80px; }
.notice { padding: .6rem .8rem; border-radius: 12px; background: var(--warn-bg); color: var(--warn); font-size: .9rem; }
.notice.info { background: var(--accent-soft); color: var(--accent-2); }
.kbd { font-family: var(--mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 0 .35rem; font-size: .82rem; }
.footer-note { text-align: center; color: var(--ink-3); font-size: .74rem; margin-top: 2rem; }
.shake { animation: shake .35s; }
.pop { animation: pop .35s; }
canvas.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 300; }
details.box { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: .5rem .8rem; }
details.box summary { cursor: pointer; font-weight: 700; }
.qr { background: #fff; padding: 12px; border-radius: 14px; display: inline-block; line-height: 0; }
.qr svg { width: 100%; height: auto; }

@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes pop { 0% { transform: scale(.9); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes toastin { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes cellflash { 0% { background: var(--good-bg); } 100% { background: var(--surface); } }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadein .3s ease-out; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media print { .topbar, .bottomnav { display: none; } body { background: #fff; } }
