:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d9e0ea;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --danger: #c2410c;
  --danger-bg: #fff1e8;
  --notice: #8a5a00;
  --notice-bg: #fff7d6;
  --ok: #15803d;
  --ok-bg: #eaf7ee;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

.shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
}

p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-button,
.secondary-button {
  min-width: 132px;
  height: 42px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  border: 0;
  background: var(--primary);
  color: #fff;
}

.primary-button:hover {
  background: var(--primary-dark);
}

.primary-button.active {
  background: var(--danger);
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.secondary-button:hover {
  border-color: #a9b7c9;
  background: #f8fafc;
}

.viewer {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101828;
}

video,
img,
canvas,
.empty-state {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

video {
  object-fit: contain;
}

#testImage {
  display: none;
  object-fit: contain;
}

#testImage.visible {
  display: block;
}

canvas {
  pointer-events: none;
}

.empty-state {
  display: grid;
  place-items: center;
  color: #cbd5e1;
  font-size: 18px;
  background: #101828;
}

.empty-state.hidden {
  display: none;
}

.status-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.status-panel.normal {
  background: var(--ok-bg);
  border-color: #b8e2c2;
}

.status-panel.notice {
  background: var(--notice-bg);
  border-color: #f0d46a;
}

.status-panel.danger {
  background: var(--danger-bg);
  border-color: #f4b38a;
}

.status-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 24px;
}

.status-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 999px;
  background: var(--ok);
}

.status-panel.notice .status-dot {
  background: var(--notice);
}

.status-panel.danger .status-dot {
  background: var(--danger);
}

.detail-text {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

@media (max-width: 680px) {
  .shell {
    width: min(100vw - 20px, 1120px);
    padding: 14px 0;
  }

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

  h1 {
    font-size: 23px;
  }

  .primary-button {
    width: 100%;
  }

  .actions,
  .secondary-button {
    width: 100%;
  }

  .viewer {
    aspect-ratio: 4 / 3;
  }
}
