:root {
  --ink: #0b1215;
  --ink-2: #121c21;
  --mist: #d9e2e0;
  --mist-dim: #8fa09c;
  --copper: #c8843a;
  --copper-hot: #e0a04e;
  --line: rgba(217, 226, 224, 0.12);
  --danger: #c45c4a;
  --ok: #3d9a7a;
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Sora", "Avenir Next", sans-serif;
  --radius: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--ink);
  color: var(--mist);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(200, 132, 58, 0.18), transparent 55%),
    radial-gradient(900px 500px at -10% 30%, rgba(61, 120, 130, 0.16), transparent 50%),
    linear-gradient(180deg, #0b1215 0%, #0e171b 45%, #0b1215 100%);
  background-attachment: fixed;
}

a {
  color: var(--copper-hot);
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  padding: 0.7rem 1rem;
  background: var(--copper);
  color: #1a1208;
  font-weight: 600;
  transition: transform 0.15s ease, background 0.2s ease, opacity 0.2s;
}

button:active {
  transform: scale(0.98);
}

button.ghost {
  background: transparent;
  color: var(--mist);
  border: 1px solid var(--line);
}

button.danger {
  background: var(--danger);
  color: #fff;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

input,
select {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(18, 28, 33, 0.85);
  color: var(--mist);
}

label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mist-dim);
  margin-bottom: 0.35rem;
}

.field {
  margin-bottom: 1rem;
}

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem calc(4.5rem + var(--safe-bottom));
}

/* Landing / login — brand-first hero */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100dvh;
  padding: 2rem 0 5rem;
  position: relative;
  animation: rise 0.7s ease both;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 8% 5% auto;
  height: 42vh;
  background:
    radial-gradient(ellipse at center, rgba(200, 132, 58, 0.22), transparent 65%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 220'%3E%3Cellipse cx='200' cy='110' rx='150' ry='70' fill='none' stroke='%23c8843a' stroke-opacity='0.35' stroke-width='3'/%3E%3Ccircle cx='200' cy='110' r='36' fill='%23c8843a' fill-opacity='0.45'/%3E%3Ccircle cx='200' cy='110' r='14' fill='%230b1215'/%3E%3C/svg%3E")
      center / contain no-repeat;
  pointer-events: none;
  animation: pulseEye 4.5s ease-in-out infinite;
}

.brand {
  font-family: var(--font-display);
  font-weight: 560;
  font-size: clamp(2.8rem, 12vw, 4.2rem);
  letter-spacing: -0.03em;
  line-height: 0.95;
  margin: 0 0 0.6rem;
  color: var(--mist);
}

.brand span {
  color: var(--copper);
}

.tagline {
  margin: 0 0 1.75rem;
  color: var(--mist-dim);
  max-width: 22rem;
  font-size: 1rem;
}

.panel {
  background: rgba(18, 28, 33, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  backdrop-filter: blur(10px);
  animation: rise 0.55s ease 0.12s both;
}

.panel h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin: 0 0 1rem;
  font-weight: 500;
}

.row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.row button {
  flex: 1;
  min-width: 7rem;
}

.error {
  color: #f0b4a8;
  font-size: 0.9rem;
  margin: 0.5rem 0 0;
}

.muted {
  color: var(--mist-dim);
  font-size: 0.88rem;
}

/* Shell after login */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0 0.75rem;
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(180deg, rgba(11, 18, 21, 0.95), rgba(11, 18, 21, 0.7) 70%, transparent);
}

.topbar .mark {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.topbar .mark em {
  font-style: normal;
  color: var(--copper);
}

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.25rem;
  padding: 0.55rem 0.75rem calc(0.55rem + var(--safe-bottom));
  background: rgba(11, 18, 21, 0.92);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
  z-index: 10;
}

.nav button {
  background: transparent;
  color: var(--mist-dim);
  border-radius: 10px;
  padding: 0.55rem 0.25rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.nav button.active {
  color: var(--copper-hot);
  background: rgba(200, 132, 58, 0.12);
}

.cam-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.cam-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  animation: rise 0.45s ease both;
}

.cam-item h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.35rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--mist-dim);
}

.badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mist-dim);
}

.badge.online .dot {
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(61, 154, 122, 0.5);
  animation: ping 2.2s ease infinite;
}

.badge.offline .dot {
  background: var(--danger);
}

.live-stage {
  margin: 0 -1rem;
  background: #000;
  min-height: 42vh;
  position: relative;
  overflow: hidden;
  animation: fade 0.4s ease both;
}

.live-stage video,
.live-stage img {
  width: 100%;
  height: auto;
  min-height: 42vh;
  object-fit: contain;
  display: block;
  background: #000;
}

.live-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.live-actions button {
  flex: 1;
  min-width: 5.5rem;
}

.ptt {
  min-height: 3.2rem;
  background: var(--ink-2);
  color: var(--mist);
  border: 1px solid var(--copper);
}

.ptt.recording {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
  animation: pulseRec 1s ease infinite;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  margin: 0.5rem 0 0.75rem;
  font-weight: 500;
}

.list-link {
  display: block;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--mist);
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(5rem + var(--safe-bottom));
  transform: translateX(-50%) translateY(8px);
  background: rgba(18, 28, 33, 0.95);
  border: 1px solid var(--line);
  color: var(--mist);
  padding: 0.65rem 1rem;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 20;
  font-size: 0.88rem;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

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

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pulseEye {
  0%,
  100% {
    opacity: 0.85;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.03);
  }
}

@keyframes ping {
  0% {
    box-shadow: 0 0 0 0 rgba(61, 154, 122, 0.45);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(61, 154, 122, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(61, 154, 122, 0);
  }
}

@keyframes pulseRec {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.75;
  }
}

@media (min-width: 720px) {
  .app {
    padding-bottom: 5rem;
  }
  .live-stage {
    border-radius: 12px;
    margin: 0;
  }
}
