:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #07111f;
  color: #f6f9fc;
  --background: #07111f;
  --surface: #101d2e;
  --surface-strong: #14253a;
  --accent: #61d3bc;
  --accent-dark: #173d3a;
  --muted: #9daabd;
  --danger: #ff7b7b;
}

* { box-sizing: border-box; }

html, body {
  min-height: 100%;
  margin: 0;
  background: var(--background);
}

body {
  min-height: 100dvh;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

[hidden] { display: none !important; }

.login-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 22px max(28px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 50% 12%, rgba(97, 211, 188, .19), transparent 33%),
    radial-gradient(circle at 5% 90%, rgba(138, 180, 248, .12), transparent 28%),
    var(--background);
}

.login-card {
  width: min(100%, 430px);
  padding: 30px 24px 24px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 32px;
  background: rgba(16, 29, 46, .92);
  box-shadow: 0 28px 80px rgba(0,0,0,.38);
  text-align: center;
  backdrop-filter: blur(18px);
}

.baby-photo-ring {
  width: 160px;
  height: 160px;
  margin: 0 auto 22px;
  padding: 6px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent), #8ab4f8);
  box-shadow: 0 14px 44px rgba(97, 211, 188, .2);
}

.baby-photo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border: 5px solid var(--surface);
  border-radius: 50%;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

h1 { margin: 0; font-size: clamp(32px, 9vw, 44px); letter-spacing: -.04em; }
.intro { margin: 10px auto 26px; max-width: 320px; color: var(--muted); line-height: 1.55; }

form { text-align: left; }
label { display: block; margin: 0 0 8px 3px; color: #dce6f3; font-size: 14px; font-weight: 700; }

input {
  width: 100%;
  height: 58px;
  padding: 0 18px;
  color: #fff;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 17px;
  outline: none;
  background: #091524;
  font-size: 18px;
  transition: border-color .18s, box-shadow .18s;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(97, 211, 188, .12);
}

.primary-button {
  width: 100%;
  min-height: 58px;
  margin-top: 14px;
  border: 0;
  border-radius: 18px;
  color: #061813;
  background: var(--accent);
  font-size: 17px;
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(97, 211, 188, .2);
}

.primary-button:disabled { opacity: .62; cursor: wait; }
.error { margin: 10px 4px 0; color: #ff9a9a; font-size: 14px; }
.privacy-note { margin: 18px 0 0; color: rgba(255,255,255,.36); font-size: 12px; }

.viewer-page, .viewer-shell { width: 100%; min-height: 100dvh; background: #000; }
.viewer-shell { position: relative; overflow: hidden; }
.video-host { position: absolute; inset: 0; background: #020509; }

.live-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at center, rgba(97,211,188,.11), transparent 38%),
    #05090e;
  text-align: center;
}

.placeholder-photo-wrap {
  width: 112px;
  height: 112px;
  padding: 4px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent), #8ab4f8);
}

.placeholder-photo { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.video-placeholder h1 { font-size: 32px; }
.video-placeholder p { margin: 9px 0 0; color: var(--muted); }
.audio-host { display: none; }

.top-bar {
  position: fixed;
  z-index: 5;
  top: max(14px, env(safe-area-inset-top));
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.live-pill, .viewer-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  background: rgba(7,17,31,.78);
  box-shadow: 0 8px 28px rgba(0,0,0,.25);
  backdrop-filter: blur(16px);
  font-size: 13px;
  font-weight: 800;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #8995a5;
  box-shadow: 0 0 0 5px rgba(137,149,165,.12);
}
.status-dot[data-status="live"] { background: #5ae0a2; box-shadow: 0 0 0 5px rgba(90,224,162,.14), 0 0 16px rgba(90,224,162,.8); }
.status-dot[data-status="connecting"], .status-dot[data-status="waiting"] { background: #ffc861; box-shadow: 0 0 0 5px rgba(255,200,97,.13); }
.status-dot[data-status="offline"] { background: #ff7b7b; box-shadow: 0 0 0 5px rgba(255,123,123,.14); }

.bottom-panel {
  position: fixed;
  z-index: 5;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 23px;
  background: rgba(7,17,31,.8);
  backdrop-filter: blur(18px);
}

.control-button {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 10px;
  color: #eef5ff;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 15px;
  background: rgba(255,255,255,.07);
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}
.control-button .icon { font-size: 18px; line-height: 1; }
.control-button.attention { color: #08231d; background: var(--accent); border-color: transparent; }
.control-button.danger { color: #ffc4c4; background: rgba(255,123,123,.10); }

@media (min-width: 700px) {
  .bottom-panel {
    left: 50%;
    right: auto;
    width: min(720px, calc(100% - 32px));
    transform: translateX(-50%);
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .top-bar { left: 24px; right: 24px; }
}

@media (orientation: landscape) and (max-height: 600px) {
  .bottom-panel { width: auto; left: 12px; right: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
