:root{
  --bg:#f6f5f1;--surface:#ffffff;--surface-2:#efede7;--ink:#17191e;--muted:#5b616c;--faint:#8a8f98;
  --line:#e2dfd7;--accent:#2b45c4;--accent-ink:#ffffff;--accent-soft:#e9ecfb;--ok:#1d7a4f;--bad:#b3261e;
  --radius:10px;--radius-lg:16px;--shadow:0 1px 2px rgba(20,20,30,.06),0 4px 14px rgba(20,20,30,.05);
  --font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif;
  --mono:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;
  --glyph:"Cambria Math","STIX Two Math","Noto Sans Math","Segoe UI Symbol","Apple Symbols","DejaVu Sans",sans-serif;
  --wrap:1120px;
}
@media (prefers-color-scheme:dark){:root{
  --bg:#121317;--surface:#1a1c21;--surface-2:#22252b;--ink:#ecedf0;--muted:#a6abb5;--faint:#7c818b;
  --line:#2d3037;--accent:#8ea0ff;--accent-ink:#0f1222;--accent-soft:#232a4a;--ok:#5fd19a;--bad:#ff8a80;
  --shadow:0 1px 2px rgba(0,0,0,.4);
}}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.65 var(--font);}
a{color:var(--accent);text-underline-offset:2px}
img{max-width:100%;height:auto}
.wrap{max-width:var(--wrap);margin:0 auto;padding:0 20px}
.skip{position:absolute;left:-999px}.skip:focus{left:12px;top:12px;background:var(--surface);padding:8px 12px;z-index:9}
header.site{background:var(--surface);border-bottom:1px solid var(--line);position:sticky;top:0;z-index:20}
header.site .wrap{display:flex;align-items:center;gap:18px;min-height:60px}
.brand{display:flex;align-items:center;gap:10px;color:var(--ink);text-decoration:none;font-weight:700;letter-spacing:-.01em;white-space:nowrap}
.brand .mark{width:32px;height:32px;border-radius:8px;background:var(--ink);color:var(--bg);display:grid;place-items:center;font:700 20px/1 var(--glyph)}
nav.main{display:flex;gap:4px;margin-left:auto;overflow-x:auto;scrollbar-width:none}
nav.main::-webkit-scrollbar{display:none}
nav.main a{color:var(--muted);text-decoration:none;font-size:14.5px;padding:7px 10px;border-radius:8px;white-space:nowrap}
nav.main a:hover,nav.main a[aria-current=page]{color:var(--ink);background:var(--surface-2)}
.crumbs{font-size:13.5px;color:var(--faint);margin:18px 0 0}
.crumbs a{color:var(--muted);text-decoration:none}.crumbs a:hover{text-decoration:underline}
.hero{padding:28px 0 8px}
.hero h1{font-size:clamp(28px,4.2vw,44px);line-height:1.12;letter-spacing:-.02em;margin:6px 0 10px}
.hero p.lede{font-size:18px;color:var(--muted);max-width:70ch;margin:0 0 18px}
.quick{display:flex;flex-wrap:wrap;gap:12px;margin:8px 0 4px}
.qcopy{display:flex;align-items:center;gap:14px;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-lg);padding:12px 16px 12px 12px;cursor:pointer;box-shadow:var(--shadow);color:var(--ink);font:inherit;text-align:left}
.qcopy:hover{border-color:var(--accent)}
.qcopy .g{font:500 44px/1 var(--glyph);width:62px;height:62px;display:grid;place-items:center;background:var(--accent-soft);border-radius:12px;color:var(--ink)}
.qcopy b{display:block;font-size:15px}.qcopy small{color:var(--muted);font-size:13px}
.qcopy .btn{margin-left:10px}
.btn{display:inline-flex;align-items:center;gap:6px;background:var(--accent);color:var(--accent-ink);border:0;border-radius:8px;padding:8px 14px;font:600 14px/1.2 var(--font);cursor:pointer;text-decoration:none}
.btn.ghost{background:transparent;color:var(--ink);border:1px solid var(--line)}
.btn:hover{filter:brightness(1.07)}
.layout{display:grid;grid-template-columns:minmax(0,1fr) 280px;gap:36px;margin:22px 0 56px}
@media (max-width:920px){.layout{grid-template-columns:minmax(0,1fr)}}
main section{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-lg);padding:22px 24px;margin:0 0 18px}
main section>h2:first-child{margin-top:0}
h2{font-size:24px;line-height:1.25;letter-spacing:-.01em;margin:26px 0 10px}
h3{font-size:18px;margin:20px 0 6px}
p,li{max-width:76ch}
.muted{color:var(--muted)}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(92px,1fr));gap:10px;margin:12px 0}
.tile{background:var(--bg);border:1px solid var(--line);border-radius:12px;padding:10px 6px 8px;text-align:center;cursor:pointer;font:inherit;color:var(--ink);transition:transform .08s,border-color .12s}
.tile:hover{border-color:var(--accent);transform:translateY(-1px)}
.tile:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.tile{display:flex;flex-direction:column;align-items:center;justify-content:flex-start}.tile .g{display:block;font:400 34px/1.15 var(--glyph);height:42px}
.tile .n{display:block;font-size:11.5px;color:var(--muted);line-height:1.3;margin-top:4px;overflow:hidden;overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:8;-webkit-box-orient:vertical}
.tablewrap{overflow-x:auto;border:1px solid var(--line);border-radius:var(--radius);margin:12px 0}
table{border-collapse:collapse;width:100%;font-size:14.5px;background:var(--surface)}
th,td{padding:9px 12px;border-bottom:1px solid var(--line);text-align:left;vertical-align:top}
th{background:var(--surface-2);font-weight:600;white-space:nowrap}
tr:last-child td{border-bottom:0}
td.g{font:400 24px/1 var(--glyph);text-align:center;width:52px;cursor:pointer}
td code,p code,li code{font:13.5px var(--mono);background:var(--surface-2);padding:1px 6px;border-radius:5px;white-space:nowrap}
pre{background:#14161b;color:#e6e7ea;border-radius:var(--radius);padding:14px 16px;overflow-x:auto;font:13.5px/1.6 var(--mono)}
kbd{font:600 13px var(--mono);background:var(--surface);border:1px solid var(--line);border-bottom-width:2px;border-radius:6px;padding:1px 7px;white-space:nowrap}
.filter{width:100%;padding:11px 14px;border:1px solid var(--line);border-radius:10px;background:var(--bg);color:var(--ink);font:inherit}
.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:12px;margin:12px 0}
.card{border:1px solid var(--line);border-radius:12px;padding:14px 16px;background:var(--bg)}
.card h3{margin:0 0 6px;font-size:16px}
.card p,.card ul{margin:0;font-size:14.5px}
.card ul{padding-left:18px}
.note{border-left:3px solid var(--accent);background:var(--accent-soft);padding:10px 14px;border-radius:0 8px 8px 0;margin:14px 0}
.faq details{border-bottom:1px solid var(--line);padding:12px 0}
.faq details:last-child{border-bottom:0}
.faq summary{font-weight:600;cursor:pointer;list-style:none;display:flex;justify-content:space-between;gap:12px}
.faq summary::after{content:"+";color:var(--muted);font-weight:400}
.faq details[open] summary::after{content:"–"}
.faq details p{margin:8px 0 0;color:var(--muted)}
aside .box{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-lg);padding:16px 18px;margin:0 0 16px;position:sticky;top:80px}
aside h2{font-size:15px;margin:0 0 8px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted)}
aside ul{list-style:none;margin:0;padding:0}
aside li a{display:flex;gap:10px;align-items:center;padding:6px 0;text-decoration:none;color:var(--ink);font-size:14.5px}
aside li a:hover{color:var(--accent)}
aside li a span{font:18px/1 var(--glyph);width:22px;text-align:center;color:var(--muted)}
.tool{display:grid;gap:12px}
.row{display:flex;flex-wrap:wrap;gap:10px;align-items:end}
.field{display:flex;flex-direction:column;gap:4px;flex:1 1 150px}
.field label{font-size:13px;color:var(--muted);font-weight:600}
.field input,.field select{padding:10px 12px;border:1px solid var(--line);border-radius:9px;background:var(--bg);color:var(--ink);font:16px var(--font);min-width:0}
.result{border:1px dashed var(--line);border-radius:12px;padding:16px;background:var(--bg)}
.result .big{font:600 clamp(26px,4vw,38px)/1.2 var(--glyph);word-break:break-word}
.steps{margin:8px 0 0;padding-left:20px;color:var(--muted);font-size:14.5px}
.nl{width:100%;height:70px}
.stats{display:flex;gap:16px;flex-wrap:wrap}
.stats div{background:var(--bg);border:1px solid var(--line);border-radius:10px;padding:8px 14px;min-width:90px}
.stats b{display:block;font-size:22px}
.stats small{color:var(--muted)}
.ok{color:var(--ok)}.bad{color:var(--bad)}
.toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%) translateY(20px);background:var(--ink);color:var(--bg);padding:10px 16px;border-radius:999px;font-size:14px;opacity:0;pointer-events:none;transition:.18s;z-index:50}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}
footer.site{border-top:1px solid var(--line);background:var(--surface);padding:28px 0 36px;font-size:14px;color:var(--muted)}
footer.site .cols{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:20px}
footer.site h2{font-size:13px;text-transform:uppercase;letter-spacing:.06em;margin:0 0 8px;color:var(--ink)}
footer.site ul{list-style:none;margin:0;padding:0}
footer.site li{margin:4px 0}
footer.site a{color:var(--muted);text-decoration:none}footer.site a:hover{color:var(--ink)}
/* worksheet */
.sheet{background:#fff;color:#111;border:1px solid var(--line);border-radius:12px;padding:28px 32px}
.sheet h2{margin:0 0 4px;color:#111}
.sheet .meta{display:flex;justify-content:space-between;font-size:14px;margin:0 0 18px;color:#333}
.probs{display:grid;grid-template-columns:repeat(2,1fr);gap:16px 28px;font:22px/1.2 var(--font)}
.prob{display:flex;align-items:center;gap:12px}
.prob .n{font-size:13px;color:#777;width:22px}
.prob .a,.prob .b{min-width:84px;text-align:center}
.prob .box{width:40px;height:40px;border:2px solid #333;border-radius:50%;display:grid;place-items:center;font:600 22px var(--glyph);color:transparent}.sheet.show .prob .box{color:#c0392b}
.answers{display:none;margin-top:22px;font-size:14px;color:#444;border-top:1px dashed #bbb;padding-top:10px}.sheet.show .answers{display:block}
@media (max-width:560px){.probs{grid-template-columns:1fr}.sheet{padding:18px}.qcopy .g{width:52px;height:52px;font-size:36px}main section{padding:18px 16px}}
@media print{
  header.site,footer.site,aside,.noprint,.crumbs,.hero,.toast{display:none!important}
  body{background:#fff}.layout{display:block;margin:0}main section{border:0;padding:0}
  .sheet{border:0;padding:0}.sheet .prob .box,.sheet.show .prob .box{color:transparent}.sheet.key .prob .box{color:#c0392b}
}
@media print{.sheet:not(.key) .answers{display:none!important}.sheet.key .probs{display:none}.sheet.key .answers{display:block;border:0;font-size:18px;line-height:2}}
main{min-width:0}.layout>*{min-width:0}pre{max-width:100%;overflow-x:auto}code{overflow-wrap:anywhere}
html,body{overflow-x:clip}
@media print{main:has(#sheet) > section:not(:first-child),main:has(#sheet) .faq,main:has(#sheet) > section:first-child > h2{display:none!important}}
