:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #070b12;
  color: #f7fbff;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; min-height: 100svh; margin: 0; overflow: hidden; }
body { background: radial-gradient(circle at top, #132034 0%, #070b12 55%, #040609 100%); }
button, input { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }

#app-shell { position: relative; width: 100%; height: 100dvh; min-height: 100svh; overflow: hidden; }
#scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: auto;
  touch-action: none;
}

.glass {
  background: rgba(10, 16, 27, 0.72);
  border: 1px solid rgba(255,255,255,0.09);
  box-shadow: 0 18px 60px rgba(0,0,0,0.25);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.topbar {
  position: absolute;
  z-index: 10;
  top: 18px;
  left: 18px;
  right: 18px;
  min-height: 88px;
  border-radius: 20px;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  pointer-events: none;
}
.topbar .status-row,
.topbar button { pointer-events: auto; }
.topbar h1 { margin: 4px 0 0; font-size: clamp(18px, 2vw, 28px); font-weight: 630; letter-spacing: -0.025em; }
.eyebrow, .panel-title { color: #8fdcff; font-size: 11px; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; }
.status-row { display: flex; gap: 8px; align-items: flex-start; }
.pill { border: 1px solid rgba(119, 222, 255, 0.25); border-radius: 999px; padding: 7px 10px; font-size: 12px; background: rgba(34, 158, 199, 0.12); color: #c9f2ff; }
.pill.muted { color: #aab5c4; border-color: rgba(255,255,255,0.1); background: rgba(255,255,255,0.04); }

.controls {
  position: absolute;
  z-index: 30;
  pointer-events: auto;
  left: 18px;
  bottom: 18px;
  width: min(610px, calc(100vw - 36px));
  border-radius: 20px;
  padding: 16px;
}
.button-row, .prompt-row, .quick-prompts { display: flex; gap: 8px; }
.button-row { flex-wrap: wrap; }
button {
  position: relative;
  z-index: 1;
  pointer-events: auto;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #f5f8fc;
  border-radius: 11px;
  padding: 10px 13px;
  min-height: 40px;
  transition: 140ms ease;
}
button:hover { background: rgba(255,255,255,0.11); transform: translateY(-1px); }
button:active { transform: translateY(0); background: rgba(255,255,255,0.16); }
button.primary { border-color: rgba(95, 213, 255, 0.36); background: linear-gradient(135deg, rgba(22,155,210,.85), rgba(66,91,220,.78)); }
button:disabled { opacity: .5; cursor: progress; transform: none; }
.hint { color: #aeb9c9; margin: 11px 1px; font-size: 12px; line-height: 1.45; }
.prompt-row input {
  min-width: 0;
  flex: 1;
  border: 1px solid rgba(255,255,255,0.11);
  background: rgba(0,0,0,.23);
  color: white;
  border-radius: 11px;
  padding: 11px 12px;
  outline: none;
}
.prompt-row input:focus { border-color: rgba(95, 213, 255, .5); }
.quick-prompts { margin-top: 8px; flex-wrap: wrap; }
.quick-prompts button { padding: 7px 9px; color: #b9c6d7; font-size: 11px; }

.dev-panel {
  position: absolute;
  z-index: 20;
  right: 18px;
  top: 124px;
  width: 260px;
  border-radius: 18px;
  padding: 15px;
  pointer-events: none;
}
dl { margin: 12px 0 0; display: grid; gap: 9px; }
dl div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
dt { color: #7f8da0; font-size: 12px; }
dd { margin: 0; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #eaf3ff; font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.transcript {
  position: absolute;
  z-index: 25;
  right: 18px;
  bottom: 18px;
  width: 330px;
  max-height: 37vh;
  border-radius: 18px;
  padding: 15px;
  overflow: hidden;
  pointer-events: auto;
}
#messages { margin-top: 10px; max-height: calc(37vh - 48px); overflow-y: auto; display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin; }
.message { border-radius: 12px; padding: 9px 10px; font-size: 12px; line-height: 1.45; background: rgba(255,255,255,.05); }
.message.user { margin-left: 28px; background: rgba(80, 125, 230, .16); }
.message.assistant { margin-right: 28px; background: rgba(61, 196, 192, .11); }
.message .role { display: block; color: #7890a8; margin-bottom: 3px; font-size: 9px; text-transform: uppercase; letter-spacing: .1em; }

#crosshair {
  pointer-events: none;
  z-index: 5;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(0,0,0,.18);
}
#crosshair::after { content: ""; position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #8ee8ff; left: 3px; top: 3px; }

#toast {
  position: absolute;
  z-index: 100;
  top: 122px;
  left: 50%;
  max-width: min(520px, calc(100vw - 32px));
  transform: translateX(-50%) translateY(-6px);
  opacity: 0;
  pointer-events: none;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(5, 9, 15, .94);
  border: 1px solid rgba(255,255,255,.12);
  color: #dce8f7;
  font-size: 12px;
  text-align: center;
  transition: .2s ease;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.hidden { display: none !important; }

html.tz-cinematic .service-only { display: none !important; }
html.tz-cinematic .topbar {
  min-height: auto;
  padding: 8px 12px;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  pointer-events: none;
}
html.tz-cinematic .topbar > div:first-child { display: none; }
html.tz-cinematic .topbar .status-row {
  pointer-events: auto;
  gap: 6px;
  margin-left: auto;
}
html.tz-cinematic .topbar .pill,
html.tz-cinematic #xr-button { display: none !important; }
html.tz-cinematic #walk-button { display: none !important; }
html.tz-cinematic .topbar { display: none !important; }
html.tz-cinematic #crosshair { display: none; }
html.tz-cinematic.walk-mode #crosshair { display: block; }
html.walk-mode .topbar { display: none !important; }
html.walk-mode #cinematic-director { display: none !important; }
html.walk-mode #scene { position: fixed; inset: 0; width: 100vw; height: 100dvh; z-index: 0; }
html.vr-sbs #scene { visibility: hidden; }

@media (max-width: 920px) {
  .dev-panel { display: none; }
  .controls {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-height: 44dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .transcript {
    display: block;
    left: 10px;
    right: 10px;
    top: calc(106px + env(safe-area-inset-top, 0px));
    bottom: auto;
    width: auto;
    max-height: 26dvh;
    padding: 11px;
  }
  #messages { max-height: calc(26dvh - 42px); }
  .message { font-size: 11px; }
}

@media (max-width: 560px) {
  .topbar {
    left: 10px;
    right: 10px;
    top: calc(10px + env(safe-area-inset-top, 0px));
    padding: 13px;
    min-height: auto;
  }
  .topbar h1 { font-size: 16px; }
  .eyebrow { font-size: 9px; }
  html.tz-cinematic .status-row { display: flex; align-items: center; }
  html.service-demo .status-row { display: none; }
  .transcript { top: calc(86px + env(safe-area-inset-top, 0px)); max-height: 21dvh; }
  #messages { max-height: calc(21dvh - 38px); }
  .quick-prompts { display: none; }
  .controls { padding: 10px; max-height: 42dvh; }
  .button-row { gap: 6px; }
  button { padding: 8px 9px; min-height: 38px; font-size: 12px; }
  .hint { display: none; }
  .prompt-row { margin-top: 7px; }
  .prompt-row input { padding: 9px 10px; }
  #toast { top: calc(72px + env(safe-area-inset-top, 0px)); border-radius: 14px; }
}

/* TV Stage entry */
html.tv-stage .topbar,
html.tv-stage .controls,
html.tv-stage .dev-panel,
html.tv-stage .transcript { display: none !important; }
html.tv-stage #scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
}
.stage-panel {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 30;
  width: min(400px, calc(100vw - 28px));
  padding: 14px 16px 12px;
  border-radius: 18px;
  background: rgba(8, 12, 20, 0.78);
  border: 1px solid rgba(180, 205, 235, 0.18);
  color: #e4eef8;
  font: 13px/1.4 system-ui, sans-serif;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}
.stage-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.stage-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #8fdcff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.stage-brand strong {
  color: #f4f8fc;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-transform: none;
}
#stage-status {
  color: #9eb4cc;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.stage-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}
.stage-actions button {
  flex: 1;
  min-width: 120px;
}
.stage-panel button {
  border: 0;
  border-radius: 11px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #e8eef7;
  cursor: pointer;
}
.stage-panel button:hover { background: rgba(255, 255, 255, 0.14); }
.stage-panel button.primary {
  background: linear-gradient(135deg, #2f7cf0, #4b5de8);
}
.stage-panel button.active { background: #8b1d1d; }
.stage-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 8px;
  color: #a9bad0;
  font-size: 12px;
}
#stage-script {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 64px;
  border-radius: 10px;
  border: 1px solid rgba(160, 180, 210, 0.25);
  background: rgba(0, 0, 0, 0.35);
  color: #e8eef7;
  padding: 8px 10px;
  font: 12px/1.4 system-ui, sans-serif;
}
#stage-log {
  margin-top: 8px;
  color: #b7c7da;
  font-size: 12px;
  min-height: 2.6em;
}
html.tv-stage.walk-mode .stage-panel {
  opacity: 0.82;
  width: min(340px, calc(100vw - 24px));
}
html.tv-stage #vr180-controls,
html.tv-stage #vr180-status { display: none !important; }
html.tv-stage.walk-mode #crosshair { display: block; }
html.vr-glasses .stage-panel,
html.vr-glasses #crosshair,
html.vr-glasses #toast,
html.vr-glasses #vr180-live-preview { display: none !important; }
html.vr-glasses #scene { cursor: none; }
html.vr-glasses #nova-vr180-stage,
html.vr-glasses #vr180-recording-overlay canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

#stage-hero{flex:1;min-width:0;border-radius:10px;border:1px solid rgba(160,180,210,.25);background:rgba(0,0,0,.35);color:#e8eef7;padding:8px 10px;font:12px system-ui}

.tv-stage .stage-actor-card{margin:0 0 8px;padding:10px 12px;border-radius:12px;background:rgba(8,12,18,.55);border:1px solid rgba(255,255,255,.08);color:#c9d6e8;font:12px/1.4 system-ui,sans-serif}
.tv-stage .stage-look{display:flex;align-items:center;gap:8px;font-weight:650;color:#f2f6fb}
.tv-stage .stage-swatch{width:12px;height:12px;border-radius:999px;border:1px solid rgba(255,255,255,.25);flex:none}
.tv-stage .stage-look-notes,.tv-stage .stage-look-want{margin-top:5px;color:#a9bad0;font-size:12px}
.tv-stage .stage-check{display:inline-flex;align-items:center;gap:6px;margin:0 10px 6px 0;color:#a9bad0;font:11px system-ui}

.tv-stage .stage-selects{display:flex;gap:8px;flex-wrap:wrap;margin:0 0 8px}.tv-stage .stage-selects label{display:flex;flex-direction:column;gap:4px;color:#a9bad0;font:11px system-ui;flex:1;min-width:140px}.tv-stage .stage-selects select{width:100%;padding:7px 8px;border-radius:8px;border:1px solid rgba(255,255,255,.14);background:#121820;color:#e8eef7}.tv-stage .stage-workshop{color:#9ec1ff;font:11px system-ui;align-self:flex-end;padding:8px 0;text-decoration:none}

