/* Ink Pad look: paper fills the view; chrome is floating glass capsules (SwiftUI .glassEffect / .ultraThinMaterial),
   system font, 22 pt wells with a ring on the selected one, a capsule size slider with a white knob. */
:root { --ink: #1d1b18; --sec: #6f6a62; --accent: #2B33C8; --glass: rgba(250, 248, 243, .62); --line: rgba(29, 27, 24, .12); --side: #f6f3ec;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", system-ui, sans-serif; color: var(--ink); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #e9e4da; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; border-radius: 8px; padding: 5px 9px; }
button:hover { background: rgba(0, 0, 0, .06); }
button.primary { background: var(--accent); color: #fff; }
.glass { background: var(--glass); backdrop-filter: blur(22px) saturate(1.6); -webkit-backdrop-filter: blur(22px) saturate(1.6); border: .5px solid rgba(255, 255, 255, .7); box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 6px 24px rgba(40, 30, 10, .12); }
.top { display: flex; align-items: center; gap: 16px; padding: 10px 16px; height: 56px; }
.brand { font-weight: 650; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.brand small { font-weight: 400; color: var(--sec); }
.brand .dot { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #5a62ff, #2B33C8 60%, #141F52); }
.modes { display: flex; gap: 2px; padding: 3px; border-radius: 999px; }
.modes button { border-radius: 999px; padding: 6px 14px; color: var(--sec); }
.modes button.on { background: rgba(29, 27, 24, .1); color: var(--ink); font-weight: 600; }
.wrap { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 12px; padding: 0 12px 12px; height: calc(100% - 56px); }
.stage { position: relative; min-height: 0; }
.paper-box { position: relative; width: 100%; height: 100%; border-radius: 14px; overflow: hidden; background: #F4EEE2; box-shadow: 0 2px 12px rgba(0,0,0,.12); touch-action: none; }
#paper, #overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
#overlay { touch-action: none; cursor: crosshair; }
.hud { position: absolute; left: 16px; top: 16px; font: 11px ui-monospace, "SF Mono", Menlo, monospace; padding: 6px 10px; border-radius: 999px; font-variant-numeric: tabular-nums; pointer-events: none; }
.hud b { color: var(--accent); }
.corner { position: absolute; right: 16px; top: 16px; }
.round { width: 34px; height: 34px; border-radius: 50%; font-size: 18px; font-weight: 700; padding: 0; }
.menu { position: absolute; right: 0; top: 42px; min-width: 200px; border-radius: 12px; padding: 6px; display: flex; flex-direction: column; z-index: 5; }
.menu button { text-align: left; display: flex; justify-content: space-between; }
.menu .mh { font-size: 11px; color: var(--sec); padding: 4px 9px; }
.menu hr { border: 0; border-top: .5px solid var(--line); margin: 4px 0; width: 100%; }
kbd { font: 11px system-ui; color: var(--sec); }
.toolbar { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; padding: 8px 16px; border-radius: 999px; white-space: nowrap; max-width: calc(100% - 24px); overflow-x: auto; }
.toolbar .seg { display: flex; gap: 2px; }
.toolbar .seg button { width: 30px; height: 30px; border-radius: 999px; padding: 0; color: var(--sec); }
.toolbar .seg button.on { background: rgba(29, 27, 24, .12); color: var(--ink); }
.toolbar .seg button:disabled { opacity: .35; cursor: default; }
.toolbar .div { width: 1px; height: 26px; background: var(--line); }
.tools { display: flex; gap: 4px; }
.tools button { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; border-radius: 9px; }
.tools button.on { color: var(--accent); background: rgba(43, 51, 200, .15); }
.tools svg, .seg svg { width: 19px; height: 19px; }
.wells { display: flex; gap: 8px; align-items: center; position: relative; }
.well { width: 22px; height: 22px; border-radius: 50%; padding: 0; box-shadow: 0 0 0 .5px rgba(29,27,24,.25) inset; position: relative; }
.well.on::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--ink); }
.size { display: flex; align-items: center; gap: 6px; color: var(--sec); }
.size i { display: block; border-radius: 50%; background: currentColor; }
input[type=range] { accent-color: var(--ink); }
.size input { width: 110px; }
.well-pop { position: absolute; bottom: 48px; left: 0; width: 250px; padding: 12px; border-radius: 12px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; z-index: 6; }
.well-pop .cap { font-size: 11px; color: var(--sec); }
.status { position: absolute; left: 50%; bottom: 70px; transform: translateX(-50%); padding: 6px 12px; border-radius: 999px; font-size: 13px; color: var(--sec); white-space: nowrap; }
.floating { position: absolute; right: 16px; bottom: 76px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.inkit { font-weight: 650; font-size: 15px; padding: 10px 20px; border-radius: 999px; background: var(--ink); color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.inkit:hover { background: #000; }
.dial { width: 116px; height: 116px; border-radius: 50%; position: relative; touch-action: none; cursor: grab; }
.dial svg { width: 100%; height: 100%; }
.dial .lbl { position: absolute; bottom: -20px; width: 100%; text-align: center; font-size: 11px; color: var(--sec); }
.side { overflow-y: auto; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.panel { background: var(--side); border-radius: 14px; padding: 12px 14px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.panel h2 { font-size: 13px; margin: 0; text-transform: uppercase; letter-spacing: .06em; color: var(--sec); }
.panel h3 { margin: 4px 0 6px; font-size: 16px; }
.panel h4 { margin: 12px 0 6px; font-size: 12px; color: var(--sec); text-transform: uppercase; letter-spacing: .05em; }
.ph { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.pa button, .row button { font-size: 12px; background: rgba(0,0,0,.06); }
.row { display: flex; align-items: center; gap: 8px; margin: 5px 0; font-size: 13px; }
label.row input[type=range] { flex: 1; }
.row output { width: 46px; text-align: right; font: 11px ui-monospace, Menlo, monospace; color: var(--sec); }
.row.dim { opacity: .55; }
.hint { font-size: 12px; color: var(--sec); line-height: 1.4; margin: 6px 0; }
textarea, input:not([type]), input[type=text], select { font: inherit; font-size: 13px; border: .5px solid var(--line); border-radius: 8px; padding: 6px 8px; background: #fff; width: 100%; }
textarea { min-height: 70px; resize: vertical; }
.graph { width: 100%; height: auto; color: #8a8173; }
.graph .edge { fill: none; stroke: currentColor; stroke-width: 1.4; }
.graph .node { cursor: pointer; }
.graph .node rect:first-child { fill: #fff; stroke: rgba(29,27,24,.18); }
.graph .node:hover rect:first-child { stroke: var(--accent); }
.graph .node.on rect:first-child { fill: #eef0ff; stroke: var(--accent); stroke-width: 2; }
.graph .t { font-size: 12.5px; font-weight: 650; fill: var(--ink); }
.graph .s { font-size: 10.5px; fill: var(--sec); font-family: ui-monospace, Menlo, monospace; }
.graph .badge { fill: var(--accent); }
.graph .b { font-size: 10px; fill: #fff; font-weight: 700; }
.notes p { font-size: 13px; line-height: 1.45; margin: 6px 0; }
.notes dl { font-size: 12px; margin: 6px 0; } .notes dt { color: var(--sec); font-weight: 600; margin-top: 6px; } .notes dd { margin: 2px 0 0; }
.notes code { font-size: 11px; background: rgba(0,0,0,.05); padding: 1px 4px; border-radius: 4px; }
.later { font-size: 10px; background: #f2b21e; color: #3a2a00; border-radius: 999px; padding: 1px 7px; vertical-align: middle; text-transform: none; letter-spacing: 0; }
/* style lab */
.lab { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; background: var(--side); border-radius: 14px; padding: 12px; overflow: auto; }
.chars { display: flex; flex-wrap: wrap; gap: 3px; }
.chars button { width: 28px; height: 30px; padding: 0; background: #fff; border: .5px solid var(--line); font-size: 15px; }
.chars button.has { background: #e8ebff; border-color: #8a90e8; }
.chars button.on { background: var(--ink); color: #fff; }
.lab-main { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 12px; min-height: 0; }
.glyph-wrap { position: relative; }
#gc { width: 100%; max-width: 640px; aspect-ratio: 1; border-radius: 12px; display: block; touch-action: none; box-shadow: 0 1px 6px rgba(0,0,0,.1); cursor: crosshair; }
.lab-bar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px 10px; border-radius: 999px; margin-top: 8px; font-size: 13px; max-width: 640px; }
.lab-bar button.on { background: rgba(43,51,200,.15); color: var(--accent); }
.lab-bar .sep { width: 1px; height: 20px; background: var(--line); }
.lab-bar select { width: auto; padding: 2px 4px; }
.lab-side { font-size: 13px; }
.wcurve { display: flex; gap: 6px; height: 110px; align-items: stretch; font-size: 12px; color: var(--sec); }
.wcurve input { writing-mode: vertical-lr; direction: rtl; width: 22px; flex: 0 0 22px; }
.typebox { min-height: 64px; }
.wordtools { display: flex; gap: 6px; }
@media (max-width: 900px) {
  .wrap { grid-template-columns: 1fr; grid-template-rows: 62vh auto; height: auto; }
  .stage { height: 62vh; }
  .lab { position: static; }
  .stage:has(.lab:not([hidden])) { height: auto; }
  .lab-main { grid-template-columns: 1fr; }
  .top { flex-wrap: wrap; height: auto; }
  .toolbar { gap: 8px; padding: 6px 10px; }
  .size input { width: 70px; }
}
[hidden] { display: none !important; }
.row button.primary, .pa button.primary { background: var(--accent); color: #fff; }
