@font-face {
  font-family: "Archivo";
  src: url("/vendor/archivo/archivo.woff2") format("woff2");
  font-weight: 300 800;
  font-stretch: 100% 125%;
  font-display: swap;
}

:root {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --amber-hi: #f6b85a; --amber-ink: #1b1307; --field: #0c1015; --ring: #f0a63a24;
  --bg: #0b0e12; --surface: #11161c; --surface-2: #161c24; --raise: #1c232d;
  --line: #222a34; --line-2: #2e3844; --ink: #dfe5ec; --muted: #8b96a5; --faint: #5b6674;
  --amber: #f0a63a; --amber-soft: #f0a63a1f; --red: #ef4f4f; --red-soft: #ef4f4f1f; --live: #59c48a;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: system-ui, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-family: var(--sans); color: var(--ink); background: var(--bg); color-scheme: dark;
}
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: #2e3844 transparent; }
[hidden] { display: none !important; }
::selection { background: #f0a63a4d; color: #fff; }
body { margin: 0; height: 100vh; display: flex; flex-direction: column; font-size: 14px; -webkit-font-smoothing: antialiased; }
body.console { min-width: 1280px; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
input[type="checkbox"], input[type="radio"], input[type="range"] { accent-color: var(--amber); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.latin { font-family: "Archivo", var(--sans); font-stretch: 112%; }
body.console .layout, body.page main { animation: page-in 0.36s var(--ease-out) both; }
@keyframes page-in { from { opacity: 0; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes spin { to { transform: rotate(360deg); } }

.bar { display: flex; align-items: center; gap: 20px; padding: 0 16px 0 18px; height: 48px; background: var(--surface); border-bottom: 1px solid var(--line); flex: none; }
.brand { display: flex; align-items: baseline; gap: 9px; }
.brand-mark { width: 10px; height: 10px; border: 2px solid var(--amber); border-radius: 2px; align-self: center; }
.brand strong { font-family: "Archivo", var(--sans); font-size: 17px; font-weight: 760; font-stretch: 125%; letter-spacing: 0.01em; line-height: 1; }
.brand-sub, .tag { color: var(--muted); font-size: 13px; }
.tag { margin-left: 6px; padding: 2px 9px; border: 1px solid var(--line-2); border-radius: 10px; font-size: 12px; }
.bar-mid { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 0; }
.bar-right { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.bar-link { color: var(--muted); font-size: 13px; text-decoration: none; background: none; border: 0; cursor: pointer; padding: 5px 9px; border-radius: 6px; transition: color 0.15s ease, background-color 0.15s ease; }
.bar-link:hover { color: var(--ink); background: var(--raise); }
.estop { margin-left: 8px; background: transparent; color: var(--muted); border: 1px solid var(--line-2); border-radius: 6px; font-weight: 700; letter-spacing: 2px; padding: 6px 17px; cursor: pointer; transition: color 0.15s ease, border-color 0.15s ease, background-color 0.2s ease, transform 0.1s ease; }
.estop:hover { color: var(--red); border-color: #ef4f4f88; }
.estop-armed { background: var(--red); color: #fff; border-color: var(--red); }
.estop-armed:hover { color: #fff; border-color: var(--red); filter: brightness(1.1); }
.estop:active { transform: translateY(1px); }

.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; padding: 3px 10px; border-radius: 11px; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; transition: color 0.25s ease, border-color 0.25s ease, background-color 0.25s ease; }
.pill:not([hidden]) { animation: rise-in 0.24s var(--ease-out); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-on { color: var(--ink); }
.pill-on::before { background: var(--live); }
.pill-off { color: var(--red); border-color: #ef4f4f55; }
.pill-motion { color: var(--amber); border-color: #f0a63a66; background: var(--amber-soft); }
.pill-motion::before { animation: blink 1s steps(2) infinite; }
.pill-warn { color: var(--amber); border-style: dashed; cursor: help; }
.pill-warn::before { border-radius: 1px; }
@keyframes blink { 50% { opacity: .2; } }

.layout { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 560px; min-height: 0; }
.viewer { position: relative; background: radial-gradient(80% 70% at 45% 42%, #19212b 0%, #10151b 48%, #0a0d11 80%, #08090c 100%); overflow: hidden; }
.scene { position: absolute; inset: 0; }
.viewer-tools { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; }
.tool { font-size: 12px; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line-2); background: #11161ccc; color: var(--muted); cursor: pointer; transition: color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease; }
.tool:hover:not(:disabled) { color: var(--ink); border-color: #3d4957; }
.tool:disabled { opacity: .45; cursor: not-allowed; }
.cam-pip { position: absolute; right: 12px; bottom: 112px; width: 320px; margin: 0; background: #000; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; box-shadow: 0 12px 32px -12px #000c; animation: rise-in 0.26s var(--ease-out); }
.cam-pip img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.cam-pip figcaption { position: absolute; left: 6px; top: 4px; font-size: 11px; color: #fff; text-shadow: 0 1px 2px #000; }
.gripper { display: flex; align-items: center; gap: 6px; margin-left: 8px; padding: 2px 8px; border: 1px solid var(--line-2); border-radius: 6px; background: #11161ccc; }
.gripper-label { font-size: 12px; color: var(--muted); }
.gripper input[type="range"] { width: 110px; accent-color: var(--amber); }
.gripper-val { font-family: var(--mono); font-size: 12px; min-width: 26px; text-align: right; }
.legend { position: absolute; top: 15px; right: 16px; display: flex; gap: 12px; font-size: 12px; color: var(--muted); }
.legend b { font-weight: 600; }
.ax-x { color: #e2574c; } .ax-y { color: #59c48a; } .ax-z { color: #4f8fe8; }
.telemetry { position: absolute; left: 12px; right: 12px; bottom: 12px; background: #0d1116eb; border: 1px solid #ffffff12; border-radius: 8px; padding: 11px 14px 9px; box-shadow: 0 -1px 0 #ffffff08 inset, 0 16px 40px -20px #000; }
.joints { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.joint { font-family: var(--mono); min-width: 0; }
.joint-head { display: flex; justify-content: space-between; align-items: baseline; }
.joint-name { color: var(--muted); font-family: "Archivo", var(--sans); font-stretch: 112%; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; }
.joint-val { font-size: 15px; font-variant-numeric: tabular-nums; }
.joint-track { position: relative; height: 3px; background: var(--line-2); border-radius: 2px; margin-top: 6px; }
.joint-mark { position: absolute; top: -3px; width: 2px; height: 9px; background: var(--ink); border-radius: 1px; transition: left 0.12s linear; }
.joint.near .joint-mark, .joint.near .joint-val { color: var(--amber); background: none; }
.joint.near .joint-mark { background: var(--amber); }
.joint-lim { display: flex; justify-content: space-between; color: var(--faint); font-size: 10px; margin-top: 3px; }
.tcp { margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tcp b { color: var(--ink); font-weight: 500; }
.tcp-label { font-family: "Archivo", var(--sans); font-stretch: 112%; font-weight: 600; letter-spacing: 0.08em; font-size: 11px; color: var(--muted); margin-right: 10px; }
.offline { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(70% 60% at 50% 46%, #121820f2 0%, #0a0d11f7 70%); text-align: center; animation: page-in 0.3s ease; }
.offline-plot { position: absolute; left: 50%; top: 66%; width: min(520px, 64%); aspect-ratio: 1; transform: translate(-50%, -50%) scaleY(0.36); pointer-events: none; overflow: visible; }
.offline-plot * { fill: none; vector-effect: non-scaling-stroke; }
.offline-plot .ring { stroke: #f0a63a26; stroke-width: 1; }
.offline-plot .ring-outer { stroke: #dfe5ec1a; stroke-dasharray: 1 2; }
.offline-plot .ticks { stroke: #dfe5ec24; stroke-width: 6; stroke-dasharray: 0.03 0.97; }
.offline-plot .ticks-major { stroke: #f0a63a40; stroke-width: 8; stroke-dasharray: 0.035 0.965; }
.offline-copy { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 440px; padding: 0 24px; margin-bottom: 140px; animation: rise-in 0.4s var(--ease-out) 0.05s both; }
.offline strong { font-size: 22px; color: var(--red); letter-spacing: 0.06em; }
.offline p { margin: 0; color: var(--muted); line-height: 1.6; }
.offline .offline-next { color: var(--faint); font-size: 13px; }

.panel { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-left: 1px solid var(--line); }
.tabs { position: relative; display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); flex: none; }
.tabs::after { content: ""; position: absolute; left: 0; bottom: -1px; height: 2px; width: var(--ink-w, 0); background: var(--amber); border-radius: 2px 2px 0 0; transform: translateX(var(--ink-x, 0)); transition: transform 0.32s var(--ease-out), width 0.32s var(--ease-out); }
.tab { background: none; border: 0; padding: 12px 14px 10px; color: var(--muted); cursor: pointer; transition: color 0.15s ease; }
.tab:hover:not(:disabled) { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); }
.tab:disabled { opacity: .4; cursor: not-allowed; }
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pane:not([hidden]) { animation: pane-in 0.24s var(--ease-out); }
@keyframes pane-in { from { opacity: 0; transform: translateY(4px); } }
#pane-nl { overflow-y: auto; padding: 14px; gap: 12px; }
.block { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.block:not([hidden]) { animation: rise-in 0.22s var(--ease-out); }
.block.grow { flex: 1; }
.block h2 { margin: 0; font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: 0.02em; }
.block-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }

textarea, .select, input[type="password"], input[type="text"], input[type="number"] { background: var(--field); border: 1px solid var(--line-2); border-radius: 6px; caret-color: var(--amber); transition: border-color 0.15s ease, box-shadow 0.2s var(--ease-out), background-color 0.15s ease; }
textarea { width: 100%; resize: vertical; font-size: 15px; line-height: 1.5; padding: 9px 12px; }
textarea:hover, .select:hover, input[type="password"]:hover, input[type="text"]:hover, input[type="number"]:hover { border-color: #3d4957; }
textarea:focus, .select:focus, input:focus { outline: none; border-color: var(--amber); background-color: #0a0d11; box-shadow: 0 0 0 3px var(--ring); }
input[type="checkbox"]:focus, input[type="range"]:focus, input[type="color"]:focus { box-shadow: none; }
input[type="checkbox"]:focus-visible, input[type="range"]:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
input:-webkit-autofill { -webkit-text-fill-color: var(--ink); -webkit-box-shadow: 0 0 0 100px var(--field) inset; }
::placeholder { color: var(--faint); opacity: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.chip { font-size: 12px; padding: 4px 10px; border-radius: 12px; border: 1px solid var(--line-2); background: none; color: var(--muted); cursor: pointer; transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease; }
.chip:hover { color: var(--ink); border-color: #3d4957; background: #ffffff06; }
.chip:active { transform: translateY(1px); }
.row { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.row .switch { margin-right: auto; }
.switch { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.switch input { accent-color: var(--amber); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 13px; padding: 6px 14px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--raise); cursor: pointer; transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.2s var(--ease-out), transform 0.1s ease; }
.btn:hover:not(:disabled) { border-color: #4a5664; background: #212a35; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); font-weight: 650; box-shadow: 0 1px 0 #ffffff40 inset, 0 6px 18px -10px #f0a63acc; }
.btn-primary:hover:not(:disabled) { background: var(--amber-hi); border-color: var(--amber-hi); }
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"]:disabled { opacity: 1; }
.btn[aria-busy="true"]::before { content: ""; width: 12px; height: 12px; flex: none; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; opacity: 0.8; animation: spin 0.7s linear infinite; }
.btn-ghost { background: none; margin-right: auto; }
.btn-small { font-size: 12px; padding: 3px 9px; }
.link-btn { background: none; border: 0; color: var(--muted); font-size: 12px; cursor: pointer; padding: 2px 4px; text-decoration: underline; text-decoration-color: #5b667480; text-underline-offset: 3px; transition: color 0.15s ease, text-decoration-color 0.15s ease; }
.link-btn:hover { text-decoration-color: currentColor; }
.link-btn:hover { color: var(--ink); }
.select { font-size: 13px; padding: 5px 8px; cursor: pointer; }
.spacer { flex: 1; }

.badge { font-size: 11px; padding: 2px 8px; border-radius: 9px; border: 1px solid var(--line-2); color: var(--muted); }
.note { font-size: 13px; color: var(--amber); background: var(--amber-soft); border: 1px solid #f0a63a33; padding: 7px 10px; border-radius: 6px; margin: 0 0 10px; }
.message { font-size: 14px; margin: 0 0 8px; line-height: 1.6; }
.steps { margin: 0 0 10px; padding-left: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 22px 1fr 54px; gap: 6px; padding: 8px 0; border-top: 1px dashed var(--line-2); }
.steps li:first-child { border-top: 0; }
.steps li::before { content: counter(s); color: var(--faint); font-family: var(--mono); }
.steps .err { grid-column: 2 / 4; color: var(--red); font-size: 13px; }
.state { font-size: 12px; text-align: right; color: var(--muted); transition: color 0.2s ease; }
.state.running { color: var(--amber); } .state.done { color: var(--ink); } .state.failed { color: var(--red); }
.history { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.history li { padding: 9px 0; border-top: 1px solid var(--line); line-height: 1.55; }
.history li:first-child { border-top: 0; }
.history .q { color: var(--ink); }
.history .o { color: var(--muted); margin-top: 2px; }
.history li.empty { display: flex; flex-direction: column; gap: 4px; padding: 18px 0 6px; border: 0; color: var(--muted); }
.history li.empty span { color: var(--faint); font-size: 12px; }

#pane-py { padding: 0; }
.py-tools { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex: none; }
.gen-row { display: flex; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex: none; }
.gen-row input { flex: 1; min-width: 0; padding: 5px 9px; font-size: 13px; }
.code-offer { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--amber-soft); flex: none; }
.offer-text { flex: 1; min-width: 0; font-size: 12px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-wrap { flex: 1 1 55%; min-height: 200px; position: relative; }
.editor-wrap .CodeMirror { position: absolute; inset: 0; height: auto; }
.py-status { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); flex: none; background: var(--surface-2); }
.py-state { font-family: var(--mono); }
.py-state.running { color: var(--amber); }
.py-state.failed { color: var(--red); }
.py-clock { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.py-other { color: var(--amber); }
.output { flex: 1 1 45%; min-height: 140px; display: flex; flex-direction: column; }
.output-tabs { display: flex; align-items: center; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--line); flex: none; }
.otab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 10px 6px; color: var(--muted); font-size: 12px; cursor: pointer; transition: color 0.15s ease, border-color 0.2s ease; }
.otab:hover { color: var(--ink); }
.otab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--amber); }
.out-text { flex: 1; margin: 0; padding: 10px 12px; overflow: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; background: var(--bg); }
.out-text .stderr { color: #f08a7e; }
.out-text .system { color: var(--amber); }
.out-text:empty::before { content: "运行后，print 的内容会显示在这里"; color: var(--faint); }
.out-img { flex: 1; overflow: auto; padding: 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; align-content: start; background: var(--bg); }
.out-img img { width: 100%; background: #fff; border-radius: 6px; cursor: zoom-in; animation: rise-in 0.24s var(--ease-out); }
.out-img:empty::before { content: "plt.show() 或 show_image() 的图会显示在这里"; color: var(--faint); font-size: 12px; }

.scene-tools { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex: none; }
.scene-tools .btn { white-space: nowrap; }
.scene-tools .hint-inline { flex: 1; min-width: 0; }
.hint-inline { font-size: 12px; color: var(--muted); }
#pane-scene { overflow-y: auto; }
.obj-form { padding: 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.obj-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.obj-row label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }
.obj-row input:not([type="color"]) { width: 92px; padding: 5px 7px; font-family: var(--mono); font-size: 12px; }
.obj-row #obj-id { width: 150px; }
.obj-row input[type="color"] { width: 44px; height: 28px; padding: 0 2px; background: var(--field); border: 1px solid var(--line-2); border-radius: 6px; cursor: pointer; }
.unit { font-size: 11px; color: var(--faint); padding-bottom: 6px; }
.obj-list { list-style: none; margin: 0; padding: 4px 0; }
.obj-list li { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 12px; transition: background-color 0.15s ease; }
.obj-list li.selected { background: var(--amber-soft); }
.obj-list li.readonly { color: var(--faint); }
.obj-swatch { width: 12px; height: 12px; border-radius: 2px; flex: none; border: 1px solid var(--line-2); }
.obj-name { font-family: var(--mono); color: var(--ink); min-width: 110px; }
.obj-list li.readonly .obj-name { color: var(--muted); }
.obj-meta { flex: 1; min-width: 0; font-family: var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obj-tag { font-size: 11px; color: var(--amber); }
.tool[aria-pressed="false"] { opacity: .55; }
#pane-cases { padding: 0; }
.case-list { flex: 1; overflow-y: auto; padding: 12px; }
.case-group + .case-group { margin-top: 18px; }
.case-group-title { margin: 0 0 10px; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.08em; }
.case-group.featured .case-group-title { color: var(--amber); }
.case-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.case-card { display: flex; flex-direction: column; gap: 7px; text-align: left; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out); }
.case-card:hover { border-color: #3d4957; background: #19202a; transform: translateY(-1px); box-shadow: 0 10px 24px -16px #000; }
.case-card.featured { padding: 16px; border-color: #f0a63a88; background: linear-gradient(var(--amber-soft), var(--amber-soft)), var(--surface-2); }
.case-card.featured:hover { border-color: var(--amber); }
.case-card-head { display: flex; align-items: center; gap: 6px; }
.case-card-title { flex: 1; min-width: 0; font-weight: 600; }
.case-card.featured .case-card-title { font-size: 15px; }
.case-star { flex: none; font-size: 11px; font-weight: 700; color: var(--bg); background: var(--amber); padding: 1px 6px; border-radius: 3px; }
.case-card-count { flex: none; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.case-card-sum { margin: 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
.case-bar { height: 3px; background: var(--line-2); border-radius: 2px; overflow: hidden; }
.case-bar-fill { height: 100%; background: var(--live); }
.case-card.featured .case-bar-fill { background: var(--amber); }
.case-detail { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.case-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex: none; }
.case-title { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case-steps { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex: none; }
.case-step { width: 26px; height: 22px; padding: 0; font-family: var(--mono); font-size: 11px; color: var(--muted); background: none; border: 1px solid var(--line-2); border-radius: 4px; cursor: pointer; transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease; }
.case-step:hover { color: var(--ink); border-color: #4a5664; }
.case-step.done { color: var(--live); border-color: #59c48a66; }
.case-step[aria-current="true"] { color: var(--amber-ink); background: var(--amber); border-color: var(--amber); font-weight: 700; }
.case-doc { flex: 1 1 34%; min-height: 90px; overflow-y: auto; padding: 12px 16px; font-size: 13.5px; line-height: 1.75; }
.case-step-title { margin: 0 0 8px; font-size: 15px; font-weight: 600; letter-spacing: 0.01em; }
.case-doc code, .ai-a code { font-family: var(--mono); font-size: 12px; background: var(--raise); border: 1px solid #ffffff0d; padding: 1px 5px; border-radius: 4px; }
.md-pre code { background: none; border: 0; padding: 0; }
.md-p { margin: 0 0 10px; }
.md-h { margin: 14px 0 6px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.md-list { margin: 0 0 10px; padding-left: 20px; }
.md-list li + li { margin-top: 3px; }
.md-list li::marker { color: var(--faint); }
.md-pre { margin: 0 0 10px; padding: 10px 12px; font-family: var(--mono); font-size: 12px; line-height: 1.55; white-space: pre; overflow-x: auto; background: var(--field); border: 1px solid var(--line); border-radius: 6px; }
.md-note { margin: 0 0 10px; padding: 8px 12px; background: var(--amber-soft); border: 1px solid #f0a63a33; border-radius: 6px; }
.md-table { margin: 0 0 10px; border-collapse: collapse; font-size: 12.5px; }
.md-table th, .md-table td { padding: 5px 10px; border: 1px solid var(--line-2); text-align: left; }
.md-table th { color: var(--muted); font-weight: 600; background: #ffffff05; }
.md-math-block { display: block; margin: 4px 0 8px; overflow-x: auto; }
.case-after { margin-top: 8px; padding-top: 6px; border-top: 1px dashed var(--line-2); }
.case-after-label { margin-bottom: 2px; font-size: 11px; font-weight: 600; color: var(--live); }
.case-prelude { margin-top: 10px; font-size: 12px; color: var(--muted); }
.case-prelude summary { cursor: pointer; }
.case-prelude .md-pre { margin-top: 6px; color: var(--ink); }
.case-tools { gap: 6px; border-top: 1px solid var(--line); }
.case-editor { flex: 1 1 30%; min-height: 140px; }
.case-output { flex: 1 1 30%; min-height: 120px; }
.case-ref { max-width: 240px; margin-right: 6px; font-size: 11px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-s-lab.CodeMirror { background: var(--bg); color: #d7dde4; font-family: var(--mono); font-size: 13px; line-height: 1.55; }
.cm-s-lab .CodeMirror-scrollbar-filler, .cm-s-lab .CodeMirror-gutter-filler { background: var(--surface); }
.cm-s-lab .CodeMirror-gutters { background: var(--surface); border-right: 1px solid var(--line); }
.cm-s-lab .CodeMirror-linenumber { color: var(--faint); }
.cm-s-lab .CodeMirror-cursor { border-left: 2px solid var(--amber); }
.cm-s-lab .CodeMirror-activeline-background { background: #ffffff08; }
.cm-s-lab .CodeMirror-selected, .cm-s-lab.CodeMirror-focused .CodeMirror-selected { background: #f0a63a2e; }
.cm-s-lab .CodeMirror-line::selection, .cm-s-lab .CodeMirror-line > span::selection, .cm-s-lab .CodeMirror-line > span > span::selection { background: #f0a63a2e; }
.cm-s-lab .CodeMirror-matchingbracket { color: var(--ink) !important; outline: 1px solid #f0a63a99; border-radius: 2px; }
.cm-s-lab .cm-keyword { color: #c792ea; }
.cm-s-lab .cm-builtin { color: #82aaff; }
.cm-s-lab .cm-def { color: #82aaff; }
.cm-s-lab .cm-string { color: #c3e88d; }
.cm-s-lab .cm-number { color: #f78c6c; }
.cm-s-lab .cm-comment { color: #5f6b7a; font-style: italic; }
.cm-s-lab .cm-variable-2, .cm-s-lab .cm-property { color: #d7dde4; }
.cm-s-lab .cm-operator { color: #89ddff; }
.cm-s-lab .cm-meta { color: var(--amber); }
.cm-s-lab .error-line { background: var(--red-soft); }
.cm-s-lab .error-gutter .CodeMirror-linenumber { color: var(--red); font-weight: 700; }
.CodeMirror-hints { background: var(--raise); border: 1px solid var(--line-2); border-radius: 6px; padding: 3px; font-family: var(--mono); font-size: 12px; box-shadow: 0 10px 28px -8px #000c; }
.CodeMirror-hint { color: var(--ink); border-radius: 4px; }
li.CodeMirror-hint-active { background: var(--amber); color: var(--amber-ink); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--raise); border: 1px solid var(--line-2); color: var(--ink); padding: 9px 16px; border-radius: 8px; font-size: 13px; line-height: 1.5; max-width: 70vw; box-shadow: 0 14px 36px -12px #000d; z-index: 10; }
.toast:not([hidden]) { animation: toast-in 0.26s var(--ease-out); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
.toast.bad { border-color: #ef4f4f99; color: #ffb3ab; }
.lightbox { position: fixed; inset: 0; background: #000c; display: grid; place-items: center; z-index: 20; cursor: zoom-out; animation: page-in 0.2s ease; }
.lightbox img { max-width: 92vw; max-height: 92vh; background: #fff; border-radius: 6px; animation: dialog-in 0.26s var(--ease-out); }

body.page { background: radial-gradient(90% 60% at 50% 0%, #121820 0%, var(--bg) 60%); }
.center { flex: 1; display: flex; justify-content: center; align-items: flex-start; padding: 56px 16px 64px; gap: 16px; overflow-y: auto; }
.center.column { flex-direction: column; align-items: center; }
.page-head { width: 100%; max-width: 440px; margin-bottom: 8px; }
.page-head.wide { max-width: 960px; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: 0.04em; line-height: 1.2; }
.page-head p { margin: 8px 0 0; font-size: 14px; line-height: 1.6; color: var(--muted); }
.card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 22px 24px; box-shadow: 0 1px 0 #ffffff06 inset, 0 24px 48px -32px #000; }
.card h2 { margin: 0 0 12px; font-size: 14px; color: var(--muted); font-weight: 600; letter-spacing: 0.02em; }
.form-card { width: 100%; max-width: 440px; }
.form-card label { display: block; font-size: 13px; color: var(--muted); margin: 18px 0 8px; }
.form-card form > label:first-of-type, .form-card h2 + form > label:first-of-type { margin-top: 4px; }
.form-card input { display: block; width: 100%; height: 46px; font-size: 15px; padding: 0 14px; }
.form-card .row { margin-top: 20px; }
.form-card .btn { height: 38px; padding: 0 16px; }
.btn-block { width: 100%; margin-top: 16px; padding: 9px; }
.form-error { color: #ff7b72; font-size: 13px; margin: 10px 0 0; }
.hint { font-size: 13px; line-height: 1.6; color: var(--muted); margin: 6px 0; }
.form-card .hint { margin-top: 10px; }

.bar-ai { color: var(--amber); border: 1px solid #f0a63a33; }
.bar-ai:hover { color: var(--amber); background: var(--amber-soft); }
.bar-ai[aria-pressed="true"] { background: var(--amber-soft); border-color: var(--amber); }
.ai-drawer { position: fixed; top: 48px; bottom: 0; right: 560px; width: 440px; z-index: 10; display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line-2); border-right: 1px solid var(--line-2); box-shadow: -16px 0 40px -8px #000a; }
.ai-drawer:not([hidden]) { animation: drawer-in 0.3s var(--ease-out); }
@keyframes drawer-in { from { opacity: 0; transform: translateX(18px); } }
.ai-head { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.ai-sub { color: var(--faint); font-size: 12px; }
.ai-log { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 14px; }
.ai-empty { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.ai-turn { display: flex; flex-direction: column; gap: 8px; animation: rise-in 0.24s var(--ease-out); }
.ai-q { align-self: flex-end; max-width: 88%; padding: 7px 12px; border-radius: 10px 10px 3px 10px; background: var(--raise); border: 1px solid var(--line-2); line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.ai-a { font-size: 13.5px; line-height: 1.72; word-break: break-word; }
.ai-a .md-pre { margin-bottom: 2px; }
.ai-code-tools { display: flex; gap: 8px; justify-content: flex-end; margin: 0 0 8px; }
.ai-sources { font-size: 12px; line-height: 1.5; color: var(--faint); }
.ai-status { font-size: 12px; color: var(--muted); }
.ai-status.bad { color: #ffb3ab; }
.ai-vote { display: flex; gap: 4px; }
.ai-vote-btn { background: none; border: 1px solid transparent; border-radius: 6px; padding: 1px 6px; cursor: pointer; opacity: .55; font-size: 13px; transition: opacity 0.15s ease, border-color 0.15s ease; }
.ai-vote-btn:hover:not(:disabled), .ai-vote-btn[aria-pressed="true"] { opacity: 1; border-color: var(--line-2); }
.ai-vote-btn:disabled { cursor: default; }
.ai-suggest { margin: 0; padding: 8px 12px 0; border-top: 1px solid var(--line); }
.ai-suggest .chip { text-align: left; }
.ai-ctx { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 12px 0; font-size: 12px; color: var(--faint); }
.ai-ctx-chip { font-size: 12px; padding: 2px 8px; border-radius: 10px; border: 1px dashed var(--line-2); background: none; color: var(--faint); cursor: pointer; text-decoration: line-through; }
.ai-ctx-chip[aria-pressed="true"] { border-style: solid; color: var(--ink); text-decoration: none; }
.ai-form { padding: 8px 12px 12px; }
.ai-form textarea { width: 100%; resize: none; padding: 9px 12px; line-height: 1.5; }
.ai-form .row { margin-top: 8px; }
.ai-form .row .hint-inline { margin-right: auto; }
.who { position: relative; }
.who summary { list-style: none; color: var(--ink); cursor: pointer; }
.who summary::-webkit-details-marker { display: none; }
.who summary::after { content: " ▾"; color: var(--muted); }
.who-menu { position: absolute; right: 0; top: calc(100% + 8px); display: flex; flex-direction: column; min-width: 132px; padding: 5px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: 0 16px 36px -12px #000d; z-index: 30; transform-origin: top right; }
.who[open] .who-menu { animation: menu-in 0.18s var(--ease-out); }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.who-menu .bar-link { text-align: left; }
.center.top { justify-content: flex-start; }
.acct-card { width: 100%; max-width: 960px; }
.acct-table th:first-child, .acct-table td:first-child { width: 32px; }
.acct-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.acct-tools input[type="text"] { font-size: 13px; padding: 7px 10px; width: 220px; }
.acct-tools .select { padding: 6px 8px; }
.acct-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.acct-table th, .acct-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.acct-table th { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; background: #ffffff04; }
.acct-table tbody tr { transition: background-color 0.12s ease; }
.acct-table tbody tr:hover { background: #ffffff05; }
.acct-table tr.off td { color: var(--faint); }
.acct-table .mono { font-family: var(--mono); }
.acct-state-locked { color: var(--amber); }
.acct-state-off { color: var(--red); }
.acct-empty { margin: 0; padding: 28px 10px 12px; color: var(--muted); text-align: center; }
.acct-empty span { display: block; margin-top: 4px; color: var(--faint); font-size: 12px; }
.dialog { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line-2); border-radius: 12px; padding: 22px 24px; width: min(560px, 92vw); box-shadow: 0 30px 80px -24px #000; }
.dialog[open] { animation: dialog-in 0.24s var(--ease-out); }
.dialog::backdrop { background: #05070acc; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.985); } }
.dialog h2 { margin: 0 0 12px; font-size: 17px; font-weight: 600; }
.dialog .select { display: block; margin: 4px 0 10px; }
.dialog code { font-family: var(--mono); font-size: 12px; background: var(--raise); padding: 1px 5px; border-radius: 4px; }
.dialog textarea { font-family: var(--mono); font-size: 13px; }
.dialog .row { margin-top: 12px; }
.dialog-error { white-space: pre-wrap; max-height: 160px; overflow-y: auto; }
.cred-wrap { max-height: 50vh; overflow-y: auto; }

@media (prefers-reduced-motion: reduce) {
  body:not(.login) *:not(.btn):not(.pill-motion), body:not(.login) *::after { animation: none !important; }
  .tabs::after, .case-card, .joint-mark { transition: none; }
  .case-card:hover { transform: none; }
  .btn[aria-busy="true"]::before { animation-duration: 1.6s; }
}
.audit-table th:first-child, .audit-table td:first-child { width: auto; }
.audit-table .mono { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.audit-table td { vertical-align: top; overflow-wrap: anywhere; }
#q-form input[type="text"] { width: 140px; }
