:root {
  --bg: #1a1220;
  --surface: #251a2e;
  --surface-2: #31243c;
  --text: #f5ecf7;
  --muted: #b9a8c2;
  --accent: #ff7aa8;
  --accent-2: #ffb36b;
  --me: #3a2a48;
  --error: #ff8a8a;
  --radius: 18px;
  font-family: "Hind Siliguri", system-ui, sans-serif;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fff8fb;
    --surface: #ffffff;
    --surface-2: #f6e9f0;
    --text: #2a1a30;
    --muted: #7d6a86;
    --me: #f3e2ee;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 17px; }
[hidden] { display: none !important; }

.screen { height: 100dvh; display: flex; flex-direction: column; }

/* login */
#login { align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 340px; text-align: center; }
.login-card h1 { margin: 16px 0 4px; font-size: 32px; }
.login-card p { color: var(--muted); margin: 0 0 24px; }
.login-card form { display: grid; gap: 12px; }
.error { color: var(--error); margin: 0; }

input, select, button { font: inherit; color: inherit; }
input, select {
  width: 100%; padding: 12px 16px; border-radius: 999px;
  border: 1px solid var(--surface-2); background: var(--surface); outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
button {
  padding: 12px 18px; border-radius: 999px; border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #2a1020; font-weight: 600;
}
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--surface-2); }

/* header */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
}
.who { display: flex; align-items: center; gap: 10px; }
#name { font-size: 22px; font-weight: 600; }
.pill { font-size: 13px; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.pill.on { color: #7ee2a8; }
.icon-btn { background: var(--surface); color: var(--text); width: 42px; height: 42px; padding: 0; font-size: 22px; }

.sheet {
  margin: 0 16px 8px; padding: 16px; border-radius: var(--radius);
  background: var(--surface); display: grid; gap: 12px;
}
.sheet label { display: grid; gap: 6px; color: var(--muted); font-size: 15px; }

/* conversation */
main { flex: 1; overflow-y: auto; padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: var(--radius); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.assistant { background: var(--surface); align-self: flex-start; border-bottom-left-radius: 6px; }
.msg.user { background: var(--me); align-self: flex-end; border-bottom-right-radius: 6px; }
.msg .meta { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.empty { margin: auto; text-align: center; color: var(--muted); }

/* controls */
footer { padding: 8px 16px calc(env(safe-area-inset-bottom) + 16px); }
.status { min-height: 22px; text-align: center; color: var(--muted); font-size: 15px; margin-bottom: 6px; }
.controls { display: flex; align-items: center; gap: 12px; }
#text-form { flex: 1; }

.mic { width: 68px; height: 68px; padding: 0; flex: none; background: transparent; display: grid; place-items: center; }
.orb {
  display: block; width: 60px; height: 60px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd6e6, var(--accent) 45%, #b84a8a 100%);
  box-shadow: 0 6px 24px rgba(255, 122, 168, .35);
  transition: transform .2s ease;
}
.orb.small { width: 72px; height: 72px; margin: 0 auto; }
.mic.listening .orb { animation: pulse 1s ease-in-out infinite; }
.mic.thinking .orb { animation: spin 1.4s linear infinite; background: conic-gradient(var(--accent), var(--accent-2), var(--accent)); }
.mic.speaking .orb { animation: pulse .6s ease-in-out infinite; }

@keyframes pulse { 50% { transform: scale(1.12); } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .orb { animation: none !important; } }
