:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #e6e9e7;
  background: #101213;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  --muted: #959e9a;
  --line: #303735;
  --accent: #a8d7be;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button, select, input { font: inherit; }
button, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled, select:disabled { cursor: wait; opacity: .55; }
button:focus-visible, select:focus-visible, input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.app { width: 100%; max-width: 1860px; margin: 0 auto; padding: 28px 32px 18px; }
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 44px; margin-bottom: 22px; }
.heading, .toolbar, .filter-control, .button, .icon-button, .camera-metrics-server { color: #809087; font-size: 10px; }
.resume-playback { margin-top: 6px; }
.text-button { display: flex; align-items: center; }
.heading { gap: 18px; min-width: 0; }
h1 { font-size: 25px; line-height: 1.3; letter-spacing: -.6px; font-weight: 600; margin: 0; }
.live-count { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.live-count::before { content: ""; height: 6px; width: 6px; border-radius: 50%; background: #68726d; }
.live-count.has-live::before { background: #8ac5a3; box-shadow: 0 0 0 3px #8ac5a311; }
.toolbar { gap: 20px; flex-shrink: 0; }
.filter-control { gap: 11px; cursor: pointer; color: #d1d8d3; font-size: 13px; user-select: none; position: relative; }
.filter-control input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-track { display: block; width: 34px; height: 20px; background: #47504b; padding: 3px; border-radius: 12px; transition: background .16s ease; }
.switch-track span { display: block; width: 14px; height: 14px; background: #dae2dc; border-radius: 50%; transition: transform .16s ease; }
.filter-control input:checked + .switch-track { background: #7baa90; }
.filter-control input:checked + .switch-track span { transform: translateX(14px); background: #101c15; }
.toolbar-divider { height: 20px; width: 1px; background: var(--line); }
.button { justify-content: center; gap: 8px; color: #d3dad5; background: #202624; border: 1px solid #3a433e; border-radius: 6px; min-height: 36px; padding: 7px 12px; font-size: 12px; font-weight: 500; }
.button:hover { background: #2a322e; border-color: #56675c; }
.toolbar-button { background: transparent; }
.toolbar-button svg { width: 15px; height: 15px; }

.notice { padding: 11px 14px; border: 1px solid; border-radius: 6px; font-size: 13px; line-height: 1.5; margin: 0 0 16px; }
.connection-warning { color: #dbbf90; border-color: #665235; background: #2a241a; }
.control-error { color: #edb4ab; border-color: #734b44; background: #30201e; }
.startup { min-height: 300px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; }
.startup p { margin: 0; }
.spinner { width: 22px; height: 22px; border: 2px solid #36443b; border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.camera-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.camera-card { overflow: hidden; min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: #191d1b; }
.camera-header { display: flex; align-items: center; justify-content: space-between; min-height: 43px; padding: 4px 8px 4px 13px; gap: 12px; }
.camera-select-label { display: flex; align-items: center; gap: 10px; min-width: 0; }
.slot-number { display: inline-flex; justify-content: center; align-items: center; color: #89968e; border: 1px solid #39423d; font-size: 10px; font-weight: 600; border-radius: 4px; min-width: 20px; height: 20px; }
.camera-select { color: #e0e6e1; background: transparent; border: 0; border-radius: 3px; padding: 5px 23px 5px 0; font-size: 13px; font-weight: 500; max-width: 100%; text-overflow: ellipsis; cursor: pointer; }
.camera-select option { background: #202623; color: #e0e6e1; }
.icon-button { justify-content: center; width: 32px; height: 32px; padding: 7px; border: 0; border-radius: 4px; background: transparent; color: #929f96; }
.icon-button:hover { color: #dce7df; background: #2a332d; }
.icon-button svg { width: 16px; height: 16px; }
.camera-stage { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 9; width: 100%; overflow: hidden; background: #080b09; }
.camera-video { display: block; width: 100%; height: 100%; object-fit: contain; }
.camera-placeholder { position: absolute; inset: 0; display: flex; justify-content: center; align-items: center; flex-direction: column; gap: 9px; background: radial-gradient(ellipse at center, #18201b, #0f1411 80%); padding: 18px; text-align: center; }
.camera-placeholder-icon { width: 36px; height: 36px; color: #45564b; stroke-width: 1.1; margin-bottom: 3px; }
.placeholder-title { font-size: 14px; color: #a6b4ab; }
.placeholder-description { font-size: 12px; color: #687a6d; }
.stage-mode { position: absolute; top: 10px; left: 10px; padding: 4px 7px; color: #eef7f0; background: #0a110cb8; border: 1px solid #ffffff1a; border-radius: 4px; backdrop-filter: blur(6px); font-size: 10px; letter-spacing: .1px; opacity: 0; transition: opacity .15s; pointer-events: none; }
.camera-card:hover .stage-mode, .camera-card:focus-within .stage-mode { opacity: 1; }
.camera-footer { min-height: 39px; padding: 4px 11px 4px 13px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.camera-information { display: flex; align-items: center; gap: 13px; min-width: 0; }
.camera-status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: #9ca99f; white-space: nowrap; }
.status-dot { display: block; width: 5px; height: 5px; background: #798a7e; border-radius: 50%; }
.camera-card[data-state="live"] .status-dot { background: #8ac5a3; }
.camera-card[data-state="reconnecting"] .status-dot, .camera-card[data-state="connecting"] .status-dot { background: #d1b67e; }
.camera-card[data-state="error"] .status-dot { background: #d08c81; }
.camera-card[data-state="error"] .camera-status { color: #cb9a91; }
.camera-metrics { display: inline-flex; flex-direction: column; gap: 2px; font-size: 11px; color: #75837a; font-variant-numeric: tabular-nums; white-space: nowrap; }
.text-button { border: 0; border-radius: 4px; background: transparent; color: #85958b; gap: 5px; padding: 6px 3px; font-size: 11px; white-space: nowrap; }
.text-button:hover { color: #dce8df; }
.text-button svg { width: 13px; height: 13px; }
.view-note { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 17px 0 0; color: #6e7a73; font-size: 11px; line-height: 1.6; text-align: center; }
.note-separator { color: #4a554e; }
.wall-exit { display: none; }

.camera-wall:fullscreen { display: flex; flex-direction: column; justify-content: center; background: #101213; padding: 18px; overflow: auto; }
.camera-wall:fullscreen .camera-grid { width: 100%; max-width: min(100%, calc((100dvh - 272px) * 16 / 9)); margin: auto; }
.camera-wall:fullscreen .wall-exit { display: flex; align-self: flex-end; margin-bottom: 12px; flex-shrink: 0; }
.camera-card:fullscreen { display: flex; flex-direction: column; background: #080b09; border: 0; border-radius: 0; }
.camera-card:fullscreen .camera-stage { flex: 1; min-height: 0; aspect-ratio: auto; }
.camera-card:fullscreen .camera-header, .camera-card:fullscreen .camera-footer { background: #191d1b; flex-shrink: 0; }
.camera-card:fullscreen .camera-video { object-fit: contain; }

@media (min-width: 1600px) { .app { padding-top: 32px; } }
@media (min-width: 761px) and (min-height: 680px) {
  .camera-wall:not(:fullscreen) { width: 100%; max-width: min(100%, calc((100dvh - 330px) * 16 / 9)); margin: 0 auto; }
}
@media (max-width: 1000px) {
  .app { padding: 22px 22px 18px; }
  .toolbar { gap: 14px; }
  .camera-grid { gap: 12px; }
  .camera-information { gap: 8px; }
}
@media (max-width: 760px) {
  .app { padding: 18px 14px; }
  .app-header { align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
  .heading { gap: 14px; min-height: 34px; }
  h1 { font-size: 23px; }
  .toolbar { justify-content: space-between; width: 100%; gap: 12px; }
  .toolbar-divider { display: none; }
  .toolbar-button { padding: 7px 10px; }
  .camera-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .camera-header { min-height: 44px; }
  .camera-footer { min-height: 42px; }
  .camera-metrics { display: inline-flex; flex-direction: column; gap: 2px; font-size: 10px; }
  .view-note { margin-top: 15px; gap: 5px; }
  .camera-wall:fullscreen { padding: 10px; justify-content: flex-start; }
  .camera-wall:fullscreen .camera-grid { max-width: 100%; }
  .camera-wall:fullscreen .wall-exit { margin-bottom: 10px; }
}
@media (max-width: 360px) {
  .app { padding: 14px 10px; }
  .filter-control { font-size: 12px; gap: 7px; }
  .toolbar-button { font-size: 11px; gap: 5px; padding: 7px; }
  .camera-footer { padding-left: 10px; padding-right: 8px; gap: 5px; }
  .camera-information { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
