:root {
  --bg: #0b1020;
  --bg2: #121a33;
  --fg: #eaf0ff;
  --muted: #9fb0d0;
  --accent: #4f9dff;
  --accent2: #7cd4ff;
  --danger: #ff5c7a;
  --radius: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(1200px 800px at 50% -10%, #1b274d 0%, var(--bg) 60%);
  color: var(--fg);
  font-family: "Segoe UI", "Noto Sans Bengali", system-ui, sans-serif;
  overflow: hidden;
  user-select: none;
}

/* ---------- screens ---------- */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.screen.active { display: flex; }

.card {
  width: 100%;
  max-width: 380px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  backdrop-filter: blur(8px);
}

h1 { font-size: 34px; margin: 10px 0 6px; letter-spacing: 1px; }
h2 { font-size: 24px; margin: 0 0 22px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.perm-note { font-size: 14px; margin: 18px 0; line-height: 1.6; }

/* ---------- buttons ---------- */
.btn {
  border: none;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 16px;
  font-family: inherit;
  color: var(--fg);
  background: rgba(255,255,255,0.08);
  cursor: pointer;
  transition: transform .08s ease, background .2s;
}
.btn:active { transform: scale(0.96); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #06122a; font-weight: 600; width: 100%; margin-top: 18px; }
.btn.ghost { background: transparent; border: 1px solid rgba(255,255,255,0.15); }
.btn.danger { background: rgba(255,92,122,0.15); color: var(--danger); border: 1px solid rgba(255,92,122,0.3); }
.btn.small { padding: 8px 14px; font-size: 14px; }
.btn.choice { flex: 1; }

.choice-row { display: flex; gap: 10px; }

input[type=text], input[type=number] {
  width: 100%;
  padding: 14px 16px;
  font-size: 18px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.25);
  color: var(--fg);
  font-family: inherit;
  text-align: center;
}
input:focus { outline: none; border-color: var(--accent); }

.hidden { display: none !important; }

/* ---------- logo face (welcome) ---------- */
.logo-face {
  width: 90px; height: 90px; margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, var(--accent2), var(--accent));
  display: flex; align-items: center; justify-content: center; gap: 14px;
  animation: float 3s ease-in-out infinite;
}
.logo-face .dot { width: 12px; height: 16px; border-radius: 50%; background: #06122a; animation: blink 4s infinite; }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
@keyframes blink { 0%,92%,100%{transform:scaleY(1)} 95%{transform:scaleY(0.1)} }

/* ---------- main face ---------- */
#cam {
  position: fixed; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; transition: opacity .6s;
  transform: scaleX(-1); /* mirror */
}
#cam.on { opacity: 0.28; }
.cam-overlay { position: fixed; inset: 0; background: radial-gradient(900px 600px at 50% 30%, transparent, var(--bg) 85%); pointer-events: none; }

.face-wrap {
  position: relative;
  text-align: center;
  z-index: 2;
  margin-bottom: 90px;
}

#face { width: 190px; height: 190px; filter: drop-shadow(0 10px 40px rgba(79,157,255,0.5)); }
#face .head { transition: transform .3s; }
#face.speaking .head { animation: pulse 0.6s ease-in-out infinite; }
#face.listening .head { animation: listen 1.2s ease-in-out infinite; }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.03)} }
@keyframes listen { 0%,100%{transform:scale(1); filter:none} 50%{transform:scale(1.05)} }

.eye { fill: #06122a; }
.pupil { fill: #0b1020; }
.eyes { animation: eyeblink 5s infinite; transform-origin: center; }
@keyframes eyeblink { 0%,94%,100%{transform:scaleY(1)} 97%{transform:scaleY(0.08)} }

#mouth { fill: #06122a; transform-origin: 100px 134px; transition: transform .05s; }

.status-line { color: var(--accent2); font-size: 14px; margin: 18px 0 4px; min-height: 18px; }
.caption { color: var(--fg); font-size: 18px; line-height: 1.5; max-width: 320px; margin: 0 auto; min-height: 26px; }

/* ---------- controls ---------- */
.controls {
  position: fixed; bottom: 22px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 14px; z-index: 3;
}
.btn.round {
  width: 58px; height: 58px; border-radius: 50%;
  font-size: 24px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.12);
}
.btn.round.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); }
#btn-mic.recording { background: var(--danger); animation: rec 1s infinite; }
@keyframes rec { 0%,100%{box-shadow:0 0 0 0 rgba(255,92,122,0.6)} 50%{box-shadow:0 0 0 12px rgba(255,92,122,0)} }

/* ---------- text drawer ---------- */
.text-drawer {
  position: fixed; bottom: 92px; left: 16px; right: 16px; z-index: 4;
  display: flex; gap: 8px;
  background: var(--bg2); padding: 10px; border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.1);
}
.text-drawer input { text-align: left; }
.text-drawer .btn.primary { width: auto; margin: 0; white-space: nowrap; }

/* ---------- brain panel ---------- */
.brain-panel {
  position: fixed; inset: 16px; z-index: 5;
  background: var(--bg2); border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 18px; overflow-y: auto;
}
.brain-head { display: flex; justify-content: space-between; align-items: center; }
.brain-head h3 { margin: 0; }
#brain-list { list-style: none; padding: 0; margin: 16px 0; }
#brain-list li {
  background: rgba(255,255,255,0.05); padding: 12px 14px; border-radius: 10px;
  margin-bottom: 8px; font-size: 15px; line-height: 1.4;
}
#brain-list li .k { color: var(--accent2); font-weight: 600; }
#brain-list .empty { color: var(--muted); text-align: center; }
