:root {
  --bg: #05060a;
  --cyan: #38f5e6;
  --cyan-dim: #1c8f88;
  --magenta: #ff3df0;
  --amber: #ffb347;
  --ink: #cdeef0;
  --panel: rgba(10, 16, 24, 0.72);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background:
    radial-gradient(1200px 800px at 70% -10%, rgba(56, 245, 230, 0.10), transparent 60%),
    radial-gradient(900px 700px at 10% 110%, rgba(255, 61, 240, 0.08), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: "Rajdhani", system-ui, sans-serif;
  overflow: hidden;
}

/* ---- boot ---- */
#boot {
  position: fixed; inset: 0; display: grid; place-content: center; gap: 22px;
  text-align: center; transition: opacity .6s ease; z-index: 50;
}
#boot.hidden { opacity: 0; pointer-events: none; }

/* ---- login ---- */
#login { position: fixed; inset: 0; display: grid; place-content: center; z-index: 60; background: rgba(2,3,6,.9); backdrop-filter: blur(6px); }
#login.hidden { display: none; }
.login-card { display: flex; flex-direction: column; gap: 14px; width: 320px; padding: 34px 30px; border-radius: 18px;
  background: var(--panel); border: 1px solid rgba(56,245,230,.25); box-shadow: 0 0 40px rgba(56,245,230,.18); }
.login-card h2 { font-family: "Orbitron"; letter-spacing: 8px; color: var(--cyan); text-align: center; text-shadow: 0 0 18px rgba(56,245,230,.5); }
.login-card .sub { color: var(--cyan-dim); letter-spacing: 2px; font-size: 12px; text-align: center; margin-top: -6px; }
.login-card input { background: rgba(0,0,0,.4); border: 1px solid rgba(56,245,230,.25); border-radius: 10px; color: var(--ink); padding: 12px 14px; font-size: 15px; font-family: "Rajdhani"; }
.login-card input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 12px rgba(56,245,230,.3); }
.login-card button { background: var(--cyan); color: #04110f; border: none; border-radius: 10px; padding: 12px; font-family: "Orbitron"; letter-spacing: 3px; cursor: pointer; transition: filter .15s; }
.login-card button:hover { filter: brightness(1.15); }
#login-err { color: var(--magenta); font-size: 13px; text-align: center; min-height: 16px; }
.boot-ring {
  width: 84px; height: 84px; margin: 0 auto; border-radius: 50%;
  border: 2px solid rgba(56, 245, 230, 0.25);
  border-top-color: var(--cyan);
  animation: spin 1.1s linear infinite;
  box-shadow: 0 0 30px rgba(56, 245, 230, 0.4);
}
.boot-text { font-family: "Orbitron", sans-serif; letter-spacing: 6px; color: var(--cyan); }
.boot-text span { display: block; font-family: "Rajdhani"; letter-spacing: 2px; color: var(--cyan-dim); font-size: 14px; margin-top: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- layout ---- */
#app {
  position: fixed; inset: 0; display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 0; transition: opacity .5s ease;
}
#app.hidden { opacity: 0; pointer-events: none; }

#stage { position: relative; overflow: hidden; }
#hestia-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

#state-pill {
  position: absolute; top: 22px; left: 22px;
  font-family: "Orbitron", sans-serif; font-size: 12px; letter-spacing: 3px;
  padding: 6px 14px; border-radius: 999px; text-transform: uppercase;
  border: 1px solid currentColor; backdrop-filter: blur(4px);
}
#state-pill.idle { color: var(--cyan-dim); }
#state-pill.listening { color: var(--magenta); border-color: var(--magenta); animation: pulse 1s ease-in-out infinite; }
#state-pill.speaking { color: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 22px rgba(56,245,230,.45); }
@keyframes pulse { 50% { opacity: .45; } }

#mic {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%);
  width: 74px; height: 74px; border-radius: 50%; cursor: pointer;
  background: radial-gradient(circle at 30% 30%, rgba(56,245,230,.25), rgba(8,14,22,.9));
  border: 2px solid var(--cyan); color: var(--cyan);
  display: grid; place-content: center; transition: transform .15s, box-shadow .2s;
  box-shadow: 0 0 24px rgba(56,245,230,.35);
}
#mic:hover { transform: translateX(-50%) scale(1.06); }
#mic:active, #mic.recording { background: radial-gradient(circle at 30% 30%, rgba(255,61,240,.4), rgba(20,8,20,.95)); border-color: var(--magenta); color: var(--magenta); box-shadow: 0 0 30px rgba(255,61,240,.55); }
#mic .wave { display:none; }

/* ---- panel ---- */
#panel {
  background: var(--panel); backdrop-filter: blur(10px);
  border-left: 1px solid rgba(56, 245, 230, 0.18);
  display: flex; flex-direction: column; padding: 26px 22px;
}
#panel header { margin-bottom: 14px; }
#panel h1 { font-family: "Orbitron", sans-serif; font-size: 30px; letter-spacing: 8px; color: var(--cyan); text-shadow: 0 0 18px rgba(56,245,230,.5); }
#panel .sub { color: var(--cyan-dim); letter-spacing: 2px; font-size: 13px; margin-top: 2px; }

#transcript { flex: 1; overflow-y: auto; padding-right: 8px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; line-height: 1.4; font-size: 16px; }
.msg.user { align-self: flex-end; background: linear-gradient(135deg, rgba(56,245,230,.18), rgba(56,245,230,.06)); border: 1px solid rgba(56,245,230,.3); }
.msg.hestia { align-self: flex-start; background: linear-gradient(135deg, rgba(255,61,240,.14), rgba(255,61,240,.04)); border: 1px solid rgba(255,61,240,.28); }
.msg .who { font-family: "Orbitron"; font-size: 10px; letter-spacing: 2px; opacity: .6; display: block; margin-bottom: 3px; }
.msg.thinking::after { content: "▍"; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

#composer { display: flex; gap: 10px; margin-top: 14px; }
#text-input {
  flex: 1; background: rgba(0,0,0,.35); border: 1px solid rgba(56,245,230,.25);
  border-radius: 10px; color: var(--ink); padding: 12px 14px; font-size: 15px; font-family: "Rajdhani";
}
#text-input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 14px rgba(56,245,230,.3); }
#send {
  width: 50px; border-radius: 10px; cursor: pointer; font-size: 18px; color: #04110f;
  background: var(--cyan); border: none; transition: filter .15s;
}
#send:hover { filter: brightness(1.15); }

#transcript::-webkit-scrollbar { width: 6px; }
#transcript::-webkit-scrollbar-thumb { background: rgba(56,245,230,.3); border-radius: 3px; }

@media (max-width: 820px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  #panel { border-left: none; border-top: 1px solid rgba(56,245,230,.18); }
}
