:root {
  --bg0: #0c1210;
  --bg1: #14201b;
  --bg2: #1c2e27;
  --ink: #e8f2ec;
  --muted: #9bb5a8;
  --accent: #3dd68c;
  --accent-dim: #1f8f5a;
  --danger: #ff6b6b;
  --line: rgba(232, 242, 236, 0.12);
  --card: rgba(20, 32, 27, 0.92);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Syne", "DM Sans", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(61, 214, 140, 0.18), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(40, 120, 90, 0.22), transparent 50%),
    linear-gradient(165deg, var(--bg0), var(--bg1) 45%, #0a1612);
}

.eyebrow {
  margin: 0 0 0.35rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 700;
}

h1 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1.05;
}

.lede { color: var(--muted); margin: 0.75rem 0 0; max-width: 28ch; }

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}
.login-shell {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2rem;
  align-items: stretch;
  background: linear-gradient(145deg, rgba(28, 46, 39, 0.85), rgba(12, 18, 16, 0.9));
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 2.5rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.login-brand h1 { font-size: clamp(2.4rem, 5vw, 3.6rem); }
.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: center;
  padding: 0.5rem 0;
}
.login-form label {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.login-form input {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--ink);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font: inherit;
}
.login-form input:focus {
  outline: 2px solid rgba(61, 214, 140, 0.45);
  border-color: var(--accent-dim);
}
.login-form button,
.ghost {
  border: 0;
  border-radius: 999px;
  padding: 0.9rem 1.25rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.login-form button {
  margin-top: 0.5rem;
  background: linear-gradient(120deg, var(--accent), #2bb673);
  color: #062016;
}
.login-form button:hover { filter: brightness(1.05); }
.error { color: var(--danger); margin: 0; font-size: 0.9rem; }

/* Wall */
.wall-page { min-height: 100vh; }
.wall-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 14, 12, 0.55);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.wall-header h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.header-actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line) !important;
}
.ghost:hover { border-color: var(--accent) !important; color: var(--accent); }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(61, 214, 140, 0.12);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
}
.pill.warn { background: rgba(255, 107, 107, 0.12); color: var(--danger); }

.wall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1rem;
  padding: 1rem 1.25rem 2rem;
}

.vehicle-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: rise 0.5s ease both;
}
.vehicle-card:nth-child(2) { animation-delay: 0.05s; }
.vehicle-card:nth-child(3) { animation-delay: 0.1s; }
.vehicle-card:nth-child(4) { animation-delay: 0.15s; }
.vehicle-card:nth-child(5) { animation-delay: 0.2s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.vehicle-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(61, 214, 140, 0.08), transparent);
}
.head-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ghost.tiny {
  padding: 0.35rem 0.7rem;
  font-size: 0.75rem;
}
.vehicle-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.vehicle-meta {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}
.dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #5a6b63;
  display: inline-block;
}
.dot.on { background: var(--accent); box-shadow: 0 0 0 4px rgba(61, 214, 140, 0.18); }

.cams {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  padding: 0.35rem;
  background: #050807;
}
.cam .player-host {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  background: #000;
}
.cam {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
}
.cam-label {
  position: absolute;
  left: 0.45rem;
  top: 0.45rem;
  z-index: 2;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--ink);
}
.cam-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 3;
}
.cam-state[hidden],
.cam-state.is-clear {
  display: none !important;
}

@media (max-width: 800px) {
  .login-shell { grid-template-columns: 1fr; padding: 1.5rem; }
  .cams { grid-template-columns: 1fr; }
  .wall-header { align-items: start; flex-direction: column; }
}
