:root {
  --bg: #090b09;
  --panel: #101310;
  --panel-2: #151915;
  --line: #293029;
  --text: #f4f6f1;
  --muted: #899187;
  --accent: #76b900;
  --accent-bright: #8fd400;
  --danger: #ff685f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--text); background: radial-gradient(circle at 50% -20%, rgba(118,185,0,.08), transparent 38%), var(--bg); }
button { font: inherit; }
[hidden] { display: none !important; }

.auth-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(440px, 100%); padding: 42px; border: 1px solid var(--line); border-radius: 18px; text-align: center; background: rgba(16,19,16,.94); box-shadow: 0 30px 90px rgba(0,0,0,.45); }
.auth-card .mark { margin: 0 auto 24px; }
.eyebrow { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .2em; }
.auth-card h1 { margin: 12px 0; font-size: 27px; font-weight: 570; }
.auth-card p { color: var(--muted); line-height: 1.6; }
.auth-card button, .call { border: 0; color: #11150d; background: var(--accent); cursor: pointer; }
.auth-card button { min-width: 150px; padding: 12px 20px; border-radius: 8px; font-weight: 750; }

.app { min-height: 100vh; display: grid; grid-template-rows: 72px minmax(0, 1fr) auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 clamp(20px, 5vw, 70px); border-bottom: 1px solid var(--line); background: rgba(9,11,9,.9); }
.brand, .topbar-actions { display: flex; align-items: center; gap: 13px; }
.brand strong { display: block; font-size: 14px; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; letter-spacing: .08em; }
.mark { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid rgba(118,185,0,.45); border-radius: 8px; color: var(--accent-bright); background: rgba(118,185,0,.08); font-size: 11px; font-weight: 850; letter-spacing: .08em; }
.status { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 10px; }
.status i, .conversation-header i { width: 7px; height: 7px; border-radius: 50%; background: #596058; }
.status[data-state="active"] i, .status[data-state="speaking"] i, .conversation-header i { background: var(--accent); box-shadow: 0 0 10px rgba(118,185,0,.65); }
.status[data-state="error"] { color: #ffaaa5; }
.status[data-state="error"] i { background: var(--danger); }
.quiet { border: 0; color: var(--muted); background: transparent; cursor: pointer; }
.quiet:hover { color: var(--accent-bright); }
#auth-user { color: var(--muted); font-size: 10px; }

.conversation { min-height: 0; display: flex; flex-direction: column; }
.conversation-header { min-height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(22px, 7vw, 110px); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 9px; font-weight: 780; letter-spacing: .16em; }
.conversation-header span { display: flex; align-items: center; gap: 9px; }
.transcript { flex: 1; min-height: 0; max-height: calc(100vh - 214px); padding: 38px clamp(22px, 7vw, 110px) 120px; overflow-y: auto; }
.empty-state { min-height: 56vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-state h2 { margin: 22px 0 7px; font-size: 19px; font-weight: 560; }
.empty-state p { margin: 0; color: var(--muted); font-size: 11px; }
.orb { display: flex; align-items: center; justify-content: center; gap: 4px; width: 76px; height: 76px; border: 1px solid rgba(118,185,0,.25); border-radius: 50%; background: radial-gradient(circle, rgba(118,185,0,.15), transparent 70%); }
.orb i { width: 2px; height: 13px; border-radius: 4px; background: var(--accent); }
.orb i:nth-child(2), .orb i:nth-child(4) { height: 25px; }
.orb i:nth-child(3) { height: 36px; }
.message { display: flex; gap: 12px; max-width: min(820px, 88%); margin: 0 0 27px; animation: message-in .22s ease-out; }
.message.user { flex-direction: row-reverse; margin-left: auto; }
.avatar { flex: 0 0 auto; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(118,185,0,.3); border-radius: 6px; color: var(--accent-bright); font-size: 8px; font-weight: 800; }
.message.user .avatar { color: #10140d; border-color: var(--accent); background: var(--accent); }
.message-content { min-width: 0; }
.message-meta { margin: 0 0 6px; color: #717970; font-size: 8px; font-weight: 750; letter-spacing: .1em; }
.message.user .message-meta { text-align: right; }
.bubble { padding: 15px 18px; border: 1px solid var(--line); border-radius: 4px 16px 16px; color: #e5e9e1; background: var(--panel-2); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.message.user .bubble { color: #10140d; border-color: var(--accent); border-radius: 16px 4px 16px 16px; background: var(--accent); }
.message.pending .bubble::after { content: "|"; margin-left: 2px; animation: blink .8s steps(1) infinite; }

.controls { position: fixed; z-index: 5; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(600px, calc(100% - 28px)); min-height: 76px; display: grid; grid-template-columns: 54px 1fr 60px; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 15px; background: rgba(17,21,17,.96); box-shadow: 0 18px 60px rgba(0,0,0,.45); }
.mute { width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: transparent; cursor: pointer; font-size: 9px; font-weight: 800; }
.mute.is-muted { color: #ffaaa5; border-color: rgba(255,104,95,.35); }
.call { height: 52px; display: flex; align-items: center; justify-content: center; gap: 12px; border-radius: 10px; }
.call:disabled { opacity: .6; cursor: wait; }
.call strong, .call small { display: block; }
.call strong { font-size: 12px; }
.call small { margin-top: 2px; opacity: .68; font-size: 8px; }
.call.is-active { color: var(--text); background: #252b25; }
.call-icon { font-size: 10px; }
#session-timer { color: var(--muted); text-align: center; font: 600 10px ui-monospace, monospace; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 110px; max-width: min(460px, calc(100% - 36px)); padding: 12px 16px; border: 1px solid rgba(255,104,95,.35); border-radius: 9px; color: #ffd3d0; background: rgba(44,15,13,.97); opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: .18s ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@keyframes blink { 50% { opacity: 0; } }
@keyframes message-in { from { opacity: 0; transform: translateY(7px); } }
@media (max-width: 680px) {
  .topbar { padding: 0 16px; }
  #auth-user, #logout-button { display: none; }
  .transcript { padding-left: 17px; padding-right: 17px; }
  .message { max-width: 96%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
