:root {
  --bg: #020814;
  --navy: #07142f;
  --panel: rgba(7, 20, 50, .78);
  --panel2: rgba(10, 32, 78, .82);
  --blue: #2d80ff;
  --blue2: #72b7ff;
  --red: #ff4058;
  --red2: #a90d25;
  --green: #35db82;
  --white: #f7fbff;
  --muted: rgba(225, 236, 255, .76);
  --line: rgba(82, 148, 255, .42);
  --softLine: rgba(255,255,255,.13);
  --shadow: 0 26px 85px rgba(0,0,0,.42);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--white);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background:
    linear-gradient(rgba(3, 10, 25, 0.65), rgba(3, 10, 25, 0.82)),
    url("assets/stormy.png") center center / cover no-repeat fixed;
  overflow-x: hidden;
}
background:
  linear-gradient(rgba(3, 10, 25, 0.65), rgba(3, 10, 25, 0.82)),
  url("assets/stormy.png") center center / cover no-repeat;
.storm-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 76% 8%, rgba(255,255,255,.22), transparent 2%),
    radial-gradient(circle at 79% 10%, rgba(95,151,255,.22), transparent 12%),
    linear-gradient(180deg, rgba(255,255,255,.03), transparent 45%);
  z-index: 0;
}

.storm-bg::before {
  content: "";
  position: absolute;
  top: 0;
  right: 12%;
  width: 3px;
  height: 210px;
  background: linear-gradient(180deg, white, rgba(112,176,255,.1));
  transform: rotate(18deg);
  filter: drop-shadow(0 0 18px rgba(125,184,255,.85));
  opacity: .65;
}

.page {
  position: relative;
  z-index: 1;
  width: min(1600px, calc(100% - 28px));
  margin: 18px auto 28px;
}

.topbar,
.notice,
.controls,
.camera-card,
footer {
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.06);
}

.topbar {
  border-radius: 28px;
  padding: 18px 22px;
  background: linear-gradient(180deg, rgba(12,26,65,.86), rgba(4,12,31,.78));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

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

.brand img {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  padding: 4px;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2.6rem);
  text-transform: uppercase;
  line-height: 1;
  letter-spacing: -.02em;
}

.brand p {
  margin: 6px 0 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .11em;
  font-size: .86rem;
}

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

.status,
#refresh-all {
  min-height: 50px;
  border-radius: 15px;
  border: 1px solid var(--softLine);
  background: rgba(12,23,58,.72);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 18px;
  font-weight: 800;
  text-transform: uppercase;
}

.status i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px rgba(53,219,130,.75);
}

#refresh-all {
  cursor: pointer;
  background: linear-gradient(180deg, #328dff, #1658e9);
}

.notice {
  width: min(1050px, 86%);
  margin: 18px auto;
  border-radius: 22px;
  padding: 15px 18px;
  background: linear-gradient(180deg, rgba(12,37,88,.78), rgba(7,20,50,.82));
}

.notice strong {
  color: var(--blue2);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.notice p {
  margin: 6px 0 0;
  color: var(--muted);
}

.notice b {
  color: var(--white);
}

.controls {
  border-radius: 24px;
  padding: 16px;
  background: var(--panel);
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr)) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
}

.control-group {
  display: grid;
  gap: 7px;
}

label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .76rem;
  font-weight: 800;
}

select {
  width: 100%;
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(91,148,255,.35);
  background: rgba(10,32,78,.88);
  color: var(--white);
  padding: 0 12px;
  font-weight: 700;
}

.summary-card {
  min-height: 58px;
  border-radius: 16px;
  border: 1px solid rgba(91,148,255,.28);
  background: rgba(10,32,78,.76);
  display: grid;
  place-items: center;
  padding: 9px 18px;
}

.summary-card span {
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1;
}

.summary-card small {
  color: var(--muted);
  text-transform: uppercase;
  font-size: .68rem;
}

.camera-grid {
  display: grid;
  gap: 18px;
}

.layout-auto {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr));
}

.layout-single { grid-template-columns: 1fr; }
.layout-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.layout-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.layout-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.camera-card {
  border-radius: 24px;
  background: var(--panel2);
  overflow: hidden;
}

.camera-header {
  padding: 16px 18px 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.camera-header h2 {
  margin: 0;
  font-size: clamp(1.05rem, 1.5vw, 1.65rem);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.camera-header p {
  margin: 5px 0 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .78rem;
}

.live-pill {
  height: fit-content;
  border-radius: 9px;
  padding: 6px 9px;
  background: linear-gradient(180deg, var(--red), var(--red2));
  text-transform: uppercase;
  font-size: .72rem;
  font-weight: 900;
}

.frame-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #020814;
  border-top: 1px solid rgba(255,255,255,.1);
  border-bottom: 1px solid rgba(255,255,255,.1);
  overflow: hidden;
}

.frame-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  z-index: 1;
  background: #020814;
}

.fallback {
  position: absolute;
  inset: auto 12px 12px;
  z-index: 0;
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(0,0,0,.62);
  border: 1px solid rgba(255,255,255,.14);
  display: grid;
  gap: 2px;
}

.fallback strong {
  color: var(--blue2);
  text-transform: uppercase;
  font-size: .8rem;
}

.fallback span {
  color: var(--muted);
  font-size: .8rem;
}

.camera-actions {
  padding: 14px 18px 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.camera-actions a,
.camera-actions button {
  border-radius: 13px;
  padding: 12px 14px;
  border: 1px solid rgba(130,170,255,.28);
  text-decoration: none;
  color: white;
  font-weight: 800;
  background: rgba(17,42,96,.78);
  cursor: pointer;
  text-align: center;
}

.camera-actions button {
  background: rgba(9,25,62,.82);
}

footer {
  margin-top: 18px;
  border-radius: 22px;
  background: rgba(5,15,38,.76);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--muted);
}

footer span:first-child {
  color: var(--white);
  font-weight: 900;
}

@media (max-width: 1180px) {
  .layout-three,
  .layout-four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .page {
    width: min(100% - 12px, 100%);
    margin-top: 8px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    border-radius: 22px;
  }

  .brand img {
    width: 58px;
    height: 58px;
  }

  .brand h1 {
    font-size: 1.45rem;
  }

  .brand p {
    font-size: .68rem;
  }

  .notice {
    width: 100%;
    border-radius: 20px;
  }

  .controls,
  .layout-two,
  .layout-three,
  .layout-four,
  .layout-auto {
    grid-template-columns: 1fr;
  }

  .camera-card,
  .controls,
  footer {
    border-radius: 20px;
  }

  .frame-wrap {
    aspect-ratio: 16 / 10;
    min-height: 260px;
  }

  .camera-actions {
    grid-template-columns: 1fr;
  }
}
