:root {
  --ink: #102033;
  --muted: #607186;
  --paper: #edf5f8;
  --panel: #ffffff;
  --line: #d6e4ed;
  --blue: #0b63b6;
  --cyan: #11b8cf;
  --green: #18a36c;
  --leaf: #37b26c;
  --amber: #f0a31a;
  --orange: #e76f2d;
  --red: #d94b4b;
  --active-color: var(--cyan);
  --active-glow: rgba(17, 184, 207, 0.36);
  --shadow: 0 18px 42px rgba(16, 32, 51, 0.14);
  --radius: 8px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(16, 32, 51, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(16, 32, 51, 0.045) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  font-family:
    "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Inter, Arial,
    sans-serif;
}

button,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: var(--radius);
  background: #e9f2f8;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(16, 32, 51, 0.12);
}

button:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(240, 163, 26, 0.56);
  outline-offset: 2px;
}

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

.app-shell {
  width: min(1740px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 28px;
}

.topbar,
.notice-strip,
.view-switcher,
.scene-card,
.operator-panel,
.step-dock {
  border: 1px solid rgba(16, 32, 51, 0.1);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 16px 18px;
  background: linear-gradient(135deg, #ffffff 0%, #f5fbff 56%, #edf9f2 100%);
  border-color: rgba(11, 99, 182, 0.2);
}

.logo-slot {
  display: grid;
  width: 84px;
  height: 64px;
  place-items: center;
  border: 1px solid rgba(11, 99, 182, 0.32);
  border-radius: var(--radius);
  color: var(--blue);
  background: rgba(255, 255, 255, 0.86);
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
}

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

.eyebrow,
.panel-kicker {
  margin: 0;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin-bottom: 4px;
  font-size: 2rem;
  line-height: 1.08;
}

h2,
h3 {
  line-height: 1.18;
}

.subtitle {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.96rem;
}

.fact-chip {
  display: grid;
  gap: 3px;
  min-width: 136px;
  padding: 10px 12px;
  border-left: 4px solid var(--green);
  border-radius: var(--radius);
  background: #edf9f2;
  color: #0b5d3b;
}

.fact-chip span {
  font-size: 0.78rem;
}

.fact-chip strong {
  font-size: 0.98rem;
}

.notice-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  margin-top: 14px;
  padding: 10px 14px;
  color: #60420c;
  background: #fff8e8;
  border-color: rgba(240, 163, 26, 0.34);
  font-size: 0.92rem;
  box-shadow: none;
}

.notice-strip strong {
  color: #7a4300;
}

.view-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 14px;
  padding: 9px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 24px rgba(16, 32, 51, 0.09);
}

.view-switch-button {
  min-height: 44px;
  padding: 0 14px;
  color: #173456;
  background: #edf5fb;
  white-space: nowrap;
}

.view-switch-button.is-active {
  color: #fff;
  background: var(--blue);
  box-shadow: 0 10px 24px rgba(11, 99, 182, 0.24);
}

.sandbox-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 16px;
  align-items: start;
  margin-top: 16px;
}

.stage-column {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.scene-card {
  padding: 18px;
  overflow: hidden;
}

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

.scene-head h2 {
  margin: 4px 0 8px;
  font-size: 1.72rem;
}

.scene-head p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
}

.scene-score {
  display: grid;
  min-width: 148px;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid rgba(17, 184, 207, 0.26);
  border-radius: var(--radius);
  background: #f0fbfc;
  color: #0f6371;
}

.scene-score span {
  font-size: 0.82rem;
  font-weight: 900;
}

.scene-score strong {
  font-size: 2rem;
  line-height: 1;
}

.scene-frame {
  position: relative;
  overflow: hidden;
  min-height: 420px;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(16, 32, 51, 0.12);
  border-radius: var(--radius);
  background: #dceaf2;
  isolation: isolate;
}

.scene-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.06) contrast(1.02);
}

.scene-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(4, 20, 36, 0.05), transparent 46%),
    radial-gradient(circle at 22% 20%, rgba(17, 184, 207, 0.18), transparent 30%),
    radial-gradient(circle at 78% 72%, rgba(24, 163, 108, 0.15), transparent 28%);
  z-index: 1;
}

.effect-layer,
.pin-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.effect {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--active-color) 18%, transparent);
  border: 2px solid color-mix(in srgb, var(--active-color) 72%, #fff);
  box-shadow:
    0 0 0 8px color-mix(in srgb, var(--active-color) 16%, transparent),
    0 0 28px var(--active-glow);
  opacity: 0.9;
}

.effect.is-large {
  width: 22%;
  height: 22%;
}

.effect.is-mid {
  width: 14%;
  height: 14%;
}

.effect.is-small {
  width: 8%;
  height: 8%;
}

.sensor-pin {
  position: absolute;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--active-color);
  color: #fff;
  box-shadow:
    0 10px 18px rgba(16, 32, 51, 0.22),
    0 0 0 8px color-mix(in srgb, var(--active-color) 18%, transparent);
  font-size: 0.82rem;
  font-weight: 900;
}

.sensor-pin.is-active {
  animation: pinPulse 1.5s ease-in-out infinite;
}

.scene-tag {
  position: absolute;
  max-width: 210px;
  padding: 8px 10px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(17, 184, 207, 0.36);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  color: #083250;
  box-shadow: 0 12px 26px rgba(16, 32, 51, 0.16);
  font-size: 0.82rem;
  font-weight: 900;
  backdrop-filter: blur(10px);
}

.live-note {
  position: absolute;
  left: 22px;
  bottom: 22px;
  z-index: 3;
  width: min(520px, calc(100% - 44px));
  padding: 16px 18px;
  border-left: 5px solid var(--active-color);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 38px rgba(16, 32, 51, 0.2);
  backdrop-filter: blur(12px);
}

.live-note span {
  display: block;
  margin-bottom: 6px;
  color: var(--cyan);
  font-size: 0.9rem;
  font-weight: 900;
}

.live-note strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.16rem;
}

.live-note p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
}

.step-dock {
  padding: 18px;
}

.step-head {
  display: flex;
  gap: 16px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 12px;
}

.step-head h2 {
  margin: 4px 0 0;
  font-size: 1.6rem;
}

.step-head p:last-child {
  max-width: 58%;
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 900;
  text-align: right;
}

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

.step-card {
  min-height: 124px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbfd;
  text-align: left;
}

.step-card.is-active {
  border-color: color-mix(in srgb, var(--active-color) 76%, #fff);
  background: color-mix(in srgb, var(--active-color) 10%, #fff);
  box-shadow: 0 12px 24px color-mix(in srgb, var(--active-color) 16%, transparent);
}

.step-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--blue);
  font-weight: 900;
}

.step-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.02rem;
}

.step-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
}

.operator-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  position: sticky;
  top: 16px;
}

.panel-heading h2 {
  margin: 4px 0 0;
  font-size: 1.55rem;
}

.field {
  display: grid;
  gap: 7px;
  font-weight: 900;
}

.field select {
  min-height: 46px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbfd;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 900;
}

.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.button-grid button {
  min-height: 48px;
}

.primary-action {
  grid-column: span 2;
  color: #fff;
  background: var(--blue);
}

.sensor-panel,
.weight-panel,
.review-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdff;
  padding: 14px;
}

.sensor-head,
.weight-head {
  display: flex;
  gap: 12px;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.sensor-head h3,
.weight-head h3 {
  margin: 3px 0 0;
  font-size: 1.12rem;
}

#sensorBadge,
#weightBadge {
  border-radius: 999px;
  background: color-mix(in srgb, var(--active-color) 12%, #fff);
  color: color-mix(in srgb, var(--active-color) 70%, #173456);
  padding: 5px 9px;
  font-size: 0.78rem;
  font-weight: 900;
}

.sensor-cards {
  display: grid;
  gap: 8px;
}

.sensor-cards article {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.sensor-cards span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.sensor-cards strong {
  font-size: 0.94rem;
  line-height: 1.35;
}

.sensor-fusion-text,
.reason-text {
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.5;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric-grid article {
  display: grid;
  gap: 6px;
  min-height: 88px;
  align-content: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7fbfd;
}

.metric-grid span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.metric-grid strong {
  font-size: 1.28rem;
}

.weight-rows {
  display: grid;
  gap: 10px;
}

.weight-row {
  display: grid;
  grid-template-columns: 88px 1fr 42px;
  gap: 8px;
  align-items: center;
}

.weight-row strong {
  font-size: 0.86rem;
}

.weight-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfebf2;
}

.weight-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--active-color), var(--green));
  transition: width 220ms ease;
}

.weight-row em {
  color: var(--muted);
  font-style: normal;
  font-weight: 900;
}

.review-card span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-weight: 900;
}

.review-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.14rem;
}

.review-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.5;
}

[data-status="running"] .fact-chip,
[data-status="incident"] .fact-chip {
  border-left-color: var(--active-color);
  background: color-mix(in srgb, var(--active-color) 10%, #fff);
}

[data-status="incident"] {
  --active-color: var(--orange);
  --active-glow: rgba(231, 111, 45, 0.36);
}

[data-status="incident"] .scene-frame {
  box-shadow: inset 0 0 0 4px rgba(231, 111, 45, 0.28);
}

@keyframes pinPulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.16);
  }
}

@media (max-width: 1120px) {
  .sandbox-layout {
    grid-template-columns: 1fr;
  }

  .operator-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 18px, 1740px);
    padding-top: 10px;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .logo-slot {
    width: 76px;
    height: 56px;
  }

  h1 {
    font-size: 1.62rem;
  }

  .fact-chip {
    width: 100%;
  }

  .notice-strip {
    display: grid;
  }

  .view-switcher {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .scene-card,
  .operator-panel,
  .step-dock {
    padding: 12px;
  }

  .scene-head,
  .step-head {
    display: grid;
  }

  .scene-score {
    width: 100%;
  }

  .scene-frame {
    min-height: 260px;
  }

  .live-note {
    left: 12px;
    bottom: 12px;
    width: calc(100% - 24px);
    padding: 12px;
  }

  .step-head p:last-child {
    max-width: none;
    text-align: left;
  }

  .step-cards {
    grid-template-columns: 1fr;
  }

  .button-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .primary-action {
    grid-column: auto;
  }

  .weight-row {
    grid-template-columns: 76px 1fr 38px;
  }
}
