:root {
  --bg: #04080b;
  --text: #dbe7ee;
  --muted: #7d8d98;
  --accent: #5ff0f2;
  --lvl: 0;
  --danger: #ff7a8a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ---------- Full-window avatar ---------- */
.scene {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 60% at 50% 35%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%),
    var(--bg);
}

/* A blurred copy of the picture fills the whole window behind the avatar. */
.backdrop {
  position: absolute;
  inset: -8%;
  background-size: cover;
  background-position: center 30%;
  filter: blur(36px) brightness(0.5) saturate(1.25);
  transform: scale(1.08);
}

/* Size and position are set by app.js so the face always fits the window. */
.stage {
  position: absolute;
  /* Soft bottom edge so the picture melts into the background on tall screens */
  -webkit-mask-image: linear-gradient(to bottom, #000 84%, transparent);
  mask-image: linear-gradient(to bottom, #000 84%, transparent);
}
.stage img, .stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Soft dark fade behind the top bar, so the title and buttons stay readable */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 130px;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(2, 6, 9, 0.8), rgba(2, 6, 9, 0.35) 55%, transparent);
}

/* HUD corner brackets on the window */
.corner {
  position: fixed;
  width: 26px;
  height: 26px;
  border: 0 solid var(--accent);
  opacity: 0.55;
  pointer-events: none;
  z-index: 2;
}
.corner.tl { top: 10px; left: 10px; border-top-width: 2px; border-left-width: 2px; border-top-left-radius: 6px; }
.corner.tr { top: 10px; right: 10px; border-top-width: 2px; border-right-width: 2px; border-top-right-radius: 6px; }
.corner.bl { bottom: 10px; left: 10px; border-bottom-width: 2px; border-left-width: 2px; border-bottom-left-radius: 6px; }
.corner.br { bottom: 10px; right: 10px; border-bottom-width: 2px; border-right-width: 2px; border-bottom-right-radius: 6px; }

/* ---------- Brand (top left) ---------- */
.brand {
  position: fixed;
  top: 14px;
  left: 18px;
  z-index: 3;
}
.brand .logo {
  display: block;
  height: 64px;
  width: auto;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.6));
}

/* ---------- Controls (top right) ---------- */
.controls {
  position: fixed;
  top: 20px;
  right: 26px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background: rgba(4, 12, 18, 0.55);
  backdrop-filter: blur(8px);
  color: var(--accent);
  font-family: "Orbitron", sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}
.ghost svg { width: 18px; height: 18px; fill: currentColor; }
.ghost:hover { background: rgba(4, 12, 18, 0.85); transform: translateY(-1px); }
.ghost:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.talk {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 28px;
  border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
  border-radius: 999px;
  font-family: "Orbitron", sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #02121a;
  background: var(--accent);
  box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 45%, transparent);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.3s ease, color 0.3s ease;
}
.talk svg { width: 19px; height: 19px; fill: currentColor; }
.talk:hover { transform: translateY(-1px); }
.talk:active { transform: scale(0.97); }
.talk:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.talk .pulse {
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 2px solid var(--accent);
  opacity: calc(var(--lvl) * 0.9);
  transform: scale(calc(1 + var(--lvl) * 0.25));
  pointer-events: none;
}
.talk.listening {
  background: var(--danger);
  border-color: var(--danger);
  box-shadow: 0 0 30px rgba(255, 122, 138, 0.45);
}
.talk.listening .pulse { border-color: var(--danger); }
.talk.busy { background: rgba(4, 12, 18, 0.9); color: var(--accent); }

/* ---------- Status and captions (bottom) ---------- */
.bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 60px 24px max(28px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(2, 6, 9, 0.85), rgba(2, 6, 9, 0.45) 55%, transparent);
  pointer-events: none;
}
.status {
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(4, 8, 12, 0.6);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  backdrop-filter: blur(8px);
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.captions {
  width: 100%;
  max-width: 760px;
  text-align: center;
}
.captions p { margin: 4px 0; line-height: 1.5; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.9); }
.captions p:empty { display: none; }
.captions .you { color: var(--muted); font-style: italic; }
.captions .claude { color: var(--text); font-size: 18px; }

@media (max-width: 600px) {
  .brand { top: 12px; left: 10px; }
  .brand .logo { height: 44px; }
  .controls { top: 16px; right: 16px; gap: 8px; }
  .talk { width: 52px; height: 52px; padding: 0; justify-content: center; }
  .talk #talkLabel { display: none; }
  .captions .claude { font-size: 16px; }
  .ghost { width: 52px; height: 52px; padding: 0; justify-content: center; }
  .ghost span { display: none; }
}
