:root {
  color-scheme: dark;
  --bg: #0a0d10;
  --panel: rgba(20, 25, 31, 0.92);
  --panel-soft: #171c22;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f5f7f8;
  --muted: #9aa6b2;
  --accent: #66e3c4;
  --accent-dark: #183b34;
  --danger: #ff7777;
  --success: #86edb6;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(102, 227, 196, 0.11), transparent 30rem),
    radial-gradient(circle at 90% 86%, rgba(91, 119, 255, 0.10), transparent 34rem),
    var(--bg);
}

button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.auth-page {
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
}

.auth-card {
  width: min(100%, 460px);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-card.wide { width: min(100%, 680px); }

.auth-brand, .settings-heading, .app-header {
  display: flex;
  align-items: center;
}

.auth-brand { gap: 14px; margin-bottom: 34px; }
.auth-brand h1, .settings-heading h1 { margin: 0; font-size: 28px; }
.auth-brand p { margin: 3px 0 0; color: var(--muted); }
.auth-card h2 { margin: 0 0 8px; font-size: 21px; }

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: #07110e;
  background: linear-gradient(145deg, #b4ffe9, var(--accent));
  box-shadow: 0 8px 28px rgba(102, 227, 196, 0.24);
  font-weight: 900;
}

.brand-mark.large { width: 54px; height: 54px; border-radius: 17px; font-size: 23px; }
.muted { color: var(--muted); line-height: 1.5; }
.eyebrow { margin: 0 0 5px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

.auth-form { display: grid; gap: 11px; margin-top: 24px; }
.auth-form label { color: #dce3e8; font-size: 14px; font-weight: 650; }

.auth-form input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  color: var(--text);
  background: #0e1216;
}

.auth-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(102, 227, 196, .12); }

.primary-button, .secondary-button, .danger-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 0;
  border-radius: 12px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 750;
}

.primary-button { margin-top: 9px; color: #07110e; background: var(--accent); }
.secondary-button { color: var(--text); background: var(--panel-soft); border: 1px solid var(--line); }
.danger-button { color: #ffd4d4; background: rgba(255, 119, 119, .12); border: 1px solid rgba(255, 119, 119, .2); }

.alert { margin: 18px 0; padding: 13px 14px; border-radius: 12px; line-height: 1.45; }
.alert.error { color: #ffd1d1; background: rgba(255, 119, 119, .1); border: 1px solid rgba(255, 119, 119, .2); }
.alert.success { color: #d7ffe8; background: rgba(134, 237, 182, .09); border: 1px solid rgba(134, 237, 182, .18); }

.settings-heading { justify-content: space-between; gap: 20px; }
.settings-section { margin: 28px 0; padding: 22px 0; border-top: 1px solid var(--line); }
.settings-section h2 { margin: 0 0 6px; }
.secret-box { overflow: auto; margin: 16px 0; padding: 13px; border-radius: 10px; background: #0c1014; border: 1px solid var(--line); }
.secret-box code { color: var(--accent); }

.app-page { height: 100dvh; overflow: hidden; }
.shell { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto auto; width: min(100%, 900px); height: 100dvh; margin: auto; background: rgba(10, 13, 16, .68); }

.app-header {
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 18px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 13, 16, .88);
  backdrop-filter: blur(18px);
}

.brand-copy { display: grid; flex: 1; }
.brand-copy strong { font-size: 17px; }
.brand-copy span { color: var(--muted); font-size: 12px; }
.status { padding: 6px 9px; border-radius: 999px; font-size: 11px; font-weight: 750; }
.status.online { color: var(--success); background: rgba(134, 237, 182, .1); }
.status.offline { color: #ffd78b; background: rgba(255, 215, 139, .1); }
.icon-link { padding: 8px; color: var(--muted); text-decoration: none; font-size: 20px; }

.messages { overflow-y: auto; padding: 24px 18px 10px; scroll-behavior: smooth; }
.message { display: flex; align-items: flex-end; gap: 9px; margin: 0 0 16px; }
.message.user { justify-content: flex-end; }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; color: #07110e; background: var(--accent); font-size: 12px; font-weight: 900; }
.bubble { max-width: min(78%, 640px); padding: 12px 14px; border: 1px solid var(--line); border-radius: 17px 17px 17px 5px; background: var(--panel-soft); line-height: 1.5; white-space: normal; }
.message.user .bubble { color: #07110e; background: var(--accent); border-color: transparent; border-radius: 17px 17px 5px 17px; }

.quick-actions { display: flex; gap: 8px; overflow-x: auto; padding: 8px 18px 10px; }
.quick-actions button { flex: 0 0 auto; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: #dce3e8; background: var(--panel-soft); cursor: pointer; }

.composer { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: end; gap: 9px; margin: 0 12px; padding: 8px; border: 1px solid var(--line); border-radius: 19px; background: var(--panel); }
.composer textarea { resize: none; max-height: 132px; min-height: 42px; padding: 10px 4px; border: 0; outline: 0; color: var(--text); background: transparent; line-height: 1.4; }
.composer textarea::placeholder { color: #74808b; }
.record-button, .send-button { width: 42px; height: 42px; border: 0; border-radius: 13px; cursor: pointer; }
.record-button { color: #ff8888; background: rgba(255, 119, 119, .1); }
.record-button.recording { color: white; background: #e24b4b; animation: pulse 1.2s infinite; }
.send-button { color: #07110e; background: var(--accent); font-size: 22px; font-weight: 900; }
.record-button:disabled, .send-button:disabled { opacity: .45; cursor: wait; }
.composer-status { min-height: 28px; margin: 0; padding: 6px 18px max(6px, env(safe-area-inset-bottom)); color: var(--muted); font-size: 12px; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@keyframes pulse { 50% { transform: scale(.92); box-shadow: 0 0 0 8px rgba(226, 75, 75, .12); } }

@media (min-width: 740px) {
  .shell { height: calc(100dvh - 32px); margin-top: 16px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 24px; overflow: hidden; box-shadow: var(--shadow); }
  .composer { margin-inline: 18px; }
}

