:root {
  color-scheme: light;
  --bg: #f2eee7;
  --panel: rgba(255, 255, 255, .82);
  --panel-2: rgba(255, 255, 255, .72);
  --line: rgba(52, 73, 89, .18);
  --text: #17242a;
  --muted: #60747d;
  --cyan: #2aa7bd;
  --green: #33b77c;
  --yellow: #e2a62e;
  --pink: #e04d6c;
  --blue: #346cc8;
  --shadow: 0 18px 50px rgba(40, 47, 52, .16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Arial, "Noto Sans TC", sans-serif;
  background:
    linear-gradient(rgba(255, 255, 255, .22), rgba(255, 255, 255, .34)),
    var(--scene-photo),
    linear-gradient(135deg, #f8efe5 0%, #eef6f5 48%, #f4efe8 100%);
  background-size: cover, cover, cover;
  background-position: center, center, center;
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--scene-art);
  opacity: .9;
}

body.bg-living {
  --scene-photo: url("./assets/living-room-hc17xx.png");
  --scene-art:
    linear-gradient(180deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .72)),
    radial-gradient(ellipse at 18% 80%, rgba(212, 126, 75, .28), transparent 18%),
    radial-gradient(ellipse at 75% 72%, rgba(65, 145, 135, .22), transparent 22%);
}

body.bg-door {
  --scene-photo: url("./assets/entrance-hc17xx.png");
  --scene-art:
    linear-gradient(90deg, rgba(242, 215, 174, .66) 0 32%, rgba(120, 180, 190, .22) 32% 100%),
    linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .7));
}

body.bg-office {
  --scene-photo: url("./assets/office-interior-hc17xx.png");
  --scene-art:
    linear-gradient(120deg, rgba(236, 241, 238, .76), rgba(211, 226, 229, .7)),
    radial-gradient(circle at 76% 28%, rgba(61, 126, 151, .2), transparent 24%);
}

body.bg-tower {
  --scene-photo: url("./assets/office-building-hc17xx.png");
  --scene-art:
    linear-gradient(180deg, rgba(204, 230, 239, .78), rgba(247, 247, 243, .74)),
    repeating-linear-gradient(90deg, rgba(60, 88, 120, .16) 0 3px, transparent 3px 92px);
}

body.bg-factory {
  --scene-photo: url("./assets/factory-hc17xx.png");
  --scene-art:
    linear-gradient(135deg, rgba(223, 228, 218, .76), rgba(237, 226, 208, .78)),
    repeating-linear-gradient(0deg, transparent 0 46px, rgba(78, 93, 86, .08) 46px 48px);
}

button,
input {
  font: inherit;
}

.topbar {
  min-height: 92px;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(18px);
}

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

.signal {
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: conic-gradient(from 20deg, #50bdd3, #84c98f, #f7c36a, #50bdd3);
  position: relative;
}

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

h1,
h2,
p {
  margin: 0;
}

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

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

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

.profile,
.mode,
.transport button,
.scene {
  min-height: 46px;
  border: 1px solid rgba(42, 99, 112, .28);
  background: rgba(255, 255, 255, .72);
  color: var(--text);
  padding: 0 16px;
  border-radius: 8px;
  cursor: pointer;
}

.profile.active,
.mode.active,
.scene.active {
  border-color: var(--cyan);
  background: rgba(42, 167, 189, .14);
  box-shadow: inset 0 0 0 1px rgba(42, 167, 189, .16);
}

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

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

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

.monitor-head {
  height: 68px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .7);
}

.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: #218b61;
  font-weight: 800;
  font-size: 20px;
}

.live-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 16px rgba(51, 183, 124, .72);
}

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

.status.error .live-dot {
  background: var(--pink);
  box-shadow: 0 0 16px rgba(224, 77, 108, .75);
}

.camera-shell {
  padding: 14px 18px 18px;
  background:
    linear-gradient(rgba(255, 255, 255, .14), rgba(255, 255, 255, .24)),
    var(--scene-photo);
  background-size: cover;
  background-position: center;
}

.camera-wrap {
  height: calc(100vh - 292px);
  min-height: 520px;
  position: relative;
  overflow: hidden;
  background: #17242a;
  border: 1px solid rgba(34, 53, 60, .24);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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(560px, calc(100% - 48px));
  padding: 26px;
  background: rgba(255, 255, 255, .86);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  color: var(--muted);
  font-size: 19px;
}

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

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

.transport {
  min-height: 64px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .8);
  flex-wrap: wrap;
}

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

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

.background-picker {
  margin-left: auto;
  flex-wrap: wrap;
}

.scene {
  min-height: 38px;
  padding: 0 12px;
}

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

.insights {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, .66);
  backdrop-filter: blur(18px);
}

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

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

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

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

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

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

.strip > div {
  min-height: 88px;
  padding: 18px;
  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: 38px;
}

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

.pipeline li {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: start;
}

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

.pipeline b {
  display: block;
  margin-top: 3px;
  color: var(--text);
}

.step-num {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(42, 167, 189, .14);
  color: #157f92;
}

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

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

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

.bar-row div {
  height: 12px;
  background: rgba(38, 54, 59, .16);
  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: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(23, 36, 42, .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: 23px;
  }

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

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

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

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

  .camera-shell {
    padding: 10px;
  }

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

  .strip > div {
    padding: 14px;
  }

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

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

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

  .background-picker {
    margin-left: 0;
  }
}
