:root {
  --ink: #eef0f4;
  --ink-2: rgba(238, 240, 244, 0.64);
  --ink-3: rgba(238, 240, 244, 0.42);
  --ink-4: rgba(238, 240, 244, 0.18);
  --line: rgba(238, 240, 244, 0.09);
  --glass: rgba(16, 24, 44, 0.55);
  --glass-edge: rgba(120, 160, 255, 0.14);
  --accent: #ff9a3c;
  --q: #4fa8ff;
  --qdim: rgba(79, 168, 255, 0.5);
  --term-bg: #050912;
  --term: #8fd0ff;
  --gutter: 40px;
  --radius: 16px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: 'Inter Tight', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scrollbar-color: rgba(143, 208, 255, 0.28) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(143, 208, 255, 0.22); border-radius: 9px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(143, 208, 255, 0.38); }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(120% 95% at 50% 20%, #122240 0%, #0a1226 38%, #050a16 72%, #03060d 100%) no-repeat;
  background-size: 100% max(100vh, 100%);
  background-color: #060a14;
  color: var(--ink);
  font-family: var(--font);
  letter-spacing: -0.02em;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
.mono { font-family: var(--mono); letter-spacing: 0; }
a { color: inherit; }
h2 { margin: 0; font-size: 15px; font-weight: 500; letter-spacing: -0.02em; }

/* header */
.hd { display: flex; align-items: center; justify-content: space-between; padding: 26px var(--gutter); font-size: 26px; line-height: 1; }
.hd-logo, .hd-link { position: relative; text-decoration: none; letter-spacing: -0.03em; }
.hd-ca { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.hd-nav { display: flex; align-items: center; gap: 32px; }
.hd-logo::after { content: ''; position: absolute; left: 0; right: 0; bottom: -4px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform 0.6s var(--ease); }
.hd-logo:hover::after { transform: scaleX(1); transform-origin: left; }
.hd-btn {
  display: inline-flex; align-items: center; min-height: 34px; padding: 8px 18px 9px;
  border-radius: 999px; background: #0b0f17; color: var(--ink);
  font-size: 14px; line-height: 1.15; letter-spacing: 0.02em; text-decoration: none;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 10px 30px -14px rgba(59,140,255,0.6);
  transition: background 0.35s var(--ease), color 0.35s var(--ease), transform 0.35s var(--ease);
}
.hd-btn:hover { background: var(--ink); color: #0b0f17; }
.hd-btn:active { transform: scale(0.97); }

.wrap { max-width: 1640px; margin: 0 auto; padding: 4px var(--gutter) 40px; }

/* status rail */
.rail { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; font-size: 11px; color: var(--ink-2); text-transform: uppercase; padding: 0 2px 16px; }
.rail b { color: var(--ink); font-weight: 500; }
.rail-live { display: inline-flex; align-items: center; gap: 8px; }
.rail-up { margin-left: auto; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--q); display: inline-block; animation: pulse 2.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(79,168,255,0.5); } 70% { box-shadow: 0 0 0 8px rgba(79,168,255,0); } 100% { box-shadow: 0 0 0 0 rgba(79,168,255,0); } }

/* panels */
.panel, .tele {
  background: var(--glass); border: 1px solid var(--glass-edge); border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 18px 40px -28px rgba(0,0,0,0.8);
}
.panel { padding: 18px 20px 20px; min-width: 0; contain: layout paint; }
.ph { display: flex; align-items: baseline; gap: 14px; margin-bottom: 14px; }
.ph-meta { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; }
.mini-h { font-size: 10px; color: var(--ink-3); letter-spacing: 0.02em; margin: 14px 0 8px; }

/* telemetry */
.tele { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 14px; }
.cell { position: relative; padding: 16px 18px 14px; min-height: 108px; display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
.cell + .cell { border-left: 1px solid var(--line); }
.cell .k { font-size: 12px; color: var(--ink-2); }
.cell .v { font-size: 25px; font-weight: 500; letter-spacing: -0.03em; line-height: 1.05; white-space: nowrap; }
.cell .v small { font-size: 11px; color: var(--ink-3); margin-left: 4px; letter-spacing: 0; font-weight: 400; }
.cell .s { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spark { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 36px; display: block; pointer-events: none; }
.press { height: 5px; border-radius: 5px; background: rgba(238,240,244,0.1); overflow: hidden; margin-top: auto; }
.press i { display: block; height: 100%; width: 2%; background: var(--q); transition: width 0.8s var(--ease); }

/* grids */
.grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; align-items: start; }
.grid3 { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.95fr) minmax(280px, 0.85fr); gap: 14px; margin-bottom: 14px; align-items: start; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.8fr) minmax(0, 0.95fr) minmax(0, 0.95fr); gap: 14px; margin-bottom: 14px; align-items: start; }

/* terminal feed */
.p-feed { padding-bottom: 14px; }
.feed {
  height: 440px; overflow: hidden; border-radius: 12px; background: var(--term-bg);
  color: var(--term); font-size: 12px; line-height: 17px; padding: 12px 14px;
  box-shadow: inset 0 0 0 1px rgba(143,208,255,0.12), inset 0 0 60px rgba(0,0,0,0.6);
  mask-image: linear-gradient(to bottom, transparent 0, #000 26px, #000 94%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 26px, #000 94%, transparent 100%);
  display: flex; flex-direction: column; justify-content: flex-end;
}
.feed, .minds { contain: strict; }
.fl, .ml, .lg { flex: 0 0 auto; }
.fl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fl .t { color: rgba(143,208,255,0.4); margin-right: 8px; }
.fl.dim { color: rgba(143,208,255,0.55); }
.fl.hit { color: #eaf5ff; background: rgba(79,168,255,0.16); border-radius: 3px; }

/* notebook transcript */
.minds {
  height: 520px; overflow: hidden; border-radius: 12px; background: var(--term-bg);
  color: rgba(234,245,255,0.86); font-size: 12px; line-height: 18px; padding: 12px 14px;
  box-shadow: inset 0 0 0 1px rgba(143,208,255,0.12), inset 0 0 60px rgba(0,0,0,0.6);
  mask-image: linear-gradient(to bottom, transparent 0, #000 26px, #000 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 26px, #000 100%);
  display: flex; flex-direction: column; justify-content: flex-end;
}
.ml { display: grid; grid-template-columns: 62px 38px minmax(0, 1fr); gap: 0 8px; padding: 3px 4px; border-radius: 4px; }
.ml .ts { color: rgba(143,208,255,0.35); }
.ml .who { font-weight: 700; }
.ml .tx { overflow-wrap: anywhere; }
.ml .tx i { font-style: normal; color: #ffb46b; }
.ml.sys { color: rgba(143,208,255,0.55); }
.ml.sys .who { color: rgba(143,208,255,0.45); }
.ml.qnt .who { color: #8fd0ff; }
.ml.eng .who { color: #7cffa0; }
.ml.hit { background: rgba(79,168,255,0.16); color: #eaf5ff; }

/* current code */
.job-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -4px 0 10px; }
.jid { font-size: 11px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip { flex: none; font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; background: rgba(238,240,244,0.1); color: var(--ink); font-family: var(--mono); }
.chip.run { background: var(--q); color: #04101f; animation: pulse 2.2s infinite; }
.chip.done { background: var(--ink); color: #0b0f17; }
.chip.fail { background: var(--accent); color: #0b0f17; }
.run-target { display: grid; gap: 1px; background: var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 4px; }
.rt-row { background: rgba(10, 16, 30, 0.6); padding: 9px 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rt-row span { font-size: 11px; color: var(--ink-2); text-transform: uppercase; flex: none; }
.rt-row b { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rt-row b.big { color: var(--q); }
.rt-row b.nwrap { font-size: 11px; white-space: normal; overflow-wrap: anywhere; text-align: right; line-height: 1.35; }
.bar { height: 6px; border-radius: 6px; background: rgba(238,240,244,0.1); overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #1b3d86, var(--q)); border-radius: 6px; transition: width 0.25s linear; }
.split { width: 100%; height: 54px; display: block; border-radius: 10px; background: rgba(5, 9, 18, 0.7); box-shadow: inset 0 0 0 1px rgba(143,208,255,0.12); }

/* knowledge */
.know { list-style: none; margin: 0; padding: 0; max-height: 440px; overflow: auto; display: grid; gap: 0; }
.know li { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 2px 10px; padding: 8px 6px; border-bottom: 1px solid var(--line); border-radius: 6px; font-size: 11px; line-height: 1.4; transition: background 0.4s var(--ease); }
.know li:last-child { border-bottom: 0; }
.know .fn { color: var(--q); font-weight: 700; }
.know .ft { color: var(--ink); font-family: var(--font); font-size: 12.5px; letter-spacing: -0.01em; }
.know .fh { grid-column: 2; color: var(--ink-3); }
.know .fu { grid-column: 2; color: var(--ink-2); text-transform: uppercase; font-size: 9.5px; letter-spacing: 0.04em; }
.know li.on { background: rgba(79,168,255,0.14); }
.know li.on .fh { color: var(--ink-2); }
.p-know .press { margin-top: 0; }

/* record board */
.rec { list-style: none; margin: 0; padding: 0; }
.rec li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: baseline; padding: 11px 2px; border-bottom: 1px solid var(--line); }
.rec li:last-child { border-bottom: 0; }
.rec .n { font-size: 12px; color: var(--ink-2); }
.rec .v { font-size: 17px; font-weight: 500; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.rec .m { grid-column: 1 / -1; font-size: 11px; color: var(--ink-3); font-family: var(--mono); overflow-wrap: anywhere; }
.rec .m b { color: var(--ink); font-weight: 500; }
.rec li.ours { background: rgba(79,168,255,0.12); border-radius: 10px; padding: 11px 10px; margin: 4px -8px; border-bottom: 0; }
.rec li.ours .v { color: var(--q); }

.note { margin: 14px 0 0; font-size: 12px; line-height: 1.45; color: var(--ink-2); }

/* ladder */
.ladder { width: 100%; height: 230px; display: block; border-radius: 10px; background: var(--term-bg); box-shadow: inset 0 0 0 1px rgba(143,208,255,0.12); }
.circ-note { margin-top: 10px; font-size: 11px; color: var(--ink-2); }

/* register */
.reg { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.reg li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 12px; }
.reg li:last-child { border-bottom: 0; }
.reg span { color: var(--ink-2); flex: none; }
.reg b { font-weight: 500; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* factor log */
.log { height: 232px; overflow: hidden; font-size: 11.5px; line-height: 19px; color: var(--ink-2); display: flex; flex-direction: column; justify-content: flex-end; mask-image: linear-gradient(to bottom, transparent 0, #000 20px, #000 100%); -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 20px, #000 100%); }
.lg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg b { color: var(--q); font-weight: 600; }
.lg .t { color: var(--ink-3); }

/* footer */
.ft { display: flex; flex-wrap: wrap; gap: 6px 26px; font-size: 10.5px; color: var(--ink-2); padding: 4px 2px; }

/* responsive */
@media (max-width: 1240px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .grid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .grid3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .p-minds { grid-column: 1 / -1; }
  .p-log { grid-column: 1 / -1; }
  .tele { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cell:nth-child(4) { border-left: 0; }
  .cell:nth-child(n+4) { border-top: 1px solid var(--line); }
}
@media (max-width: 820px) {
  :root { --gutter: 16px; }
  .hd { padding: 18px var(--gutter); font-size: 20px; }
  .hd-nav { gap: 16px; }
  .rail-up { margin-left: 0; }
  .tele { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cell:nth-child(n) { border-left: 0; border-top: 1px solid var(--line); }
  .cell:nth-child(2n) { border-left: 1px solid var(--line); }
  .cell:nth-child(-n+2) { border-top: 0; }
  .cell .v { font-size: 21px; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .grid3 { grid-template-columns: minmax(0, 1fr); }
  .feed { height: 320px; }
  .minds { height: 380px; }
  .ml { grid-template-columns: 38px minmax(0, 1fr); }
  .ml .ts { display: none; }
  .panel { padding: 16px 14px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* engine panel: let values wrap instead of clipping */
.p-reg .reg li { align-items: flex-start; }
.p-reg .reg b { white-space: normal; overflow: visible; }

/* queue list under the bench */
.queue { display: grid; gap: 0; max-height: 190px; overflow: hidden; font-size: 11px; }
.ql { display: flex; justify-content: space-between; gap: 10px; padding: 5px 2px; border-bottom: 1px solid var(--line); color: var(--ink-2); }
.ql:last-child { border-bottom: 0; }
.ql a { color: var(--q); text-decoration: none; }
.jid { color: var(--ink-2); text-decoration: none; }
.jid:hover { color: var(--q); }
.lg a { color: inherit; text-decoration: none; }
.lg a:hover b { text-decoration: underline; }
