:root {
  color-scheme: dark;
  --bg: #050607;
  --panel: rgba(11, 13, 15, 0.88);
  --line: rgba(255,255,255,0.11);
  --muted: #8b9299;
  --text: #f1f2f2;
  --accent: #b72525;
  --accent2: #e7d8bc;
}

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

#app-shell {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.55fr);
  background: radial-gradient(circle at 35% 35%, #18191b 0%, #08090a 44%, #030404 100%);
}

#stage { position: relative; min-width: 0; overflow: hidden; border-right: 1px solid var(--line); }
#skull-canvas { display: block; width: 100%; height: 100%; }
.vignette { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 180px 50px rgba(0,0,0,.9); }

.topbar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: flex-start; justify-content: space-between; padding: 28px 30px; pointer-events: none; }
.eyebrow { color: var(--muted); font-size: 10px; letter-spacing: .25em; }
h1 { margin: 5px 0 0; font-size: 20px; letter-spacing: .18em; font-weight: 650; }
.status { display: flex; align-items: center; gap: 8px; font-size: 10px; letter-spacing: .16em; color: var(--muted); }
.status span { width: 7px; height: 7px; border-radius: 50%; background: #4b5156; box-shadow: 0 0 0 transparent; }
.status.thinking span { background: #d69e45; box-shadow: 0 0 16px #d69e45; animation: pulse .8s infinite alternate; }
.status.speaking span { background: #b72525; box-shadow: 0 0 18px #b72525; animation: pulse .3s infinite alternate; }
.status.ready span { background: #6d8372; box-shadow: 0 0 12px rgba(109,131,114,.7); }
@keyframes pulse { to { transform: scale(1.65); opacity: .7; } }

.model-note, .hint { position: absolute; left: 30px; color: var(--muted); font-size: 11px; letter-spacing: .05em; }
.model-note { bottom: 54px; }
.hint { bottom: 30px; opacity: .65; }

#console { min-width: 0; height: 100vh; display: grid; grid-template-rows: 1fr auto auto; background: linear-gradient(180deg, rgba(10,12,14,.94), rgba(4,5,6,.98)); }
.messages { min-height: 0; overflow-y: auto; padding: 30px 26px 18px; scrollbar-width: thin; scrollbar-color: #292c30 transparent; }
.message { margin: 0 0 22px; }
.role { font-size: 9px; letter-spacing: .18em; color: var(--muted); margin-bottom: 7px; }
.message.user .role { color: #8b9299; }
.message.assistant .role { color: #be9d73; }
.bubble { color: #dadcdf; font-size: 14px; line-height: 1.55; white-space: pre-wrap; word-wrap: break-word; }
.message.user .bubble { color: #f3f3f3; }
.message.error .bubble { color: #e09797; }

.composer { margin: 0 20px 12px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.035); display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 10px; transition: border-color .2s ease, background .2s ease; }
.composer:focus-within { border-color: rgba(231,216,188,.32); background: rgba(255,255,255,.05); }
textarea { width: 100%; resize: none; min-height: 54px; max-height: 150px; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; line-height: 1.4; padding: 8px 7px; }
textarea::placeholder { color: #62686e; }
button { align-self: end; height: 38px; min-width: 72px; border: 1px solid rgba(231,216,188,.26); border-radius: 9px; background: #17191c; color: #e7d8bc; font-size: 10px; font-weight: 700; letter-spacing: .14em; cursor: pointer; transition: transform .15s, background .15s; }
button:hover { background: #202328; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: not-allowed; }
.footer-note { padding: 0 24px 18px; font-size: 10px; color: #60666c; }

@media (max-width: 900px) {
  body { overflow: auto; }
  #app-shell { height: auto; min-height: 100vh; grid-template-columns: 1fr; grid-template-rows: 58vh minmax(42vh, auto); }
  #stage { border-right: 0; border-bottom: 1px solid var(--line); }
  #console { height: 42vh; min-height: 420px; }
}
