@font-face {
  font-family: 'Inter';
  src: url('fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: block;
}
:root {
  --bg: #1c1d20;
  --view: #141518;
  --bar: #232428;
  --side: #202125;
  --card: #27292d;
  --card-hi: #2c2e33;
  --line: #34363b;
  --line-soft: #2b2d31;
  --btn: #2f3136;
  --btn-hi: #383b41;
  --btn-line: #3c3f45;
  --text: #e6e4de;
  --text-strong: #ffffff;
  --muted: #b6b3ab;
  --faint: #99968f;
  --accent: #ff8a3d;
  --accent-hi: #ff9c59;
  --accent-ink: #1c1d20;
  --acc-rgb: 255,138,61;
  --mark: #ff8a3d;
  --field: #18191c;
  --danger: #ff6b5b;
  --radius: 8px;
  --bar-a: #26272b; --bar-b: #222327;
  --pop: #26272b;
  --thumb: #1a1b1e;
  --logo: #b9b6ae;
  --btn-active: #2a2c30;
  --pri-a: #ff9550; --pri-b: #fb8233; --pri-line: #ffa266; --pri-a-hi: #ffa063; --pri-b-hi: #ff8d43;
  --pri-dis-bg: #4a3a30; --pri-dis-ink: #8c7a6e;
  --scroll: #3a3c42; --scroll-hi: #4a4d54;
  --err: #ffb4a8; --ok: #9fe0a8; --devc: #ffd28a;
  --chip-text: #d4d1ca;
  --ptext: #d4d1ca;
  --track: #3a3c42; --knob: #d4d1ca;
  --placeholder: #8a877f;
  --scrim: rgba(20,21,24,.82);
  color-scheme: dark;
}
/* light look: purple accent */
:root[data-theme="light"] {
  --bg: #f2f1f6;
  --view: #e3e1eb;
  --bar: #ffffff;
  --side: #fbfafd;
  --card: #ffffff;
  --card-hi: #f7f4ff;
  --line: #d9d5e3;
  --line-soft: #e6e3ee;
  --btn: #ffffff;
  --btn-hi: #f2effa;
  --btn-line: #d3cee0;
  --text: #1e1b25;
  --text-strong: #000000;
  --muted: #4c4757;
  --faint: #67626f;
  --accent: #7a5fd0;
  --accent-hi: #6347c2;
  --accent-ink: #ffffff;
  --acc-rgb: 122,95,208;
  --mark: #7a5fd0;
  --field: #f7f6fb;
  --danger: #c2392b;
  --bar-a: #ffffff; --bar-b: #faf9fc;
  --pop: #ffffff;
  --thumb: #ecebf1;
  --logo: #6c6777;
  --btn-active: #ebe7f6;
  --pri-a: #8a70da; --pri-b: #7357cc; --pri-line: #6d52c6; --pri-a-hi: #957ce0; --pri-b-hi: #7d62d3;
  --pri-dis-bg: #ddd6f1; --pri-dis-ink: #8f86a8;
  --scroll: #c9c5d4; --scroll-hi: #b3aec2;
  --err: #c2392b; --ok: #1f7a36; --devc: #7a4f00;
  --chip-text: #3c3846;
  --ptext: #3a3644;
  --track: #cfcad9; --knob: #ffffff;
  --placeholder: #8b8696;
  --scrim: rgba(242,241,246,.86);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 13px/1.4 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  display: flex; flex-direction: column; overflow: hidden; user-select: none;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- top bar */
.bar {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; min-height: 52px;
  background: linear-gradient(var(--bar-a), var(--bar-b)); border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255,255,255,.02) inset, 0 2px 10px rgba(0,0,0,.25); position: relative; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; letter-spacing: -.01em; margin-right: 6px; font-size: 13.5px; }
.brand .logo { width: 24px; height: 24px; stroke: var(--logo); stroke-width: 2.4; }
.logo .acc, .art .acc { stroke: var(--accent); fill: rgba(var(--acc-rgb),.16); }
.logo .accf { fill: var(--accent); stroke: var(--accent); }
.bar > * { flex-shrink: 0; }
.bar > .fname { flex-shrink: 1; }
.fname { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 40px; max-width: 34vw; margin-left: 6px; }
.fname b { color: var(--text); font-weight: 600; }
.grow { flex: 1; }
.group { display: flex; align-items: center; gap: 6px; }
.group + .group { margin-left: 8px; padding-left: 12px; border-left: 1px solid var(--line-soft); }
.lbl { color: var(--muted); font-size: 13px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 32px; padding: 0 12px;
  background: var(--btn); border: 1px solid var(--btn-line); border-radius: 7px; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:hover { background: var(--btn-hi); }
.btn:active { transform: translateY(1px); background: var(--btn-active); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.icon { width: 32px; padding: 0; }
.btn.primary { background: linear-gradient(var(--pri-a), var(--pri-b)); color: var(--accent-ink); border-color: var(--pri-line); font-weight: 650; box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 2px 8px rgba(var(--acc-rgb),.18); }
.btn.primary:hover { background: linear-gradient(var(--pri-a-hi), var(--pri-b-hi)); }
.btn.primary:disabled { background: var(--pri-dis-bg); color: var(--pri-dis-ink); border-color: var(--pri-dis-bg); box-shadow: none; opacity: 1; }
.btn.big { height: 40px; padding: 0 18px; font-size: 14px; border-radius: 9px; }
.btn.big svg { width: 18px; height: 18px; }
.btn.ghostbtn { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghostbtn:hover { color: var(--text); background: var(--btn); }
.seg { display: flex; background: var(--field); border: 1px solid var(--btn-line); border-radius: 7px; padding: 2px; }
.seg button { width: 30px; height: 26px; border: 0; background: transparent; border-radius: 5px; cursor: pointer; color: var(--muted); font-weight: 650; font-size: 13px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--btn-hi); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.seg.tools button { width: auto; padding: 0 10px 0 8px; display: inline-flex; align-items: center; gap: 6px; height: 26px; font-size: 12.5px; }
.seg.tools svg { width: 15px; height: 15px; }
.seg.tools button.on { color: var(--accent-hi); }
#toolHint { background: var(--pop); border: 1px solid rgba(var(--acc-rgb),.6); color: var(--text); padding: 9px 14px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.3); pointer-events: auto; font-size: 14px; line-height: 1.4; max-width: 560px; }
#toolHint[hidden] { display: none; }
#toolHint b { color: var(--accent-hi); font-weight: 650; }
#toolHint span { color: var(--muted); }
.zl { width: 48px; text-align: center; font-variant-numeric: tabular-nums; color: var(--text); font-size: 13px; }

/* ---------------------------------------------------------------- layout */
main { flex: 1; display: flex; min-height: 0; }
#viewer { flex: 1; position: relative; min-width: 0; display: flex; flex-direction: column; background: var(--view); }
#scroller { flex: 1; overflow: auto; position: relative; outline: none; }
#scroller.panning { cursor: grabbing !important; }
#stack { position: relative; }
#splitter { width: 5px; margin: 0 -2px; cursor: col-resize; z-index: 3; position: relative; }
#splitter::after { content: ''; position: absolute; inset: 0 2px; background: var(--line); }
#splitter:hover::after, #splitter.drag::after { background: var(--accent); }
#side { width: 340px; min-width: 280px; max-width: 46vw; background: var(--side); display: flex; flex-direction: column; min-height: 0; }

/* scrollbars */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 6px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-hi); }
::-webkit-scrollbar-corner { background: transparent; }

/* ---------------------------------------------------------------- pages */
.page { position: absolute; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.5), 0 6px 22px rgba(0,0,0,.42); cursor: crosshair; }
.page canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; }
.page canvas.detail { width: auto; height: auto; }
.page .marks { position: absolute; inset: 0; pointer-events: none; }
.page.loading::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(-45deg, #f4f3ef 0 10px, #fbfaf7 10px 20px); }
.box {
  position: absolute; border: 1.8px solid var(--accent); border-radius: 3px; background: rgba(var(--acc-rgb),.13);
  transition: background .1s;
}
.box.hover, .box.sel { background: rgba(var(--acc-rgb),.24); }
.box.sel { border-width: 2.6px; box-shadow: 0 0 0 3px rgba(var(--acc-rgb),.22); }
.box .num {
  position: absolute; left: -1.8px; bottom: 100%; margin-bottom: 2px; min-width: 20px; height: 18px; padding: 0 6px;
  background: var(--accent); color: var(--accent-ink); border-radius: 4px; font: 700 12px/18px 'Inter', 'Segoe UI', sans-serif;
  text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.box.flip .num { bottom: auto; top: 2px; left: 2px; margin: 0; }
.box.pending { border-style: dashed; background: rgba(var(--acc-rgb),.08); animation: pend 1.1s ease-in-out infinite alternate; }
@keyframes pend { to { background: rgba(var(--acc-rgb),.2); } }
.arrows { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.arrows path { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 7 5; vector-effect: non-scaling-stroke; stroke-linecap: round; opacity: .9; }
.arrows path.sel { stroke-width: 2.8; opacity: 1; }
.arrows path.ahit { stroke: transparent; stroke-width: 16; stroke-dasharray: none; pointer-events: stroke; cursor: grab; opacity: 1; }
.arrows path.ahit:hover { stroke: rgba(var(--acc-rgb),.14); }
#scroller.snapped .arrows path.sel { stroke-dasharray: none; stroke-width: 3.2; }
.arrows polygon { fill: var(--accent); stroke: none; }
.band { position: absolute; border: 1.5px dashed var(--accent); background: rgba(var(--acc-rgb),.11); pointer-events: none; }
.phead {
  position: absolute; display: flex; align-items: center; gap: 8px; height: 30px; color: var(--muted); font-size: 12px;
}
.phead .t { color: var(--text); font-weight: 600; }
.phead button { height: 24px; padding: 0 8px; border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.phead button:hover { background: var(--btn); border-color: var(--btn-line); color: var(--text); }
.phead button svg { width: 14px; height: 14px; }
.colhint { position: absolute; left: 0; right: 0; text-align: center; color: var(--muted); font-size: 13px; }
.colhint b { color: var(--text); font-weight: 600; }
kbd { font: 600 11px 'Inter', sans-serif; background: var(--btn); border: 1px solid var(--btn-line); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; color: var(--text); }

/* ---------------------------------------------------------------- video */
#videoBar { display: flex; gap: 16px; padding: 14px 16px; background: var(--field); border-bottom: 1px solid var(--line); align-items: center; }
#videoBar[hidden] { display: none; }
#video { height: min(40vh, 380px); max-width: 68%; background: #000; border-radius: 8px; box-shadow: 0 6px 22px rgba(0,0,0,.45); }
.vside { display: flex; flex-direction: column; gap: 10px; max-width: 290px; }
.vside .btn { align-self: flex-start; }
.vside p { margin: 0; color: var(--muted); line-height: 1.5; }
.err { color: var(--err) !important; }

/* ---------------------------------------------------------------- start screen */
#empty { position: absolute; inset: 0; overflow: auto; display: flex; background:
  radial-gradient(1200px 600px at 50% -10%, rgba(var(--acc-rgb),.07), transparent 60%),
  radial-gradient(900px 500px at 85% 110%, rgba(120,140,255,.05), transparent 60%), var(--view); }
#empty[hidden] { display: none; }
.hero { margin: auto; padding: 40px 24px 48px; max-width: 720px; width: 100%; text-align: center; }
.hero h1 { font-size: 30px; line-height: 1.18; letter-spacing: -.025em; font-weight: 700; margin: 26px 0 12px; }
.hero .sub { color: var(--muted); font-size: 14.5px; line-height: 1.6; max-width: 540px; margin: 0 auto 26px; }
.cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.drop { color: var(--faint); font-size: 12.5px; margin: 14px 0 30px; }
.types { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; max-width: 620px; margin: 0 auto; }
.types span { padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.035); border: 1px solid var(--line-soft); color: var(--chip-text); font-size: 12.5px; }
.types span.win { border-style: dashed; }
.types .note { width: 100%; background: none; border: 0; color: var(--faint); font-size: 11.5px; padding-top: 4px; }
#recentWrap h3 { margin: 34px 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 600; }
.recent { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; text-align: left; max-width: 520px; margin: 0 auto; }
.recent button { min-width: 0; width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 12px; background: rgba(255,255,255,.025); border: 1px solid var(--line-soft); border-radius: 9px; cursor: pointer; text-align: left; }
.recent button:hover { background: var(--card); border-color: var(--line); }
.recent .ext { flex: none; width: 40px; height: 28px; border-radius: 6px; background: var(--btn-hi); color: var(--accent); font: 700 10px/28px 'Inter', sans-serif; text-align: center; letter-spacing: .03em; text-transform: uppercase; }
.recent .nm { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent .dir { color: var(--faint); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent .tx { min-width: 0; flex: 1; }
.recent .when { color: var(--faint); font-size: 11.5px; flex: none; }

/* the little picture on the start screen: a circuit with numbered boxes and a path */
.art { position: relative; width: 340px; max-width: 100%; margin: 0 auto -6px; }
.schem { width: 100%; height: auto; display: block; overflow: visible; }
.schem .ink { stroke: #34373d; stroke-width: 1.5; fill: none; }
.schem .amp { fill: #fffdf6; }
.schem .term { fill: #fbfaf6; }
.schem .dot { fill: #34373d; stroke: none; }
.schem text { stroke: none; fill: #55575e; font: 500 8px 'Inter', 'Segoe UI', sans-serif; }
.schem .pm { font-size: 10px; fill: #34373d; }
.schem .mk { fill: rgba(var(--acc-rgb),.15); stroke: var(--accent); stroke-width: 1.6; }
.schem .mkb, .schem .mka { fill: var(--accent); stroke: none; }
.schem .mkn { fill: var(--accent-ink); font: 800 7.5px 'Inter', sans-serif; text-anchor: middle; }
.schem .mkl { fill: #fff; stroke: var(--accent); stroke-width: 1.6; }
.schem .mkln { fill: var(--accent); font: 800 8px 'Inter', sans-serif; text-anchor: middle; }
.schem .mkp { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-dasharray: 4.5 3.5; stroke-linecap: round; }
.types span.hi { color: var(--text); border-color: rgba(var(--acc-rgb),.45); background: rgba(var(--acc-rgb),.07); }
.sub b { color: var(--text); font-weight: 600; }
.sub kbd { font-size: 11px; }

#dropHint { position: absolute; inset: 10px; border: 2px dashed var(--accent); border-radius: 14px; background: var(--scrim); display: flex; z-index: 20; pointer-events: none; }
#dropHint[hidden] { display: none; }
#dropHint div { margin: auto; font-size: 20px; font-weight: 650; color: var(--accent); }

/* ---------------------------------------------------------------- side panel */
.sidehead { padding: 14px 14px 8px; }
.sidehead h2 { margin: 0 0 4px; font-size: 14px; font-weight: 650; }
.hint { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
#cards { flex: 1; overflow: auto; padding: 6px 10px 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.nocards { margin: 18px 4px; padding: 18px 14px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; line-height: 1.6; font-size: 13.5px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 7px; transition: border-color .12s, background .12s; }
.card.sel { border-color: var(--accent); background: var(--card-hi); box-shadow: 0 0 0 1px rgba(var(--acc-rgb),.25); }
.card .top { display: flex; align-items: center; gap: 8px; }
.card .badge { min-width: 26px; height: 20px; padding: 0 6px; border-radius: 4px; background: var(--accent); color: var(--accent-ink); font-weight: 700; text-align: center; line-height: 20px; font-size: 12px; }
.card .where { color: var(--muted); font-size: 13px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .rm { width: 24px; height: 24px; border: 0; background: transparent; color: var(--faint); border-radius: 5px; cursor: pointer; display: grid; place-items: center; }
.card .rm:hover { color: var(--accent); background: rgba(255,255,255,.04); }
.card .rm svg { width: 15px; height: 15px; }
.card .thumb { display: grid; place-items: center; background: var(--thumb); border-radius: 5px; height: 200px; cursor: pointer; overflow: hidden; }
.card .thumb { gap: 6px; grid-auto-flow: column; }
.card .thumb canvas { max-width: 100%; max-height: 196px; display: block; border-radius: 2px; }
.card .chips { display: none; flex-wrap: wrap; gap: 5px; }
.card.sel .chips { display: flex; }
.chip { height: 24px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--btn-line); background: rgba(255,255,255,.03); color: var(--chip-text); font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.chip:hover { background: var(--btn-hi); color: var(--text); border-color: rgba(var(--acc-rgb),.45); }
/* symbols */
.symbar { position: relative; display: flex; align-items: center; gap: 6px; padding: 2px 10px 8px 14px; }
.pins { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.pinned { min-width: 30px; height: 28px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--btn-line); background: var(--btn); color: var(--text); font: 15px/1 'Segoe UI', 'Inter', sans-serif; cursor: pointer; }
.pinned:hover { background: var(--btn-hi); border-color: rgba(var(--acc-rgb),.5); }
.nopins { color: var(--muted); font-size: 13px; }
.btn.symbtn { height: 28px; padding: 0 9px; font-size: 12.5px; gap: 6px; }
.btn.symbtn.on { border-color: var(--accent); }
.symbtn .om { color: var(--accent-hi); font: 600 15px/1 'Segoe UI', sans-serif; }
.sympop { position: absolute; top: calc(100% - 2px); left: 10px; right: 10px; z-index: 30; background: var(--pop); border: 1px solid var(--btn-line); border-radius: 11px; padding: 10px; box-shadow: 0 18px 50px rgba(0,0,0,.55); display: flex; flex-direction: column; gap: 8px; animation: pop .12s ease-out; }
.sympop[hidden] { display: none; }
.sympop input { width: 100%; background: var(--field); border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; color: var(--text); font: 13px 'Inter', 'Segoe UI', sans-serif; outline: none; user-select: text; }
.sympop input:focus { border-color: var(--accent); }
.symgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 5px; max-height: min(330px, 46vh); overflow: auto; padding-right: 2px; }
.sym { position: relative; }
.sym .ch { width: 100%; height: 58px; border-radius: 7px; border: 1px solid var(--line-soft); background: rgba(255,255,255,.03); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 0 3px; }
.sym .ch:hover { background: var(--btn-hi); border-color: rgba(var(--acc-rgb),.45); }
.sym .ch span { font: 20px/1 'Segoe UI', 'Cambria Math', 'Inter', sans-serif; color: var(--text); }
.sym .ch small { font-size: 10px; color: var(--muted); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sym .pin { position: absolute; top: 1px; right: 2px; width: 18px; height: 18px; border: 0; background: none; color: var(--faint); cursor: pointer; font-size: 12px; line-height: 18px; padding: 0; border-radius: 4px; }
.sym .pin:hover { color: var(--accent-hi); }
.sym.on .pin { color: var(--accent); }
.sym.on .ch { border-color: rgba(var(--acc-rgb),.35); }
.nosym { grid-column: 1 / -1; color: var(--faint); padding: 14px; text-align: center; }
.symfoot { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.symfoot b { color: var(--accent); font-weight: 400; }
.symfoot code { background: var(--field); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; color: var(--text); font-size: 11px; }
/* hints-only switch */
.switch { display: flex; align-items: center; gap: 9px; cursor: pointer; padding: 4px 0 2px; color: var(--muted); font-size: 13.5px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { flex: none; width: 30px; height: 17px; border-radius: 999px; background: var(--track); position: relative; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; left: 2px; top: 2px; width: 13px; height: 13px; border-radius: 50%; background: var(--knob); transition: transform .15s, background .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(13px); background: #fff; }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(var(--acc-rgb),.3); }
.switch .tx b { color: var(--text); font-weight: 600; }
.switch .tx span { color: var(--muted); display: block; font-size: 12.5px; }
textarea.q, textarea {
  width: 100%; background: var(--field); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; color: var(--text);
  font: 15px/1.4 'Inter', 'Segoe UI', sans-serif; outline: none; user-select: text;
}
textarea::placeholder { color: var(--placeholder); }
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--acc-rgb),.12); }
.sidefoot { padding: 10px 14px 12px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 6px; }
.sidefoot label { color: var(--muted); font-size: 13.5px; }
.sidefoot label span { color: var(--faint); font-size: 12.5px; }
textarea { resize: none; height: 72px; }
textarea.q { height: 44px; min-height: 44px; overflow: hidden; line-height: 1.35; }
.sidefoot .btn { align-self: flex-start; margin-top: 2px; }

/* ---------------------------------------------------------------- busy, modal, toast */
#busy { position: fixed; inset: 0; background: rgba(12,13,15,.55); backdrop-filter: blur(2px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; z-index: 40; font-size: 14px; }
#busy[hidden] { display: none; }
.spin { width: 30px; height: 30px; border-radius: 50%; border: 3px solid rgba(var(--acc-rgb),.2); border-top-color: var(--accent); animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
#modalBack { position: fixed; inset: 0; background: rgba(10,11,13,.6); display: flex; z-index: 50; animation: fade .12s ease-out; }
#modalBack[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
#modal { margin: auto; width: min(500px, calc(100vw - 32px)); background: var(--pop); border: 1px solid var(--btn-line); border-radius: 12px; padding: 20px 22px 18px; box-shadow: 0 20px 60px rgba(0,0,0,.55); animation: pop .14s ease-out; user-select: text; }
@keyframes pop { from { transform: translateY(6px) scale(.98); opacity: 0; } }
#modal h3 { margin: 0 0 10px; font-size: 16px; font-weight: 650; }
#modal p { margin: 0 0 10px; color: var(--ptext); line-height: 1.55; }
#modal ol { margin: 0 0 12px; padding-left: 20px; line-height: 1.8; color: var(--ptext); }
#modal ol b { color: var(--text); }
#modal ol i { color: var(--text); font-style: normal; background: var(--field); border: 1px solid var(--line); padding: 1px 6px; border-radius: 4px; }
#modal .row { display: flex; gap: 8px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
#modal .row .grow { flex: 1; }
#modal a { color: var(--accent-hi); cursor: pointer; text-decoration: none; }
#modal a:hover { text-decoration: underline; }
#modal .links { color: var(--muted); font-size: 12.5px; }
#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--pop); border: 1px solid var(--btn-line); color: var(--text); padding: 10px 16px; border-radius: 9px; box-shadow: 0 10px 30px rgba(0,0,0,.45); z-index: 60; max-width: min(560px, calc(100vw - 32px)); line-height: 1.45; animation: pop .14s ease-out; }
#toast[hidden] { display: none; }

/* ---------------------------------------------------------------- Box / Path buttons, info tip, handles, AI text */
.dock { position: absolute; top: 12px; left: 14px; z-index: 6; display: flex; align-items: flex-start; gap: 10px; pointer-events: none; max-width: calc(100% - 28px); }
.dock > * { pointer-events: auto; }
.dock .tools { flex: none; display: flex; gap: 4px; padding: 4px; background: var(--pop); border: 1px solid var(--btn-line); border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.3); }
.dock .tools button { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--text); font: 600 15px 'Inter', 'Segoe UI', sans-serif; cursor: pointer; }
.dock .tools button svg { width: 20px; height: 20px; }
.dock .tools button:hover { background: var(--btn-hi); }
.dock .tools button.on { background: var(--accent); color: var(--accent-ink); box-shadow: 0 2px 8px rgba(var(--acc-rgb),.3); }
.dock #toolHint b { color: var(--text-strong); }
.tipwrap { position: relative; display: inline-flex; align-items: center; gap: 6px; cursor: help; outline: none; }
.info { width: 17px; height: 17px; border-radius: 50%; border: 1.5px solid var(--muted); color: var(--muted); font: italic 700 11px/14px Georgia, 'Times New Roman', serif; text-align: center; flex: none; }
.tipwrap:hover .info, .tipwrap:focus .info { border-color: var(--accent); color: var(--accent-hi); }
.tip { display: none; position: absolute; top: calc(100% + 12px); left: 50%; transform: translateX(-50%); width: 280px; background: var(--pop); border: 1px solid var(--btn-line); border-radius: 10px; padding: 10px 13px; box-shadow: 0 12px 34px rgba(0,0,0,.35); color: var(--ptext); font-size: 13.5px; line-height: 1.5; z-index: 30; white-space: normal; cursor: default; }
.tip b { color: var(--text); }
.tipwrap:hover .tip, .tipwrap:focus .tip { display: block; }
.box .hdl { position: absolute; width: 10px; height: 10px; background: var(--pop); border: 2px solid var(--accent); border-radius: 2px; }
.box .hdl.nw { left: -6px; top: -6px; } .box .hdl.ne { right: -6px; top: -6px; }
.box .hdl.sw { left: -6px; bottom: -6px; } .box .hdl.se { right: -6px; bottom: -6px; }
.footbtns { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.sidefoot .footbtns .btn { margin-top: 0; }
#modal:has(.aitext) { width: min(680px, calc(100vw - 32px)); }
.aitext { max-height: 58vh; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 22px 26px; font: 14px/1.5 Arial, 'Liberation Sans', sans-serif; user-select: text; }
#modal .aitext p { color: #161616; margin: 0 0 10px; }
.aitext h4 { color: #111; margin: 14px 0 6px; font-size: 16px; }
.aitext h4.big { font-size: 20px; margin-top: 0; }

/* ---------------------------------------------------------------- paths: lettered arrows between boxes */
.plabel { position: absolute; transform: translate(-50%, -50%); width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 2px solid var(--accent); background: #fff; color: var(--accent); font: 800 12px/18px 'Inter', 'Segoe UI', sans-serif; text-align: center; pointer-events: auto; cursor: grab; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.plabel:hover, .plabel.sel { background: var(--accent); color: var(--accent-ink); }
.pdel { position: absolute; transform: translate(14px, -26px); width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 1px solid #d8d4cc; background: #fff; color: #d23b2b; pointer-events: auto; cursor: pointer; display: grid; place-items: center; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.pdel svg { width: 13px; height: 13px; stroke-width: 2.4; }
.pdel:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.aend { position: absolute; width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 2.5px solid var(--accent); transform: translate(-50%, -50%); pointer-events: auto; cursor: move; box-shadow: 0 1px 4px rgba(0,0,0,.35); transition: transform .08s; }
.aend:hover { transform: translate(-50%, -50%) scale(1.3); background: var(--accent); }
.arrows path.rubber { stroke-dasharray: 4 5; opacity: .75; }
.arrows path.rubber.locked { stroke-dasharray: none; opacity: 1; stroke-width: 2.6; }
.arrows polygon.rubber { opacity: .75; }
.box.pending { border-style: dashed; animation: pend 1.1s ease-in-out infinite alternate; }
.box.target { border-width: 3px; box-shadow: 0 0 0 4px rgba(var(--acc-rgb),.3); background: rgba(var(--acc-rgb),.22); }
.box .away { position: absolute; right: -2px; bottom: 100%; margin-bottom: 2px; height: 18px; padding: 0 6px; border-radius: 9px; border: 1.5px solid var(--accent); background: #fff; color: var(--accent); font: 800 11px/15px 'Inter', 'Segoe UI', sans-serif; white-space: nowrap; }
.cardhead { margin: 10px 2px 0; font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; }
.cardhead span { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--faint); }
.card .badge.pbadge { border-radius: 50%; min-width: 22px; width: 22px; padding: 0; background: var(--pop); color: var(--accent-hi); border: 2px solid var(--accent); line-height: 18px; }
.card.pathcard.sel .badge.pbadge { background: var(--accent); color: var(--accent-ink); }
.btn.dangerbtn { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.dangerbtn:hover { background: rgba(255,107,91,.12); }
.btn.dangerbtn:disabled { opacity: .45; }
#modal { position: relative; }
.mclose { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; padding: 0; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.mclose svg { width: 18px; height: 18px; }
.mclose:hover { background: var(--btn-hi); color: var(--text); border-color: var(--btn-line); }
#modal h3 { padding-right: 34px; }

/* ---------------------------------------------------------------- X on every pop-up */
.pclose { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; padding: 0; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; z-index: 2; }
.pclose svg { width: 16px; height: 16px; }
.pclose:hover { background: var(--btn-hi); color: var(--text); border-color: var(--btn-line); }
.helppop, .sympop { padding-right: 40px !important; }
.sympop { position: absolute; }
.tip { padding-right: 38px !important; }
.tipwrap.shut .tip { display: none !important; }
#toast { padding-right: 44px; }
#toast .pclose { top: 50%; transform: translateY(-50%); right: 8px; }

/* ---------------------------------------------------------------- chains, shortcut keys, path help */
.dock .tools { align-items: center; }
.dock .tools button kbd { font-size: 11px; padding: 0 5px; margin-left: 2px; opacity: .8; background: transparent; border-color: currentColor; color: inherit; }
.dock .tools button.on kbd { border-color: rgba(0,0,0,.35); }
:root[data-theme="light"] .dock .tools button.on kbd { border-color: rgba(255,255,255,.6); }
.dock .tools .itoggle { width: 22px; height: 22px; margin: 0 6px 0 4px; padding: 0; border-radius: 50%; border: 1.5px solid var(--muted); color: var(--muted); background: transparent; font: italic 700 12px/19px Georgia, 'Times New Roman', serif; text-align: center; cursor: pointer; display: inline-block; }
.dock .tools .itoggle:hover { border-color: var(--accent); color: var(--accent-hi); background: transparent; }
.dock .tools .itoggle.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.helppop { position: absolute; top: 66px; left: 14px; z-index: 7; width: min(400px, calc(100% - 28px)); background: var(--pop); border: 1px solid var(--btn-line); border-radius: 12px; padding: 14px 16px 12px; box-shadow: 0 14px 40px rgba(0,0,0,.4); color: var(--ptext); font-size: 14px; line-height: 1.5; }
.helppop[hidden] { display: none; }
.helppop p { margin: 0 0 6px; }
.helppop p:last-of-type { margin-bottom: 0; }
.helppop ol { margin: 0 0 8px; padding-left: 20px; }
.helppop li { margin-bottom: 5px; }
.helppop b { color: var(--text); }
.helppop .sm { font-size: 13px; color: var(--muted); margin: 0; }
.btn.mini { height: 26px; padding: 0 9px; font-size: 13px; border-radius: 6px; margin-left: 6px; vertical-align: middle; }
.btn.mini kbd { font-size: 10px; padding: 0 4px; }
#toolHint { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }
#toolHint[hidden] { display: none; }
.box .pext { position: absolute; right: -13px; top: -13px; width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 2px solid var(--accent); background: #fff; color: var(--accent); pointer-events: auto; cursor: pointer; display: grid; place-items: center; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.box .pext svg { width: 14px; height: 14px; stroke-width: 2.6; }
.box .pext:hover { background: var(--accent); color: var(--accent-ink); }

/* ---------------------------------------------------------------- arrow dots and joining */
.box .cdot { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2.5px solid var(--accent); pointer-events: auto; cursor: crosshair; box-shadow: 0 1px 4px rgba(0,0,0,.35); transform: translate(-50%, -50%); transition: transform .08s; }
.box .cdot:hover { transform: translate(-50%, -50%) scale(1.3); background: var(--accent); }
.box .cdot.t { left: 50%; top: -14px; } .box .cdot.b { left: 50%; top: calc(100% + 14px); }
.box .cdot.l { left: -14px; top: 50%; } .box .cdot.r { left: calc(100% + 14px); top: 50%; }
.joins { display: flex; flex-direction: column; gap: 5px; }
.joinbtn { text-align: left; padding: 6px 10px; border-radius: 7px; border: 1px dashed rgba(var(--acc-rgb),.7); background: rgba(var(--acc-rgb),.08); color: var(--text); font: 13px/1.35 'Inter', 'Segoe UI', sans-serif; cursor: pointer; }
.joinbtn:hover { background: rgba(var(--acc-rgb),.18); border-style: solid; }
.joinbtn b { color: var(--accent-hi); }

/* ---------------------------------------------------------------- website: paid-service bar, account, preview */
body:not(.web) .webonly { display: none !important; }
.plan {
  display: flex; align-items: center; gap: 12px; padding: 9px 14px; flex-wrap: wrap;
  background: linear-gradient(90deg, rgba(var(--acc-rgb),.2), rgba(var(--acc-rgb),.09)); border-bottom: 1px solid rgba(var(--acc-rgb),.45);
  font-size: 14.5px; line-height: 1.45; color: var(--text); position: relative; z-index: 4;
}
.plan[hidden] { display: none; }
.plan .tag { flex: none; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; padding: 4px 9px; border-radius: 5px; }
.plan .msg { flex: 1; min-width: 240px; color: var(--text); }
.plan .msg b { color: var(--text-strong); font-weight: 650; }
.plan .btn { height: 32px; flex: none; }
#btnAcct { max-width: 230px; }
#btnAcct span { overflow: hidden; text-overflow: ellipsis; }
#btnAcct.in { color: var(--muted); }
.legal { color: var(--faint); font-size: 12.5px; margin: 34px 0 0; }
.legal a { color: var(--muted); text-decoration: none; }
.legal a:hover { color: var(--text); text-decoration: underline; }

#modal .lead { color: var(--text); font-size: 14.5px; }
#modal .small { font-size: 13px; color: var(--muted); }
#modal .small.ok { color: var(--ok); }
#modal .small.dev { color: var(--devc); background: rgba(255,200,120,.08); border: 1px dashed rgba(255,200,120,.4); border-radius: 6px; padding: 6px 9px; }
#modal .err { margin-top: 8px; }
.inrow { display: flex; gap: 8px; margin: 6px 0 8px; }
.inrow input { flex: 1; min-width: 0; height: 40px; background: var(--field); border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; color: var(--text); font: 16px 'Inter', 'Segoe UI', sans-serif; outline: none; user-select: text; }
.inrow input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--acc-rgb),.14); }
.inrow input#inCode { letter-spacing: .3em; font-weight: 650; }
.inrow .btn { height: 40px; padding: 0 16px; font-size: 14px; }
#modal:has(.pv) { width: min(760px, calc(100vw - 32px)); }
.pv { margin: 4px 0 6px; }
.pvpages { display: flex; gap: 14px; justify-content: center; align-items: flex-start; padding: 16px; background: var(--thumb); border: 1px solid var(--line-soft); border-radius: 10px; overflow: hidden; }
.pvpage { position: relative; flex: 0 1 200px; min-width: 0; aspect-ratio: 612 / 792; background: #fff; border-radius: 2px; box-shadow: 0 4px 16px rgba(0,0,0,.5); overflow: hidden; user-select: none; }
.pvpage canvas { display: block; width: 100%; height: 100%; object-fit: contain; filter: blur(.35px); pointer-events: none; }
.pvpage::after { content: 'PREVIEW'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-32deg); font: 800 34px 'Inter', sans-serif; letter-spacing: .12em; color: rgba(var(--acc-rgb),.2); pointer-events: none; white-space: nowrap; }
.pvpage.more { display: flex; align-items: center; justify-content: center; text-align: center; background: repeating-linear-gradient(-45deg, var(--btn) 0 9px, var(--bg) 9px 18px); border: 1px dashed var(--btn-line); box-shadow: none; }
.pvpage.more::after { content: none; }
.pvpage.more b { display: block; font-size: 30px; color: var(--accent-hi); }
.pvpage.more span { color: var(--muted); font-size: 12.5px; padding: 0 12px; display: block; }
.pvnote { margin: 12px 0 4px !important; font-size: 13.5px; }
.dlbox { border-top: 1px solid var(--line-soft); padding-top: 14px; margin-top: 10px; }
.dlbox .row { margin-top: 10px !important; justify-content: flex-end; }

/* ---------------------------------------------------------------- narrow windows */
@media (max-width: 1180px) {
  .brand span, .lbl { display: none; }
  .brand { margin-right: 0; }
}
@media (max-width: 1000px) {
  #btnOpen .t, #btnPaste .t { display: none; }
  #btnOpen, #btnPaste { width: 34px; padding: 0; }
  .group + .group { margin-left: 2px; padding-left: 8px; }
  .zl { width: 40px; }
  #side { width: 300px; min-width: 260px; }
  .hero h1 { font-size: 26px; }
}

/* ---------------------------------------------------------------- phones */
@media (max-width: 700px) {
  body { overflow: auto; height: auto; min-height: 100%; }
  .bar { flex-wrap: wrap; gap: 6px; padding: 6px 8px; min-height: 0; }
  .brand span { display: inline; font-size: 14px; }
  .bar > .fname { order: 10; flex-basis: 100%; max-width: none; margin: 0; }
  .group + .group { border-left: 0; padding-left: 0; margin-left: 0; }
  .group[title^="Size"] { display: none; }
  .group.zoom .zl { display: none; }
  #btnExport span { font-size: 13px; }
  #btnAcct span { display: none; }
  #btnAcct { width: 34px; padding: 0; }
  .plan { font-size: 13.5px; padding: 8px 10px; gap: 8px; }
  .plan .msg { min-width: 0; flex-basis: calc(100% - 110px); }
  main { flex-direction: column; flex: none; }
  #viewer { height: 64vh; flex: none; }
  #splitter { display: none; }
  #side { width: 100% !important; max-width: none; min-width: 0; min-height: 50vh; border-top: 1px solid var(--line); }
  #cards { overflow: visible; }
  #scroller { touch-action: pan-x pan-y; }
  #empty { position: relative; inset: auto; min-height: 64vh; }
  body:not(.hasdoc) #viewer { height: auto; }
  body:not(.hasdoc) #side { display: none; }
  body:not(.hasdoc) #scroller { display: none; }
  .hero { padding: 26px 16px 34px; }
  .hero h1 { font-size: 25px; }
  .hero .sub { font-size: 14px; }
  .cta .btn.big { width: 100%; }
  .drop { display: none; }
  #modal { padding: 16px 16px 14px; }
  .pvpages { padding: 10px; gap: 8px; }
  .pvpage.more span { font-size: 11px; }
  .inrow { flex-direction: column; }
  .inrow input { flex: none; }
  #toolHint { white-space: normal; width: calc(100% - 24px); text-align: center; }
}
