:root {
  color-scheme: dark;
  --bg: #050b0f;
  --panel: rgba(9, 21, 28, 0.93);
  --panel-strong: #09171e;
  --panel-soft: rgba(16, 35, 44, 0.68);
  --line: rgba(120, 173, 190, 0.18);
  --line-strong: rgba(103, 211, 225, 0.44);
  --cyan: #4de0e7;
  --cyan-soft: #9af2f3;
  --green: #58e39b;
  --amber: #ffb765;
  --orange: #ff7a4b;
  --ink: #eaf6f7;
  --muted: #8099a3;
  --dim: #516a74;
  --danger: #ff656f;
  font-family: "Inter", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 1180px;
  min-height: 100%;
  margin: 0;
  background: #03090d;
}

body {
  color: var(--ink);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.twin-shell {
  width: 100vw;
  height: 100vh;
  min-width: 1180px;
  min-height: 680px;
  display: grid;
  grid-template-rows: 68px minmax(0, 1fr) 82px;
  overflow: hidden;
  background:
    linear-gradient(rgba(76, 159, 173, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(76, 159, 173, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 50% -20%, rgba(34, 136, 153, 0.13), transparent 46%),
    #050b0f;
  background-size: 36px 36px, 36px 36px, auto, auto;
}

.command-header {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: 255px minmax(280px, 1fr) auto;
  align-items: center;
  gap: 24px;
  min-width: 0;
  padding: 0 290px 0 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(7, 18, 24, 0.98), rgba(11, 27, 35, 0.96) 50%, rgba(6, 17, 23, 0.98));
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.28);
}

.command-header::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  width: 36%;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.55;
}

.brand-block {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  color: inherit;
  text-decoration: none;
}

.brand-block img {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 0 18px rgba(78, 225, 231, 0.12);
}

.brand-block span {
  display: grid;
  line-height: 1;
}

.brand-block strong {
  font-size: 18px;
  letter-spacing: 0.16em;
}

.brand-block small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.18em;
}

.machine-title {
  min-width: 0;
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

.machine-title p,
.machine-title h1 {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.machine-title p {
  color: var(--cyan);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.24em;
}

.machine-title h1 {
  margin-top: 5px;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: 0.06em;
}

.system-flags {
  display: flex;
  align-items: center;
  gap: 8px;
}

.system-flags span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(90, 157, 166, 0.2);
  border-radius: 3px;
  color: #a8bec5;
  background: rgba(13, 30, 38, 0.72);
  font-size: 10px;
  white-space: nowrap;
}

.system-flags i,
.diagnosis-panel header b i,
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(88, 227, 155, 0.8);
}

.clock-block {
  position: absolute;
  right: 150px;
  display: grid;
  justify-items: end;
}

body[data-example-page="electron-beam"] .example-language-switcher {
  top: 18px;
  right: 18px;
}

.clock-block strong {
  font: 500 18px/1 "Consolas", "SFMono-Regular", monospace;
  letter-spacing: 0.05em;
}

.clock-block span {
  margin-top: 5px;
  color: var(--dim);
  font: 10px/1 "Consolas", monospace;
}

.twin-workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 262px minmax(520px, 1fr) 306px;
  gap: 8px;
  padding: 8px;
}

.side-column {
  min-height: 0;
  display: grid;
  gap: 8px;
}

.left-column {
  grid-template-rows: auto minmax(0, 1fr);
}

.right-column {
  grid-template-rows: auto auto minmax(142px, 0.9fr) minmax(122px, 0.75fr);
}

.panel,
.scene-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: linear-gradient(145deg, rgba(11, 27, 35, 0.95), rgba(6, 17, 23, 0.96));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.018), 0 10px 28px rgba(0, 0, 0, 0.13);
}

.panel::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 26px;
  height: 1px;
  content: "";
  background: var(--cyan);
  box-shadow: 0 0 9px var(--cyan);
  opacity: 0.62;
}

.panel-heading {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 29, 37, 0.56);
}

.panel-heading.compact {
  min-height: 49px;
  padding-top: 9px;
  padding-bottom: 9px;
}

.panel-heading span {
  display: block;
  margin-bottom: 4px;
  color: var(--cyan);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.panel-heading h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.panel-heading > b,
.panel-heading > em {
  color: var(--muted);
  font: 600 10px/1 "Consolas", monospace;
  font-style: normal;
}

.panel-heading > em b {
  color: var(--cyan-soft);
  font-size: 15px;
}

.cell-map {
  display: grid;
  grid-template-columns: 1fr 25px 1fr 25px 1fr;
  align-items: center;
  padding: 17px 13px 13px;
}

.map-node {
  position: relative;
  display: grid;
  place-items: center;
  height: 61px;
  padding: 6px 4px;
  border: 1px solid rgba(91, 147, 158, 0.2);
  background: rgba(12, 30, 38, 0.72);
  color: var(--muted);
  text-align: center;
  transition: border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.map-node::after {
  position: absolute;
  inset: 4px;
  content: "";
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.map-node i {
  color: var(--dim);
  font: 9px/1 "Consolas", monospace;
  font-style: normal;
}

.map-node span {
  font-size: 10px;
}

.map-node.featured,
.map-node.active {
  border-color: rgba(77, 224, 231, 0.54);
  color: var(--ink);
  background: rgba(19, 55, 64, 0.75);
  box-shadow: inset 0 0 20px rgba(77, 224, 231, 0.08), 0 0 15px rgba(77, 224, 231, 0.08);
}

.map-node.active i {
  color: var(--cyan);
}

.map-line {
  position: relative;
  height: 1px;
  background: rgba(89, 151, 161, 0.25);
}

.map-line::after {
  position: absolute;
  top: -2px;
  right: 0;
  width: 5px;
  height: 5px;
  content: "";
  border-top: 1px solid var(--cyan);
  border-right: 1px solid var(--cyan);
  transform: rotate(45deg);
}

.map-line span {
  position: absolute;
  top: -1px;
  left: 0;
  width: 8px;
  height: 3px;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
  animation: flow-line 2.2s linear infinite;
}

.work-order {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 7px 8px;
  padding: 11px 13px 13px;
  border-top: 1px solid rgba(90, 155, 165, 0.12);
  font-size: 9px;
}

.work-order span {
  color: var(--dim);
}

.work-order strong {
  overflow: hidden;
  color: #a9c1c8;
  font: 500 9px/1.3 "Consolas", "Microsoft YaHei", sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phase-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.phase-list {
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(10, minmax(34px, 1fr));
  margin: 0;
  padding: 5px 0;
  list-style: none;
}

.phase-list li {
  position: relative;
  min-height: 0;
}

.phase-list li::before,
.phase-list li::after {
  position: absolute;
  left: 25px;
  z-index: 2;
  width: 1px;
  height: 50%;
  content: "";
  background: rgba(100, 159, 169, 0.19);
}

.phase-list li::before {
  top: 0;
}

.phase-list li::after {
  top: 50%;
}

.phase-list li:first-child::before,
.phase-list li:last-child::after {
  display: none;
}

.phase-list button {
  position: relative;
  z-index: 3;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 3px 12px 3px 11px;
  border: 0;
  color: var(--muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease;
}

.phase-list button:hover,
.phase-list button:focus-visible {
  color: var(--ink);
  background: rgba(69, 187, 198, 0.07);
  outline: none;
}

.phase-list button > i {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(100, 157, 168, 0.25);
  border-radius: 50%;
  color: var(--dim);
  background: #0a171d;
  font: 8px/1 "Consolas", monospace;
  font-style: normal;
}

.phase-list button > span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.phase-list button b {
  color: #adc1c6;
  font-size: 10px;
  font-weight: 600;
}

.phase-list button small {
  overflow: hidden;
  color: var(--dim);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phase-list button > em {
  color: #3f5861;
  font: 7px/1 "Consolas", monospace;
  font-style: normal;
  letter-spacing: 0.08em;
}

.phase-list li.complete button > i {
  border-color: rgba(88, 227, 155, 0.5);
  color: var(--green);
  background: rgba(27, 67, 52, 0.68);
}

.phase-list li.complete button > i::after {
  content: "✓";
}

.phase-list li.complete button > i {
  font-size: 0;
}

.phase-list li.complete button b {
  color: #8bb8a2;
}

.phase-list li.active button {
  color: var(--ink);
  background: linear-gradient(90deg, rgba(47, 184, 196, 0.13), transparent);
  box-shadow: inset 2px 0 var(--cyan);
}

.phase-list li.active button > i {
  border-color: var(--cyan);
  color: #061216;
  background: var(--cyan);
  box-shadow: 0 0 12px rgba(77, 224, 231, 0.38);
}

.phase-list li.active button b {
  color: #efffff;
}

.phase-list li.active button > em {
  color: var(--cyan);
}

.scene-panel {
  display: grid;
  grid-template-rows: 45px minmax(0, 1fr);
  border-color: rgba(88, 164, 178, 0.25);
  background: #071116;
}

.scene-toolbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 11px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 23, 30, 0.92);
}

.view-tabs,
.scene-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}

.h5-entry-button {
  flex: 0 0 auto;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid rgba(88, 227, 155, 0.34);
  border-radius: 2px;
  color: #a9f5ce;
  background: rgba(88, 227, 155, 0.07);
  font-size: 9px;
  text-decoration: none;
  white-space: nowrap;
}

.h5-entry-button:hover,
.h5-entry-button:focus-visible {
  border-color: rgba(88, 227, 155, 0.7);
  color: #e9fff4;
  background: rgba(88, 227, 155, 0.13);
  outline: none;
}

.view-tabs button,
.scene-tools button {
  height: 28px;
  border: 1px solid transparent;
  border-radius: 2px;
  color: #779099;
  background: transparent;
  font-size: 9px;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.view-tabs button {
  min-width: 45px;
  padding: 0 10px;
}

.scene-tools button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
}

.view-tabs button:hover,
.view-tabs button:focus-visible,
.scene-tools button:hover,
.scene-tools button:focus-visible,
.view-tabs button.active,
.scene-tools button.active {
  border-color: rgba(77, 224, 231, 0.32);
  color: var(--cyan-soft);
  background: rgba(77, 224, 231, 0.08);
  outline: none;
}

.scene-tools i {
  position: relative;
  width: 12px;
  height: 12px;
  display: inline-block;
}

.tool-rotate {
  border: 1px solid currentColor;
  border-radius: 50%;
  border-left-color: transparent;
}

.tool-rotate::after {
  position: absolute;
  top: -2px;
  left: -1px;
  width: 3px;
  height: 3px;
  content: "";
  border-top: 1px solid currentColor;
  border-left: 1px solid currentColor;
  transform: rotate(-30deg);
}

.tool-cutaway {
  border: 1px solid currentColor;
  background: linear-gradient(135deg, transparent 48%, currentColor 49%, currentColor 55%, transparent 56%);
}

.tool-label::before,
.tool-label::after {
  position: absolute;
  content: "";
}

.tool-label::before {
  inset: 1px 2px 4px 1px;
  border: 1px solid currentColor;
}

.tool-label::after {
  right: 1px;
  bottom: 0;
  border-width: 3px;
  border-style: solid;
  border-color: currentColor currentColor transparent transparent;
}

.tool-reset::before,
.tool-reset::after {
  position: absolute;
  top: 1px;
  width: 7px;
  height: 9px;
  content: "";
  border: 1px solid currentColor;
}

.tool-reset::before { left: 0; border-right: 0; }
.tool-reset::after { right: 0; border-left: 0; }

.scene-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(36, 79, 88, 0.2), transparent 42%),
    linear-gradient(180deg, #071116, #040c10);
}

#twin-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
}

.scene-grid-overlay {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  opacity: 0.15;
  background-image:
    linear-gradient(rgba(106, 202, 213, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(106, 202, 213, 0.12) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(circle at center, #000, transparent 76%);
}

.loading-state {
  position: absolute;
  inset: 0;
  z-index: 14;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  color: #b5cbd0;
  background: radial-gradient(circle, rgba(13, 36, 44, 0.95), rgba(5, 14, 19, 0.98));
  transition: opacity 400ms ease, visibility 400ms ease;
}

.loading-state.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-state strong {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.loading-state small {
  color: var(--dim);
  font: 8px/1 "Consolas", monospace;
  letter-spacing: 0.18em;
}

.loader-mark {
  position: relative;
  width: 52px;
  height: 52px;
  margin-bottom: 5px;
  border: 1px solid rgba(77, 224, 231, 0.18);
  border-radius: 50%;
  animation: rotate-loader 3s linear infinite;
}

.loader-mark::before,
.loader-mark::after {
  position: absolute;
  inset: 7px;
  content: "";
  border: 1px solid rgba(77, 224, 231, 0.32);
  border-radius: 50%;
}

.loader-mark::after {
  inset: 16px;
  border-color: var(--cyan);
  background: rgba(77, 224, 231, 0.14);
  box-shadow: 0 0 18px rgba(77, 224, 231, 0.45);
}

.loader-mark span {
  position: absolute;
  top: 23px;
  left: 50%;
  width: 23px;
  height: 1px;
  background: linear-gradient(90deg, var(--cyan), transparent);
  transform-origin: left center;
}

.loader-mark span:nth-child(2) { transform: rotate(120deg); }
.loader-mark span:nth-child(3) { transform: rotate(240deg); }

.model-labels {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.model-labels.hidden {
  opacity: 0;
}

.model-label {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: auto;
  transform: translate(-8px, -50%);
  cursor: pointer;
}

.model-label > i {
  position: relative;
  width: 23px;
  height: 1px;
  background: var(--cyan);
  box-shadow: 0 0 6px rgba(77, 224, 231, 0.45);
}

.model-label > i::before {
  position: absolute;
  top: -3px;
  left: -2px;
  width: 5px;
  height: 5px;
  content: "";
  border: 1px solid var(--cyan);
  border-radius: 50%;
  background: #061217;
}

.model-label > span {
  min-width: 94px;
  display: grid;
  gap: 3px;
  padding: 6px 8px;
  border: 1px solid rgba(77, 224, 231, 0.35);
  border-left: 2px solid var(--cyan);
  color: #d8f5f5;
  background: rgba(5, 19, 24, 0.88);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.25);
  text-align: left;
  backdrop-filter: blur(7px);
}

.model-label b {
  font-size: 9px;
  font-weight: 600;
}

.model-label small {
  color: var(--cyan);
  font: 8px/1 "Consolas", monospace;
}

.scene-corner {
  position: absolute;
  z-index: 4;
  width: 42px;
  height: 42px;
  border-color: rgba(77, 224, 231, 0.38);
  border-style: solid;
  pointer-events: none;
}

.scene-corner.top-left {
  top: 13px;
  left: 13px;
  border-width: 1px 0 0 1px;
}

.scene-corner.bottom-right {
  right: 13px;
  bottom: 55px;
  border-width: 0 1px 1px 0;
}

.scene-corner span {
  position: absolute;
  width: 5px;
  height: 5px;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

.scene-corner.top-left span { top: -3px; left: -3px; }
.scene-corner.bottom-right span { right: -3px; bottom: -3px; }

.scene-hint {
  position: absolute;
  z-index: 6;
  right: 17px;
  top: 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: rgba(125, 157, 166, 0.66);
  font-size: 8px;
  pointer-events: none;
}

.scene-hint span {
  width: 13px;
  height: 18px;
  border: 1px solid currentColor;
  border-radius: 7px;
}

.scene-hint span::before {
  display: block;
  width: 1px;
  height: 4px;
  margin: 3px auto;
  content: "";
  background: currentColor;
}

.scene-caption {
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: 12px;
  z-index: 7;
  min-height: 38px;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid rgba(93, 156, 166, 0.18);
  background: rgba(5, 17, 22, 0.79);
  backdrop-filter: blur(9px);
}

.scene-caption div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.scene-caption small {
  color: var(--cyan);
  font: 7px/1 "Consolas", monospace;
  letter-spacing: 0.15em;
}

.scene-caption strong {
  overflow: hidden;
  color: #c9dcdf;
  font-size: 9px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-caption em {
  color: #5e7a83;
  font: 8px/1 "Consolas", monospace;
  font-style: normal;
}

.state-pill,
.quality-result {
  padding: 4px 7px;
  border: 1px solid rgba(88, 227, 155, 0.32);
  border-radius: 2px;
  color: var(--green) !important;
  background: rgba(88, 227, 155, 0.07);
  font-family: inherit !important;
}

.state-pill.running {
  border-color: rgba(77, 224, 231, 0.4);
  color: var(--cyan) !important;
  background: rgba(77, 224, 231, 0.09);
}

.cycle-state {
  display: grid;
  grid-template-columns: 55px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  padding: 13px 14px 9px;
}

.phase-code {
  position: relative;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(77, 224, 231, 0.28);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(77, 224, 231, 0.12), transparent 67%);
}

.phase-code::before,
.phase-code::after {
  position: absolute;
  inset: 5px;
  content: "";
  border: 1px dashed rgba(77, 224, 231, 0.24);
  border-radius: 50%;
}

.phase-code::after {
  inset: 10px;
  border-style: solid;
}

.phase-code span {
  z-index: 1;
  color: var(--cyan-soft);
  font: 700 15px/1 "Consolas", monospace;
}

.phase-code i {
  position: absolute;
  top: -2px;
  left: 24px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

.cycle-state > div:last-child {
  min-width: 0;
}

.cycle-state small {
  color: var(--dim);
  font-size: 8px;
}

.cycle-state strong {
  display: block;
  margin-top: 3px;
  color: #d8ebed;
  font-size: 13px;
}

.cycle-state p {
  overflow: hidden;
  margin: 4px 0 0;
  color: #6c858e;
  font-size: 8px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cycle-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: center;
  gap: 8px;
  padding: 0 14px 13px;
}

.cycle-progress > span {
  height: 3px;
  overflow: hidden;
  background: rgba(101, 154, 163, 0.16);
}

.cycle-progress i {
  width: 0;
  height: 100%;
  display: block;
  background: linear-gradient(90deg, #2497a8, var(--cyan));
  box-shadow: 0 0 8px rgba(77, 224, 231, 0.48);
}

.cycle-progress b {
  color: #7eabb2;
  font: 8px/1 "Consolas", monospace;
  text-align: right;
}

.parameter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.parameter-grid article {
  position: relative;
  min-width: 0;
  height: 61px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: center;
  padding: 8px 10px 9px;
  border-right: 1px solid rgba(105, 163, 173, 0.11);
  border-bottom: 1px solid rgba(105, 163, 173, 0.11);
}

.parameter-grid article:nth-child(2n) { border-right: 0; }
.parameter-grid article:nth-last-child(-n + 2) { border-bottom: 0; }

.parameter-grid article > span {
  grid-column: 1 / -1;
  color: #67808a;
  font-size: 8px;
}

.parameter-grid strong {
  overflow: hidden;
  align-self: end;
  color: #d7ecee;
  font: 600 15px/1.1 "Consolas", monospace;
  text-overflow: ellipsis;
}

.parameter-grid small {
  align-self: end;
  color: var(--dim);
  font: 7px/1.3 "Consolas", monospace;
}

.parameter-grid i {
  position: absolute;
  right: 8px;
  bottom: 5px;
  left: 8px;
  height: 1px;
  overflow: hidden;
  background: rgba(81, 130, 138, 0.14);
}

.parameter-grid i::after {
  width: var(--value, 0%);
  height: 100%;
  display: block;
  content: "";
  background: var(--cyan);
  box-shadow: 0 0 5px var(--cyan);
}

.quality-panel {
  display: grid;
  grid-template-rows: auto minmax(72px, 1fr) auto;
}

.quality-chart {
  position: relative;
  min-height: 72px;
  margin: 8px 10px 0;
  overflow: hidden;
  border-bottom: 1px solid rgba(100, 157, 168, 0.16);
  background-image:
    linear-gradient(rgba(98, 150, 159, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(98, 150, 159, 0.08) 1px, transparent 1px);
  background-size: 100% 33%, 12.5% 100%;
}

#trend-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.chart-scale {
  position: absolute;
  top: 3px;
  right: 3px;
  bottom: 3px;
  display: grid;
  align-content: space-between;
  color: rgba(91, 124, 133, 0.55);
  font: 6px/1 "Consolas", monospace;
  text-align: right;
}

.quality-values {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 9px 10px 11px;
}

.quality-values span {
  min-width: 0;
  display: grid;
  gap: 4px;
  color: var(--dim);
  font-size: 7px;
}

.quality-values b {
  color: #a8c8ce;
  font: 600 9px/1 "Consolas", monospace;
}

.quality-result.pass {
  color: var(--green) !important;
}

.diagnosis-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.diagnosis-panel header b {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
}

.event-log {
  min-height: 0;
  margin: 0;
  padding: 4px 0;
  overflow: hidden;
  list-style: none;
}

.event-log li {
  min-height: 28px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-bottom: 1px solid rgba(93, 147, 157, 0.08);
  color: #78929a;
  font-size: 8px;
}

.event-log time {
  color: #435e67;
  font: 7px/1 "Consolas", monospace;
}

.event-log li span {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-log li i {
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 5px rgba(88, 227, 155, 0.5);
}

.event-log li i.info {
  background: var(--cyan);
  box-shadow: 0 0 5px rgba(77, 224, 231, 0.5);
}

.event-log li i.warn {
  background: var(--amber);
  box-shadow: 0 0 5px rgba(255, 183, 101, 0.5);
}

.control-deck {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: 150px minmax(280px, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  border-top: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(7, 18, 24, 0.98), rgba(10, 28, 35, 0.98), rgba(6, 17, 23, 0.98));
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.22);
}

.control-deck::before {
  position: absolute;
  top: -1px;
  left: 24%;
  width: 26%;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
}

.cycle-summary {
  display: grid;
  grid-template-columns: auto auto;
  align-items: end;
  gap: 3px 8px;
}

.cycle-summary span {
  grid-column: 1 / -1;
  color: var(--dim);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.cycle-summary strong {
  color: #e3f4f5;
  font: 500 21px/1 "Consolas", monospace;
}

.cycle-summary small {
  color: #4d6871;
  font: 8px/1.4 "Consolas", monospace;
}

.timeline-wrap {
  position: relative;
  min-width: 0;
  padding: 15px 0 7px;
}

.timeline-labels {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  justify-content: space-between;
  color: #4f6c74;
  font-size: 7px;
}

#cycle-timeline {
  position: relative;
  z-index: 3;
  width: 100%;
  height: 22px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

#cycle-timeline::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 0;
  background: linear-gradient(90deg, var(--cyan) var(--progress, 0%), rgba(94, 151, 161, 0.17) var(--progress, 0%));
}

#cycle-timeline::-moz-range-track {
  height: 4px;
  background: rgba(94, 151, 161, 0.17);
}

#cycle-timeline::-moz-range-progress {
  height: 4px;
  background: var(--cyan);
}

#cycle-timeline::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  margin-top: -4px;
  appearance: none;
  border: 2px solid #09212a;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan), 0 0 12px rgba(77, 224, 231, 0.62);
}

#cycle-timeline::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 2px solid #09212a;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan), 0 0 12px rgba(77, 224, 231, 0.62);
}

.timeline-marks {
  position: absolute;
  z-index: 2;
  top: 29px;
  right: 5px;
  left: 5px;
  height: 9px;
  pointer-events: none;
}

.timeline-marks i {
  position: absolute;
  left: var(--x);
  width: 1px;
  height: 7px;
  background: #35535c;
}

.transport-controls {
  display: flex;
  align-items: center;
  gap: 7px;
}

.restart-button,
.play-button,
.speed-control button {
  height: 36px;
  border: 1px solid rgba(98, 158, 169, 0.23);
  border-radius: 2px;
  background: rgba(15, 34, 42, 0.86);
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease, transform 160ms ease;
}

.restart-button:hover,
.restart-button:focus-visible,
.play-button:hover,
.play-button:focus-visible,
.speed-control button:hover,
.speed-control button:focus-visible,
.speed-control button.active {
  border-color: rgba(77, 224, 231, 0.54);
  color: var(--cyan-soft);
  background: rgba(35, 88, 97, 0.45);
  outline: none;
}

.restart-button:active,
.play-button:active {
  transform: translateY(1px);
}

.restart-button {
  width: 36px;
  display: grid;
  place-items: center;
}

.restart-button i {
  position: relative;
  width: 13px;
  height: 13px;
  border: 1px solid currentColor;
  border-radius: 50%;
  border-left-color: transparent;
}

.restart-button i::after {
  position: absolute;
  top: -2px;
  left: -2px;
  content: "";
  border-width: 3px;
  border-style: solid;
  border-color: currentColor transparent transparent currentColor;
}

.play-button {
  min-width: 134px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 15px;
  border-color: rgba(77, 224, 231, 0.48);
  color: #d8ffff;
  background: linear-gradient(135deg, rgba(23, 93, 103, 0.68), rgba(13, 60, 70, 0.7));
  box-shadow: 0 0 18px rgba(45, 189, 201, 0.08);
  font-size: 10px;
  font-weight: 650;
}

.play-button i {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid var(--cyan);
}

.play-button.playing i {
  width: 8px;
  height: 10px;
  border: 0;
  border-left: 3px solid var(--cyan);
  border-right: 3px solid var(--cyan);
}

.speed-control {
  display: flex;
  align-items: center;
}

.speed-control button {
  min-width: 34px;
  padding: 0 7px;
  border-right-width: 0;
  color: #648089;
  font: 8px/1 "Consolas", monospace;
}

.speed-control button:last-child {
  border-right-width: 1px;
}

.loop-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-left: 4px;
  color: #647e87;
  font-size: 8px;
  cursor: pointer;
}

.loop-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.loop-switch > span {
  position: relative;
  width: 26px;
  height: 14px;
  border: 1px solid rgba(99, 157, 167, 0.3);
  border-radius: 8px;
  background: rgba(18, 39, 47, 0.8);
  transition: border-color 160ms ease, background 160ms ease;
}

.loop-switch > span::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 8px;
  height: 8px;
  content: "";
  border-radius: 50%;
  background: #59727a;
  transition: transform 160ms ease, background 160ms ease;
}

.loop-switch input:checked + span {
  border-color: rgba(77, 224, 231, 0.52);
  background: rgba(31, 100, 108, 0.58);
}

.loop-switch input:checked + span::after {
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
  transform: translateX(12px);
}

.loop-switch input:focus-visible + span {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

noscript {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  color: #fff;
  background: #071016;
}

.example-back-link {
  top: 18px;
  right: auto;
  left: 170px;
  z-index: 50;
  min-height: 30px;
  padding: 0 11px;
  font-size: 9px;
}

@keyframes flow-line {
  from { transform: translateX(0); }
  to { transform: translateX(17px); }
}

@keyframes rotate-loader {
  to { transform: rotate(360deg); }
}

@media (max-width: 1420px) {
  .command-header {
    grid-template-columns: 215px minmax(260px, 1fr) auto;
    gap: 15px;
    padding-right: 238px;
  }

  .clock-block { right: 125px; }

  .system-flags span:nth-child(2) {
    display: none;
  }

  .twin-workspace {
    grid-template-columns: 238px minmax(480px, 1fr) 286px;
  }

  .scene-tools button span {
    display: none;
  }

  .h5-entry-button {
    width: 28px;
    padding: 0;
    overflow: hidden;
    color: transparent;
  }

  .h5-entry-button::after {
    content: "H5";
    color: #a9f5ce;
  }

  .example-back-link {
    left: 168px;
    justify-content: center;
    width: 32px;
    padding: 0;
  }

  .example-back-link span {
    display: none;
  }
}

@media (max-height: 850px) {
  .twin-shell {
    grid-template-rows: 60px minmax(0, 1fr) 72px;
  }

  .command-header {
    padding-right: 14px;
    padding-left: 14px;
  }

  .brand-block img {
    width: 33px;
    height: 33px;
  }

  .machine-title h1 {
    font-size: 16px;
  }

  .panel-heading {
    min-height: 49px;
    padding-top: 9px;
    padding-bottom: 9px;
  }

  .panel-heading.compact {
    min-height: 42px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .cell-map {
    padding-top: 10px;
    padding-bottom: 8px;
  }

  .map-node {
    height: 48px;
  }

  .work-order {
    padding-top: 8px;
    padding-bottom: 9px;
  }

  .phase-list {
    padding-top: 2px;
    padding-bottom: 2px;
  }

  .phase-list button > i {
    width: 25px;
    height: 25px;
  }

  .phase-list li::before,
  .phase-list li::after {
    left: 22px;
  }

  .phase-list button small {
    display: none;
  }

  .cycle-state {
    padding-top: 8px;
    padding-bottom: 6px;
  }

  .phase-code {
    width: 43px;
    height: 43px;
  }

  .cycle-state {
    grid-template-columns: 47px minmax(0, 1fr);
  }

  .cycle-state p {
    display: none;
  }

  .parameter-grid article {
    height: 49px;
  }

  .parameter-grid strong {
    font-size: 13px;
  }

  .quality-values {
    padding-top: 6px;
    padding-bottom: 7px;
  }

  .event-log li {
    min-height: 24px;
  }

}

@media (max-width: 900px) {
  html,
  body {
    min-width: 0;
    min-height: 0;
  }

  body {
    overflow: auto;
  }

  .twin-shell {
    width: 100%;
    height: auto;
    min-width: 0;
    min-height: 100vh;
    display: block;
    overflow: visible;
  }

  .command-header {
    min-height: 64px;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
    padding: 0 128px 0 12px;
  }

  .brand-block span,
  .system-flags,
  .clock-block {
    display: none;
  }

  body[data-example-page="electron-beam"] .example-language-switcher {
    top: 12px;
    right: 10px;
  }

  .machine-title {
    padding-left: 11px;
  }

  .machine-title h1 {
    font-size: 14px;
  }

  .clock-block strong {
    font-size: 13px;
  }

  .twin-workspace {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
  }

  .scene-panel {
    order: -1;
    height: 68vh;
    min-height: 460px;
  }

  .side-column {
    display: grid;
    grid-template-columns: 1fr;
  }

  .left-column,
  .right-column {
    grid-template-rows: auto;
  }

  .phase-list {
    grid-template-rows: repeat(10, 46px);
  }

  .phase-list button small {
    display: block;
  }

  .quality-chart {
    min-height: 130px;
  }

  .event-log {
    max-height: 140px;
  }

  .control-deck {
    position: sticky;
    bottom: 0;
    min-height: 94px;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    padding: 9px 12px;
  }

  .cycle-summary {
    display: none;
  }

  .timeline-wrap {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .transport-controls {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .example-back-link {
    top: 72px;
    right: 12px;
    left: auto;
  }
}

@media (max-width: 560px) {
  .scene-panel {
    height: 64vh;
    min-height: 390px;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .scene-toolbar {
    min-height: 72px;
    align-items: stretch;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 7px;
  }

  .h5-entry-button {
    position: absolute;
    top: 7px;
    right: 7px;
    width: auto;
    padding: 0 8px;
    color: #a9f5ce;
  }

  .h5-entry-button::after {
    display: none;
  }

  .view-tabs,
  .scene-tools {
    justify-content: center;
  }

  .view-tabs button {
    flex: 1;
  }

  .scene-tools button span {
    display: inline;
  }

  .scene-hint,
  .scene-caption em,
  .model-label[data-label-object="VacuumPump"] {
    display: none;
  }

  .model-label > span {
    min-width: 78px;
    padding: 5px 6px;
  }

  .map-node span {
    font-size: 9px;
  }

  .parameter-grid article {
    height: 58px;
  }

  .play-button {
    min-width: 118px;
    padding: 0 10px;
  }

  .loop-switch b {
    display: none;
  }

  .speed-control button {
    min-width: 31px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
