:root {
  color-scheme: dark;
  --bg-1: #020912;
  --bg-2: #071523;
  --bg-3: #0a2034;
  --bg-4: #102d45;
  --panel: rgba(8, 16, 28, 0.78);
  --panel-strong: rgba(7, 14, 24, 0.9);
  --panel-soft: rgba(255, 255, 255, 0.05);
  --panel-glow: rgba(38, 211, 200, 0.1);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f4f9ff;
  --muted: #9aacbe;
  --muted-2: #6d829b;
  --accent: #27d9cb;
  --accent-2: #ffb44d;
  --accent-3: #7caeff;
  --danger: #ff6d82;
  --shadow: 0 40px 110px rgba(0, 0, 0, 0.42);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  padding: 18px;
  overflow: hidden;
  font-family: "Bahnschrift", "Segoe UI Variable Display", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 12%, rgba(38, 217, 203, 0.14), transparent 24%),
    radial-gradient(circle at 88% 12%, rgba(255, 180, 77, 0.14), transparent 24%),
    radial-gradient(circle at 60% 100%, rgba(124, 174, 255, 0.13), transparent 30%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2) 35%, var(--bg-3) 70%, var(--bg-4));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at center, black, transparent 84%);
  opacity: 0.9;
  pointer-events: none;
}

.backdrop {
  position: fixed;
  border-radius: 999px;
  filter: blur(12px);
  pointer-events: none;
  opacity: 0.72;
}

.backdrop-a {
  width: 420px;
  height: 420px;
  left: -110px;
  top: 10%;
  background: radial-gradient(circle, rgba(38, 217, 203, 0.24), transparent 66%);
  animation: drift-a 18s ease-in-out infinite alternate;
}

.backdrop-b {
  width: 300px;
  height: 300px;
  right: 4%;
  top: 6%;
  background: radial-gradient(circle, rgba(255, 180, 77, 0.2), transparent 70%);
  animation: drift-b 24s ease-in-out infinite alternate;
}

.backdrop-c {
  width: 520px;
  height: 520px;
  right: 8%;
  bottom: -180px;
  background: radial-gradient(circle, rgba(124, 174, 255, 0.16), transparent 68%);
  animation: drift-c 20s ease-in-out infinite alternate;
}

.backdrop-d {
  width: 240px;
  height: 240px;
  left: 48%;
  top: 42%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.07), transparent 74%);
  animation: drift-d 22s ease-in-out infinite alternate;
}

.screen {
  position: relative;
  z-index: 2;
  width: min(1520px, calc(100vw - 36px));
  margin: 0 auto;
}

.auth-screen,
.app-shell {
  min-height: calc(100vh - 36px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-screen {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  overflow: hidden;
  border-radius: 34px;
  background: linear-gradient(145deg, rgba(6, 14, 24, 0.9), rgba(11, 23, 38, 0.82));
}

.auth-hero,
.auth-card,
.sidebar,
.main-panel,
.settings-panel {
  position: relative;
}

.auth-hero {
  padding: 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  background:
    radial-gradient(circle at 24% 14%, rgba(38, 217, 203, 0.1), transparent 24%),
    radial-gradient(circle at 78% 18%, rgba(255, 180, 77, 0.08), transparent 18%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 62%);
}

.hero-shell h1 {
  margin: 0;
  max-width: 10ch;
  font-size: clamp(3rem, 5vw, 5.4rem);
  line-height: 0.92;
  letter-spacing: -0.07em;
}

.eyebrow,
.settings-kicker,
.showcase-kicker {
  margin: 0 0 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.74rem;
}

.hero-copy {
  max-width: 60ch;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.8;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-row-hero {
  margin-bottom: 18px;
}

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(38, 217, 203, 0.96), rgba(124, 174, 255, 0.94));
  color: #041019;
  font-size: 1.5rem;
  font-weight: 900;
  box-shadow: 0 18px 38px rgba(38, 217, 203, 0.26);
}

.brand-mark-small {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  font-size: 1.16rem;
}

.brand-name {
  display: block;
  font-size: 1.08rem;
  font-weight: 800;
}

.brand-tag {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.84rem;
}

.hero-stage {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.showcase-card {
  min-height: 186px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.03));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.showcase-card strong {
  display: block;
  margin-bottom: 10px;
  font-size: 1rem;
}

.showcase-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.92rem;
}

.showcase-primary {
  background:
    radial-gradient(circle at top right, rgba(38, 217, 203, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
}

.showcase-secondary {
  background:
    radial-gradient(circle at top right, rgba(255, 180, 77, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
}

.showcase-tertiary {
  background:
    radial-gradient(circle at top right, rgba(124, 174, 255, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
}

.hero-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.metric {
  min-width: 140px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
}

.metric span {
  display: block;
  font-size: 1.44rem;
  font-weight: 900;
  letter-spacing: -0.05em;
}

.metric small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.auth-card {
  padding: 38px;
  background:
    radial-gradient(circle at top left, rgba(124, 174, 255, 0.08), transparent 24%),
    rgba(7, 14, 24, 0.88);
  border-left: 1px solid var(--line);
}

.auth-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.auth-tab,
.ghost-btn,
.primary-btn {
  border: 0;
  outline: none;
  font: inherit;
}

.auth-tab {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.auth-tab.active {
  background: linear-gradient(135deg, rgba(38, 217, 203, 0.94), rgba(124, 174, 255, 0.9));
  color: #041019;
  box-shadow: 0 16px 34px rgba(38, 217, 203, 0.2);
}

.auth-tab:hover,
.ghost-btn:hover,
.primary-btn:hover,
.chat-item:hover,
.search-result:hover,
.settings-friend-row:hover {
  transform: translateY(-1px);
}

.auth-form,
.settings-card {
  display: grid;
  gap: 16px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.field input,
.search-row input,
.composer textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  outline: none;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.field input {
  padding: 15px 16px;
  font-size: 0.98rem;
}

.search-row input,
.composer textarea {
  padding: 15px 16px;
  font-size: 0.96rem;
}

.field input:focus,
.search-row input:focus,
.composer textarea:focus {
  border-color: rgba(38, 217, 203, 0.44);
  background: rgba(255, 255, 255, 0.065);
  box-shadow: 0 0 0 4px rgba(38, 217, 203, 0.11);
}

.form-hint {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 0.92rem;
}

.auth-submit {
  width: 100%;
}

.primary-btn {
  padding: 14px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(38, 217, 203, 0.96), rgba(124, 174, 255, 0.92));
  color: #041019;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 18px 32px rgba(38, 217, 203, 0.18);
}

.ghost-btn {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
}

.ghost-btn-danger {
  color: #ffd5de;
  background: rgba(255, 109, 130, 0.08);
}

.screen.hidden,
.hidden {
  display: none !important;
}

.field-register-only,
body[data-mode="login"] .field-register-only {
  display: none;
}

body[data-mode="register"] .field-register-only {
  display: block;
}

body[data-mode="register"] .auth-submit {
  background: linear-gradient(135deg, rgba(255, 180, 77, 0.96), rgba(38, 217, 203, 0.9));
}

.app-shell {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  overflow: hidden;
  border-radius: 34px;
  background: linear-gradient(180deg, rgba(7, 14, 24, 0.88), rgba(10, 21, 35, 0.94));
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(circle at top left, rgba(38, 217, 203, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 44%);
}

.sidebar-top,
.toolbar-actions,
.chat-actions,
.chat-list-header,
.chat-item-top,
.message-meta {
  display: flex;
  align-items: center;
}

.sidebar-top {
  justify-content: space-between;
  gap: 16px;
}

.toolbar-actions {
  gap: 10px;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03)),
    radial-gradient(circle at top right, rgba(38, 217, 203, 0.1), transparent 28%);
}

.profile-card-hero {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.profile-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.profile-copy strong {
  font-size: 1rem;
}

.profile-username,
.profile-status {
  color: var(--muted);
  font-size: 0.88rem;
}

.sidebar-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.stat-card strong {
  display: block;
  font-size: 1.12rem;
  font-weight: 900;
}

.stat-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.search-panel {
  display: grid;
  gap: 12px;
}

.search-panel label {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.search-results,
.chat-list,
.message-stream,
.settings-friends-list {
  overflow: auto;
  scrollbar-color: rgba(255, 255, 255, 0.14) rgba(255, 255, 255, 0.04);
}

.search-results {
  display: grid;
  gap: 10px;
  max-height: 220px;
}

.search-result,
.chat-item,
.settings-friend-row {
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  text-align: left;
  cursor: pointer;
}

.result-copy,
.chat-item-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.result-copy strong,
.chat-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-copy small,
.chat-item p,
.chat-item small,
.chat-title-copy p,
.empty-card p,
.card-head p {
  color: var(--muted);
}

.chat-list-header {
  justify-content: space-between;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  padding-top: 4px;
}

.chat-list {
  display: grid;
  gap: 10px;
  min-height: 0;
  padding-right: 2px;
}

.chat-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  text-align: left;
}

.chat-item:hover,
.search-result:hover,
.settings-friend-row:hover {
  border-color: rgba(38, 217, 203, 0.24);
  background: rgba(255, 255, 255, 0.055);
}

.chat-item.active {
  border-color: rgba(38, 217, 203, 0.42);
  background:
    radial-gradient(circle at top right, rgba(38, 217, 203, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.035));
  box-shadow: inset 0 0 0 1px rgba(38, 217, 203, 0.06);
}

.chat-item-top {
  justify-content: space-between;
  gap: 12px;
}

.chat-item p {
  margin: 0;
  font-size: 0.89rem;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-item small {
  font-size: 0.78rem;
}

.pill,
.badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.pill-accent {
  color: var(--accent);
  background: rgba(38, 217, 203, 0.1);
}

.badge {
  color: #ffe2ae;
  background: rgba(255, 180, 77, 0.16);
}

.avatar {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 18px;
  color: #041019;
  font-weight: 900;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, hsl(var(--hue, 180) 88% 62%), hsl(calc(var(--hue, 180) + 28) 82% 49%));
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.24);
}

.avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent 50%);
  pointer-events: none;
}

.avatar-xl {
  width: 54px;
  height: 54px;
  font-size: 1.2rem;
}

.avatar-lg {
  width: 62px;
  height: 62px;
  font-size: 1.34rem;
}

.avatar-sm {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  font-size: 1rem;
}

.main-panel {
  display: grid;
  min-width: 0;
  background:
    radial-gradient(circle at top right, rgba(255, 180, 77, 0.07), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 34%);
}

.empty-state,
.chat-panel {
  min-width: 0;
  min-height: 0;
}

.empty-state {
  display: grid;
  place-items: center;
  padding: 32px;
}

.empty-card {
  width: min(560px, 100%);
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    radial-gradient(circle at top right, rgba(38, 217, 203, 0.08), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  text-align: center;
}

.empty-logo {
  width: 82px;
  height: 82px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(38, 217, 203, 0.96), rgba(255, 180, 77, 0.92));
  color: #041019;
  font-size: 2rem;
  font-weight: 900;
  box-shadow: 0 20px 44px rgba(38, 217, 203, 0.18);
}

.empty-card h2 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 4vw, 2.8rem);
  letter-spacing: -0.05em;
}

.empty-card p {
  margin: 0 0 18px;
  line-height: 1.75;
}

.empty-chat-hint {
  padding: 14px 16px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.chat-title-copy {
  min-width: 0;
}

.chat-title-copy h2 {
  margin: 0;
  font-size: 1.34rem;
  letter-spacing: -0.03em;
}

.chat-title-copy p {
  margin: 4px 0 0;
  font-size: 0.9rem;
}

.chat-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.chat-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.chat-stage-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(38, 217, 203, 0.06), transparent 22%),
    radial-gradient(circle at 80% 0%, rgba(255, 180, 77, 0.05), transparent 18%);
  pointer-events: none;
}

.message-stream {
  position: relative;
  z-index: 1;
  height: 100%;
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.date-separator {
  align-self: center;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.message-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  max-width: 100%;
  animation: rise 180ms ease;
}

.message-row.mine {
  justify-content: flex-end;
}

.message-bubble {
  max-width: min(720px, 82%);
  padding: 14px 16px 13px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-row.mine .message-bubble {
  background: linear-gradient(135deg, rgba(38, 217, 203, 0.96), rgba(124, 174, 255, 0.92));
  color: #041019;
}

.message-meta {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.8rem;
  opacity: 0.84;
}

.message-meta strong {
  font-weight: 800;
}

.composer {
  display: flex;
  gap: 12px;
  padding: 18px 22px 22px;
  border-top: 1px solid var(--line);
  background: rgba(7, 14, 24, 0.88);
}

.composer textarea {
  min-height: 58px;
  max-height: 180px;
  resize: none;
  line-height: 1.55;
}

.send-btn {
  align-self: flex-end;
  min-width: 126px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 14, 0.6);
  backdrop-filter: blur(10px);
}

.settings-panel {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    radial-gradient(circle at top right, rgba(38, 217, 203, 0.08), transparent 24%),
    radial-gradient(circle at top left, rgba(255, 180, 77, 0.08), transparent 18%),
    rgba(8, 16, 28, 0.96);
  box-shadow: var(--shadow);
}

.settings-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.settings-header h2,
.card-head h3 {
  margin: 0;
  letter-spacing: -0.04em;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.settings-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.04);
}

.settings-card-wide {
  grid-column: 1 / -1;
}

.card-head p {
  margin: 8px 0 0;
  line-height: 1.6;
  font-size: 0.9rem;
}

.settings-friends-list {
  display: grid;
  gap: 10px;
  max-height: 320px;
  margin-top: 6px;
}

.settings-friend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.settings-friend-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.settings-friend-copy strong,
.settings-friend-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-friend-copy span {
  color: var(--muted);
  font-size: 0.88rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 18px);
  opacity: 0;
  z-index: 20;
  max-width: min(780px, calc(100vw - 32px));
  padding: 14px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(8, 16, 28, 0.94);
  color: var(--text);
  box-shadow: var(--shadow);
  transition: opacity 160ms ease, transform 160ms ease;
  text-align: center;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast[data-kind="error"] {
  border-color: rgba(255, 109, 130, 0.3);
}

.toast[data-kind="success"] {
  border-color: rgba(38, 217, 203, 0.3);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(38, 217, 203, 0.5);
  outline-offset: 2px;
}

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

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
}

@keyframes drift-a {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(28px, 24px, 0) scale(1.08);
  }
}

@keyframes drift-b {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(-18px, 24px, 0) scale(1.12);
  }
}

@keyframes drift-c {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(-14px, -16px, 0) scale(1.08);
  }
}

@keyframes drift-d {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(18px, -16px, 0) scale(1.08);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1200px) {
  .hero-stage {
    grid-template-columns: 1fr;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1040px) {
  body {
    padding: 0;
    overflow: auto;
  }

  .screen {
    width: 100%;
  }

  .auth-screen,
  .app-shell {
    min-height: 100vh;
    border-radius: 0;
  }

  .auth-screen {
    grid-template-columns: 1fr;
  }

  .auth-card {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  .auth-hero,
  .auth-card,
  .sidebar,
  .chat-header,
  .composer,
  .message-stream,
  .settings-panel {
    padding-left: 18px;
    padding-right: 18px;
  }

  .toolbar-actions,
  .chat-actions,
  .hero-foot,
  .sidebar-stats {
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .sidebar-top,
  .chat-header,
  .settings-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar-actions {
    width: 100%;
  }

  .toolbar-actions .ghost-btn,
  .chat-actions .ghost-btn,
  .empty-card .ghost-btn,
  .send-btn {
    width: 100%;
  }

  .search-row,
  .composer {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .message-bubble {
    max-width: 92%;
  }

  .modal {
    padding: 0;
  }

  .settings-panel {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
