:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #071018;
  --panel: rgba(12, 24, 34, 0.86);
  --panel-border: rgba(148, 177, 198, 0.16);
  --text: #f2f7fa;
  --muted: #95a9b8;
  --cyan: #54e2d0;
  --blue: #5b8cff;
  --danger: #ff8b91;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 10%, rgba(40, 115, 136, .22), transparent 30%),
    radial-gradient(circle at 90% 90%, rgba(73, 75, 165, .20), transparent 32%),
    var(--bg);
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }

.ambient { position: fixed; border-radius: 999px; filter: blur(90px); opacity: .28; pointer-events: none; }
.ambient-one { width: 320px; height: 320px; background: #17b9a6; top: -180px; right: 5%; }
.ambient-two { width: 280px; height: 280px; background: #604bd3; bottom: -160px; left: 4%; }
.shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.panel {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .38);
  backdrop-filter: blur(18px);
}
.hidden { display: none !important; }

.auth-card { width: min(440px, 100%); padding: 42px; border-radius: 24px; }
.brand-mark {
  display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 26px;
  border-radius: 15px; color: #07201e; background: linear-gradient(135deg, var(--cyan), #8ff0c7);
  font-size: 24px; box-shadow: 0 12px 36px rgba(84, 226, 208, .25);
}
.eyebrow { margin: 0 0 8px; color: var(--cyan); font-size: 11px; font-weight: 750; letter-spacing: .18em; }
h1 { margin: 0; font-size: clamp(28px, 5vw, 38px); letter-spacing: -.035em; }
.muted { margin: 14px 0 30px; color: var(--muted); line-height: 1.65; }
label { display: block; margin: 18px 0 8px; color: #c6d2da; font-size: 13px; font-weight: 650; }
input, textarea {
  width: 100%; color: var(--text); border: 1px solid rgba(158, 184, 202, .2); outline: none;
  background: rgba(4, 12, 18, .64); transition: border-color .2s, box-shadow .2s;
}
input { padding: 14px 15px; border-radius: 11px; }
input:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(84, 226, 208, .11); }
.primary, .secondary { border-radius: 11px; border: 0; font-weight: 700; }
.primary { width: 100%; margin-top: 24px; padding: 14px; color: #06201d; background: linear-gradient(135deg, var(--cyan), #93edca); }
.secondary { padding: 9px 13px; color: #dce7ed; border: 1px solid rgba(158, 184, 202, .2); background: rgba(255, 255, 255, .04); }
.error { min-height: 20px; margin: 13px 0 0; color: var(--danger); font-size: 13px; }

.chat-panel { display: flex; flex-direction: column; width: min(1040px, 100%); height: min(780px, calc(100vh - 48px)); border-radius: 24px; overflow: hidden; }
.chat-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 25px 30px; border-bottom: 1px solid var(--panel-border); }
.chat-header h1 { font-size: 24px; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.status { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.messages { flex: 1; overflow-y: auto; padding: 30px max(24px, 8%); scroll-behavior: smooth; }
.message { display: flex; gap: 12px; margin-bottom: 24px; animation: rise .28s ease both; }
.message.user { flex-direction: row-reverse; }
.avatar { display: grid; place-items: center; flex: 0 0 34px; height: 34px; border-radius: 10px; color: #06201d; background: var(--cyan); font-size: 11px; font-weight: 800; }
.user .avatar { color: #edf1ff; background: #536ccc; }
.bubble { max-width: min(680px, 78%); padding: 14px 17px; border-radius: 5px 16px 16px; background: rgba(255, 255, 255, .065); line-height: 1.6; }
.user .bubble { border-radius: 16px 5px 16px 16px; background: rgba(83, 108, 204, .24); }
.bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble strong { display: block; margin-bottom: 4px; color: var(--cyan); font-size: 12px; }
.bubble small { display: block; margin-top: 10px; color: var(--muted); font-size: 10px; }
.pending .bubble { color: var(--muted); }
.composer { display: flex; align-items: flex-end; gap: 12px; margin: 0 max(24px, 8%); padding: 13px; border: 1px solid var(--panel-border); border-radius: 17px; background: rgba(4, 12, 18, .68); }
textarea { min-height: 25px; max-height: 180px; resize: none; padding: 5px; border: 0; background: transparent; line-height: 1.5; }
textarea:focus { box-shadow: none; }
.send { flex: 0 0 40px; height: 40px; border: 0; border-radius: 12px; color: #06201d; background: var(--cyan); font-size: 21px; }
.disclaimer { margin: 11px 0 17px; color: #657986; text-align: center; font-size: 10px; }
.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 rise { from { opacity: 0; transform: translateY(7px); } }

@media (max-width: 640px) {
  .shell { padding: 0; }
  .auth-card { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; border: 0; border-radius: 0; }
  .chat-panel { height: 100vh; border: 0; border-radius: 0; }
  .chat-header { padding: 18px; }
  .status { display: none; }
  .messages { padding: 22px 16px; }
  .composer { margin: 0 14px; }
  .bubble { max-width: 85%; }
}
