:root {
  color-scheme: dark;
  --bg: #07110f;
  --panel: #0e1d19;
  --panel-soft: #12241f;
  --line: rgba(180, 255, 216, 0.17);
  --line-strong: rgba(180, 255, 216, 0.32);
  --text: #f3fff9;
  --muted: #9fb8ad;
  --green: #65f0ae;
  --orange: #ffb86b;
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% 10%, rgba(50, 200, 132, 0.14), transparent 30rem),
    radial-gradient(circle at 86% 76%, rgba(255, 153, 74, 0.08), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.3;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

a { color: inherit; }

.shell {
  position: relative;
  width: min(1180px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
}

.topbar {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.brand,
.back-link {
  text-decoration: none;
}

.brand {
  font-weight: 780;
  letter-spacing: 0.18em;
}

.back-link {
  color: var(--muted);
  font-size: 0.9rem;
}

.back-link:hover { color: var(--text); }

.hero { padding: 72px 0 42px; }

.eyebrow {
  margin: 0 0 14px;
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 760;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.5rem, 7vw, 5.4rem);
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.lead {
  max-width: 700px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.map-section {
  padding: 0 0 54px;
}

.section-heading,
.catalog-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
}

.section-heading {
  margin-bottom: 20px;
}

.section-heading .eyebrow,
.catalog-heading .eyebrow {
  margin-bottom: 8px;
}

.section-heading h2,
.catalog-heading h2 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  letter-spacing: -0.04em;
}

.section-heading > p {
  max-width: 340px;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
  text-align: right;
}

.map-frame {
  position: relative;
  min-height: 480px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #e8eef0;
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.3);
}

#camera-map {
  width: 100%;
  min-height: 480px;
}

.map-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 28px;
  color: var(--muted);
  text-align: center;
  background: radial-gradient(circle at center, rgba(18, 48, 38, 0.92), rgba(5, 14, 11, 0.98));
}

.catalog-heading {
  margin-bottom: 20px;
}

.camera-map-marker {
  position: relative;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(180, 255, 216, 0.7);
  border-radius: 50%;
  color: #07110f;
  background: var(--green);
  box-shadow: 0 0 0 7px rgba(101, 240, 174, 0.12), 0 10px 30px rgba(0, 0, 0, 0.42);
  cursor: pointer;
}

.camera-map-marker svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.camera-map-marker:hover,
.camera-map-marker:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 4px;
  background: #b4ffd8;
}

.camera-popup {
  color: #102019;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

.camera-popup strong,
.camera-popup span,
.camera-popup a {
  display: block;
}

.camera-popup strong {
  margin-bottom: 5px;
  font-size: 1rem;
}

.camera-popup span {
  color: #486157;
  font-size: 0.78rem;
}

.camera-popup a {
  margin-top: 12px;
  color: #087449;
  font-size: 0.82rem;
  font-weight: 760;
  text-decoration: none;
}

.maplibregl-popup-content {
  padding: 16px 18px;
  border-radius: 14px;
}

.catalog-status,
.empty-state,
.error-state {
  margin: 0 0 22px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(14, 29, 25, 0.72);
}

.error-state {
  border-color: rgba(255, 184, 107, 0.36);
  color: #ffd4a5;
}

[hidden] { display: none !important; }

.camera-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr));
  gap: 18px;
  margin: 0;
  padding: 0 0 72px;
  list-style: none;
}

.camera-card {
  min-height: 270px;
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(18, 36, 31, 0.95), rgba(10, 23, 19, 0.94));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
}

.card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 760;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.live-badge::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 14px rgba(101, 240, 174, 0.8);
  content: "";
}

.live-badge.offline { color: #ff9b9b; }
.live-badge.unknown { color: #bac5c0; }
.live-badge.offline::before { background: #ff7272; box-shadow: none; }
.live-badge.unknown::before { background: #bac5c0; box-shadow: none; }
.camera-map-marker.offline { background: #ff7272; border-color: #ffd0d0; box-shadow: 0 0 0 7px rgba(255, 114, 114, .16); }
.camera-map-marker.unknown { background: #bac5c0; border-color: #eef3f0; box-shadow: none; }
.online-filter { display: flex; align-items: center; gap: 10px; width: fit-content; min-height: 44px; margin-top: 24px; cursor: pointer; }
.online-filter input { width: 20px; height: 20px; accent-color: var(--green); }
.online-filter input:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
.health-note { max-width: 700px; color: var(--muted); font-size: .85rem; line-height: 1.6; }

.coordinates {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.78rem;
}

.camera-card h2 {
  margin: 38px 0 12px;
  font-size: 1.55rem;
  letter-spacing: -0.025em;
}

.description {
  margin: 0;
  color: var(--muted);
  line-height: 1.58;
}

.watch-link {
  align-self: flex-start;
  margin-top: auto;
  padding-top: 26px;
  color: var(--green);
  font-weight: 720;
  text-decoration: none;
}

.watch-link:hover { color: #b4ffd8; }

.player-main { padding: 52px 0 72px; }

.player-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #030806;
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.42);
}

.player-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.player-message {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  color: var(--muted);
  text-align: center;
  background: #07100d;
}

.player-message > span,
.player-account-link {
  display: block;
}

.player-account-link {
  margin-top: 12px;
  color: var(--green);
  font-weight: 720;
}

.camera-detail { padding: 32px 0 0; }

.camera-detail h1 {
  font-size: clamp(2.3rem, 6vw, 4.6rem);
}

.camera-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.viewer-limit {
  margin: 18px 0 0;
  color: var(--orange);
  font-size: 0.85rem;
}

.history-panel {
  margin-top: 30px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-soft);
}

.history-panel h2 { margin-top: 6px; }

.history-panel label,
.history-panel select,
.history-panel video { display: block; }

.history-panel label {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.history-panel select {
  width: min(100%, 420px);
  margin-top: 8px;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--text);
  background: #07110f;
}

.history-panel select { min-height: 48px; font: inherit; }
.history-panel select:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }

.history-panel video {
  width: 100%;
  margin-top: 18px;
  border-radius: 12px;
  background: #030806;
}

.history-status { margin-top: 10px; color: var(--muted); }

.fact {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  background: var(--panel-soft);
}

@media (max-width: 680px) {
  .shell { width: min(100% - 28px, 620px); }
  .topbar { min-height: 74px; }
  .hero { padding-top: 54px; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 10px; text-align: left; }
  .map-frame,
  #camera-map { min-height: 400px; }
  .player-main { padding-top: 28px; }
  .player-frame { border-radius: 16px; }
}
