:root {
  --bg-1: #06101d;
  --bg-2: #0a1626;
  --bg-3: #0d1b30;

  --primary: #173a74;
  --primary-strong: #204f9e;

  --glass-border: rgba(255, 255, 255, 0.14);
  --text-main: rgba(255, 255, 255, 0.96);
  --text-soft: rgba(255, 255, 255, 0.72);
  --text-muted: rgba(255, 255, 255, 0.5);
  --danger-soft: rgba(255, 120, 120, 0.14);
  --danger-border: rgba(255, 120, 120, 0.28);

  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.34);
  --shadow-md: 0 14px 32px rgba(0, 0, 0, 0.22);

  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-pill: 999px;

  --sidebar-width: 360px;
  --page-gutter: 24px;
  --panel-height: min(920px, calc(100dvh - (var(--page-gutter) * 2)));

  --transition: 220ms ease;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  padding: var(--page-gutter);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top left, rgba(64, 104, 176, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(72, 105, 170, 0.1), transparent 24%),
    linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 48%, var(--bg-3) 100%);
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
}

button,
textarea,
input {
  font: inherit;
}

button {
  border: none;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: inherit;
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1000;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(11, 28, 54, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  transform: translateY(-160%);
  transition: transform var(--transition);
}

.skip-link:focus {
  transform: translateY(0);
}

.page-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(90px);
  opacity: 0.42;
}

.orb-1 {
  width: 340px;
  height: 340px;
  background: rgba(58, 98, 190, 0.25);
  top: -100px;
  left: -80px;
}

.orb-2 {
  width: 360px;
  height: 360px;
  background: rgba(94, 122, 182, 0.15);
  top: 20%;
  right: -120px;
}

.orb-3 {
  width: 280px;
  height: 280px;
  background: rgba(67, 104, 170, 0.12);
  bottom: -80px;
  left: 20%;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1440px, calc(100vw - (var(--page-gutter) * 2)));
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}

.glass-panel {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.10),
    rgba(255, 255, 255, 0.06)
  );
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  box-shadow: var(--shadow-lg);
}

.glass-inner {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.09),
    rgba(255, 255, 255, 0.05)
  );
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  box-shadow: var(--shadow-md);
}

.main-panel {
  grid-column: 2;
  grid-row: 1;
  padding: 20px;
  display: grid;
  grid-template-rows: auto auto minmax(460px, 1fr);
  align-content: start;
  gap: 18px;
  min-width: 0;
  height: 100%;
  min-height: var(--panel-height);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.topbar-statuses {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
  flex: 1 1 auto;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: background var(--transition), transform var(--transition), opacity var(--transition);
  text-decoration: none;
}

.ghost-btn--reveal {
  gap: 8px;
  min-width: auto;
  padding: 0 14px;
  overflow: visible;
  transition:
    background var(--transition),
    border-color var(--transition),
    transform var(--transition),
    box-shadow var(--transition);
}

.ghost-btn__label {
  display: inline-block;
  max-width: none;
  opacity: 1;
  white-space: nowrap;
  overflow: visible;
  transform: none;
  transition: opacity 160ms ease;
}

.ghost-btn--small {
  height: 36px;
  padding: 0 12px;
  font-size: 0.88rem;
}

.ghost-btn i {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.ghost-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.ghost-btn--reveal:hover:not(:disabled),
.ghost-btn--reveal:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.ghost-btn:disabled {
  opacity: 0.65;
  transform: none;
}

.status-pill {
  cursor: default;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.10);
}

.ghost-btn.status-pill:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.09);
  transform: none;
}

.status-pill__icon {
  width: 18px;
  height: 18px;
  display: block;
  flex: 0 0 auto;
}

.status-pill__icon-fa {
  font-size: 0.78rem;
  flex-shrink: 0;
  color: rgba(214, 222, 235, 0.55);
}

.status-pill[data-tone="connected"] .status-pill__icon-fa,
.status-pill[data-tone="verified"] .status-pill__icon-fa {
  color: rgba(100, 210, 150, 0.85);
}

.status-pill[data-tone="degraded"] .status-pill__icon-fa,
.status-pill[data-tone="rate_limited"] .status-pill__icon-fa {
  color: rgba(220, 185, 85, 0.85);
}

.status-pill[data-tone="disconnected"] .status-pill__icon-fa,
.status-pill[data-tone="unavailable"] .status-pill__icon-fa {
  color: rgba(210, 95, 95, 0.85);
}

.status-pill__label {
  color: var(--text-muted);
  white-space: nowrap;
  max-width: 100%;
}

.ghost-btn:focus-visible,
.prompt-chip:focus-visible,
.send-btn:focus-visible,
.link-list a:focus-visible,
#messageInput:focus-visible,
.chat-window:focus-visible,
.skip-link:focus-visible {
  outline: 2px solid rgba(158, 197, 255, 0.85);
  outline-offset: 2px;
}

.feedback-btn:focus-visible,
.message-copy-btn:focus-visible,
.bookmark-star-btn:focus-visible,
.tts-btn:focus-visible,
.message-edit-btn:focus-visible,
.consent-action-btn:focus-visible,
.bookmarks-panel__close:focus-visible,
.scroll-bottom-btn:focus-visible {
  outline: 2px solid rgba(158, 197, 255, 0.85);
  outline-offset: 2px;
}

/* ── Tools dropdown menu ─────────────────────────────── */
.tools-menu-wrap {
  position: relative;
}

.tools-menu-btn {
  gap: 6px;
  padding: 0 14px;
  font-size: 0.88rem;
  font-weight: 500;
}

.tools-menu-btn__label {
  font-size: 0.88rem;
}

.tools-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 210px;
  background: rgba(18, 18, 26, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.25);
  z-index: 200;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.tools-menu[hidden] {
  display: none;
}

.tools-menu__item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  border-radius: 8px;
  color: var(--text-main);
  background: transparent;
  border: none;
  text-decoration: none;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease;
  width: 100%;
  white-space: nowrap;
}

.tools-menu__item:hover,
.tools-menu__item:focus-visible {
  background: rgba(255, 255, 255, 0.09);
  outline: none;
}

.tools-menu__item:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(158, 197, 255, 0.7);
}

.tools-menu__item:disabled,
.tools-menu__item[aria-disabled="true"] {
  opacity: 0.38;
  cursor: default;
  pointer-events: none;
}

.menu-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.88rem;
}

.menu-icon--red,
.menu-icon--blue,
.menu-icon--green,
.menu-icon--purple,
.menu-icon--amber,
.menu-icon--teal {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.11);
  color: rgba(214, 222, 235, 0.68);
}

.tools-menu__divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 5px 4px;
}

.tools-menu__section {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 14px 2px;
  pointer-events: none;
  user-select: none;
}

#clearChatBtn.tools-menu__item:hover:not(:disabled) {
  background: rgba(160, 30, 30, 0.45);
}

.tools-menu__kbd {
  margin-left: auto;
  font-size: 0.7rem;
  opacity: 0.45;
  font-family: monospace;
  padding: 1px 4px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.tools-menu__item--sub {
  padding-left: 20px;
  font-size: 0.8rem;
  opacity: 0.85;
}

.chat-search-bar {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(6, 16, 29, 0.6);
}

.chat-search-bar.is-hidden {
  display: none;
}

.chat-search-bar__inner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 6px 10px;
}

.chat-search-bar__icon {
  color: var(--text-soft);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.chat-search-bar__input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.875rem;
  min-width: 0;
}

.chat-search-bar__input::placeholder {
  color: var(--text-soft);
  opacity: 0.6;
}

.chat-search-bar__input::-webkit-search-cancel-button {
  display: none;
}

.chat-search-bar__count {
  font-size: 0.75rem;
  color: var(--text-soft);
  white-space: nowrap;
  flex-shrink: 0;
}

.chat-search-bar__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-soft);
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}

.chat-search-bar__close:hover {
  color: var(--text-primary);
}

.message.search-hidden {
  display: none;
}

.message .bubble-text mark {
  background: rgba(255, 200, 50, 0.35);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

.intro-card {
  padding: 24px;
  align-self: start;
}

.intro-copy h1 {
  margin: 0 0 12px;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1.06;
  letter-spacing: -0.05em;
  font-weight: 800;
  max-width: 15ch;
}

.intro-text {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.75;
  max-width: 68ch;
}

.intro-status {
  margin-top: 14px;
}

.hero-cta-row {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.prompt-list {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.prompt-chip {
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: background var(--transition), transform var(--transition), opacity var(--transition);
}

.prompt-chip:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.prompt-chip:disabled {
  opacity: 0.55;
  transform: none;
}

.prompt-chip--followup {
  font-size: 0.82rem;
}

.storyteller-mode-chip.is-selected {
  background: rgba(104, 164, 255, 0.18);
  border-color: rgba(151, 195, 255, 0.3);
}

.chat-card {
  min-height: 0;
  height: 100%;
  max-height: 100%;
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
  min-width: 0;
  position: relative;
}

.chat-window {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  min-width: 0;
}

.sidebar-scroll::-webkit-scrollbar {
  width: 5px;
}

.sidebar-scroll::-webkit-scrollbar-track {
  background: transparent;
}

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

.message {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: fadeUp 240ms ease;
  min-width: 0;
}

.message.user {
  flex-direction: row-reverse;
}

.message--from-typing {
  transform-origin: left top;
}

.message--from-typing .avatar,
.message--from-typing .bubble,
.message--from-typing .message-name {
  transition:
    opacity 280ms ease,
    transform 420ms cubic-bezier(0.22, 1, 0.36, 1),
    filter 420ms ease,
    box-shadow 520ms ease,
    background 420ms ease,
    border-color 420ms ease;
}

.message--from-typing .avatar {
  opacity: 0.88;
  transform: scale(0.94);
}

.message--from-typing .bubble {
  transform: translateY(2px) scale(0.985);
  filter: saturate(1.08);
}

.message--from-typing .message-name {
  opacity: 0.7;
  transform: translateY(2px);
}

.message--from-typing.is-morphed .avatar,
.message--from-typing.is-morphed .bubble,
.message--from-typing.is-morphed .message-name {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: none;
}

.message--revealing .bubble {
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 0 rgba(125, 211, 252, 0);
}

.message--revealing .reveal-segment {
  opacity: 0;
  transform: translateY(10px);
  filter: blur(4px);
  clip-path: inset(0 100% 0 0 round 10px);
  transition:
    opacity 260ms ease,
    transform 420ms ease,
    filter 420ms ease,
    clip-path 640ms cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--reveal-delay, 0ms);
}

.message--revealing.is-visible .reveal-segment {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
  clip-path: inset(0 0 0 0 round 10px);
}

.message--revealing.is-visible .bubble {
  animation: assistantGlowPulse 900ms ease-out forwards;
}

.message--revealing .reveal-list {
  margin-top: 6px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.assistant-avatar {
  background: rgba(255, 255, 255, 0.12);
}

.user-avatar {
  background: rgba(23, 58, 116, 0.42);
}

.bubble {
  max-width: min(78%, 760px);
  padding: 14px 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  min-width: 0;
}

.message.user .bubble {
  background: rgba(23, 58, 116, 0.24);
}

.message-name {
  margin: 0 0 6px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.bubble-text {
  line-height: 1.72;
  color: var(--text-main);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.bubble-text p {
  margin: 0 0 10px;
}

.bubble-text p:last-child {
  margin-bottom: 0;
}

.bubble-text ul,
.bubble-text ol {
  margin: 8px 0 10px 18px;
  padding: 0;
}

.bubble-text li {
  margin-bottom: 6px;
}

.bubble-text strong {
  font-weight: 700;
}

.bubble-text small {
  display: inline-block;
  font-size: 0.76rem;
  line-height: 1.55;
  color: rgba(214, 222, 235, 0.58);
}

.bubble-text small i {
  margin-right: 6px;
  font-size: 0.7rem;
}

.bubble-text code {
  font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', monospace;
  font-size: 0.84em;
  background: rgba(100, 160, 255, 0.1);
  border: 1px solid rgba(120, 170, 255, 0.2);
  border-radius: 5px;
  padding: 1px 6px;
  color: rgba(160, 200, 255, 0.92);
  word-break: break-all;
}

.source-refs-row {
  display: flex !important;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px !important;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.source-chip {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
  transition: background 0.15s, color 0.15s;
}

.source-chip i {
  font-size: 0.63rem;
  margin-right: 0;
}

.message-actions .feedback-btn,
.message-actions .message-copy-btn {
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.message-actions .feedback-btn.is-active,
.message-actions .feedback-btn[aria-pressed="true"] {
  /* active state styles below */
}

.message-readstat {
  font-size: 0.66rem;
  color: var(--text-muted);
  opacity: 0.55;
  white-space: nowrap;
  margin-right: 2px;
}

.message-copy-btn.is-copied {
  color: rgb(110, 212, 151);
  border-color: rgba(110, 212, 151, 0.3);
  background: rgba(60, 174, 120, 0.12);
}

.message-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.feedback-group {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 4px;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.feedback-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.88rem;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.feedback-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-soft);
  border-color: rgba(255, 255, 255, 0.1);
}

.feedback-btn--like.is-active,
.feedback-btn--like[aria-pressed="true"] {
  background: rgba(60, 174, 120, 0.18);
  border-color: rgba(110, 212, 151, 0.3);
  color: rgb(110, 212, 151);
}

.feedback-btn--dislike.is-active,
.feedback-btn--dislike[aria-pressed="true"] {
  background: rgba(186, 94, 94, 0.18);
  border-color: rgba(220, 132, 132, 0.3);
  color: rgb(220, 132, 132);
}

.follow-up-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -2px 20px 0 50px;
}

.follow-up-list__hint {
  width: 100%;
  font-size: 0.73rem;
  color: var(--text-muted);
  margin: 0 0 2px;
}

.chat-form {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px;
  min-width: 0;
}

.composer-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
  min-width: 0;
}

.helper-text--compact {
  margin-top: 0;
}

.input-row {
  min-width: 0;
}

.input-wrap {
  position: relative;
  min-width: 0;
}

#messageInput {
  width: 100%;
  min-height: 56px;
  max-height: 180px;
  resize: none;
  overflow: hidden;
  border-radius: 20px;
  padding: 16px 152px 16px 18px;
  font-size: 0.95rem;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  outline: none;
  line-height: 1.6;
  transition: border-color var(--transition), box-shadow var(--transition), opacity var(--transition);
}

#messageInput:disabled {
  opacity: 0.72;
}

#messageInput::placeholder {
  color: rgba(255, 255, 255, 0.44);
}

#messageInput:focus {
  border-color: rgba(120, 160, 235, 0.35);
  box-shadow: 0 0 0 4px rgba(120, 160, 235, 0.08);
}

/* Action buttons group: voice + send, vertically centered in textarea */
.input-actions {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-actions .voice-btn {
  position: static;
  width: 36px;
  height: 36px;
  margin: 0;
}

.send-btn__icon {
  display: hidden;
}

.send-btn__label {
  display: inline;
}

.send-btn {
  font-weight: 700;
  color: white;
  background: linear-gradient(180deg, var(--primary-strong), var(--primary));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 6px 18px rgba(10, 40, 90, 0.3);
  transition: transform var(--transition), filter var(--transition), opacity var(--transition);
  border-radius: 14px;
}

.send-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.send-btn:disabled {
  opacity: 0.7;
  transform: none;
  filter: none;
}

.input-wrap .send-btn {
  height: 40px;
  padding: 0 18px;
  font-size: 0.88rem;
  font-weight: 600;
  min-width: auto;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-main);
  box-shadow: none;
}

.input-wrap .send-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
  transform: none;
  filter: none;
}

.helper-text {
  margin: 8px 2px 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.65;
}

.helper-text--status {
  color: var(--text-muted);
}

.consent-modal {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.consent-modal.is-hidden {
  display: none;
}

.consent-modal__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(2, 8, 18, 0.76);
  backdrop-filter: blur(10px);
}

.consent-modal__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 620px);
  padding: 24px;
  max-height: min(100%, calc(100dvh - 40px));
  overflow-y: auto;
  pointer-events: auto;
  -webkit-overflow-scrolling: touch;
}

.consent-modal__panel h2 {
  margin: 0 0 12px;
  font-size: clamp(1.3rem, 2.2vw, 2rem);
  line-height: 1.2;
}

.consent-copy {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.72;
}

.consent-checks {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.consent-check {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-soft);
}

.consent-check input {
  margin-top: 4px;
  width: 18px;
  height: 18px;
  accent-color: #4c9cff;
}

.consent-actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding-top: 12px;
  background: transparent;
}

.consent-action-btn {
  flex: 1 1 240px;
  min-height: 56px;
  border-radius: 20px;
  touch-action: manipulation;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: none;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.consent-action-btn--ghost {
  height: auto;
  padding: 14px 18px;
  border-radius: 20px;
  font-weight: 700;
}

.consent-action-btn:hover:not(:disabled),
.consent-action-btn:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.alert-banner {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
}

.alert-banner.is-hidden {
  display: none;
}

.alert-banner__copy strong {
  display: block;
  margin-bottom: 4px;
}

.alert-banner__copy p {
  margin: 0;
  color: var(--text-soft);
}

.alert-banner__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#storytellerBanner {
  grid-template-columns: 1fr;
  align-items: stretch;
}

#storytellerBanner .alert-banner__actions {
  justify-content: flex-start;
}

.turnstile-wrap {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.turnstile-wrap__header {
  display: grid;
  gap: 2px;
}

.turnstile-wrap__label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.turnstile-wrap__copy {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.turnstile-status {
  max-width: min(320px, 100%);
  margin: 0;
  padding: 8px 10px;
  border-radius: 12px;
  color: var(--text-soft);
  background: rgba(8, 14, 26, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

.turnstile-status.is-hidden {
  display: none;
}

.rights {
  margin: 10px 2px 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}

.sidebar-panel {
  grid-column: 1;
  grid-row: 1;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  min-height: var(--panel-height);
}

.identity-card {
  padding: 18px;
}

.identity-top {
  display: flex;
  gap: 14px;
  align-items: center;
}

.verified-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.verified-row h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.verified-badge {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
}

.verified-badge svg {
  width: 100%;
  height: 100%;
  display: block;
}

.verified-badge svg path:first-child {
  fill: #4c9cff;
}

.verified-badge .check {
  fill: none;
  stroke: #ffffff;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.role {
  margin: 6px 0 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.identity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.meta-chip {
  padding: 9px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-soft);
  font-size: 0.88rem;
}

.meta-chip--link a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.meta-chip--status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.sidebar-scroll {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar-card {
  padding: 16px;
}

.card-head h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.content-copy {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.72;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-list--compact {
  margin-top: 10px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-soft);
  font-size: 0.84rem;
  line-height: 1.2;
}

.stack-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-soft);
  display: grid;
  gap: 10px;
  list-style-type: none;
}

.detail-stack {
  display: grid;
  gap: 10px;
}

.detail-card {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.detail-card__title,
.detail-card__meta,
.detail-card__copy {
  margin: 0;
}

.detail-card__title {
  color: var(--text-main);
  font-weight: 600;
  line-height: 1.5;
}

.detail-card__meta {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.detail-card__copy {
  margin-top: 8px;
  color: var(--text-soft);
  line-height: 1.65;
}

.link-list {
  display: grid;
  gap: 8px;
}

.link-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.95rem;
}

.link-icon--teal,
.link-icon--blue,
.link-icon--purple,
.link-icon--green,
.link-icon--amber {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.11);
  color: rgba(214, 222, 235, 0.68);
}

.link-list a {
  display: grid;
  grid-template-columns: 36px max-content minmax(0, 1fr);
  align-items: center;
  width: 100%;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: background var(--transition), transform var(--transition);
}

.link-list a:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.link-list__label {
  font-weight: 600;
}

.link-list__text {
  min-width: 0;
  text-align: right;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-skeleton-loader {
  display: grid;
  gap: 8px;
  padding: 4px 0;
  min-width: 180px;
}

.chat-skel-a { width: 88%; }
.chat-skel-b { width: 72%; }
.chat-skel-c { width: 92%; }
.chat-skel-d { width: 52%; }

.chat-skel-b::before { animation-delay: 0.20s; }
.chat-skel-c::before { animation-delay: 0.10s; }
.chat-skel-d::before { animation-delay: 0.30s; }

.storyteller-actions {
  margin: 10px 0 14px;
}

.storyteller-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.storyteller-fontsize-btn {
  flex: 0 0 auto;
}

.storyteller-fontsize-btn.is-active {
  background: rgba(120, 160, 240, 0.15);
  border-color: rgba(120, 160, 240, 0.35);
  color: rgba(160, 200, 255, 0.9);
}

.storyteller-select-wrap {
  flex: 0 0 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.storyteller-select-wrap i {
  color: var(--text-soft);
  font-size: 0.82rem;
}

.storyteller-select {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text-main);
  outline: none;
  appearance: none;
}

.storyteller-select option {
  color: #0c1522;
}

.storyteller-generate-btn {
  flex: 1 1 auto;
  white-space: nowrap;
}

.storyteller-copy-btn {
  flex: 0 0 auto;
}

.storyteller-generate-btn.is-hidden {
  display: none;
}

.storyteller-copy-btn.is-hidden {
  display: none;
}

.storyteller-content {
  min-height: 118px;
  color: var(--text-soft);
  line-height: 1.72;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 0.93rem;
  transition: font-size 0.2s ease;
}

.storyteller-content--large {
  font-size: 1.06rem;
  line-height: 1.82;
  letter-spacing: 0.01em;
}

.storyteller-content p {
  margin: 0 0 10px;
}

.storyteller-content p:last-child {
  margin-bottom: 0;
}

.storyteller-content strong {
  color: var(--text-main);
  font-weight: 700;
}

.storyteller-content em {
  color: var(--text-main);
}

.storyteller-content small {
  display: inline-block;
  font-size: 0.76rem;
  line-height: 1.55;
  color: rgba(214, 222, 235, 0.58);
}

.storyteller-content small i {
  margin-right: 6px;
  font-size: 0.7rem;
}

.storyteller-placeholder {
  color: var(--text-muted);
}

@media (min-width: 769px) {
  .topbar {
    flex-wrap: nowrap;
  }

  .topbar-actions {
    flex-wrap: nowrap;
  }

  .ghost-btn--reveal {
    gap: 0;
    min-width: 40px;
    padding: 0 11px;
    overflow: hidden;
  }

  .ghost-btn--reveal .ghost-btn__label {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateX(-6px);
    transition:
      max-width 220ms ease,
      opacity 160ms ease,
      transform 220ms ease,
      margin-left 220ms ease;
  }

  .ghost-btn--reveal:hover,
  .ghost-btn--reveal:focus-visible {
    gap: 8px;
    padding-right: 14px;
  }

  .ghost-btn--reveal:hover .ghost-btn__label,
  .ghost-btn--reveal:focus-visible .ghost-btn__label {
    max-width: 180px;
    opacity: 1;
    transform: translateX(0);
  }
}

.storyteller-content.is-loading {
  min-height: 100px;
}

.storyteller-loader {
  display: grid;
  gap: 9px;
  padding: 4px 0;
}

.storyteller-loader-orb {
  display: none;
}

.storyteller-loader-lines {
  display: grid;
  gap: 9px;
}

.story-line {
  position: relative;
  display: block;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.story-line::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.09) 30%,
    rgba(190, 215, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.09) 70%,
    transparent 100%
  );
  transform: translateX(-150%);
  animation: storytellerLineSweep 2s ease-in-out infinite;
}

.line-1 {
  width: 91%;
}

.line-2 {
  width: 76%;
}

.line-3 {
  width: 87%;
}

.line-4 {
  width: 60%;
}

.line-5 {
  width: 95%;
}

.line-6 {
  width: 70%;
}

.line-7 {
  width: 83%;
}

.line-head {
  height: 13px;
  width: 48%;
  margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.065);
}

.line-2::before {
  animation-delay: 0.22s;
}

.line-3::before {
  animation-delay: 0.11s;
}

.line-4::before {
  animation-delay: 0.33s;
}

.line-5::before {
  animation-delay: 0.16s;
}

.line-6::before {
  animation-delay: 0.28s;
}

.line-7::before {
  animation-delay: 0.07s;
}

.line-head::before {
  animation-delay: 0.44s;
}

.icon-gap {
  margin-right: 10px;
}

.title-with-icon {
  display: flex;
  align-items: center;
  gap: 10px;
}

.title-with-icon--small {
  font-size: inherit;
}

.title-icon {
  display: block;
  flex-shrink: 0;
  opacity: 0.72;
}

.helper-text a,
.rights a,
.legal-section a {
  color: #9ec5ff;
}

.legal-shell {
  position: relative;
  z-index: 1;
  width: min(980px, calc(100vw - 48px));
  margin: 24px auto;
  padding: 24px;
}

.legal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.legal-head h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.04em;
}

.legal-lead {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.7;
  max-width: 60ch;
}

.legal-body {
  padding: 22px;
}

.legal-section + .legal-section {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.legal-section h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.legal-section p,
.legal-section li {
  color: var(--text-soft);
  line-height: 1.72;
}

.legal-section ul {
  margin: 10px 0 0 20px;
}

.legal-table-wrap {
  margin-top: 14px;
  overflow-x: auto;
}

.legal-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.legal-table th,
.legal-table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.legal-table th {
  color: var(--text-main);
  font-size: 0.84rem;
}

.legal-table td {
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.6;
}


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

@keyframes assistantGlowPulse {
  0% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.04),
      0 0 0 rgba(125, 211, 252, 0);
  }
  35% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.06),
      0 0 26px rgba(125, 211, 252, 0.16);
  }
  100% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.04),
      0 0 0 rgba(125, 211, 252, 0);
  }
}

@keyframes storytellerLineSweep {
  0% {
    transform: translateX(-150%);
  }
  100% {
    transform: translateX(160%);
  }
}

@media (max-width: 1180px) {
  :root {
    --page-gutter: 14px;
    --panel-height: auto;
  }

  .app-shell {
    width: min(100%, calc(100vw - (var(--page-gutter) * 2)));
    min-height: auto;
    margin: 0 auto;
    grid-template-columns: 1fr;
  }

  .sidebar-panel {
    grid-column: 1;
    grid-row: 1;
  }

  .main-panel {
    grid-column: 1;
    grid-row: 2;
    grid-template-rows: auto auto 1fr;
    height: auto;
    max-height: none;
  }

  .chat-card {
    height: min(720px, calc(100dvh - 240px));
    max-height: calc(100dvh - 240px);
  }

  .sidebar-scroll {
    overflow: visible;
  }

  .sidebar-panel {
    height: auto;
    max-height: none;
  }
}

@media (max-width: 768px) {
  .consent-modal {
    place-items: start center;
    padding: 14px;
  }

  .consent-modal__panel {
    margin: auto 0;
    max-height: calc(100dvh - 28px);
  }

  .turnstile-wrap {
    padding: 12px 14px;
  }

  .app-shell {
    width: 100%;
    max-width: 100%;
    padding: 0;
  }

  .main-panel,
  .sidebar-panel {
    padding: 14px;
  }

  .chat-card {
    height: auto;
    max-height: none;
    min-height: 460px;
    width: 100%;
    max-width: 100%;
  }

  .topbar {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
  }

  .topbar-statuses {
    flex: 1 1 auto;
    min-width: 0;
  }

  .topbar-actions {
    flex-shrink: 0;
  }

  .tools-menu {
    right: 0;
    min-width: 200px;
  }

  .ghost-btn {
    height: 38px;
    padding: 0 12px;
    font-size: 0.9rem;
  }

  .status-pill {
    min-height: 38px;
    max-width: 100%;
  }

  .status-pill__label {
    font-size: 0.86rem;
    max-width: 100%;
    white-space: normal;
  }

  .eyebrow {
    font-size: 0.62rem;
    letter-spacing: 0.1em;
  }

  .intro-copy h1 {
    max-width: none;
    font-size: 1.72rem;
    line-height: 1.08;
    letter-spacing: -0.04em;
  }

  .title-with-icon {
    gap: 8px;
  }

  .intro-copy .title-icon {
    width: 29px;
    height: 29px;
  }

  .intro-card {
    padding: 20px;
  }

  .intro-text {
    font-size: 0.96rem;
    line-height: 1.65;
  }

  .verified-row h2 {
    font-size: 1.28rem;
  }

  .role {
    font-size: 0.94rem;
  }

  .card-head h3 {
    font-size: 0.95rem;
  }

  .meta-chip,
  .prompt-chip,
  .link-list a {
    font-size: 0.9rem;
  }

  .prompt-list {
    flex-wrap: wrap;
    overflow: visible;
    padding-bottom: 0;
  }

  .prompt-chip {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.84rem;
    padding: 9px 12px;
  }

  #messageInput {
    padding-right: 100px;
    font-size: 0.88rem;
  }

  .send-btn__label {
    display: none;
  }

  .send-btn__icon {
    display: inline;
  }

  .input-wrap .send-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
  }

  .input-actions {
    gap: 4px;
  }

  .input-actions .voice-btn {
    width: 34px;
    height: 34px;
  }

  .bubble {
    max-width: calc(100% - 50px);
    padding: 12px 14px;
  }

  .avatar {
    width: 34px;
    height: 34px;
    border-radius: 12px;
  }

  .message {
    gap: 8px;
  }

  .follow-up-list {
    margin-left: 42px;
  }

  .identity-top {
    align-items: flex-start;
  }

  .alert-banner {
    grid-template-columns: 1fr;
  }

  .alert-banner__actions {
    justify-content: flex-start;
  }

  .consent-actions {
    flex-direction: column;
  }

  .consent-action-btn {
    width: 100%;
    flex-basis: auto;
  }

  .consent-action-btn.send-btn {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: none;
  }

  .consent-action-btn--ghost {
    background: rgba(255, 255, 255, 0.08);
  }

  .composer-meta {
    align-items: flex-start;
  }

  .storyteller-generate-btn {
    flex: 1 1 auto;
  }

  .legal-shell {
    width: min(100%, calc(100vw - 20px));
    margin: 10px auto;
    padding: 14px;
  }

  .legal-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .legal-body {
    padding: 16px;
  }

  .scroll-bottom-btn {
    bottom: 80px;
    right: 16px;
  }
}

@media (max-width: 520px) {
  .topbar {
    gap: 10px;
  }

  .tools-menu {
    min-width: 190px;
  }

  .status-pill__label {
    max-width: none;
    font-size: 0.84rem;
  }
}

@media (max-width: 560px) {
  .main-panel,
  .sidebar-panel {
    padding: 12px;
  }

  .chat-window {
    padding: 14px;
  }

  .chat-form {
    padding: 14px;
  }

  #messageInput,
  .send-btn,
  .input-row,
  .chat-card {
    max-width: 100%;
  }

  .follow-up-list {
    margin-left: 0;
  }

  .ghost-btn,
  .status-pill {
    height: 36px;
  }

  .status-pill__label {
    font-size: 0.82rem;
    white-space: normal;
    text-align: left;
  }

  .intro-copy h1 {
    font-size: 1.52rem;
  }

  .intro-copy .title-icon {
    width: 26px;
    height: 26px;
  }

  .intro-text {
    font-size: 0.92rem;
  }

  .verified-row h2 {
    font-size: 1.15rem;
  }

  .card-head h3,
  .meta-chip,
  .prompt-chip,
  .link-list a,
  .role {
    font-size: 0.88rem;
  }

  .prompt-chip {
    font-size: 0.8rem;
    padding: 8px 11px;
  }
}

body.keyboard-open .turnstile-wrap__copy {
  display: none;
}

body.keyboard-open .turnstile-wrap {
  padding-block: 10px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ── Custom tooltip system ────────────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%) translateY(3px);
  background: rgba(12, 18, 40, 0.94);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.70rem;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  pointer-events: none;
  opacity: 0;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 120;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

[data-tooltip][data-tooltip-pos="left"]::after {
  left: auto;
  right: 0;
  transform: translateY(3px);
}

[data-tooltip][data-tooltip-pos="left"]:hover::after {
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  [data-tooltip]::after {
    transition: none;
  }
}

/* ── Message timestamps ──────────────────────────────────────────────────────── */
.message-timestamp {
  display: inline-flex;
  align-items: center;
  font-size: 0.66rem;
  color: var(--text-muted);
  margin-left: auto;
  opacity: 0.65;
  letter-spacing: 0.01em;
  padding-left: 6px;
  white-space: nowrap;
  cursor: default;
  position: relative;
}

.message-timestamp::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 5px);
  right: 0;
  background: rgba(14, 20, 36, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.65rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 150ms ease, transform 150ms ease;
  z-index: 20;
}

.message-timestamp:hover::after {
  opacity: 1;
  transform: translateY(0);
}

/* ── Scroll-to-bottom floating button ───────────────────────────────────────── */
.scroll-bottom-btn {
  position: fixed;
  bottom: 100px;
  right: 32px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  background: var(--primary-strong);
  color: var(--text-main);
  border-radius: var(--radius-pill);
  font-size: 0.76rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  z-index: 50;
  transition: opacity var(--transition), transform var(--transition);
  border: 1px solid rgba(255,255,255,0.1);
}

.scroll-bottom-btn:hover {
  background: var(--primary);
}

.scroll-bottom-btn.is-hidden {
  display: none;
}

/* ── Toast notifications ─────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  background: rgba(20, 35, 60, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
  white-space: nowrap;
}

.toast--visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Voice input button ──────────────────────────────────────────────────────── */
.voice-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-soft);
  border: 1px solid var(--glass-border);
  transition: color var(--transition), background var(--transition), box-shadow var(--transition);
}

.voice-btn:not(.is-hidden) {
  display: flex;
}

.voice-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.voice-btn--listening {
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.12);
  border-color: rgba(255, 107, 107, 0.35);
  animation: voice-pulse 1.1s ease-in-out infinite;
}

@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.35); }
  50% { box-shadow: 0 0 0 7px rgba(255, 107, 107, 0); }
}

/* ── Feedback follow-up input ────────────────────────────────────────────────── */
.feedback-followup {
  margin-top: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: fade-in 180ms ease;
}

.feedback-followup__label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-soft);
}

.feedback-followup__optional {
  color: var(--text-muted);
  font-weight: 400;
}

.feedback-followup__row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.feedback-followup__input {
  flex: 1;
  height: 34px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: var(--text-main);
  font-size: 0.8rem;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}

.feedback-followup__input::placeholder {
  color: rgba(255, 255, 255, 0.32);
}

.feedback-followup__input:focus {
  border-color: rgba(120, 160, 235, 0.35);
  background: rgba(255, 255, 255, 0.09);
}

.feedback-followup__submit {
  flex-shrink: 0;
  height: 34px;
  padding: 0 14px;
  font-size: 0.8rem;
  border-radius: 10px;
}

.feedback-tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.feedback-tag-chip {
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-soft);
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.feedback-tag-chip:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.25);
}

.feedback-tag-chip.is-selected {
  background: rgba(100, 150, 240, 0.2);
  border-color: rgba(100, 150, 240, 0.45);
  color: #a8c4f8;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Error pages ─────────────────────────────────────────────────────────────── */
.error-page-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  width: 100%;
  padding: var(--page-gutter);
}

.error-card {
  max-width: 420px;
  width: 100%;
  padding: 48px 40px;
  text-align: center;
  border-radius: var(--radius-xl);
}

.error-code {
  font-size: 5.5rem;
  font-weight: 800;
  color: var(--primary-strong);
  line-height: 1;
  margin-bottom: 16px;
  opacity: 0.55;
}

.error-heading {
  font-size: 1.45rem;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--text-main);
}

.error-message {
  color: var(--text-soft);
  margin: 0 0 32px;
  font-size: 0.93rem;
  line-height: 1.65;
}

.error-home-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  transition: background var(--transition), border-color var(--transition);
}

.error-home-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.22);
}

/* ── Email export modal ──────────────────────────────────────────────────────── */
.email-export-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--page-gutter);
}

.email-export-modal.is-hidden {
  display: none;
}

.email-export-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 18, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.email-export-modal__panel {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  padding: 36px 32px 32px;
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fade-in 180ms ease;
}

.email-export-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.email-export-modal__icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.11);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: rgba(214, 222, 235, 0.68);
}

.email-export-modal__title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
}

.email-export-modal__copy {
  font-size: 0.87rem;
  color: var(--text-soft);
  margin: 0;
  line-height: 1.6;
}

.email-export-modal__input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  color: var(--text-main);
  font-size: 0.92rem;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
  box-sizing: border-box;
}

.email-export-modal__input::placeholder {
  color: rgba(255, 255, 255, 0.34);
}

.email-export-modal__input:focus {
  border-color: rgba(120, 160, 235, 0.4);
  background: rgba(255, 255, 255, 0.1);
}

.email-export-modal__error {
  margin: -6px 0 0;
  color: rgb(220, 132, 132);
}

.email-export-modal__send {
  width: 100%;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-main);
  font-weight: 600;
  box-shadow: none;
}

.email-export-modal__send:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
  transform: none;
  filter: none;
}

.email-export-modal__success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 12px 0 4px;
  text-align: center;
}

.email-export-modal__success.is-hidden {
  display: none;
}

.email-export-modal__success-icon {
  font-size: 2.4rem;
  color: rgb(110, 212, 151);
  line-height: 1;
}

.email-export-modal__success p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-soft);
  line-height: 1.6;
}

#emailExportForm {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#emailExportForm.is-hidden {
  display: none;
}

/* reCAPTCHA v3 — hide floating badge, show inline attribution instead */
.grecaptcha-badge {
  visibility: hidden !important;
  pointer-events: none !important;
}

.recaptcha-attribution {
  opacity: 0.72;
}

/* ── Idle prompt ──────────────────────────────────────────────────────────── */
.idle-prompt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 8px 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.idle-prompt__text {
  flex: 1;
}

.idle-prompt__dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  opacity: 0.6;
  line-height: 1;
  flex-shrink: 0;
}

.idle-prompt__dismiss:hover {
  opacity: 1;
}

/* ── Thinking status pill tone ────────────────────────────────────────────── */
.status-pill[data-tone="thinking"] .status-pill__icon-fa {
  color: rgba(160, 200, 255, 0.75);
}

/* ── Button micro-interactions (spring-eased active scale) ───────────────── */
.ghost-btn:active:not(:disabled),
.prompt-chip:active:not(:disabled),
.consent-action-btn:active:not(:disabled),
.tools-menu__item:active:not(:disabled),
.feedback-btn:active:not(:disabled),
.bookmark-star-btn:active:not(:disabled),
.tts-btn:active:not(:disabled) {
  transform: scale(0.97);
  transition: transform 80ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.send-btn:active:not(:disabled),
.input-wrap .send-btn:active:not(:disabled) {
  transform: scale(0.96);
  transition: transform 80ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Custom scrollbar (chat-window) ──────────────────────────────────────── */
.chat-window::-webkit-scrollbar {
  width: 5px;
}

.chat-window::-webkit-scrollbar-track {
  background: transparent;
}

.chat-window::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.chat-window::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ── Verified badge hover pulse-glow ─────────────────────────────────────── */
@keyframes badgePulse {
  0%   { filter: drop-shadow(0 0 0 rgba(76, 156, 255, 0)); }
  40%  { filter: drop-shadow(0 0 6px rgba(76, 156, 255, 0.6)); }
  100% { filter: drop-shadow(0 0 0 rgba(76, 156, 255, 0)); }
}

.verified-badge {
  cursor: default;
  transition: filter 200ms ease;
}

.verified-badge:hover {
  animation: badgePulse 0.85s ease-out;
}

/* ── Chat scroll-progress bar ────────────────────────────────────────────── */
.chat-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  z-index: 10;
  pointer-events: none;
  border-radius: 2px 2px 0 0;
  overflow: hidden;
}

.chat-progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(80, 140, 255, 0.75), rgba(140, 190, 255, 0.45));
  width: 0%;
  transition: width 60ms linear;
}

/* ── Keyboard shortcuts overlay ──────────────────────────────────────────── */
.shortcuts-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.shortcuts-overlay.is-hidden {
  display: none;
}

.shortcuts-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 18, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.shortcuts-overlay__panel {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  padding: 24px;
  border-radius: var(--radius-xl);
  animation: fadeUp 180ms ease;
}

.shortcuts-overlay__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.shortcuts-overlay__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.shortcuts-overlay__close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-soft);
  cursor: pointer;
  border-radius: 8px;
  transition: background 120ms ease, color 120ms ease;
}

.shortcuts-overlay__close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.shortcuts-list {
  display: grid;
  gap: 2px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border-radius: 8px;
  gap: 12px;
}

.shortcut-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.shortcut-label {
  font-size: 0.86rem;
  color: var(--text-soft);
}

.shortcut-keys {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.shortcut-key {
  font-family: monospace;
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-main);
}

/* ── Bookmarks slide-over panel ──────────────────────────────────────────── */
.bookmarks-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, 100vw);
  z-index: 600;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
  border-radius: 30px 0 0 30px;
  overflow: hidden;
}

.bookmarks-panel.is-open {
  transform: translateX(0);
}

.bookmarks-panel__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 8, 18, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: -1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}

.bookmarks-panel.is-open .bookmarks-panel__backdrop {
  opacity: 1;
  pointer-events: auto;
}

.bookmarks-panel__inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: var(--radius-xl) 0 0 var(--radius-xl);
}

.bookmarks-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.bookmarks-panel__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bookmarks-panel__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-soft);
  cursor: pointer;
  border-radius: 8px;
  transition: background 120ms ease, color 120ms ease;
}

.bookmarks-panel__close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.bookmarks-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bookmarks-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 16px;
  text-align: center;
  color: var(--text-muted);
}

.bookmarks-empty i {
  font-size: 2rem;
  opacity: 0.35;
}

.bookmarks-empty p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.55;
}

.bookmark-item {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}

.bookmark-item__text {
  font-size: 0.82rem;
  color: var(--text-soft);
  line-height: 1.55;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  margin: 0 0 8px;
}

.bookmark-item__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.bookmark-item__time {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.bookmark-item__remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.72rem;
  line-height: 1;
  transition: color 120ms ease;
}

.bookmark-item__remove:hover {
  color: rgb(220, 132, 132);
}

/* ── Bookmark star button (in message actions) ───────────────────────────── */
.bookmark-star-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.88rem;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.bookmark-star-btn.is-bookmarked {
  color: rgb(255, 195, 60);
  background: rgba(255, 195, 60, 0.1);
  border-color: rgba(255, 195, 60, 0.25);
  opacity: 1;
}

.bookmark-star-btn:hover:not(.is-bookmarked) {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-soft);
  border-color: rgba(255, 255, 255, 0.1);
}

/* ── TTS voice-output button ─────────────────────────────────────────────── */
.tts-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.88rem;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.tts-btn.is-speaking {
  color: rgba(100, 180, 255, 0.9);
  background: rgba(100, 180, 255, 0.1);
  border-color: rgba(100, 180, 255, 0.25);
  opacity: 1;
  animation: ttsPulse 1.2s ease-in-out infinite;
}

@keyframes ttsPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

.tts-btn:hover:not(.is-speaking) {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-soft);
  border-color: rgba(255, 255, 255, 0.1);
}

/* ── Prompt history autocomplete ─────────────────────────────────────────── */
.prompt-history-list {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  right: 0;
  background: rgba(14, 20, 36, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  z-index: 100;
  overflow: hidden;
  padding: 6px;
}

.prompt-history-list.is-hidden {
  display: none;
}

.prompt-history-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-soft);
  font-size: 0.84rem;
  background: transparent;
  border: none;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background 100ms ease, color 100ms ease;
}

.prompt-history-item:hover,
.prompt-history-item.is-focused {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-main);
}

/* ── High-contrast mode ──────────────────────────────────────────────────── */
body.high-contrast {
  --bg-1: #000000;
  --bg-2: #080808;
  --bg-3: #0f0f0f;
  --text-main: #ffffff;
  --text-soft: rgba(255, 255, 255, 0.92);
  --text-muted: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.38);
}

body.high-contrast .glass-panel,
body.high-contrast .glass-inner {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.32);
}

body.high-contrast .bubble {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
}

body.high-contrast .ghost-btn {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.1);
}

body.high-contrast .prompt-chip {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.1);
}

/* ── Page transitions ────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  @keyframes pageOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-6px); }
  }

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

  .page-transition-out {
    animation: pageOut 200ms ease forwards;
  }

  .app-shell {
    animation: pageIn 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 20ms;
  }
}

/* ── High-contrast toggle button active state ───────────────────────────── */
#highContrastBtn.is-active .menu-icon {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
}

/* ── Touch-action: prevent double-tap zoom on buttons and links ──────────── */
button,
a {
  touch-action: manipulation;
}

/* ── Confidence pill ─────────────────────────────────────────────────────── */
.confidence-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
  margin-left: 6px;
  border: 1px solid transparent;
  opacity: 0.85;
}

.confidence-pill--high {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

.confidence-pill--medium {
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.3);
  color: #fbbf24;
}

.confidence-pill--low {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

/* ── User message edit button ────────────────────────────────────────────── */
.message-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease;
  flex-shrink: 0;
  opacity: 0.55;
}

.message-edit-btn:hover {
  opacity: 1;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.07);
}

.message.user .message-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  justify-content: flex-end;
}

/* ── Pull-to-refresh indicator ───────────────────────────────────────────── */
.ptr-indicator {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-48px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-soft);
  font-size: 0.78rem;
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1), opacity 200ms ease;
  pointer-events: none;
  z-index: 10;
  white-space: nowrap;
}

.ptr-indicator.is-visible {
  transform: translateX(-50%) translateY(12px);
}

.ptr-indicator i {
  font-size: 0.76rem;
}

/* ── Storyteller vary button ─────────────────────────────────────────────── */
.storyteller-vary-btn {
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.storyteller-vary-btn.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── PWA install button in tools menu ────────────────────────────────────── */
#pwaInstallBtn {
  display: none;
}

#pwaInstallBtn.is-available {
  display: flex;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LIGHT MODE
   Same brand design language — deep navy blues, glass panels, Inter —
   but on a cool blue-tinted light canvas.
   ══════════════════════════════════════════════════════════════════════════ */

/*
 * html.light-mode — applied by the <head> inline script on sub-pages
 * (privacy, 404, 500) where app.js is absent. Sets CSS variables so they
 * cascade to all descendants, and handles the body background and key
 * glass panels that use hardcoded values rather than CSS vars.
 */
html.light-mode {
  --bg-1: #eef2fb;
  --bg-2: #e4ecf8;
  --bg-3: #d9e3f5;
  --primary: #1a3e7a;
  --primary-strong: #2554ac;
  --glass-border: rgba(13, 31, 70, 0.11);
  --text-main: rgba(8, 18, 38, 0.94);
  --text-soft: rgba(8, 18, 38, 0.68);
  --text-muted: rgba(8, 18, 38, 0.46);
  --danger-soft: rgba(180, 40, 40, 0.08);
  --danger-border: rgba(180, 40, 40, 0.22);
  --shadow-lg: 0 24px 60px rgba(13, 31, 70, 0.13);
  --shadow-md: 0 14px 32px rgba(13, 31, 70, 0.09);
}

html.light-mode body {
  background:
    radial-gradient(circle at top left, rgba(64, 104, 200, 0.10), transparent 28%),
    radial-gradient(circle at bottom right, rgba(90, 130, 215, 0.07), transparent 24%),
    linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 48%, var(--bg-3) 100%);
}

html.light-mode .glass-panel {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.88),
    rgba(255, 255, 255, 0.76)
  );
}

html.light-mode .glass-inner {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.82),
    rgba(255, 255, 255, 0.68)
  );
  border-color: rgba(13, 31, 70, 0.10);
}

html.light-mode .ghost-btn {
  background: rgba(13, 31, 70, 0.06);
  border-color: rgba(13, 31, 70, 0.13);
}

/* ── Error pages light mode ─────────────────────────────────────────────── */
html.light-mode .error-home-btn:hover,
body.light-mode .error-home-btn:hover {
  background: rgba(13, 31, 70, 0.06);
  border-color: rgba(13, 31, 70, 0.18);
}

/* ── Legal page light mode ──────────────────────────────────────────────── */
body.light-mode .legal-section + .legal-section {
  border-top-color: rgba(13, 31, 70, 0.09);
}

body.light-mode .legal-section a {
  color: rgba(37, 84, 172, 0.85);
}

body.light-mode .legal-table th,
body.light-mode .legal-table td {
  border-bottom-color: rgba(13, 31, 70, 0.09);
}

html.light-mode .legal-section + .legal-section {
  border-top-color: rgba(13, 31, 70, 0.09);
}

html.light-mode .legal-section a {
  color: rgba(37, 84, 172, 0.85);
}

html.light-mode .legal-table th,
html.light-mode .legal-table td {
  border-bottom-color: rgba(13, 31, 70, 0.09);
}

body.light-mode {
  --bg-1: #eef2fb;
  --bg-2: #e4ecf8;
  --bg-3: #d9e3f5;
  --primary: #1a3e7a;
  --primary-strong: #2554ac;
  --glass-border: rgba(13, 31, 70, 0.11);
  --text-main: rgba(8, 18, 38, 0.94);
  --text-soft: rgba(8, 18, 38, 0.68);
  --text-muted: rgba(8, 18, 38, 0.46);
  --danger-soft: rgba(180, 40, 40, 0.08);
  --danger-border: rgba(180, 40, 40, 0.22);
  --shadow-lg: 0 24px 60px rgba(13, 31, 70, 0.13);
  --shadow-md: 0 14px 32px rgba(13, 31, 70, 0.09);

  background:
    radial-gradient(circle at top left, rgba(64, 104, 200, 0.10), transparent 28%),
    radial-gradient(circle at bottom right, rgba(90, 130, 215, 0.07), transparent 24%),
    linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 48%, var(--bg-3) 100%);
}

/* ── Glass panels ──────────────────────────────────────────────────────── */
body.light-mode .glass-panel {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.88),
    rgba(255, 255, 255, 0.76)
  );
}

body.light-mode .glass-inner {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.82),
    rgba(255, 255, 255, 0.68)
  );
  border-color: rgba(13, 31, 70, 0.10);
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
body.light-mode .ghost-btn {
  background: rgba(13, 31, 70, 0.06);
  border-color: rgba(13, 31, 70, 0.13);
}

body.light-mode .ghost-btn:hover:not(:disabled) {
  background: rgba(13, 31, 70, 0.10);
}

body.light-mode .ghost-btn--reveal:hover:not(:disabled),
body.light-mode .ghost-btn--reveal:focus-visible {
  background: rgba(13, 31, 70, 0.10);
  border-color: rgba(13, 31, 70, 0.18);
  box-shadow: 0 10px 24px rgba(13, 31, 70, 0.10);
}

body.light-mode .status-pill {
  background: rgba(13, 31, 70, 0.05);
  border-color: rgba(13, 31, 70, 0.09);
}

body.light-mode .ghost-btn.status-pill:hover:not(:disabled) {
  background: rgba(13, 31, 70, 0.08);
}

body.light-mode .prompt-chip {
  background: rgba(13, 31, 70, 0.06);
  border-color: rgba(13, 31, 70, 0.12);
}

body.light-mode .prompt-chip:hover:not(:disabled) {
  background: rgba(13, 31, 70, 0.10);
}

/* ── Chat bubbles ──────────────────────────────────────────────────────── */
body.light-mode .bubble {
  background: rgba(255, 255, 255, 0.70);
  border-color: rgba(13, 31, 70, 0.10);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

body.light-mode .message.user .bubble {
  background: rgba(37, 84, 172, 0.09);
  border-color: rgba(37, 84, 172, 0.18);
}

body.light-mode .assistant-avatar {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(37, 84, 172, 0.18);
}

body.light-mode .user-avatar {
  background: rgba(37, 84, 172, 0.20);
  border-color: rgba(37, 84, 172, 0.22);
}

body.light-mode .bubble-text small {
  color: rgba(8, 18, 38, 0.50);
}

body.light-mode .bubble-text code {
  background: rgba(37, 84, 172, 0.08);
  border-color: rgba(37, 84, 172, 0.18);
  color: rgba(37, 84, 172, 0.88);
}

/* ── Message actions ───────────────────────────────────────────────────── */
body.light-mode .feedback-btn:hover {
  background: rgba(13, 31, 70, 0.07);
  color: var(--text-soft);
  border-color: rgba(13, 31, 70, 0.12);
}

body.light-mode .feedback-group {
  border-left-color: rgba(13, 31, 70, 0.14);
}

body.light-mode .bookmark-star-btn:hover:not(.is-bookmarked) {
  background: rgba(13, 31, 70, 0.07);
  color: var(--text-soft);
  border-color: rgba(13, 31, 70, 0.12);
}

body.light-mode .tts-btn:hover:not(.is-speaking) {
  background: rgba(13, 31, 70, 0.07);
  color: var(--text-soft);
  border-color: rgba(13, 31, 70, 0.12);
}

body.light-mode .message-edit-btn:hover {
  background: rgba(13, 31, 70, 0.07);
}

body.light-mode .idle-prompt {
  background: rgba(13, 31, 70, 0.05);
  border-color: rgba(13, 31, 70, 0.12);
}

/* ── Source chips ──────────────────────────────────────────────────────── */
body.light-mode .source-chip {
  background: rgba(13, 31, 70, 0.07);
  border-color: rgba(13, 31, 70, 0.13);
  color: var(--text-soft);
}

/* ── Tag chips ─────────────────────────────────────────────────────────── */
body.light-mode .tag-chip {
  background: rgba(13, 31, 70, 0.06);
  border-color: rgba(13, 31, 70, 0.10);
}

body.light-mode .detail-card {
  background: rgba(13, 31, 70, 0.04);
  border-color: rgba(13, 31, 70, 0.08);
}

/* ── Input ─────────────────────────────────────────────────────────────── */
body.light-mode #messageInput {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(13, 31, 70, 0.14);
  color: var(--text-main);
}

body.light-mode #messageInput::placeholder {
  color: rgba(13, 31, 70, 0.36);
}

body.light-mode #messageInput:focus {
  border-color: rgba(37, 84, 172, 0.36);
  box-shadow: 0 0 0 4px rgba(37, 84, 172, 0.08);
}

body.light-mode .input-wrap .send-btn {
  background: rgba(13, 31, 70, 0.08);
  border-color: rgba(13, 31, 70, 0.16);
  color: var(--text-main);
}

body.light-mode .input-wrap .send-btn:hover:not(:disabled) {
  background: rgba(13, 31, 70, 0.13);
}

/* ── Tools menu ────────────────────────────────────────────────────────── */
body.light-mode .tools-menu {
  background: rgba(244, 248, 255, 0.98);
  border-color: rgba(13, 31, 70, 0.12);
  box-shadow: 0 16px 40px rgba(13, 31, 70, 0.12), 0 2px 8px rgba(13, 31, 70, 0.07);
}

body.light-mode .tools-menu__item:hover,
body.light-mode .tools-menu__item:focus-visible {
  background: rgba(13, 31, 70, 0.07);
}

/* ── Prompt history dropdown ───────────────────────────────────────────── */
body.light-mode .prompt-history-list {
  background: rgba(244, 248, 255, 0.98);
  border-color: rgba(13, 31, 70, 0.12);
  box-shadow: 0 16px 40px rgba(13, 31, 70, 0.14);
}

body.light-mode .prompt-history-item {
  color: var(--text-soft);
}

body.light-mode .prompt-history-item:hover,
body.light-mode .prompt-history-item.is-focused {
  background: rgba(13, 31, 70, 0.07);
  color: var(--text-main);
}

/* ── Storyteller skeleton lines ────────────────────────────────────────── */
body.light-mode .story-line {
  background: rgba(13, 31, 70, 0.07);
  border-color: rgba(13, 31, 70, 0.09);
}

body.light-mode .story-line::before {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(13, 31, 70, 0.07) 30%,
    rgba(37, 84, 172, 0.12) 50%,
    rgba(13, 31, 70, 0.07) 70%,
    transparent 100%
  );
}

/* ── Storyteller select ────────────────────────────────────────────────── */
body.light-mode .storyteller-select {
  background: transparent;
  color: var(--text-main);
}

/* ── Scrollbars ────────────────────────────────────────────────────────── */
body.light-mode .sidebar-scroll::-webkit-scrollbar-thumb,
body.light-mode .chat-window::-webkit-scrollbar-thumb {
  background: rgba(13, 31, 70, 0.18);
}

/* ── Consent modal ─────────────────────────────────────────────────────── */
body.light-mode .consent-modal__backdrop {
  background: rgba(190, 210, 240, 0.72);
}

/* ── Alert / error banner ──────────────────────────────────────────────── */
body.light-mode .alert-banner {
  background: rgba(200, 45, 45, 0.07);
  border-color: rgba(190, 45, 45, 0.20);
}

/* ── Shortcuts overlay ─────────────────────────────────────────────────── */
body.light-mode .shortcuts-overlay__backdrop {
  background: rgba(190, 210, 240, 0.70);
}

body.light-mode .shortcuts-overlay__panel {
  background: rgba(244, 248, 255, 0.98) !important;
  border: 1px solid rgba(13, 31, 70, 0.12);
}

body.light-mode .shortcuts-overlay__close:hover {
  background: rgba(13, 31, 70, 0.07);
}

body.light-mode .shortcut-row:hover {
  background: rgba(13, 31, 70, 0.04);
}

body.light-mode .shortcut-key {
  background: rgba(13, 31, 70, 0.07);
  border-color: rgba(13, 31, 70, 0.18);
}

/* ── Bookmarks panel ───────────────────────────────────────────────────── */
body.light-mode .bookmarks-panel__backdrop {
  background: rgba(190, 210, 240, 0.60);
}

body.light-mode .bookmarks-panel__inner {
  background: rgba(244, 248, 255, 0.99) !important;
  border-color: rgba(13, 31, 70, 0.12) !important;
  border-bottom: none !important;
  box-shadow: -6px 0 28px rgba(13, 31, 70, 0.10) !important;
}

body.light-mode .bookmarks-panel__header {
  border-bottom-color: rgba(13, 31, 70, 0.09);
}

body.light-mode .bookmark-item {
  border-color: rgba(13, 31, 70, 0.09);
}

body.light-mode .bookmark-item:hover {
  background: rgba(13, 31, 70, 0.04);
}

/* ── Chat search ───────────────────────────────────────────────────────── */
body.light-mode .chat-search-bar {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(13, 31, 70, 0.14);
}

body.light-mode .chat-search-input {
  background: transparent;
  color: var(--text-main);
}

body.light-mode .chat-search-input::placeholder {
  color: rgba(13, 31, 70, 0.36);
}


/* ── Tools menu: colored icon boxes ───────────────────────────────────── */
body.light-mode .menu-icon--red,
body.light-mode .menu-icon--blue,
body.light-mode .menu-icon--green,
body.light-mode .menu-icon--purple,
body.light-mode .menu-icon--amber,
body.light-mode .menu-icon--teal {
  background: rgba(13, 31, 70, 0.07);
  border: 1px solid rgba(13, 31, 70, 0.14);
  color: rgba(13, 31, 70, 0.65);
}

body.light-mode .tools-menu__divider {
  background: rgba(13, 31, 70, 0.09);
}

body.light-mode .tools-menu__kbd {
  border-color: rgba(13, 31, 70, 0.16);
  color: var(--text-muted);
}

body.light-mode #clearChatBtn.tools-menu__item:hover:not(:disabled) {
  background: rgba(160, 30, 30, 0.10);
  color: rgba(160, 30, 30, 0.88);
}

/* ── Open for networking / meta chips ──────────────────────────────────── */
body.light-mode .meta-chip {
  background: rgba(13, 31, 70, 0.06);
  border-color: rgba(13, 31, 70, 0.13);
}

/* ── Social links: icon boxes and rows ─────────────────────────────────── */
body.light-mode .link-icon--teal,
body.light-mode .link-icon--blue,
body.light-mode .link-icon--purple,
body.light-mode .link-icon--green,
body.light-mode .link-icon--amber {
  background: rgba(13, 31, 70, 0.07);
  border: 1px solid rgba(13, 31, 70, 0.14);
  color: rgba(13, 31, 70, 0.65);
}

body.light-mode .link-list a {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(13, 31, 70, 0.10);
}

body.light-mode .link-list a:hover {
  background: rgba(255, 255, 255, 0.80);
}

/* ── Source references (storyteller + chat) ────────────────────────────── */
body.light-mode .source-refs-row {
  border-top-color: rgba(13, 31, 70, 0.09);
}

body.light-mode .source-chip {
  background: rgba(13, 31, 70, 0.08);
  border-color: rgba(13, 31, 70, 0.16);
  color: var(--text-soft);
}

/* ── Toast notifications ───────────────────────────────────────────────── */
body.light-mode .toast {
  background: rgba(244, 248, 255, 0.97);
  border-color: rgba(13, 31, 70, 0.14);
  color: var(--text-main);
  box-shadow: 0 14px 32px rgba(13, 31, 70, 0.14);
}

/* ── Chat search bar ───────────────────────────────────────────────────── */
body.light-mode .chat-search-bar {
  background: rgba(232, 240, 252, 0.90);
  border-bottom-color: rgba(13, 31, 70, 0.09);
}

body.light-mode .chat-search-bar__inner {
  background: rgba(255, 255, 255, 0.65);
  border-color: rgba(13, 31, 70, 0.12);
}

/* ── Storyteller toolbar: dropdown wrap ────────────────────────────────── */
body.light-mode .storyteller-select-wrap {
  background: rgba(13, 31, 70, 0.06);
  border-color: rgba(13, 31, 70, 0.13);
  color: var(--text-soft);
}

/* ── Chat progress bar ─────────────────────────────────────────────────── */
body.light-mode .chat-progress-bar__fill {
  background: linear-gradient(90deg, rgba(37, 84, 172, 0.65), rgba(80, 140, 255, 0.40));
}

/* ── Consent banner (bottom strip) ────────────────────────────────────── */
body.light-mode .consent-banner {
  background: rgba(244, 248, 255, 0.97);
  border-color: rgba(13, 31, 70, 0.12);
  box-shadow: 0 -8px 24px rgba(13, 31, 70, 0.08);
}

/* ── Message bubble glow on reveal ────────────────────────────────────── */
body.light-mode .message--revealing .bubble {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.90);
}

/* ── Feedback group divider ────────────────────────────────────────────── */
body.light-mode .feedback-group {
  border-left-color: rgba(13, 31, 70, 0.14);
}

/* ── Email export modal ────────────────────────────────────────────────── */
body.light-mode .email-export-modal__icon {
  background: rgba(13, 31, 70, 0.06);
  border-color: rgba(13, 31, 70, 0.12);
  color: rgba(13, 31, 70, 0.55);
}

body.light-mode .email-export-modal__input {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(13, 31, 70, 0.14);
}

body.light-mode .email-export-modal__input::placeholder {
  color: rgba(13, 31, 70, 0.36);
}

body.light-mode .email-export-modal__input:focus {
  border-color: rgba(37, 84, 172, 0.36);
  background: rgba(255, 255, 255, 0.90);
}

body.light-mode .email-export-modal__send {
  background: rgba(13, 31, 70, 0.07);
  border-color: rgba(13, 31, 70, 0.15);
}

body.light-mode .email-export-modal__send:hover:not(:disabled) {
  background: rgba(13, 31, 70, 0.12);
}

/* ── Status pill icon: default (no tone) ───────────────────────────────── */
body.light-mode .status-pill__icon-fa {
  color: rgba(13, 31, 70, 0.38);
}

/* ── Storyteller "based on context" meta text ──────────────────────────── */
body.light-mode .storyteller-content small {
  color: rgba(13, 31, 70, 0.50);
}

/* ── Pull-to-refresh indicator ─────────────────────────────────────────── */
body.light-mode .ptr-indicator {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(13, 31, 70, 0.13);
}

/* ── Scroll-to-bottom button ───────────────────────────────────────────── */
body.light-mode .scroll-bottom-btn {
  color: #ffffff;
  border-color: rgba(37, 84, 172, 0.35);
}

/* ── Confidence pills: readable in light mode ──────────────────────────── */
body.light-mode .confidence-pill--high {
  background: rgba(22, 163, 74, 0.09);
  border-color: rgba(22, 163, 74, 0.28);
  color: rgb(21, 128, 61);
}

body.light-mode .confidence-pill--medium {
  background: rgba(180, 130, 10, 0.10);
  border-color: rgba(180, 130, 10, 0.28);
  color: rgb(146, 100, 8);
}

body.light-mode .confidence-pill--low {
  background: rgba(185, 28, 28, 0.09);
  border-color: rgba(185, 28, 28, 0.26);
  color: rgb(153, 27, 27);
}

/* ── Timestamp tooltip ─────────────────────────────────────────────────── */
body.light-mode .message-timestamp::after {
  background: rgba(244, 248, 255, 0.98);
  border-color: rgba(13, 31, 70, 0.14);
  color: var(--text-soft);
}

/* ── Copied state in light mode ────────────────────────────────────────── */
body.light-mode .message-copy-btn.is-copied {
  color: rgb(22, 128, 70);
  border-color: rgba(22, 128, 70, 0.30);
  background: rgba(22, 128, 70, 0.09);
}

/* ── Focus ring ────────────────────────────────────────────────────────── */
body.light-mode :is(
  .ghost-btn,
  .prompt-chip,
  .send-btn,
  .link-list a,
  #messageInput,
  .chat-window,
  .skip-link,
  .feedback-btn,
  .message-copy-btn,
  .bookmark-star-btn,
  .tts-btn,
  .message-edit-btn,
  .consent-action-btn,
  .bookmarks-panel__close,
  .scroll-bottom-btn
):focus-visible {
  outline-color: rgba(37, 84, 172, 0.70);
}

/* ── High-contrast override: disable light-mode background ─────────────── */
body.light-mode.high-contrast {
  --bg-1: #ffffff;
  --bg-2: #f5f7fc;
  --bg-3: #edf0f8;
  --text-main: #000000;
  --text-soft: rgba(0, 0, 0, 0.90);
  --text-muted: rgba(0, 0, 0, 0.70);
  --glass-border: rgba(0, 0, 0, 0.35);
}

/* ── Chat form top separator ───────────────────────────────────────────── */
body.light-mode .chat-form {
  border-top-color: rgba(13, 31, 70, 0.08);
}

/* ── Consent modal inner elements ──────────────────────────────────────── */
body.light-mode .consent-check {
  background: rgba(13, 31, 70, 0.05);
  border-color: rgba(13, 31, 70, 0.10);
}

body.light-mode .consent-action-btn.send-btn {
  background: linear-gradient(180deg, var(--primary-strong), var(--primary));
  border-color: rgba(37, 84, 172, 0.30);
  color: #fff;
}

body.light-mode .consent-action-btn:not(.send-btn) {
  background: rgba(13, 31, 70, 0.07);
  border-color: rgba(13, 31, 70, 0.14);
}

body.light-mode .consent-action-btn:hover:not(:disabled) {
  background: rgba(13, 31, 70, 0.11);
  border-color: rgba(13, 31, 70, 0.20);
}

body.light-mode .turnstile-wrap {
  background: rgba(13, 31, 70, 0.04);
  border-color: rgba(13, 31, 70, 0.09);
}

/* ── Active feedback like/dislike buttons ──────────────────────────────── */
body.light-mode .feedback-btn--like.is-active,
body.light-mode .feedback-btn--like[aria-pressed="true"] {
  background: rgba(22, 163, 74, 0.10);
  border-color: rgba(22, 163, 74, 0.28);
  color: rgb(21, 128, 61);
}

body.light-mode .feedback-btn--dislike.is-active,
body.light-mode .feedback-btn--dislike[aria-pressed="true"] {
  background: rgba(185, 28, 28, 0.09);
  border-color: rgba(185, 28, 28, 0.26);
  color: rgb(153, 27, 27);
}

/* ── Feedback follow-up inline form ────────────────────────────────────── */
body.light-mode .feedback-followup {
  background: rgba(13, 31, 70, 0.04);
  border-color: rgba(13, 31, 70, 0.09);
}

body.light-mode .feedback-followup__input {
  background: rgba(255, 255, 255, 0.70);
  border-color: rgba(13, 31, 70, 0.14);
}

body.light-mode .feedback-followup__input::placeholder {
  color: rgba(13, 31, 70, 0.36);
}

body.light-mode .feedback-followup__input:focus {
  border-color: rgba(37, 84, 172, 0.36);
  background: rgba(255, 255, 255, 0.90);
}

/* ── Voice button hover ────────────────────────────────────────────────── */
body.light-mode .voice-btn:hover {
  background: rgba(13, 31, 70, 0.06);
}

/* ── Bookmarked star state in light mode ───────────────────────────────── */
body.light-mode .bookmark-star-btn.is-bookmarked {
  background: rgba(200, 145, 10, 0.12);
  border-color: rgba(200, 145, 10, 0.30);
}

/* ── Theme toggle button active state ──────────────────────────────────── */
#themeModeBtn.is-active .menu-icon {
  background: rgba(255, 195, 60, 0.18);
  border-color: rgba(255, 195, 60, 0.35);
}

/* ── Offline banner ────────────────────────────────────────────────────── */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: rgba(200, 40, 40, 0.92);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-align: center;
  padding: 0.45rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  animation: slideDownFadeIn 0.22s ease;
}

@keyframes slideDownFadeIn {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

body.light-mode .offline-banner {
  background: rgba(180, 30, 30, 0.90);
}

/* ── Streaming message (real SSE content + typewriter cursor) ──────────── */
.bubble-text--streaming {
  white-space: pre-wrap;
}

.message--streaming .bubble-text::after {
  content: "▍";
  display: inline-block;
  animation: cursorBlink 0.7s step-end infinite;
  opacity: 0.7;
  margin-left: 1px;
  font-size: 0.9em;
  vertical-align: baseline;
}

@keyframes cursorBlink {
  0%, 100% { opacity: 0.7; }
  50%       { opacity: 0; }
}

/* ── Light-mode tooltip override ────────────────────────────────────────── */
body.light-mode [data-tooltip]::after {
  background: rgba(14, 22, 46, 0.92);
  border-color: rgba(13, 31, 70, 0.18);
  color: rgba(255, 255, 255, 0.95);
}
