:root {
  --bg0: #05070C;
  --bg1: #0A0D16;
  --card: rgba(255, 255, 255, 0.04);
  --line: rgba(255, 255, 255, 0.08);

  --text: #F0F4FF;
  --muted: #A9B4D0;

  /* Skalering for Wallboard / TV-skjermer */
  --scale: clamp(.95, 1vw + 0.8, 1.4);
  --h1: calc(115px * var(--scale));
  --h2: calc(36px * var(--scale));
  --body: calc(28px * var(--scale));
  --small: calc(18px * var(--scale));

  /* Ekstremt tydelige signalfarger */
  --good: #00FF88; /* Sterk Grønn */
  --warn: #FFB800; /* Kraftig Gul/Oransje (Fail-safe) */
  --bad: #FF3333;  /* Intens Rød */
  --info: #00A3FF;

  --shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
  --radius: 28px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }

body {
  background-color: var(--bg0);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Dynamisk bakgrunnsglød styrt av status-klasse på #app */
.app {
  height: 100%; width: 100%;
  padding:
    calc(24px * var(--scale) + env(safe-area-inset-top))
    calc(24px * var(--scale) + env(safe-area-inset-right))
    calc(24px * var(--scale) + env(safe-area-inset-bottom))
    calc(24px * var(--scale) + env(safe-area-inset-left));
  display: flex; flex-direction: column; gap: calc(18px * var(--scale));
  transition: background 0.5s ease;
  background:
    radial-gradient(circle at 50% -20%, var(--status-glow, transparent), transparent 70%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
}

/* Status-temaer */
.app.good { --status-color: var(--good); --status-glow: rgba(0, 255, 136, 0.12); }
.app.bad  { --status-color: var(--bad);  --status-glow: rgba(255, 51, 51, 0.18); }
.app.warn { --status-color: var(--warn); --status-glow: rgba(255, 184, 0, 0.12); }

/* Header */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(16px * var(--scale)) calc(24px * var(--scale));
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 24px;
  backdrop-filter: blur(20px);
}

.brand { display: flex; align-items: center; gap: 18px; }
.brandText .title { font-size: calc(30px * var(--scale)); font-weight: 850; letter-spacing: -0.5px; }
.brandText .sub { font-size: var(--small); color: var(--muted); }

.hdot {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--status-color, var(--warn));
  box-shadow: 0 0 20px var(--status-color);
  transition: background 0.4s ease;
}

.meta { display: flex; gap: 12px; }
.chip {
  font-size: var(--small); padding: 10px 18px;
  border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  font-variant-numeric: tabular-nums;
}

/* Grid Layout */
.grid { flex: 1; display: grid; gap: calc(20px * var(--scale)); grid-template-columns: 1.4fr 0.6fr; min-height: 0; }

.card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.01) 100%);
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column;
}

/* Hero Section (Hovedstatus) */
.hero { padding: calc(36px * var(--scale)); position: relative; justify-content: space-between; }

/* Subtil ramme-farge som følger status */
.hero::after {
  content: ""; position: absolute; inset: 0;
  border-radius: var(--radius); border: 2px solid var(--status-color);
  opacity: 0.15; pointer-events: none;
}

.heroTop { display: flex; justify-content: space-between; align-items: flex-start; }
.kicker { font-size: var(--small); color: var(--muted); text-transform: uppercase; letter-spacing: 2px; font-weight: 600; }

.statusWrap { display: flex; align-items: center; gap: 28px; margin-top: 10px; }

/* Kraftig pulserende indikator */
.indicator {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--status-color, var(--warn));
  box-shadow: 0 0 35px var(--status-color);
  position: relative; flex-shrink: 0;
}

.indicator::before, .indicator::after {
  content: ""; position: absolute; inset: -15px;
  border-radius: 50%; border: 4px solid var(--status-color);
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.indicator::after { animation-delay: 1s; }

@keyframes pulse {
  0% { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(1.8); opacity: 0; }
}

.status {
  font-size: var(--h1); font-weight: 950; line-height: 0.85;
  text-transform: uppercase; color: var(--status-color, var(--warn));
}

.reason { font-size: var(--body); color: var(--muted); margin-top: 15px; max-width: 80%; line-height: 1.3; }

.pill {
  font-size: var(--body); font-weight: 800; padding: 12px 32px;
  border-radius: 16px; background: var(--status-color); color: #000;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3); transition: all 0.4s ease;
}

/* Kamera-feeder */
.cams { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; flex: 1; min-height: 0; margin-top: 20px; }
.cam { margin: 0; border-radius: 20px; overflow: hidden; background: #000; border: 1px solid var(--line); display: flex; flex-direction: column; }
.camHead { padding: 10px 16px; background: rgba(0,0,0,0.6); display: flex; justify-content: space-between; font-size: var(--small); border-bottom: 1px solid var(--line); }
.cam img { width: 100%; height: 100%; object-fit: cover; opacity: 0.85; }

/* Hendelsesliste */
.listHead { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; }
.h2 { font-size: var(--h2); font-weight: 850; }
.items { padding: 16px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.item { 
  padding: 16px; border-radius: 18px; background: rgba(255,255,255,0.03); 
  border: 1px solid var(--line); display: flex; gap: 16px; 
}
.item.bad { border-left: 6px solid var(--bad); }
.item.warn { border-left: 6px solid var(--warn); }
.badge { width: 12px; height: 12px; border-radius: 50%; background: var(--info); margin-top: 8px; flex-shrink: 0; }

.itemTitle { font-size: calc(20px * var(--scale)); font-weight: 800; margin-bottom: 4px; }
.itemText { font-size: var(--small); color: var(--muted); line-height: 1.4; }
.itemWhere {
  margin-top: calc(6px * var(--scale));
  opacity: 0.75;
  font-size: calc(13px * var(--scale));
}


.foot { padding: 10px 24px; display: flex; justify-content: space-between; font-size: var(--small); color: rgba(255,255,255,0.4); }

@media (orientation: portrait) {
  .grid { grid-template-columns: 1fr; }
  .status { font-size: calc(var(--h1) * 0.75); }
}

@media (prefers-reduced-motion: reduce) {
  .indicator::before, .indicator::after { animation: none; opacity: 0.4; }
}

/* ===============================
   Kamera Byfjordtunnelen
   =============================== */

#cam1,
#cam2 {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}