:root {
  color-scheme: dark;
  --page: #080f1a;
  --surface: #111b2b;
  --border: #26344a;
  --text: #f5f7fb;
  --muted: #9eb0c8;
  --accent: #73b7d8;
  --accent-dark: #071522;
  --green: #70d59c;
  --amber: #efbd61;
  --red: #f08370;
}

* { box-sizing: border-box; }
html { background: var(--page); }
body {
  background: radial-gradient(circle at 55% 120%, rgba(35, 78, 110, .14), transparent 45%), var(--page);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  min-height: 100vh;
}
button { font: inherit; }
[hidden] { display: none !important; }

.portal-shell { margin: 0 auto; max-width: 1460px; padding: 22px 24px 18px; }
.project-header { margin-bottom: 22px; }
.project-header-copy { min-width: 0; }
.brand-line { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .18em; margin: 0 0 12px; }
.project-identity { align-items: flex-start; display: flex; gap: 18px; }
h1 { font-size: clamp(26px, 2.45vw, 38px); letter-spacing: -.035em; line-height: 1.08; margin: 0; max-width: 1200px; }
.location-line { align-items: center; color: var(--muted); display: flex; font-size: 15px; gap: 9px; margin: 12px 0 0; max-width: max-content; text-decoration: none; transition: color .15s ease; }
.location-line:hover { color: var(--accent); }
.location-line:focus-visible { border-radius: 5px; outline: 3px solid rgba(115,183,216,.3); outline-offset: 4px; }
.external-mark { font-size: 13px; }
.location-line svg { fill: none; height: 19px; stroke: currentColor; stroke-width: 1.7; width: 19px; }
.project-facts { align-items: center; display: flex; flex-wrap: wrap; gap: 12px 20px; margin-top: 16px; }
.project-fact { color: var(--muted); font-size: 14px; }
.project-link { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-size: 14px; padding: 10px 14px; text-decoration: none; }
.project-link:hover { border-color: var(--accent); }
.brand-logo { align-items: center; display: flex; height: 104px; justify-content: center; width: 104px; }
.brand-logo img { display: block; height: 100%; object-fit: contain; width: 100%; }

.camera-heading { align-items: center; display: flex; gap: 18px; justify-content: space-between; margin-bottom: 11px; }
.camera-heading h2 { color: var(--muted); font-size: clamp(16px, 1.4vw, 20px); font-weight: 450; margin: 0; }
.camera-heading h2 strong { color: var(--text); font-weight: 800; }
.camera-heading h2 span { color: #60718a; margin: 0 4px; }
.status-badge { align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; display: inline-flex; flex: 0 0 auto; font-size: 12px; font-weight: 750; gap: 8px; padding: 8px 13px; }
.status-badge::before { background: #9bacc1; border-radius: 50%; content: ""; height: 8px; width: 8px; }
.status-badge.requesting::before, .status-badge.available::before { background: var(--accent); }
.status-badge.live::before { background: var(--green); box-shadow: 0 0 0 5px rgba(112,213,156,.12); }
.status-badge.sleeping::before { background: var(--amber); }
.status-badge.lost::before { background: var(--red); }

.stream-stage { aspect-ratio: 16 / 9; background: #05090e; border: 1px solid var(--border); border-radius: 20px; isolation: isolate; min-height: 390px; overflow: hidden; position: relative; width: 100%; }
.renderer-host { height: 100%; inset: 0; position: absolute; width: 100%; }
.readonly .renderer-host { pointer-events: none !important; }
.renderer-host .gm-wrapper, .renderer-host .player-screen-wrapper, .renderer-host .gm-video-wrapper { height: 100% !important; max-height: none !important; max-width: none !important; width: 100% !important; }
.renderer-host .gm-wrapper { display: flex !important; }
.renderer-host .player-screen-wrapper { flex: 1 1 auto !important; padding: 0 !important; }
.renderer-host .gm-video-wrapper { align-self: stretch !important; margin: 0 !important; min-height: 0 !important; }
.renderer-host .gm-video { border-radius: 0 !important; height: 100% !important; max-height: none !important; max-width: none !important; object-fit: contain !important; width: 100% !important; }

.stream-overlay { align-items: center; backdrop-filter: blur(9px); background: rgba(6, 10, 15, .74); display: flex; inset: 0; justify-content: center; padding: 32px; position: absolute; z-index: 5; }
body[data-view-state="live"] .stream-overlay { display: none; }
.overlay-panel { align-items: center; display: flex; flex-direction: column; max-width: 560px; text-align: center; }
.overlay-icon { color: #c2ccd9; font-size: 49px; line-height: 1; margin-bottom: 18px; }
.overlay-panel h3 { font-size: clamp(20px, 1.8vw, 27px); letter-spacing: -.02em; margin: 0; }
.overlay-panel p { color: #d2d9e3; font-size: clamp(13px, 1.15vw, 16px); line-height: 1.55; margin: 11px 0 0; max-width: 520px; }
.overlay-panel small { color: #a8bad1; font-size: 13px; margin-top: 14px; }
.loader { animation: spin .85s linear infinite; border: 4px solid rgba(115,183,216,.23); border-radius: 50%; border-top-color: var(--accent); height: 48px; margin: 0 0 20px; width: 48px; }
@keyframes spin { to { transform: rotate(360deg); } }
.connection-steps { display: grid; gap: 10px; list-style: none; margin: 22px 0 0; padding: 0; text-align: left; }
.connection-steps li { color: #8fa4be; font-size: 15px; }
.connection-steps li span { display: inline-block; margin-right: 9px; width: 16px; }
.connection-steps li.done { color: #cbd6e4; }
.connection-steps li.done span { color: var(--green); }
.connection-steps li.current { color: var(--text); }
.connection-steps li.current span { color: var(--accent); }

.overlay-actions { align-items: center; display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.button { border: 1px solid transparent; border-radius: 11px; cursor: pointer; font-size: 14px; font-weight: 800; min-height: 48px; min-width: 250px; padding: 0 22px; transition: transform .15s ease, filter .15s ease; }
.button:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.button:focus-visible { outline: 3px solid rgba(115,183,216,.35); outline-offset: 3px; }
.button:disabled { cursor: wait; opacity: .65; }
.primary { background: var(--accent); color: var(--accent-dark); }
.quiet { background: rgba(7,11,17,.68); border-color: #6b6770; color: var(--text); min-height: 44px; min-width: 96px; }
.wake-action, .retry-action { align-items: center; display: flex; flex-direction: column; gap: 9px; }
.action-feedback { color: #b9c8d9; font-size: 12px; max-width: 430px; }
.action-feedback:empty { display: none; }

.live-hud { display: flex; inset: 18px 18px auto; justify-content: space-between; pointer-events: none; position: absolute; z-index: 4; }
.hud-left, .hud-right { align-items: center; display: flex; gap: 9px; }
.hud-chip { background: rgba(5, 9, 14, .84); border: 1px solid rgba(255,255,255,.08); border-radius: 999px; color: #edf2f8; font-size: 13px; padding: 8px 13px; }
.hud-chip b { font-weight: 750; }
.hud-exit { background: rgba(5,9,14,.84); border: 1px solid rgba(255,255,255,.16); border-radius: 999px; color: #edf2f8; cursor: pointer; font-size: 13px; font-weight: 750; padding: 8px 14px; pointer-events: auto; }

body[data-view-state="sleeping"] .stream-overlay, body[data-view-state="lost"] .stream-overlay { background: rgba(8, 9, 11, .68); }
body[data-view-state="sleeping"] .overlay-icon { color: var(--amber); }
body[data-view-state="lost"] .overlay-icon { color: var(--red); }
.sr-only { clip: rect(0,0,0,0); clip-path: inset(50%); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; }
.site-footer { border-top: 1px solid rgba(158,176,200,.14); color: var(--muted); font-size: 13px; line-height: 1.55; margin-top: 18px; padding: 16px 4px 2px; text-align: center; }
.site-footer p { margin: 0 auto; max-width: 900px; }
.site-footer p + p { margin-top: 3px; }
.site-footer strong { color: var(--text); }

@media (min-width: 1100px) { .stream-stage { aspect-ratio: auto; height: clamp(430px, 55vh, 650px); } }
@media (min-width: 1600px) { .portal-shell { max-width: 1500px; } }
@media (max-width: 720px) {
  .portal-shell { padding: 18px 14px 14px; }
  .project-header { margin-bottom: 20px; }
  .project-identity { gap: 10px; }
  .brand-line { font-size: 9px; }
  .location-line { font-size: 14px; margin-top: 11px; }
  .brand-logo { height: 64px; width: 64px; }
  .project-facts { gap: 10px; }
  .project-link { font-size: 13px; padding: 10px 12px; }
  .camera-heading { align-items: flex-start; }
  .camera-heading h2 { line-height: 1.45; }
  .status-badge { font-size: 11px; padding: 8px 11px; }
  .stream-stage { aspect-ratio: 4 / 3; border-radius: 14px; min-height: 360px; }
  .stream-overlay { padding: 20px; }
  .overlay-icon { font-size: 38px; margin-bottom: 14px; }
  .button { font-size: 14px; min-width: min(270px, 78vw); }
  .live-hud { inset: 10px 10px auto; }
  .hud-chip { font-size: 11px; padding: 7px 9px; }
  .site-footer { font-size: 12px; margin-top: 14px; padding-top: 14px; }
}

@media (max-width: 480px) {
  .brand-logo { height: 52px; width: 52px; }
  h1 { font-size: 23px; line-height: 1.13; }
  .project-facts { align-items: stretch; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-fact { grid-column: 1 / -1; }
  .project-link { text-align: center; }
  .camera-heading { display: grid; }
  .status-badge { justify-self: start; }
  .stream-stage { aspect-ratio: 3 / 4; height: auto; min-height: 420px; }
  .hud-readonly { display: none; }
  .live-hud { align-items: flex-start; }
  .hud-left { align-items: flex-start; flex-direction: column; gap: 6px; }
  .overlay-panel p { font-size: 14px; }
}
