/* One restrained palette for the chat and the public document pages.
   Loaded after the compiled chat stylesheet so visual changes stay easy to edit. */
:root {
  --background: #14141b;
  --foreground: #f5f4f8;
  --card: #1d1d26;
  --card-foreground: #f5f4f8;
  --popover: #22222d;
  --popover-foreground: #f5f4f8;
  --primary: #7665b5;
  --secondary: #2a2936;
  --muted: #292934;
  --muted-foreground: #bdbac9;
  --border: #34343f;
  --input: #454453;
  --ring: #a895ef;
  --surface: #1d1d26;
  --page: #14141b;
  --line: #34343f;
  --text: #f5f4f8;
  --subtext: #bfbdca;
  --blue: #ad9be7;
  --blue-soft: #302b42;
  --message: #292936;
  --action: #7665b5;
  --action-hover: #8877c6;
  --aqua: #ad9be7;
  --action-gradient: #7665b5;
  --page-glow: #14141b;
  --panel-glow: transparent;
  --glass: #17171f;
  --shadow: 0 16px 42px rgb(0 0 0 / .26);
}

html[data-theme="light"] {
  --background: #f7f6fc;
  --foreground: #1c1b32;
  --card: #fff;
  --card-foreground: #1c1b32;
  --popover: #fff;
  --popover-foreground: #1c1b32;
  --primary: #6752ad;
  --secondary: #efedf7;
  --muted: #efedf7;
  --muted-foreground: #68677e;
  --border: #e1dfed;
  --input: #cecadf;
  --ring: #765fc3;
  --surface: #fff;
  --page: #f7f6fc;
  --line: #e1dfed;
  --text: #1c1b32;
  --subtext: #68677e;
  --blue: #654ac7;
  --blue-soft: #efecfa;
  --message: #f0eef7;
  --action: #6752ad;
  --action-hover: #765fc0;
  --aqua: #654ac7;
  --action-gradient: #6752ad;
  --page-glow: #f7f6fc;
  --panel-glow: transparent;
  --glass: #fff;
  --shadow: 0 14px 34px rgb(40 30 85 / .09);
}

body {
  background: var(--page) url('/conversation-pattern.svg') center top / 720px 480px repeat fixed;
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}
html[data-theme="light"] body { background: var(--page); }

.topbar, .site-shell .topbar {
  background: var(--page);
  border-bottom: 1px solid var(--line);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.topbar-inner { max-width: 1220px; }
.brand-mark { border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.brand-name > span, .brand-dot { color: var(--blue); }
.top-link, .icon-button, .online-counter { background: var(--surface); }
.top-link:hover, .icon-button:hover { border-color: var(--blue); background: var(--blue-soft); transform: none; }

.chat-panel {
  border-color: var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.chat-header { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
.chat-kicker { color: var(--blue); }
.chat-body { background: var(--surface); }
.welcome-intro .section-label { display: none; }
.welcome-intro h1 { font-weight: 730; letter-spacing: -.04em; }
.preference-field [data-slot="select-trigger"],
.country-picker-trigger,
.age-filter-options button,
.country-shortcuts button { border-color: var(--line); background: var(--muted); box-shadow: none; }
.preference-field [data-slot="select-trigger"]:hover,
.country-picker-trigger:hover,
.age-filter-options button:hover:not(:disabled),
.country-shortcuts button:hover:not(:disabled) { border-color: var(--blue); }
.age-filter-options button.selected,
.country-shortcuts button.selected { border-color: var(--blue); background: var(--blue-soft); box-shadow: none; color: var(--text); }
.country-preferences { border-color: var(--line); background: var(--muted); border-radius: 14px; }
.country-picker-popover, .chat-menu, .rules-dialog { border-color: var(--line); background: var(--surface); box-shadow: var(--shadow); backdrop-filter: none; -webkit-backdrop-filter: none; }

.primary-button, .send-button,
button[data-slot="button"][data-variant="default"]:not(.primary-button) { border-color: var(--action); background: var(--action); box-shadow: none; }
.primary-button:hover, .send-button:hover,
button[data-slot="button"][data-variant="default"]:not(.primary-button):hover { border-color: var(--action-hover); background: var(--action-hover); box-shadow: none; filter: none; }
.state-symbol, .rules-hero-icon, .orbit-core { background: var(--blue-soft); box-shadow: none; }
.rules-dialog { border-radius: 16px; }
.rule-item { border-color: var(--line); background: var(--muted); }
.message-bubble { background: var(--message); }
.message-row.mine .message-bubble { background: var(--action); }
.composer, .mobile-nav { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
.mobile-nav button.active { background: var(--blue-soft); color: var(--blue); }
.emoji-button, .composer input { background: var(--muted); }
.ended-card { box-shadow: none; }

@media (max-width: 720px) {
  body { background-attachment: scroll; }
  .chat-panel { border-radius: 0; box-shadow: none; }
  .welcome-intro h1 { font-size: clamp(27px, 8vw, 33px); }
  .country-preferences { border-radius: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}

/* Animate controls without moving the message list or mobile keyboard layout. */
.top-link, .icon-button, .primary-button, .send-button, .emoji-button,
.mobile-nav button, .preference-field [data-slot="select-trigger"],
.country-picker-trigger, .age-filter-options button, .country-shortcuts button {
  transition: background-color .2s ease, border-color .2s ease, color .2s ease, opacity .2s ease;
}
.composer input { transition: border-color .2s ease; }
.welcome-intro { animation: chat-intro .44s cubic-bezier(.22, 1, .36, 1) both; }
.country-picker-popover, .chat-menu, .rules-dialog {
  animation: chat-popover .2s cubic-bezier(.22, 1, .36, 1) both;
}
.top-link:focus-visible, .icon-button:focus-visible, .emoji-button:focus-visible,
.send-button:focus-visible, .age-filter-options button:focus-visible,
.country-shortcuts button:focus-visible, .mobile-nav button:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
@keyframes chat-intro { from { opacity: 0; transform: translateY(8px); } }
@keyframes chat-popover { from { opacity: 0; } }
@media (min-width: 900px) {
  .home-view .preferences-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-view .country-preferences { height: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .welcome-intro, .country-picker-popover, .chat-menu, .rules-dialog { animation: none; }
}

/* The footer now belongs to the public pages, never the chat workspace. */
.site-shell .site-footer:not(.site-footer-preview) { display: none !important; }

/* The chat uses the same navigation rhythm as the public homepage. */
.site-shell .topbar.chat-site-header { height: 78px; flex: 0 0 78px; }
.site-shell .topbar-inner { width: min(1450px, calc(100% - 64px)); max-width: none; padding: 0; gap: 24px; }
.site-shell .brand.brand-composed { gap: 8px; }
.site-shell .brand-dove { width: 54px; height: 54px; }
.site-shell .brand-dove::before { display: none; }
.site-shell .brand-dove img { filter: none; }
.site-shell .brand.brand-composed > .brand-wordmark { font-size: 28px; letter-spacing: -.065em; }
.chat-site-nav { display: flex; align-items: center; gap: clamp(20px, 3vw, 42px); margin: 0 auto; color: var(--subtext); font-size: 14px; font-weight: 650; white-space: nowrap; }
.chat-site-nav a { padding: 12px 0; }
.chat-site-nav a:hover, .chat-site-nav a[aria-current] { color: var(--text); }
.chat-site-nav a[aria-current] { box-shadow: inset 0 -2px var(--blue); }
.chat-site-tools { display: flex; align-items: center; gap: 9px; }
.chat-site-home { display: none; }
.chat-site-theme, .chat-site-language summary { display: flex; align-items: center; justify-content: center; min-height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer; }
.chat-site-theme { width: 42px; padding: 0; }
.chat-site-theme:hover, .chat-site-language summary:hover { border-color: var(--blue); background: var(--blue-soft); }
.chat-site-theme img { width: 20px; height: 20px; }
html[data-theme="dark"] .chat-site-theme img { filter: brightness(0) invert(.88); }
html[data-theme="dark"] .chat-site-moon, html[data-theme="light"] .chat-site-sun { display: none; }
.chat-site-language { position: relative; z-index: 32; }
.chat-site-language summary { gap: 8px; padding: 0 11px; font-size: 12px; font-weight: 700; list-style: none; white-space: nowrap; }
.chat-site-language summary::-webkit-details-marker { display: none; }
.chat-site-language summary img, .chat-site-language-options img { width: 20px; height: 14px; border-radius: 2px; object-fit: cover; }
.chat-site-language summary b { color: var(--subtext); font-size: 15px; font-weight: 400; }
.chat-site-language-options { position: absolute; top: calc(100% + 7px); right: 0; display: grid; min-width: 165px; padding: 5px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: var(--shadow); }
.chat-site-language-options button { display: flex; align-items: center; gap: 9px; min-height: 38px; padding: 7px 9px; border: 0; border-radius: 7px; background: transparent; color: var(--subtext); text-align: left; font-size: 13px; font-weight: 650; }
.chat-site-language-options button:hover, .chat-site-language-options button[aria-current="true"] { background: var(--blue-soft); color: var(--text); }
.site-shell .top-actions { margin-left: 0; }
.site-shell .rules-shortcut { display: none; }
@media (max-width: 900px) {
  .chat-site-nav { display: none; }
  .site-shell .topbar-inner { width: calc(100% - 32px); gap: 10px; }
  .chat-site-tools { margin-left: auto; }
  .chat-site-home { display: grid; place-items: center; width: 42px; min-height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); }
  .chat-site-home:hover { border-color: var(--blue); background: var(--blue-soft); }
  .chat-site-language summary { width: 42px; padding: 0; }
  .chat-site-language summary span, .chat-site-language summary b { display: none; }
}
@media (max-width: 720px) {
  .site-shell .topbar.chat-site-header { height: 62px; flex: 0 0 62px; }
  .site-shell .topbar-inner { width: 100%; padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right)); gap: 6px; }
  .site-shell .brand-dove { width: 42px; height: 42px; }
  .site-shell .brand.brand-composed > .brand-wordmark { font-size: 21px; }
  .chat-site-tools { gap: 6px; }
  .chat-site-home { width: 38px; min-height: 38px; }
  .chat-site-theme, .chat-site-language summary { width: 38px; min-height: 38px; }
  .site-shell .top-actions { padding: 2px; }
  .site-shell .top-menu-trigger { min-height: 36px; }
}
@media (max-width: 360px) {
  .site-shell .brand-dove { width: 36px; height: 36px; }
  .site-shell .brand.brand-composed > .brand-wordmark { font-size: 18px; }
  .chat-site-home, .chat-site-theme, .chat-site-language summary { width: 34px; min-height: 36px; }
  .site-shell .top-menu-trigger { padding-inline: 7px; }
}
