:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  background: #07111c;
  color: #edf5fb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 50% -10%, rgba(61, 178, 205, .24), transparent 38%),
    linear-gradient(180deg, #081521 0%, #07111c 70%);
}

.auth-gate {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center;
  padding: 24px;
  background: rgba(5, 14, 24, .94);
  backdrop-filter: blur(16px);
}
.auth-gate[hidden] { display: none; }
.auth-panel {
  width: min(100%, 380px); padding: 28px 24px;
  border: 1px solid #294255; border-radius: 24px;
  background: #0b1b29; text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .36);
}
.auth-symbol {
  width: 66px; height: 66px; margin: 0 auto 16px;
  display: grid; place-items: center; border-radius: 21px;
  background: linear-gradient(145deg, #54d1d7, #1d6c9b);
  font-size: 30px; font-weight: 760;
}
.auth-panel h2 { margin: 0; font-size: 24px; }
.auth-panel p { color: #b7c6d2; line-height: 1.5; }
.auth-panel small { display: block; margin-top: 14px; color: #718a9b; line-height: 1.4; }
.primary-action {
  width: 100%; padding: 14px 18px; border: 0; border-radius: 15px;
  background: #dff9f5; color: #08232d; font-weight: 750;
}

button, input { font: inherit; }

.shell {
  width: min(100%, 440px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 18px calc(16px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
  gap: 14px;
}

.topbar { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 15px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #54d1d7, #1d6c9b);
  box-shadow: 0 10px 30px rgba(37, 154, 185, .28);
  font-weight: 750; font-size: 22px;
}
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.connection { margin: 3px 0 0; color: #9db1c2; font-size: 13px; }
.connection[data-mode="ok"] { color: #75d7ad; }
.connection[data-mode="error"] { color: #ff9e9e; }
.icon-button {
  margin-left: auto; width: 42px; height: 42px; border: 1px solid #294053;
  border-radius: 13px; background: #0d1d2b; color: inherit;
}

.security-card {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 12px 14px; border: 1px solid #314052; border-radius: 16px;
  background: rgba(13, 27, 40, .78);
}
.security-card { padding: 9px 12px; }
.security-card p { display: none; }
.security-card strong { font-size: 13px; }
.security-card p { margin: 3px 0 0; color: #aab8c4; font-size: 12px; line-height: 1.4; }
.security-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: none; }
.security-dot.warning { background: #f5b75e; box-shadow: 0 0 12px rgba(245,183,94,.5); }
.security-dot.ok { background: #75d7ad; box-shadow: 0 0 12px rgba(117,215,173,.45); }

.conversation {
  max-height: 34dvh;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
  padding: 6px 0;
  overscroll-behavior: contain;
}
.conversation[hidden], .composer[hidden] { display: none; }

.voice-widget {
  min-height: 410px;
  padding: 22px 18px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 13px;
  border: 1px solid rgba(76, 132, 158, .42);
  border-radius: 30px;
  background:
    radial-gradient(circle at 50% 42%, rgba(61, 190, 201, .16), transparent 42%),
    rgba(11, 27, 41, .82);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
  backdrop-filter: blur(18px);
}
.widget-presence { display: flex; align-items: center; gap: 10px; align-self: flex-start; }
.widget-presence div { display: grid; gap: 2px; }
.widget-presence strong { font-size: 14px; }
.widget-presence span { color: #8ea6b7; font-size: 11px; }
.presence-ring {
  width: 12px; height: 12px; border-radius: 50%;
  background: #75d7ad; box-shadow: 0 0 16px rgba(117, 215, 173, .65);
}
.message {
  max-width: 88%; padding: 12px 14px; border-radius: 18px;
  border: 1px solid #263c4d; background: #0d1c29;
}
.message.user { align-self: flex-end; background: #15394a; border-color: #246379; }
.message.atlas { align-self: flex-start; }
.message .label { color: #77d2d5; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.message.user .label { color: #a4e3ef; }
.message p { margin: 5px 0 0; line-height: 1.5; white-space: pre-wrap; }

.composer { display: grid; justify-items: center; gap: 9px; }
.interim { min-height: 24px; color: #bdd0dc; text-align: center; font-size: 14px; }
.mic-button {
  position: relative; width: 164px; height: 164px; border: 0; border-radius: 50%;
  background: linear-gradient(150deg, #38b8c5, #245b97);
  color: white; display: grid; place-content: center; gap: 5px;
  box-shadow: 0 16px 45px rgba(35, 119, 162, .35);
  font-weight: 650; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.mic-button.listening { background: linear-gradient(150deg, #e07468, #b84062); }
.mic-button:disabled { opacity: .55; }
.mic-icon { font-size: 30px; }
.pulse { position: absolute; inset: -1px; border: 2px solid rgba(98, 225, 226, .5); border-radius: inherit; opacity: 0; }
.mic-button.listening .pulse { animation: pulse 1.4s infinite; }
@keyframes pulse { from { transform: scale(1); opacity: .8; } to { transform: scale(1.28); opacity: 0; } }
.hint { margin: 0; color: #879aaa; font-size: 12px; text-align: center; }

.text-form { width: 100%; display: flex; gap: 8px; margin-top: 5px; }
.text-form input {
  min-width: 0; flex: 1; padding: 12px 14px; border: 1px solid #2a4153;
  border-radius: 14px; background: #0b1925; color: inherit; outline: none;
}
.text-form input:focus { border-color: #3fa6bd; box-shadow: 0 0 0 3px rgba(63,166,189,.12); }
.text-form button {
  padding: 0 16px; border: 0; border-radius: 14px; background: #dff9f5; color: #08232d; font-weight: 700;
}

footer { color: #617888; font-size: 10px; text-align: center; line-height: 1.4; }

@media (max-height: 690px) {
  .voice-widget { min-height: 320px; padding: 14px; }
  .mic-button { width: 124px; height: 124px; }
  .security-card { padding: 9px 11px; }
}
