:root {
  color-scheme: dark;
  --bg: #07111c;
  --panel: #0d1e2d;
  --panel-2: #12283a;
  --panel-3: #173249;
  --line: rgba(145, 181, 207, 0.22);
  --text: #f4f8fb;
  --muted: #9bb3c5;
  --cyan: #48d9c5;
  --cyan-deep: #17aa99;
  --blue: #67b7ff;
  --amber: #ffc257;
  --red: #ff667c;
  --green: #72e49b;
  --purple: #b894ff;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  font-family:
    "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
}

.text-button {
  padding: 0;
  border: 0;
  cursor: pointer;
  color: var(--blue);
  background: transparent;
  font-size: 14px;
}

.text-button:hover {
  text-decoration: underline;
}

.scenario-list {
  display: grid;
  gap: 5px;
}

.scenario-nav-copy {
  min-width: 0;
}

.scenario-nav-copy strong,
.scenario-nav-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clear-progress {
  width: 100%;
  margin-top: 10px;
  padding: 9px 11px;
  border: 1px solid rgba(255, 102, 124, 0.25);
  border-radius: 10px;
  cursor: pointer;
  color: #ffb4c0;
  background: rgba(255, 102, 124, 0.06);
  font-size: 12px;
}

.lobby-metrics,
.scenario-card-meta,
.review-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.lobby-metrics {
  margin-top: 18px;
}

.lobby-metrics span,
.scenario-card-meta span {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(4, 16, 25, 0.34);
  font-size: 12px;
}

.lobby-metrics b {
  margin-right: 4px;
  color: var(--cyan);
}

.scenario-card.compact {
  min-height: 285px;
}

.scenario-card-top,
.term-card-title,
.lab-action-head,
.diagram-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.mastery-badge,
.knowledge-label,
.action-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(3, 14, 23, 0.42);
  font-size: 11px;
  font-weight: 800;
}

.mastery-badge.mastered {
  color: #b9f4d0;
  border-color: rgba(114, 228, 155, 0.38);
  background: rgba(114, 228, 155, 0.09);
}

.learning-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.learning-shell > * {
  min-width: 0;
}

.learning-stage-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(7, 24, 37, 0.9);
}

.learning-stage {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  color: var(--muted);
  background: rgba(11, 32, 48, 0.75);
  font-weight: 800;
}

.learning-stage.active {
  color: #05231f;
  border-color: rgba(72, 217, 197, 0.6);
  background: var(--cyan);
}

.diagram-toolbar {
  align-items: center;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(9, 28, 43, 0.92);
}

.diagram-toolbar > div:first-child {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.diagram-layer-switch {
  display: flex;
  flex-shrink: 0;
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(2, 11, 18, 0.45);
}

.diagram-layer-switch button {
  min-height: 32px;
  padding: 6px 10px;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.diagram-layer-switch button.active {
  color: var(--text);
  background: var(--panel-3);
}

.lab-diagram-panel,
.demonstration-panel,
.stage-callout,
.lab-workbench,
.lab-review,
.term-drawer {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background:
    linear-gradient(145deg, rgba(16, 45, 65, 0.92), rgba(8, 25, 39, 0.94)),
    var(--panel);
  box-shadow: var(--shadow);
}

.lab-diagram-svg {
  display: block;
  width: 100%;
  max-height: 430px;
  margin-top: 10px;
  border-radius: 12px;
  background:
    linear-gradient(rgba(112, 157, 182, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(112, 157, 182, 0.055) 1px, transparent 1px),
    rgba(2, 12, 20, 0.55);
  background-size: 24px 24px;
}

.lab-diagram-edge {
  stroke: #6c95ad;
  stroke-width: 2.5;
}

.lab-diagram-svg marker path {
  fill: #6c95ad;
}

.lab-edge-label {
  fill: var(--amber);
  font-size: 12px;
}

.lab-diagram-node rect {
  fill: #112b3d;
  stroke: #557b94;
  stroke-width: 2;
}

.lab-diagram-node text {
  fill: #ecf5f8;
  font-size: 13px;
  font-weight: 800;
}

.lab-diagram-node .lab-node-index {
  fill: #82a6bc;
  font-size: 10px;
  font-weight: 600;
}

.lab-diagram-node.node-source rect,
.lab-diagram-node.node-start rect {
  stroke: var(--blue);
}

.lab-diagram-node.node-fault rect {
  fill: rgba(117, 28, 45, 0.56);
  stroke: var(--red);
}

.lab-diagram-node.node-ground rect {
  stroke: var(--green);
}

.lab-diagram-node.node-active rect {
  fill: rgba(36, 121, 111, 0.48);
  stroke: var(--cyan);
  filter: drop-shadow(0 0 8px rgba(72, 217, 197, 0.3));
}

.term-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.term-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(7, 25, 38, 0.82);
}

.term-card h4,
.lab-action-card h4 {
  margin: 5px 0 0;
}

.term-card p {
  margin: 9px 0 0;
  color: #c6d8e2;
  line-height: 1.65;
  font-size: 13px;
}

.term-danger {
  color: #ffc1ca !important;
}

.term-drawer summary {
  cursor: pointer;
  color: var(--cyan);
  font-weight: 800;
}

.term-drawer .term-grid {
  margin-top: 14px;
}

.stage-callout {
  text-align: center;
}

.stage-callout p {
  color: var(--muted);
}

.demo-timeline {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  padding: 0;
  list-style: none;
}

.demo-timeline li {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(4, 17, 27, 0.42);
}

.demo-timeline li > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #06221f;
  background: var(--cyan);
  font-weight: 900;
}

.demo-timeline p {
  margin: 3px 0 0;
  color: var(--muted);
}

.lab-action-groups {
  display: grid;
  gap: 12px;
}

.lab-station {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(3, 14, 23, 0.34);
}

.lab-station > h3 {
  margin-bottom: 10px;
  color: var(--cyan);
  font-size: 14px;
}

.lab-action-card {
  margin-top: 8px;
  padding: 13px;
  border: 1px solid rgba(139, 177, 201, 0.18);
  border-radius: 11px;
  background: rgba(14, 40, 58, 0.66);
}

.lab-action-card.completed {
  border-color: rgba(114, 228, 155, 0.35);
  background: rgba(35, 100, 74, 0.2);
}

.lab-action-card.blocked {
  border-style: dashed;
}

.action-status {
  flex-shrink: 0;
}

.lab-option-grid,
.lab-multi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.lab-option,
.lab-multi-grid label {
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  color: #d9e8ef;
  background: rgba(3, 15, 24, 0.48);
  text-align: left;
}

.lab-option:hover,
.lab-multi-grid label:hover {
  border-color: rgba(72, 217, 197, 0.5);
}

.lab-multi-grid label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.lab-action-card .button,
.lab-action-card .textarea {
  margin-top: 12px;
}

.lab-review .review-cards .status-card {
  flex: 1 1 160px;
}

.variant-facts,
.mistake-list {
  margin-top: 14px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(4, 16, 25, 0.42);
}

.variant-facts li,
.mistake-list p {
  color: #c8dae4;
  line-height: 1.65;
}

@media (max-width: 1180px) {
  .term-grid,
  .lab-option-grid,
  .lab-multi-grid {
    grid-template-columns: 1fr;
  }

  .diagram-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .diagram-layer-switch {
    width: 100%;
  }

  .diagram-layer-switch button {
    flex: 1;
  }
}

@media (max-width: 820px) {
  .learning-stage-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

body {
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 0%, rgba(37, 139, 145, 0.24), transparent 28%),
    radial-gradient(circle at 100% 18%, rgba(68, 93, 170, 0.18), transparent 32%),
    linear-gradient(160deg, #07111c, #081725 50%, #061019);
}

button,
textarea,
select,
input {
  font: inherit;
}

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

button {
  color: inherit;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

.sim-shell {
  width: min(1700px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.sim-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 17px 21px;
  border: 1px solid var(--line);
  border-radius: 20px 20px 8px 8px;
  background:
    linear-gradient(120deg, rgba(19, 52, 70, 0.96), rgba(10, 27, 42, 0.96)),
    var(--panel);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(72, 217, 197, 0.4);
  border-radius: 15px;
  color: var(--amber);
  background: rgba(72, 217, 197, 0.1);
  box-shadow: inset 0 0 24px rgba(72, 217, 197, 0.08);
  font-size: 25px;
}

.brand p {
  margin-bottom: 3px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.11em;
}

.brand h1 {
  margin-bottom: 0;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.1;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.offline-badge,
.status-chip,
.severity,
.mode-label {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.offline-badge {
  color: #b9f4d0;
  border: 1px solid rgba(114, 228, 155, 0.35);
  background: rgba(114, 228, 155, 0.08);
}

.text-link {
  color: var(--blue);
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.control-bar {
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin: 7px 0 13px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 8px 8px 16px 16px;
  background: rgba(10, 27, 42, 0.95);
  box-shadow: var(--shadow);
}

.mode-switch {
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(2, 11, 18, 0.55);
}

.mode-button {
  min-height: 34px;
  padding: 7px 13px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.mode-button.active {
  color: #03211d;
  background: var(--cyan);
}

.control-note {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
}

.control-note strong {
  color: var(--text);
}

.control-note span {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button {
  min-height: 39px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
  transition:
    transform 0.12s ease,
    filter 0.12s ease,
    border-color 0.12s ease;
}

.button:hover {
  filter: brightness(1.08);
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.7);
  opacity: 0.5;
}

.button-primary {
  color: #03211d;
  background: var(--cyan);
}

.button-amber {
  color: #271800;
  background: var(--amber);
}

.button-danger {
  color: #fff;
  background: var(--red);
}

.button-ghost {
  color: #d8e9f5;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.button-small {
  min-height: 31px;
  padding: 5px 9px;
  font-size: 12px;
}

.sim-workspace {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 13px;
  min-height: calc(100vh - 175px);
}

.sim-sidebar,
.sim-main {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(12, 29, 44, 0.94);
  box-shadow: var(--shadow);
}

.sim-sidebar {
  align-self: start;
  position: sticky;
  top: 12px;
  display: grid;
  gap: 8px;
  padding: 11px;
}

.scenario-home,
.scenario-entry {
  display: grid;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  background: transparent;
  text-align: left;
}

.scenario-home {
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 11px;
}

.scenario-entry {
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px 10px;
}

.scenario-home:hover,
.scenario-home.active,
.scenario-entry:hover,
.scenario-entry.active {
  border-color: rgba(72, 217, 197, 0.42);
  background: rgba(72, 217, 197, 0.09);
}

.nav-icon,
.scenario-index {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(103, 183, 255, 0.36);
  border-radius: 10px;
  color: var(--blue);
  background: rgba(103, 183, 255, 0.08);
  font-weight: 900;
}

.scenario-home strong,
.scenario-home small,
.scenario-entry strong,
.scenario-entry small {
  display: block;
}

.scenario-home strong,
.scenario-entry strong {
  font-size: 13px;
  line-height: 1.4;
}

.scenario-home small,
.scenario-entry small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.sidebar-facts {
  margin-top: 7px;
  padding: 14px;
  border: 1px solid rgba(255, 194, 87, 0.25);
  border-radius: 12px;
  background: rgba(255, 194, 87, 0.06);
}

.sidebar-facts p {
  margin-bottom: 6px;
  color: var(--amber);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.sidebar-facts strong,
.sidebar-facts span {
  display: block;
}

.sidebar-facts span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.sim-main {
  min-width: 0;
  padding: clamp(16px, 2.5vw, 28px);
}

.lobby-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 14px;
  margin-bottom: 18px;
}

.lobby-intro,
.learning-loop,
.scenario-card,
.sim-panel,
.status-card,
.log-panel,
.meter,
.schematic-panel {
  border: 1px solid var(--line);
  background: rgba(15, 35, 52, 0.74);
}

.lobby-intro,
.learning-loop {
  padding: clamp(20px, 3vw, 32px);
  border-radius: 18px;
}

.lobby-intro {
  background:
    linear-gradient(145deg, rgba(26, 84, 91, 0.42), rgba(15, 35, 52, 0.76)),
    var(--panel);
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.11em;
}

.lobby-intro h2,
.scenario-title h2 {
  margin-bottom: 10px;
  font-size: clamp(25px, 3.5vw, 40px);
}

.lobby-intro p,
.scenario-title p,
.learning-loop p {
  color: #cfdee8;
  line-height: 1.8;
}

.learning-loop ol {
  display: grid;
  gap: 9px;
  padding-left: 21px;
  margin: 13px 0 0;
  color: #d9e6ee;
  line-height: 1.55;
}

.scenario-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.scenario-card {
  position: relative;
  overflow: hidden;
  min-height: 240px;
  padding: 22px;
  border-radius: 17px;
}

.scenario-card::after {
  position: absolute;
  right: -38px;
  bottom: -50px;
  width: 170px;
  height: 170px;
  border: 1px solid rgba(72, 217, 197, 0.16);
  border-radius: 50%;
  content: "";
}

.scenario-card h3 {
  margin-bottom: 9px;
  font-size: 21px;
}

.scenario-card p {
  max-width: 620px;
  color: var(--muted);
  line-height: 1.7;
}

.scenario-card ul {
  display: grid;
  gap: 5px;
  padding-left: 20px;
  color: #d8e6ee;
  font-size: 13px;
  line-height: 1.5;
}

.scenario-card .button {
  position: relative;
  z-index: 1;
  margin-top: 10px;
}

.scenario-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.scenario-title {
  min-width: 0;
}

.scenario-title p {
  max-width: 900px;
  margin-bottom: 0;
  color: var(--muted);
}

.scenario-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.status-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.status-card {
  padding: 11px 13px;
  border-radius: 11px;
}

.status-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.status-card strong {
  display: block;
  margin-top: 5px;
  font-size: 15px;
}

.status-good {
  color: var(--green);
}

.status-warn {
  color: var(--amber);
}

.status-bad {
  color: var(--red);
}

.hint-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 194, 87, 0.28);
  border-radius: 11px;
  background: rgba(255, 194, 87, 0.06);
}

.hint-strip p {
  margin: 0;
  color: #ffe0a5;
  line-height: 1.5;
}

.sim-tabs {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  margin-bottom: 10px;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}

.tab-button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-weight: 800;
}

.tab-button.active {
  color: var(--text);
  border-color: rgba(72, 217, 197, 0.5);
  background: rgba(72, 217, 197, 0.1);
}

.sim-panel {
  padding: 15px;
  border-radius: 14px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-heading h3 {
  margin-bottom: 3px;
}

.panel-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.monitor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(270px, 0.65fr);
  gap: 11px;
}

.one-line-wrap {
  min-width: 0;
  overflow: auto;
  overscroll-behavior-inline: contain;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(rgba(103, 183, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(103, 183, 255, 0.035) 1px, transparent 1px),
    rgba(2, 12, 20, 0.55);
  background-size: 24px 24px;
  -webkit-overflow-scrolling: touch;
}

.one-line {
  display: block;
  min-width: 820px;
  width: 100%;
  height: auto;
}

.one-line text,
.circuit-svg text {
  fill: #dceaf2;
  font-family: "Microsoft YaHei UI", sans-serif;
  font-size: 12px;
}

.bus-line {
  stroke-width: 9;
  stroke-linecap: round;
}

.bus-energized {
  stroke: var(--green);
  filter: drop-shadow(0 0 7px rgba(114, 228, 155, 0.48));
}

.bus-dead {
  stroke: #567084;
}

.bus-fault {
  stroke: var(--red);
  filter: drop-shadow(0 0 8px rgba(255, 102, 124, 0.55));
}

.conductor {
  stroke: #91aabc;
  stroke-width: 3;
}

.conductor-live {
  stroke: var(--green);
}

.device-symbol {
  cursor: pointer;
  outline: none;
  pointer-events: bounding-box;
}

.device-symbol:hover .device-hit,
.device-symbol:focus .device-hit,
.device-symbol.selected .device-hit {
  stroke: var(--cyan);
  stroke-width: 3;
}

.device-hit {
  fill: rgba(9, 27, 40, 0.92);
  stroke: #7891a3;
  stroke-width: 2;
}

.device-closed .device-hit {
  fill: rgba(114, 228, 155, 0.22);
  stroke: var(--green);
}

.device-open .device-hit {
  fill: rgba(86, 112, 132, 0.3);
}

.device-failed .device-hit {
  fill: rgba(255, 102, 124, 0.22);
  stroke: var(--red);
}

.fault-flash {
  fill: var(--red);
  animation: faultPulse 1s infinite alternate;
}

@keyframes faultPulse {
  from {
    opacity: 0.45;
  }
  to {
    opacity: 1;
  }
}

.alarm-stack {
  display: grid;
  align-content: start;
  gap: 8px;
}

.alarm-item {
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.alarm-item.trip {
  border-color: rgba(255, 102, 124, 0.42);
  background: rgba(255, 102, 124, 0.08);
}

.alarm-item.acknowledged {
  opacity: 0.62;
}

.alarm-item strong {
  display: block;
  margin-bottom: 4px;
  color: var(--red);
  font-size: 12px;
}

.alarm-item p {
  margin-bottom: 0;
  line-height: 1.45;
}

.device-control {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid rgba(103, 183, 255, 0.25);
  border-radius: 11px;
  background: rgba(103, 183, 255, 0.05);
}

.device-control h4 {
  margin-bottom: 5px;
}

.device-control p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.inspection-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
}

.inspection-card.checked {
  border-color: rgba(114, 228, 155, 0.4);
  background: rgba(114, 228, 155, 0.055);
}

.inspection-card h4 {
  margin-bottom: 7px;
}

.inspection-card p {
  min-height: 42px;
  margin-bottom: 11px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.finding {
  margin-top: 9px;
  padding: 9px;
  border-radius: 9px;
  color: #c9f1d6;
  background: rgba(114, 228, 155, 0.08);
  font-size: 12px;
  line-height: 1.55;
}

.dispatch-layout,
.notebook-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.75fr);
  gap: 10px;
}

.dispatch-stage {
  color: var(--amber);
  font-size: 12px;
  font-weight: 900;
}

.textarea {
  width: 100%;
  min-height: 145px;
  padding: 12px;
  resize: vertical;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: rgba(2, 11, 18, 0.55);
  line-height: 1.7;
}

.textarea:focus {
  border-color: rgba(72, 217, 197, 0.55);
  box-shadow: 0 0 0 3px rgba(72, 217, 197, 0.07);
}

.dispatch-history,
.note-list {
  max-height: 310px;
  overflow: auto;
}

.history-item {
  margin-bottom: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
}

.history-item strong {
  color: var(--blue);
  font-size: 12px;
}

.history-item p {
  margin: 5px 0 0;
  color: #d9e6ed;
  font-size: 12px;
  line-height: 1.5;
}

.log-panel {
  margin-top: 12px;
  padding: 13px;
  border-radius: 13px;
}

.log-list {
  display: grid;
  max-height: 280px;
  overflow: auto;
  gap: 6px;
}

.log-entry {
  display: grid;
  grid-template-columns: 46px 76px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
  font-size: 12px;
}

.log-time {
  color: #7190a6;
  font-family: Consolas, monospace;
}

.severity {
  justify-content: center;
  min-height: 22px;
  padding: 2px 6px;
}

.severity-success {
  color: #baf1cc;
  background: rgba(114, 228, 155, 0.11);
}

.severity-critical {
  color: #ffc0cb;
  background: rgba(255, 102, 124, 0.12);
}

.severity-warning {
  color: #ffe0a6;
  background: rgba(255, 194, 87, 0.12);
}

.severity-info {
  color: #cce6ff;
  background: rgba(103, 183, 255, 0.11);
}

.log-copy strong {
  display: block;
  margin-bottom: 3px;
}

.log-copy span {
  color: var(--muted);
  line-height: 1.45;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.result-item {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.result-item span,
.result-item strong {
  display: block;
}

.result-item span {
  color: var(--muted);
  font-size: 11px;
}

.result-item strong {
  margin-top: 5px;
}

.q10-grid {
  display: grid;
  grid-template-columns: minmax(620px, 1.5fr) minmax(310px, 0.7fr);
  align-items: start;
  gap: 11px;
}

.schematic-panel {
  min-width: 0;
  overflow: auto;
  overscroll-behavior-inline: contain;
  padding: 13px;
  border-radius: 13px;
  -webkit-overflow-scrolling: touch;
}

.circuit-svg {
  display: block;
  min-width: 760px;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
  background:
    linear-gradient(rgba(103, 183, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(103, 183, 255, 0.035) 1px, transparent 1px),
    rgba(2, 12, 20, 0.55);
  background-size: 20px 20px;
}

.circuit-wire {
  fill: none;
  stroke: #a1b8c8;
  stroke-width: 3;
}

.circuit-live {
  stroke: var(--green);
  filter: drop-shadow(0 0 5px rgba(114, 228, 155, 0.35));
}

.component-box {
  fill: #10273a;
  stroke: #7792a6;
  stroke-width: 2;
}

.component-box.active {
  stroke: var(--green);
}

.test-point {
  fill: #07121d;
  stroke: var(--amber);
  stroke-width: 3;
  cursor: crosshair;
}

.test-point:hover,
.test-point.probe-red,
.test-point.probe-black {
  stroke-width: 5;
  filter: drop-shadow(0 0 5px currentColor);
}

.test-point.probe-red {
  color: var(--red);
  stroke: var(--red);
}

.test-point.probe-black {
  color: #dce7ee;
  stroke: #dce7ee;
}

.meter-column {
  display: grid;
  gap: 10px;
}

.meter {
  padding: 15px;
  border-radius: 15px;
  background:
    linear-gradient(155deg, rgba(48, 57, 64, 0.95), rgba(19, 25, 29, 0.98)),
    #222;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.035),
    var(--shadow);
}

.meter-brand {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  color: #e5edf2;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.meter-display {
  min-height: 76px;
  padding: 12px;
  border: 3px solid #26372d;
  border-radius: 8px;
  color: #18321e;
  background: #b9d1a4;
  box-shadow: inset 0 4px 8px rgba(18, 49, 26, 0.2);
  font-family: Consolas, monospace;
  text-align: right;
}

.meter-display strong {
  display: block;
  overflow: hidden;
  font-size: clamp(21px, 2.8vw, 31px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meter-display span {
  display: block;
  margin-top: 5px;
  font-size: 11px;
}

.meter-modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 12px 0;
}

.meter-mode {
  padding: 8px 4px;
  border: 1px solid #4f5b62;
  border-radius: 8px;
  cursor: pointer;
  color: #cad5da;
  background: #263139;
  font-size: 12px;
  font-weight: 900;
}

.meter-mode.active {
  color: #201500;
  border-color: var(--amber);
  background: var(--amber);
}

.probe-dock {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.probe-handle {
  min-height: 58px;
  padding: 8px;
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: grab;
  background: #151d22;
  text-align: left;
}

.probe-handle.active {
  border-color: var(--amber);
}

.probe-handle strong,
.probe-handle span {
  display: block;
}

.probe-handle strong {
  font-size: 12px;
}

.probe-handle span {
  overflow: hidden;
  margin-top: 4px;
  color: #9fadB4;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.probe-red strong {
  color: var(--red);
}

.probe-black strong {
  color: #e5edf1;
}

.control-console,
.repair-console,
.measurement-list {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.control-console h3,
.repair-console h3,
.measurement-list h3 {
  margin-bottom: 9px;
  font-size: 15px;
}

.console-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.console-value {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(2, 11, 18, 0.45);
}

.console-value span,
.console-value strong {
  display: block;
}

.console-value span {
  color: var(--muted);
  font-size: 10px;
}

.console-value strong {
  margin-top: 4px;
  font-size: 12px;
}

.repair-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.repair-button {
  min-height: 43px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
  font-size: 11px;
  line-height: 1.35;
}

.repair-button:hover {
  border-color: rgba(72, 217, 197, 0.46);
}

.repair-button.repaired {
  color: var(--green);
  border-color: rgba(114, 228, 155, 0.4);
  background: rgba(114, 228, 155, 0.07);
}

.measurement-list ul {
  max-height: 190px;
  overflow: auto;
  padding: 0;
  margin: 0;
  list-style: none;
}

.measurement-list li {
  padding: 7px 0;
  border-bottom: 1px solid rgba(145, 181, 207, 0.1);
  color: #d6e4ec;
  font-family: Consolas, "Microsoft YaHei UI", sans-serif;
  font-size: 11px;
  line-height: 1.45;
}

.measurement-list li:last-child {
  border-bottom: 0;
}

.fault-review {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.fault-card {
  padding: 10px;
  border: 1px solid rgba(255, 194, 87, 0.3);
  border-radius: 9px;
  background: rgba(255, 194, 87, 0.06);
}

.fault-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--amber);
  font-size: 12px;
}

.fault-card span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.scenario-evidence {
  margin: 14px 0 18px;
  padding: 14px;
  overflow: hidden;
  border: 1px solid rgba(71, 176, 207, 0.28);
  border-radius: 12px;
  background:
    linear-gradient(145deg, rgba(10, 34, 49, 0.94), rgba(4, 18, 29, 0.98)),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(96, 177, 201, 0.03) 40px);
}

.dedicated-variant-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 194, 87, 0.28);
  border-radius: 9px;
  background: rgba(255, 194, 87, 0.06);
}

.remedial-guide {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(320px, 1.3fr);
  gap: 14px;
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 194, 87, 0.32);
  border-radius: 10px;
  background: rgba(255, 194, 87, 0.06);
}

.remedial-guide span {
  color: var(--amber);
  font-size: 10px;
}

.remedial-guide h3 {
  margin: 4px 0 0;
  font-size: 14px;
}

.remedial-guide ul,
.remedial-guide p {
  margin: 0;
  color: #d8e4eb;
  font-size: 11px;
  line-height: 1.6;
}

.remedial-guide ul {
  padding-left: 18px;
}

.dedicated-variant-banner span {
  color: var(--muted);
  font-size: 10px;
}

.dedicated-variant-banner strong {
  color: var(--amber);
  font-size: 12px;
}

.evidence-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.evidence-heading > div > span {
  color: var(--cyan);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.evidence-heading h3 {
  margin: 3px 0 0;
  font-size: 15px;
}

.evidence-grid {
  display: grid;
  gap: 8px;
}

.evidence-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.evidence-grid article {
  min-height: 92px;
  padding: 11px;
  border: 1px solid rgba(145, 181, 207, 0.18);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.18);
}

.evidence-grid article strong,
.evidence-grid article span,
.evidence-grid article small {
  display: block;
}

.evidence-grid article strong,
.evidence-grid article span {
  min-height: 45px;
  font-size: 12px;
  line-height: 1.5;
}

.evidence-grid article small {
  margin-top: 7px;
  color: var(--muted);
}

.evidence-waiting {
  color: #8aa2b3;
}

.power-strip,
.kelvin-leads {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.power-strip span,
.kelvin-leads span,
.kelvin-leads b {
  flex: 1;
  padding: 8px;
  border: 1px solid rgba(72, 217, 197, 0.24);
  border-radius: 8px;
  color: #c8dce8;
  text-align: center;
  font-size: 11px;
}

.power-strip i {
  width: 28px;
  height: 2px;
  background: var(--amber);
  box-shadow: 0 0 8px rgba(255, 194, 87, 0.42);
}

.power-strip.restored i {
  background: var(--green);
  box-shadow: 0 0 8px rgba(114, 228, 155, 0.5);
}

.transformer-scene {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(220px, 0.65fr);
  align-items: center;
  gap: 12px;
}

.transformer-scene svg {
  width: 100%;
  min-height: 230px;
  border: 1px solid rgba(145, 181, 207, 0.14);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.scene-wire {
  fill: none;
  stroke: #52778e;
  stroke-width: 4;
}

.transformer-component rect {
  fill: #102b3c;
  stroke: #45687e;
  stroke-width: 2;
}

.transformer-component text {
  fill: #9fb5c3;
  font-size: 13px;
}

.transformer-component text:last-child {
  font-size: 10px;
}

.transformer-component.checked rect {
  fill: rgba(72, 217, 197, 0.12);
  stroke: var(--cyan);
}

.transformer-component.checked text {
  fill: #dff9f4;
}

.transformer-component.defect rect {
  fill: rgba(255, 102, 102, 0.15);
  stroke: #ff6b6b;
  stroke-width: 3;
}

.evidence-note,
.evidence-alert {
  padding: 14px;
  border: 1px solid rgba(145, 181, 207, 0.18);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
}

.evidence-alert {
  border-color: rgba(255, 102, 102, 0.42);
  background: rgba(255, 102, 102, 0.08);
}

.evidence-note strong,
.evidence-alert strong {
  font-size: 13px;
}

.evidence-note p,
.evidence-alert p,
.evidence-caption {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.waveform-evidence svg {
  width: 100%;
  min-height: 265px;
  border: 1px solid rgba(145, 181, 207, 0.14);
  border-radius: 10px;
  background: #06131e;
}

.wave-zone {
  fill: rgba(72, 217, 197, 0.025);
}

.wave-zone.fault {
  fill: rgba(255, 102, 102, 0.06);
}

.wave-zone.post {
  fill: rgba(114, 228, 155, 0.025);
}

.wave-marker {
  stroke-width: 2;
  stroke-dasharray: 6 4;
}

.wave-marker.fault {
  stroke: #ff6b6b;
}

.wave-marker.trip {
  stroke: var(--amber);
}

.wave-line,
.trip-line {
  fill: none;
  stroke-width: 2;
}

.wave-0 {
  stroke: #48d9c5;
}

.wave-1 {
  stroke: #ffc257;
}

.wave-2 {
  stroke: #ff7897;
}

.wave-3 {
  stroke: #7ba7ff;
}

.trip-line {
  stroke: #f1f4f6;
}

.wave-label,
.waveform-evidence svg text {
  fill: #9eb4c2;
  font-size: 11px;
}

.evidence-placeholder {
  padding: 42px 20px;
  border: 1px dashed rgba(145, 181, 207, 0.25);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.uhf-layout,
.breather-layout,
.kelvin-layout {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 12px;
}

.uhf-points {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.uhf-points article {
  padding: 11px;
  border: 1px solid rgba(145, 181, 207, 0.18);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.17);
}

.uhf-points span,
.uhf-points strong,
.uhf-points small {
  display: block;
}

.uhf-points span {
  color: var(--muted);
  font-size: 10px;
}

.uhf-points strong {
  margin: 6px 0;
  font-size: 18px;
}

.uhf-points small {
  color: #7894a6;
}

.uhf-points article.peak {
  border-color: rgba(255, 194, 87, 0.7);
  background: rgba(255, 194, 87, 0.09);
  box-shadow: 0 0 18px rgba(255, 194, 87, 0.08);
}

.prpd-panel {
  padding: 11px;
  border: 1px solid rgba(145, 181, 207, 0.18);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.2);
}

.prpd-panel > strong,
.prpd-panel > p {
  display: block;
  font-size: 11px;
}

.prpd-panel > p {
  color: var(--muted);
  line-height: 1.5;
}

.prpd-dots {
  position: relative;
  height: 125px;
  margin: 9px 0;
  overflow: hidden;
  border: 1px solid rgba(72, 217, 197, 0.18);
  background:
    linear-gradient(rgba(72, 217, 197, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(72, 217, 197, 0.08) 1px, transparent 1px);
  background-size: 25% 25%;
}

.prpd-dots i {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  opacity: 0.2;
  background: var(--cyan);
}

.prpd-panel.active .prpd-dots i {
  opacity: 0.8;
}

.logic-builder,
.accident-network {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.logic-builder article,
.accident-network article {
  flex: 1;
  min-width: 0;
  padding: 11px;
  border: 1px solid rgba(145, 181, 207, 0.2);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.17);
  text-align: center;
}

.logic-builder small,
.logic-builder strong {
  display: block;
}

.logic-builder small {
  color: var(--muted);
  margin-bottom: 7px;
}

.logic-builder strong {
  font-size: 13px;
}

.logic-arrow {
  align-self: center;
  color: var(--amber);
  font-size: 11px;
  white-space: nowrap;
}

.logic-conditions div {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
}

.logic-conditions span {
  padding: 4px 6px;
  border-radius: 5px;
  color: var(--cyan);
  background: rgba(72, 217, 197, 0.09);
  font-size: 10px;
}

.logic-conditions em {
  color: var(--muted);
  font-size: 11px;
}

.logic-builder .logic-pass {
  border-color: rgba(114, 228, 155, 0.46);
  background: rgba(114, 228, 155, 0.08);
}

.breather-layout {
  align-items: center;
}

.breather-layout svg {
  width: 100%;
  max-height: 310px;
}

.breather-pipe {
  fill: none;
  stroke: #7391a3;
  stroke-width: 18;
}

.breather-pipe.wrapped {
  stroke: #f4f0dc;
  stroke-dasharray: 10 5;
}

.breather-glass,
.oil-cup {
  fill: rgba(105, 164, 190, 0.08);
  stroke: #6f9aae;
  stroke-width: 4;
}

.silica-fill {
  stroke: rgba(255, 255, 255, 0.22);
}

.silica-fill.wet {
  fill: #b66f98;
}

.silica-fill.fresh {
  fill: #f3973f;
}

.oil-level {
  fill: #b28a35;
}

.oil-level.low {
  fill: #67552b;
}

.glass-crack {
  fill: none;
  stroke: #ff6b6b;
  stroke-width: 4;
  filter: drop-shadow(0 0 5px rgba(255, 107, 107, 0.45));
}

.breather-layout text {
  fill: #b9ceda;
  font-size: 12px;
}

.breather-checks p {
  padding: 9px 10px;
  margin: 6px 0;
  border-left: 3px solid #3d5a6c;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.16);
  font-size: 11px;
}

.breather-checks p.done {
  border-left-color: var(--green);
  color: #d7f4e2;
}

.breather-checks p.defect-found {
  border-left-color: #ff6b6b;
  color: #ffd1d1;
  background: rgba(255, 102, 102, 0.08);
}

.accident-network {
  align-items: center;
  flex-wrap: wrap;
}

.accident-network > i {
  width: 34px;
  height: 3px;
  background: #ff6b6b;
}

.accident-network > i.open {
  background: repeating-linear-gradient(90deg, #7894a6 0 6px, transparent 6px 11px);
}

.accident-network article strong {
  display: block;
  margin-top: 6px;
  font-size: 11px;
}

.accident-network article.fault {
  border-color: rgba(255, 102, 102, 0.55);
  background: rgba(255, 102, 102, 0.09);
}

.accident-network article.healthy {
  border-color: rgba(114, 228, 155, 0.45);
  background: rgba(114, 228, 155, 0.07);
}

.accident-network article.isolated {
  border-style: dashed;
  color: #a8bbc7;
  background: rgba(145, 181, 207, 0.04);
}

.network-branches {
  display: grid;
  flex: 1 1 100%;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.kelvin-layout {
  grid-template-columns: minmax(240px, 0.65fr) minmax(400px, 1.35fr);
}

.kelvin-meter {
  grid-row: span 2;
  padding: 16px;
  border: 2px solid #537489;
  border-radius: 15px;
  background: #08131a;
}

.kelvin-meter small,
.kelvin-meter strong,
.kelvin-meter span {
  display: block;
}

.kelvin-meter small,
.kelvin-meter span {
  color: var(--muted);
  font-size: 10px;
}

.kelvin-meter strong {
  margin: 16px 0;
  color: #c9ff8f;
  font-family: Consolas, monospace;
  font-size: clamp(28px, 4vw, 50px);
  text-shadow: 0 0 12px rgba(201, 255, 143, 0.22);
}

.kelvin-leads {
  flex-wrap: wrap;
  margin-top: 0;
}

.kelvin-leads span {
  flex: 1 1 20%;
  color: #8aa2b3;
}

.kelvin-leads.connected span {
  color: var(--cyan);
  border-color: rgba(72, 217, 197, 0.45);
}

.kelvin-leads b {
  flex: 1 1 42%;
  color: #d6e5ed;
}

.reading-table {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.reading-table p {
  padding: 8px;
  margin: 0;
  border: 1px solid rgba(145, 181, 207, 0.18);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.16);
}

.reading-table span,
.reading-table strong {
  display: block;
}

.reading-table span {
  color: var(--muted);
  font-size: 10px;
}

.reading-table strong {
  margin-top: 4px;
  font-size: 12px;
}

.reading-table .average {
  border-color: rgba(255, 194, 87, 0.38);
}

.sim-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  max-width: min(460px, calc(100vw - 36px));
  padding: 12px 15px;
  border: 1px solid rgba(72, 217, 197, 0.38);
  border-radius: 11px;
  pointer-events: none;
  opacity: 0;
  background: #102a3c;
  box-shadow: var(--shadow);
  transform: translateY(12px);
  transition:
    opacity 0.16s ease,
    transform 0.16s ease;
}

.sim-toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1160px) {
  .monitor-grid,
  .q10-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .monitor-grid > *,
  .q10-grid > * {
    min-width: 0;
  }

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

  .meter {
    grid-row: span 2;
  }

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

  .evidence-grid.four,
  .uhf-points {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .transformer-scene,
  .uhf-layout,
  .breather-layout,
  .kelvin-layout,
  .remedial-guide {
    grid-template-columns: 1fr;
  }

  .kelvin-meter {
    grid-row: auto;
  }
}

@media (max-width: 900px) {
  .control-bar {
    grid-template-columns: 1fr auto;
  }

  .control-note {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .sim-workspace {
    grid-template-columns: 1fr;
  }

  .sim-sidebar {
    position: static;
    display: block;
    min-width: 0;
    overflow: hidden;
  }

  .scenario-home {
    margin-bottom: 8px;
  }

  .scenario-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding-bottom: 7px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .scenario-entry {
    flex: 0 0 min(270px, 78vw);
    min-height: 66px;
    scroll-snap-align: start;
  }

  .sidebar-facts {
    display: none;
  }

  .lobby-hero {
    grid-template-columns: 1fr;
  }

  .dispatch-layout,
  .notebook-layout {
    grid-template-columns: 1fr;
  }

  .logic-builder {
    flex-direction: column;
  }

  .logic-arrow {
    transform: rotate(90deg);
  }
}

@media (max-width: 670px) {
  .sim-shell {
    padding: 8px;
  }

  .sim-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-mark {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
  }

  .brand p {
    letter-spacing: 0.05em;
  }

  .brand h1 {
    font-size: clamp(23px, 8vw, 31px);
  }

  .header-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px 12px;
  }

  .header-actions .offline-badge,
  .header-actions .text-button,
  .header-actions .text-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  .header-actions .text-button,
  .header-actions .text-link {
    padding: 7px 0;
  }

  .control-bar {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .mode-switch {
    width: 100%;
  }

  .mode-button {
    flex: 1;
  }

  .control-note {
    display: block;
    grid-column: auto;
    grid-row: auto;
  }

  .control-note span {
    display: block;
    margin-top: 4px;
    white-space: normal;
  }

  .control-bar > .button {
    width: 100%;
    min-height: 44px;
  }

  .sim-main {
    padding: 12px;
  }

  .learning-stage-row {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding-bottom: 8px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .learning-stage {
    flex: 0 0 96px;
    min-height: 44px;
    scroll-snap-align: start;
  }

  .diagram-layer-switch {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  .diagram-layer-switch button {
    flex: 0 0 104px;
    min-height: 44px;
  }

  .scenario-card-top,
  .term-card-title,
  .lab-action-head,
  .panel-heading,
  .hint-strip,
  .dedicated-variant-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .button,
  .lab-option,
  .lab-multi-grid label,
  .repair-button,
  .meter-mode,
  .probe-handle {
    min-height: 44px;
  }

  .textarea,
  textarea,
  input,
  select {
    font-size: 16px;
  }

  .one-line {
    min-width: 720px;
  }

  .circuit-svg {
    min-width: 680px;
  }

  .one-line-wrap,
  .schematic-panel {
    padding: 7px;
  }

  .scenario-picker,
  .status-row,
  .result-grid,
  .fault-review {
    grid-template-columns: 1fr;
  }

  .card-grid,
  .meter-column {
    grid-template-columns: 1fr;
  }

  .evidence-grid.four,
  .uhf-points,
  .reading-table,
  .network-branches {
    grid-template-columns: 1fr;
  }

  .power-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .power-strip i {
    width: 2px;
    height: 18px;
    margin: 0 auto;
  }

  .evidence-heading {
    flex-direction: column;
  }

  .scenario-head {
    flex-direction: column;
  }

  .scenario-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .scenario-actions .button {
    flex: 1 1 180px;
  }

  .log-entry {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .log-copy {
    grid-column: 1 / -1;
  }
}
