:root {
  color-scheme: dark;
  --bg: #071112;
  --panel: #111a20;
  --panel-2: #172231;
  --line: #31414b;
  --text: #f6fbff;
  --muted: #a9c2cb;
  --cyan: #5ed3e8;
  --green: #55d89f;
  --yellow: #ffc857;
  --pink: #ff5c7a;
  --blue: #1d75d8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Noto Sans TC", sans-serif;
}

button,
input {
  font: inherit;
}

.topbar {
  min-height: 96px;
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: #0f171a;
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.signal {
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: conic-gradient(from 20deg, #52d6e7, #6fe3a5, #ffd36b, #52d6e7);
  position: relative;
}

.signal::after {
  content: "";
  position: absolute;
  inset: 15px;
  border-radius: inherit;
  background: #0f171a;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
}

.brand p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 19px;
}

.profile-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.profile,
.mode,
.transport button {
  min-height: 52px;
  border: 1px solid #3a5870;
  background: var(--panel-2);
  color: var(--text);
  padding: 0 20px;
  border-radius: 8px;
  cursor: pointer;
}

.profile.active,
.mode.active {
  border-color: var(--cyan);
  background: #0a3543;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 540px;
  min-height: calc(100vh - 96px);
}

.stage,
.insights {
  min-width: 0;
}

.stage {
  border-right: 1px solid var(--line);
}

.monitor-head {
  height: 72px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: #121b1d;
}

.monitor-head strong {
  font-size: 21px;
}

#clock {
  margin-left: 16px;
  color: var(--muted);
  font-size: 20px;
}

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #68e6b0;
  font-weight: 800;
  font-size: 20px;
}

.live-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 16px rgba(85, 216, 159, .75);
}

.status.error {
  color: var(--pink);
}

.status.error .live-dot {
  background: var(--pink);
  box-shadow: 0 0 16px rgba(255, 92, 122, .75);
}

.camera-wrap {
  height: calc(100vh - 230px);
  min-height: 520px;
  position: relative;
  overflow: hidden;
  background: #091012;
}

video,
canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

video {
  transform: scaleX(-1);
}

.startup-panel {
  position: absolute;
  left: 24px;
  top: 36px;
  width: min(620px, calc(100% - 48px));
  padding: 28px;
  background: rgba(12, 18, 20, .86);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  color: var(--muted);
  font-size: 20px;
}

.startup-panel strong {
  color: var(--text);
  font-size: 26px;
}

.startup-panel.hidden {
  display: none;
}

.transport {
  min-height: 62px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-top: 1px solid var(--line);
  background: #111820;
  flex-wrap: wrap;
}

.transport button:disabled {
  opacity: .5;
  cursor: default;
}

.toggle,
.range {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.range input {
  width: 190px;
  accent-color: var(--cyan);
}

.insights {
  display: flex;
  flex-direction: column;
  background: #0d1416;
}

.mode-panel,
.panel,
.strip {
  border-bottom: 1px solid var(--line);
}

.mode-panel,
.panel {
  padding: 24px;
}

.mode-panel h2,
.panel h2 {
  margin-bottom: 18px;
  color: #b7d8e5;
  font-size: 20px;
  text-transform: uppercase;
}

.mode-panel {
  display: grid;
  gap: 12px;
}

.mode {
  width: 100%;
  text-align: left;
  font-size: 18px;
}

.strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.strip > div {
  min-height: 96px;
  padding: 22px;
  border-right: 1px solid var(--line);
}

.strip > div:last-child {
  border-right: 0;
}

.metric-label {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.strip strong {
  font-size: 42px;
}

.pipeline {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 18px;
}

.pipeline li {
  display: grid;
  grid-template-columns: 42px 1fr minmax(120px, auto);
  gap: 14px;
  align-items: center;
}

.pipeline em {
  color: var(--muted);
}

.pipeline b {
  text-align: right;
}

.step-num {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #17373b;
  color: var(--green);
}

.profile-note {
  color: var(--muted);
  margin-bottom: 18px;
}

.bars {
  display: grid;
  gap: 18px;
}

.bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 92px;
  gap: 12px;
  align-items: center;
  color: var(--muted);
}

.bar-row div {
  height: 12px;
  background: #26363b;
  border-radius: 999px;
  overflow: hidden;
}

.bar-row i {
  display: block;
  height: 100%;
  width: 45%;
  background: linear-gradient(90deg, var(--green), var(--cyan));
  border-radius: inherit;
}

.bar-row b {
  color: var(--text);
  text-align: right;
}

.object-list,
.events {
  display: grid;
  gap: 10px;
  color: var(--muted);
}

.tag-row,
.event {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.event b {
  color: var(--text);
}

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

  .stage {
    border-right: 0;
  }

  .camera-wrap {
    height: 62vh;
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }

  h1 {
    font-size: 24px;
  }

  .brand p {
    font-size: 16px;
  }

  .profile-tabs {
    justify-content: flex-start;
  }

  .profile,
  .mode,
  .transport button {
    min-height: 46px;
    padding: 0 14px;
  }

  .monitor-head {
    padding: 0 16px;
  }

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

  .strip > div {
    padding: 16px;
  }

  .strip strong {
    font-size: 34px;
  }

  .pipeline li,
  .bar-row {
    grid-template-columns: 1fr;
  }

  .pipeline b,
  .bar-row b {
    text-align: left;
  }
}
