/* ==========================================================================
   Библейский помощник · jw.org — Minimalist ChatGPT Layout + JW Library Warmth
   Designed for Jehovah's Witnesses (Personal Study, Meetings, Family Worship)
   ========================================================================== */

:root {
  --bg-main: #ffffff;
  --bg-sidebar: #f7f8fa;
  --bg-surface: #f1f3f7;
  --bg-surface-hover: #e7ebf2;
  --bg-card: #ffffff;
  --text-primary: #141619;
  --text-secondary: #4e5562;
  --text-muted: #7c8494;
  --border-subtle: rgba(20, 22, 25, 0.08);
  --border-strong: rgba(20, 22, 25, 0.15);
  /* JW.ORG Sanctuary Blue & JW Library Study Accent */
  --accent: #3b629b;
  --accent-hover: #2d4e7e;
  --accent-soft: rgba(59, 98, 155, 0.09);
  --btn-send-bg: #3b629b;
  --btn-send-fg: #ffffff;
  --quote-border: #3b629b;
  --quote-bg: #f6f8fc;
  --shadow-composer: 0 2px 14px rgba(20, 22, 25, 0.06);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Noto Serif", "PT Serif", "Times New Roman", serif;
}

html[data-theme="dark"] {
  --bg-main: #1d1e22;
  --bg-sidebar: #151619;
  --bg-surface: #282a30;
  --bg-surface-hover: #32353d;
  --bg-card: #24262c;
  --text-primary: #eceef2;
  --text-secondary: #b0b6c3;
  --text-muted: #828997;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --accent: #7da6e0;
  --accent-hover: #9bc0f5;
  --accent-soft: rgba(125, 166, 224, 0.14);
  --btn-send-bg: #5882c1;
  --btn-send-fg: #ffffff;
  --quote-border: #6c96d4;
  --quote-bg: rgba(125, 166, 224, 0.07);
  --shadow-composer: 0 4px 20px rgba(0, 0, 0, 0.32);
}

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

html,
body {
  height: 100%;
  width: 100%;
  background: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ==========================================================================
   Layout Shell
   ========================================================================== */
.chat-layout {
  position: relative;
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 24, 0.46);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 45;
  transition: opacity 0.2s ease;
}

.sidebar-backdrop[hidden] {
  display: none !important;
}

/* ==========================================================================
   Left Sidebar (ChatGPT 264px rail)
   ========================================================================== */
.sidebar {
  width: 264px;
  min-width: 264px;
  height: 100%;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 10px 10px 12px;
  transition: margin-left 0.22s cubic-bezier(0.22, 1, 0.36, 1), transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
  z-index: 50;
}

.chat-layout.sidebar-collapsed .sidebar,
.sidebar.is-collapsed {
  margin-left: -264px;
  opacity: 0;
  pointer-events: none;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.new-chat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
  margin-bottom: 6px;
}

.new-chat-row:hover {
  background: var(--bg-surface-hover);
}

.new-chat-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar-quick-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.quick-resource-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.quick-resource-link:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.quick-resource-arrow {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.sidebar-history {
  flex: 1;
  overflow-y: auto;
  padding: 0 2px;
}

.history-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px 6px;
}

.history-section-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
}

.history-clear-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.12s ease, color 0.12s ease;
}

.history-clear-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.history-clear-btn[hidden] {
  display: none !important;
}

.session-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.session-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: 8px;
}

.session-row:hover {
  background: var(--bg-surface-hover);
}

.session-item-btn,
.session-item {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-primary);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.87rem;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background 0.12s ease;
}

.session-item-btn:hover,
.session-item:hover {
  background: var(--bg-surface-hover);
}

.session-item-btn.is-active,
.session-item.is-active {
  background: var(--bg-surface);
  font-weight: 500;
}

.session-delete-btn {
  opacity: 0.72;
  border: none;
  background: transparent;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  margin-right: 4px;
  transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.session-row:hover .session-delete-btn,
.session-delete-btn:focus-visible {
  opacity: 1;
}

.session-delete-btn:hover {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
}

.sidebar-footer {
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lang-segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-surface);
  padding: 3px;
  border-radius: 9px;
}

.lang-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 6px 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-btn.is-active {
  background: var(--bg-main);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.88rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.user-profile-btn:hover {
  background: var(--bg-surface-hover);
}

.user-avatar-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-surface);
  color: var(--text-secondary);
}

.user-profile-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Main Chat Area
   ========================================================================== */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  background: var(--bg-main);
}

.topbar {
  height: 54px;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 18px;
  border-bottom: 1px solid transparent;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.chat-layout:not(.sidebar-collapsed) #btn-open-sidebar {
  display: none;
}

.model-title-group {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 2px 6px;
  border-radius: 8px;
  min-width: 0;
  overflow: hidden;
}

.model-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: nowrap;
}

.model-title {
  font-size: clamp(0.92rem, 1.5vw, 1.02rem);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unofficial-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: rgba(217, 119, 6, 0.14);
  color: #b45309;
  border: 1px solid rgba(217, 119, 6, 0.36);
  white-space: nowrap;
  flex-shrink: 0;
}

[data-theme="dark"] .unofficial-badge {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.42);
}

.model-subtitle {
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.delete-chat-top-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.delete-chat-top-btn:hover {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.35);
  color: #dc2626;
}

.delete-chat-top-btn[hidden] {
  display: none !important;
}

@media (max-width: 640px) {
  .delete-chat-top-label {
    display: none;
  }
  .delete-chat-top-btn {
    padding: 6px 8px;
  }
}

.topbar-lang-segmented {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface);
  padding: 2px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
}

.topbar-lang-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.topbar-lang-btn.is-active {
  background: var(--bg-main);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   Scrollable Conversation Area (Centered reading column)
   ========================================================================== */
.chat-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 18px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.chat-center-column {
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* Empty State (Centered Study Hub for Brothers & Sisters) */
.empty-state {
  margin: auto 0;
  padding: 28px 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.empty-state[hidden] {
  display: none !important;
}

.empty-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.empty-headline {
  font-size: clamp(1.22rem, 2.6vw, 1.65rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.empty-subtext {
  max-width: 40rem;
  font-size: clamp(0.86rem, 1.4vw, 0.94rem);
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.55;
}

/* Quick Scripture Reader Bar */
.verse-quick-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 16px;
}

.verse-quick-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-right: 4px;
}

.verse-quick-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.verse-pill-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 4px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.verse-pill-btn:hover,
.verse-pill-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

/* Inline Bilingual Scripture Preview Card */
.verse-preview-card {
  width: 100%;
  text-align: left;
  background: var(--quote-bg);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--quote-border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.verse-preview-card[hidden] {
  display: none !important;
}

.verse-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.verse-preview-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
}

.verse-preview-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}

.verse-preview-close:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.verse-preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.verse-preview-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.verse-preview-edition {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
}

.verse-preview-text {
  font-family: var(--font-serif);
  font-size: 0.94rem;
  line-height: 1.62;
  color: var(--text-primary);
}

.verse-study-notes {
  padding-top: 8px;
  border-top: 1px dashed var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.verse-study-notes-title {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--accent);
}

.verse-study-note-item {
  font-size: 0.83rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.verse-preview-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8rem;
}

.verse-preview-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.verse-ask-btn {
  border: none;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.verse-ask-btn:hover {
  background: var(--accent-hover);
}

/* Suggestion Scenario Grid */
.suggestion-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.suggestion-pill {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.suggestion-pill:hover {
  background: var(--bg-sidebar);
  border-color: var(--border-strong);
}

.suggestion-category {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--accent);
}

.suggestion-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.suggestion-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* ==========================================================================
   Messages Stream (Clean ChatGPT User Bubbles & Editorial Assistant Prose)
   ========================================================================== */
.messages-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 20px 0 36px;
}

.msg-row {
  display: flex;
  width: 100%;
}

.msg-row-user,
.msg-user-wrap {
  display: flex;
  width: 100%;
  justify-content: flex-end;
}

.user-bubble,
.msg-user-bubble {
  max-width: 78%;
  background: var(--bg-surface);
  color: var(--text-primary);
  padding: 11px 18px;
  border-radius: 22px;
  font-size: 0.98rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-user-mode-badge {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
}

.msg-row-assistant,
.msg-assistant-wrap {
  display: flex;
  width: 100%;
  align-items: flex-start;
  gap: 14px;
}

.assistant-avatar,
.msg-avatar {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  margin-top: 2px;
}

.assistant-body,
.msg-content {
  flex: 1;
  min-width: 0;
  font-size: 0.98rem;
  line-height: 1.68;
  color: var(--text-primary);
}

/* Assistant Prose Formatting */
.assistant-prose,
.msg-prose {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.assistant-prose p,
.msg-prose p {
  margin: 0;
}

.assistant-prose h3,
.msg-prose h3 {
  font-size: 1.04rem;
  font-weight: 600;
  margin: 4px 0 0;
}

.assistant-prose ul,
.assistant-prose ol,
.msg-prose ul,
.msg-prose ol {
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Verbatim Scripture & Publication Blockquotes in Book Serif */
.assistant-prose blockquote,
.msg-prose blockquote {
  border-left: 3px solid var(--quote-border);
  background: var(--quote-bg);
  padding: 11px 16px;
  border-radius: 0 10px 10px 0;
  color: var(--text-primary);
  font-family: var(--font-serif);
  font-size: 0.97rem;
  line-height: 1.68;
}

.assistant-prose strong,
.msg-prose strong {
  font-weight: 600;
}

.refusal-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px 16px;
  border-radius: 14px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

/* Verified Official Sources Bar Below Assistant Answer */
.sources-section {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sources-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
}

.sources-chip-row,
.sources-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
  color: var(--text-secondary);
  font-size: 0.79rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.source-chip:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

.verse-compare-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.verse-compare-chip:hover {
  background: var(--accent);
  color: #ffffff;
}

.quote-item-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.quote-item-secondary-link {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.typing-status-text {
  margin-left: 6px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.source-chip-domain,
.source-chip-arrow {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.btn-toggle-quotes,
.quotes-toggle-btn {
  align-self: flex-start;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.btn-toggle-quotes:hover,
.quotes-toggle-btn:hover {
  background: var(--accent-soft);
}

.expanded-quotes-list,
.quotes-drawer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.expanded-quotes-list[hidden],
.quotes-drawer[hidden] {
  display: none !important;
}

.quote-source-card,
.quote-item {
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--quote-border);
  background: var(--quote-bg);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
}

.quote-source-title,
.quote-item-header {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.quote-item-body {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-primary);
}

/* Typing indicator */
.typing-dots,
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 10px 4px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulseDot 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes pulseDot {
  0%, 80%, 100% {
    opacity: 0.3;
    transform: scale(0.85);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ==========================================================================
   Bottom Floating Composer (ChatGPT pill input)
   ========================================================================== */
.composer-area {
  padding: 8px 18px 16px;
  background: var(--bg-main);
}

.composer-center {
  max-width: 48rem;
  margin: 0 auto;
}

.composer-box {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 26px;
  padding: 10px 12px 10px 18px;
  box-shadow: var(--shadow-composer);
  transition: border-color 0.15s ease;
}

.composer-box:focus-within {
  border-color: var(--accent);
}

.composer-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  resize: none;
  max-height: 180px;
  font-size: 0.98rem;
  line-height: 1.5;
  padding: 3px 0;
  color: var(--text-primary);
}

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

.composer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.composer-char-counter {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  user-select: none;
  padding-right: 2px;
}

.composer-char-counter.is-near-limit {
  color: #d97706;
  font-weight: 600;
}

.send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--btn-send-bg);
  color: var(--btn-send-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.send-btn:hover {
  opacity: 0.9;
}

.send-btn:disabled {
  opacity: 0.32;
  cursor: default;
}

.composer-caption {
  margin-top: 8px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Minimal Modal
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-dialog {
  width: 100%;
  max-width: 400px;
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-title {
  font-size: 1.08rem;
  font-weight: 600;
}

.modal-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-surface);
  padding: 3px;
  border-radius: 10px;
  margin-bottom: 16px;
}

.modal-tab {
  border: none;
  background: transparent;
  padding: 7px;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}

.modal-tab.is-active {
  background: var(--bg-main);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-form[hidden] {
  display: none !important;
}

.field-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.field-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-main);
  font-size: 0.92rem;
  outline: none;
}

.field-input:focus {
  border-color: var(--accent);
}

.primary-btn {
  margin-top: 6px;
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background: var(--btn-send-bg);
  color: var(--btn-send-fg);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
}

.auth-feedback {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-surface);
  font-size: 0.84rem;
  color: var(--text-primary);
}

/* ==========================================================================
   Elderly-Friendly Large Font Mode (А+ Крупный шрифт)
   ========================================================================== */
.font-scale-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.font-scale-btn:hover,
.font-scale-btn.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

body.elderly-font-mode {
  font-size: 19px;
}

body.elderly-font-mode .assistant-prose,
body.elderly-font-mode .msg-prose {
  font-size: 1.18rem;
  line-height: 1.82;
}

body.elderly-font-mode .assistant-prose blockquote,
body.elderly-font-mode .msg-prose blockquote,
body.elderly-font-mode .verse-preview-text {
  font-size: 1.16rem;
  line-height: 1.8;
}

body.elderly-font-mode .user-bubble {
  font-size: 1.14rem;
  line-height: 1.65;
}

body.elderly-font-mode .composer-input {
  font-size: 1.16rem;
  line-height: 1.6;
}

body.elderly-font-mode .suggestion-title {
  font-size: 1.08rem;
}

body.elderly-font-mode .suggestion-desc,
body.elderly-font-mode .task-mode-chip,
body.elderly-font-mode .followup-chip,
body.elderly-font-mode .source-chip {
  font-size: 0.96rem;
}

body.elderly-font-mode .voice-mic-btn {
  padding: 9px 16px;
  font-size: 1rem;
}

/* ==========================================================================
   Theocratic Task Mode Selector Pills (Above Composer)
   ========================================================================== */
.task-mode-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 9px;
  padding: 0 4px;
}

.task-mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
  color: var(--text-secondary);
  font-size: 0.81rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.task-mode-chip:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.task-mode-chip.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

/* ==========================================================================
   Voice Dictation Controls & Live Recording Banner (RU / KK)
   ========================================================================== */
.voice-control-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 4px;
}

.voice-lang-pill {
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-main);
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.voice-lang-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.voice-mic-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-main);
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.voice-mic-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.voice-mic-btn.is-recording {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
  animation: pulseVoiceBtn 1.3s infinite ease-in-out;
}

@keyframes pulseVoiceBtn {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(220, 38, 38, 0);
  }
}

.voice-status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 10px 16px;
  border-radius: 14px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
}

.voice-status-banner[hidden] {
  display: none !important;
}

.voice-status-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.voice-pulse-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #dc2626;
  flex-shrink: 0;
  animation: pulseDot 1s infinite ease-in-out;
}

.voice-stop-btn {
  padding: 6px 14px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

/* ==========================================================================
   ChatGPT-Style Follow-Up Action Chips Below Assistant Responses
   ========================================================================== */
.followup-actions-bar {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.followup-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-main);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.followup-chip:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

/* ==========================================================================
   Multi-Resolution Responsive Architecture
   (Ultra-Wide 2K/4K · Desktop · Tablet/iPad · Mobile Phones · Small 320px)
   ========================================================================== */

/* 1. Large Desktops & MacBooks (1440px+) */
@media (min-width: 1440px) {
  .sidebar {
    width: 280px;
    min-width: 280px;
  }

  .chat-layout.sidebar-collapsed .sidebar,
  .sidebar.is-collapsed {
    margin-left: -280px;
  }

  .chat-center-column,
  .composer-center {
    max-width: 55rem;
  }

  .suggestion-grid {
    gap: 12px;
  }
}

/* 2. Ultra-Wide & 2K/4K Displays (1800px+) */
@media (min-width: 1800px) {
  .sidebar {
    width: 296px;
    min-width: 296px;
  }

  .chat-layout.sidebar-collapsed .sidebar,
  .sidebar.is-collapsed {
    margin-left: -296px;
  }

  .chat-center-column,
  .composer-center {
    max-width: 62rem;
  }

  .chat-scroll {
    padding: 0 32px;
  }

  .assistant-prose,
  .msg-prose {
    font-size: 1.04rem;
  }
}

/* 3. Tablets & iPads (<= 1024px: Off-Canvas Drawer Sidebar + Full-Width Stage) */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(84vw, 290px);
    min-width: 0;
    margin-left: 0 !important;
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.22);
  }

  .chat-layout.sidebar-collapsed .sidebar,
  .sidebar.is-collapsed {
    transform: translateX(-105%);
    opacity: 0;
    pointer-events: none;
  }

  .chat-layout:not(.sidebar-collapsed) #btn-open-sidebar {
    display: inline-flex;
  }

  .chat-scroll {
    padding: 0 20px;
  }

  .composer-area {
    padding: 8px 20px calc(14px + env(safe-area-inset-bottom, 0px));
  }
}

/* 4. Tablet Portrait & Large Phones (<= 768px) */
@media (max-width: 768px) {
  .topbar {
    height: 52px;
    min-height: 52px;
    padding: 0 12px;
    border-bottom: 1px solid var(--border-subtle);
  }

  .model-subtitle {
    display: none;
  }

  .suggestion-grid,
  .verse-preview-grid {
    grid-template-columns: 1fr;
  }

  .verse-preview-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .verse-ask-btn {
    width: 100%;
    text-align: center;
  }

  .user-bubble,
  .msg-user-bubble {
    max-width: 88%;
  }

  .empty-state {
    padding: 20px 0 18px;
  }
}

/* 5. Mobile Smartphones (<= 640px: Touch-Scroll Bars, iOS No-Zoom, Safe Areas) */
@media (max-width: 640px) {
  .topbar {
    height: auto;
    min-height: 52px;
    padding: calc(4px + env(safe-area-inset-top, 0px)) 10px 4px;
    gap: 6px;
  }

  .topbar-left {
    gap: 4px;
  }

  .model-title-group {
    padding: 1px 2px;
  }

  .model-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .model-title {
    font-size: 0.88rem;
    line-height: 1.2;
  }

  .unofficial-badge {
    font-size: 0.63rem;
    padding: 1px 6px;
  }

  .topbar-right {
    gap: 4px;
  }

  .topbar-lang-btn {
    padding: 4px 6px;
    font-size: 0.68rem;
  }

  .font-scale-btn {
    padding: 5px 8px;
    font-size: 0;
    white-space: nowrap;
  }

  .font-scale-btn::after {
    content: "А+";
    font-size: 0.76rem;
    font-weight: 700;
  }

  .chat-scroll {
    padding: 0 12px;
  }

  .empty-logo {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    margin-bottom: 12px;
  }

  .empty-subtext {
    margin-bottom: 14px;
  }

  /* Horizontal touch-scroll for Quick Verses on mobile */
  .verse-quick-bar {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 2px 6px;
    margin-bottom: 14px;
  }

  .verse-quick-bar::-webkit-scrollbar {
    display: none;
  }

  .verse-quick-label {
    flex-shrink: 0;
    font-size: 0.78rem;
  }

  .verse-quick-pills {
    flex-wrap: nowrap;
    justify-content: flex-start;
    flex-shrink: 0;
  }

  .verse-pill-btn {
    flex-shrink: 0;
    padding: 5px 10px;
    font-size: 0.78rem;
  }

  .suggestion-pill {
    padding: 12px 14px;
    border-radius: 12px;
  }

  .messages-list {
    padding: 14px 0 20px;
    gap: 18px;
  }

  .assistant-turn,
  .msg-assistant-wrap {
    gap: 10px;
  }

  .assistant-avatar,
  .msg-avatar {
    width: 26px;
    height: 26px;
    min-width: 26px;
    margin-top: 2px;
  }

  .user-bubble,
  .msg-user-bubble {
    max-width: 92%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 0.95rem;
  }

  .assistant-prose,
  .msg-prose {
    font-size: 0.96rem;
    line-height: 1.66;
  }

  .assistant-prose blockquote,
  .msg-prose blockquote {
    padding: 10px 12px;
    font-size: 0.93rem;
  }

  /* Multi-row wrapped grid for Task Modes on mobile so all modes are visible at 375px */
  .task-mode-bar {
    flex-wrap: wrap;
    overflow-x: visible;
    margin-bottom: 7px;
    padding: 2px 0;
    gap: 5px;
  }

  .task-mode-chip {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 5px 10px;
    font-size: 0.76rem;
  }

  .composer-char-counter:not(.is-near-limit) {
    display: none;
  }

  .voice-mic-label {
    display: none;
  }

  .composer-area {
    padding: 6px 10px calc(10px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border-subtle);
  }

  .composer-box {
    padding: 8px 8px 8px 14px;
    border-radius: 22px;
    gap: 6px;
  }

  /* 16px (1rem) prevents iOS Safari automatic viewport zoom on focus */
  .composer-input,
  .field-input {
    font-size: 16px;
  }

  .voice-control-group {
    gap: 3px;
    margin-right: 2px;
  }

  .voice-lang-pill {
    padding: 5px 7px;
    font-size: 0.7rem;
  }

  .voice-mic-btn {
    padding: 6px 10px;
    font-size: 0.8rem;
    gap: 4px;
  }

  .composer-caption {
    font-size: 0.7rem;
    line-height: 1.35;
    margin-top: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .voice-status-banner {
    padding: 8px 12px;
    font-size: 0.82rem;
    flex-wrap: wrap;
    gap: 8px;
  }

  .modal-dialog {
    padding: 16px;
    border-radius: 14px;
    max-height: 90dvh;
    overflow-y: auto;
  }
}

/* 6. Compact Small Phones (<= 400px, e.g., iPhone SE / Mini / 375px) */
@media (max-width: 400px) {
  .voice-mic-label {
    display: none;
  }

  .voice-mic-btn {
    padding: 7px 9px;
  }

  .font-scale-btn {
    padding: 4px 7px;
    font-size: 0;
  }

  .font-scale-btn::after {
    content: "А+";
    font-size: 0.72rem;
    font-weight: 700;
  }

  .model-title {
    font-size: 0.85rem;
  }
}

/* 7. Mobile Landscape Orientation (Short Viewport Height <= 520px) */
@media (max-height: 520px) and (orientation: landscape) {
  .topbar {
    height: 44px;
    min-height: 44px;
  }

  .empty-logo {
    display: none;
  }

  .empty-state {
    padding: 10px 0;
  }

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

  .composer-area {
    padding: 4px 14px 6px;
  }

  .composer-caption {
    display: none;
  }
}

/* ==========================================================================
   Claude & ChatGPT Style Expandable Reasoning + Web Research Accordion
   ========================================================================== */
.reasoning-accordion {
  margin-bottom: 12px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.reasoning-accordion.is-streaming {
  border-color: var(--accent);
}

.reasoning-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.reasoning-header:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.reasoning-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
  flex-shrink: 0;
}

.reasoning-icon.is-pulsing {
  color: var(--accent);
  animation: pulseDot 1.1s infinite ease-in-out;
}

.reasoning-header-title {
  flex: 1;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reasoning-step-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.73rem;
  font-weight: 600;
  flex-shrink: 0;
}

.reasoning-chevron {
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.reasoning-body {
  padding: 6px 14px 13px 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.83rem;
  color: var(--text-secondary);
}

.reasoning-body[hidden] {
  display: none !important;
}

.reasoning-steps-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reasoning-step-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  line-height: 1.45;
}

.reasoning-step-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  margin-top: 1px;
  flex-shrink: 0;
  background: var(--accent-soft);
  color: var(--accent);
}

.reasoning-step-item.is-running .reasoning-step-dot {
  animation: pulseDot 1s infinite ease-in-out;
}

.reasoning-step-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.reasoning-step-title {
  font-weight: 600;
  color: var(--text-primary);
}

.reasoning-step-detail {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.reasoning-web-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-top: 4px;
}

.reasoning-web-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.reasoning-web-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 500;
}

.reasoning-thoughts-box {
  padding: 9px 12px;
  border-radius: 8px;
  border-left: 2px solid var(--accent);
  background: var(--bg-main);
  color: var(--text-secondary);
  font-size: 0.81rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.reasoning-thoughts-box[hidden] {
  display: none !important;
}

.msg-prose.is-streaming > *:last-child::after {
  content: "▍";
  display: inline-block;
  margin-left: 3px;
  color: var(--accent);
  animation: pulseDot 0.9s infinite ease-in-out;
}

/* ==========================================================================
   ChatGPT Advanced Voice Mode-Style Full-Duplex Live Voice Chat
   (Separate from standard Voice Dictation #btn-voice-input)
   ========================================================================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.live-voice-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, transform 0.12s ease, box-shadow 0.16s ease;
}

.live-voice-trigger-btn:hover {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(59, 98, 155, 0.25);
}

.live-voice-overlay {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: radial-gradient(circle at 50% 35%, #162338 0%, #0b111d 65%, #060911 100%);
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top, 16px) 20px env(safe-area-inset-bottom, 20px);
}

.live-voice-overlay[hidden] {
  display: none !important;
}

.live-voice-stage {
  width: 100%;
  max-width: 720px;
  height: 100%;
  max-height: 860px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
}

.live-voice-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
}

.live-voice-brand {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.live-voice-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #f8fafc;
}

.live-voice-badge {
  font-size: 0.74rem;
  font-weight: 500;
  color: #93c5fd;
  opacity: 0.9;
}

.live-voice-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-voice-select {
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f8fafc;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

.live-voice-select option {
  background: #0f172a;
  color: #f8fafc;
}

.live-voice-icon-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.live-voice-icon-close:hover {
  background: rgba(255, 255, 255, 0.18);
}

.live-voice-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  text-align: center;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 6px;
}

.live-voice-orb {
  --orb-dynamic-scale: 1;
  position: relative;
  width: 156px;
  height: 156px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transform: scale(var(--orb-dynamic-scale));
  transition: transform 0.08s linear;
  user-select: none;
}

.live-voice-orb-glow {
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.45) 0%, rgba(59, 130, 246, 0) 72%);
  animation: orbBreathe 3.2s infinite ease-in-out;
  pointer-events: none;
}

.live-voice-orb-core {
  position: relative;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  background: linear-gradient(145deg, #3b82f6 0%, #1d4ed8 55%, #1e3a8a 100%);
  box-shadow:
    0 0 42px rgba(59, 130, 246, 0.55),
    inset 0 4px 18px rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.live-voice-orb[data-orb-state="listening"] .live-voice-orb-core {
  background: linear-gradient(145deg, #38bdf8 0%, #2563eb 55%, #1e40af 100%);
  box-shadow:
    0 0 48px rgba(56, 189, 248, 0.6),
    inset 0 4px 18px rgba(255, 255, 255, 0.4);
}

.live-voice-orb[data-orb-state="searching"] .live-voice-orb-core {
  background: linear-gradient(145deg, #a855f7 0%, #6366f1 55%, #312e81 100%);
  box-shadow:
    0 0 54px rgba(168, 85, 247, 0.65),
    inset 0 4px 18px rgba(255, 255, 255, 0.4);
  animation: orbPulseFast 1.1s infinite ease-in-out;
}

.live-voice-orb[data-orb-state="speaking"] .live-voice-orb-core {
  background: linear-gradient(145deg, #60a5fa 0%, #3b82f6 50%, #1d4ed8 100%);
  box-shadow:
    0 0 64px rgba(96, 165, 250, 0.8),
    inset 0 6px 24px rgba(255, 255, 255, 0.5);
}

.live-voice-orb[data-orb-state="muted"] .live-voice-orb-core {
  background: linear-gradient(145deg, #475569 0%, #334155 60%, #1e293b 100%);
  box-shadow: 0 0 20px rgba(148, 163, 184, 0.25);
}

.live-voice-orb[data-orb-state="error"] .live-voice-orb-core {
  background: linear-gradient(145deg, #ef4444 0%, #b91c1c 65%, #7f1d1d 100%);
  box-shadow: 0 0 36px rgba(239, 68, 68, 0.55);
}

@keyframes orbBreathe {
  0%, 100% {
    transform: scale(0.95);
    opacity: 0.65;
  }
  50% {
    transform: scale(1.12);
    opacity: 1;
  }
}

@keyframes orbPulseFast {
  0%, 100% {
    transform: scale(0.96);
  }
  50% {
    transform: scale(1.06);
  }
}

.live-voice-status {
  font-size: 0.96rem;
  font-weight: 500;
  color: #cbd5e1;
  max-width: 520px;
}

.live-voice-transcripts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 600px;
  min-height: 54px;
}

.live-voice-user-transcript {
  font-size: 0.92rem;
  color: #93c5fd;
  font-style: italic;
  margin: 0;
}

.live-voice-assistant-transcript {
  font-size: 1.04rem;
  line-height: 1.58;
  color: #f8fafc;
  font-weight: 500;
  margin: 0;
}

.live-voice-grounding-tray {
  width: 100%;
  max-width: 620px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.live-voice-grounding-tray[hidden] {
  display: none !important;
}

.live-grounding-card {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-left: 3px solid #60a5fa;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.live-grounding-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.live-grounding-ref {
  font-size: 0.8rem;
  font-weight: 600;
  color: #93c5fd;
}

.live-grounding-link {
  font-size: 0.75rem;
  color: #cbd5e1;
  text-decoration: none;
}

.live-grounding-link:hover {
  color: #ffffff;
  text-decoration: underline;
}

.live-grounding-quote {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 0.88rem;
  line-height: 1.5;
  color: #f1f5f9;
}

.live-voice-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-bottom: 6px;
}

.live-voice-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.live-call-btn {
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.12s ease, opacity 0.15s ease, background 0.15s ease;
}

.live-call-btn[hidden] {
  display: none !important;
}

.live-call-btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.live-call-btn-secondary.is-muted {
  background: rgba(245, 158, 11, 0.22);
  border-color: #f59e0b;
  color: #fde68a;
}

.live-call-btn-interrupt {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.45);
}

.live-call-btn-end {
  background: #dc2626;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.4);
}

.live-voice-context-hint {
  margin: 0;
  font-size: 0.76rem;
  color: #94a3b8;
  text-align: center;
}

@media (max-width: 640px) {
  .live-voice-trigger-label {
    display: none;
  }

  .live-voice-trigger-btn {
    padding: 6px 10px;
  }

  .live-voice-orb {
    width: 132px;
    height: 132px;
  }

  .live-voice-orb-core {
    width: 108px;
    height: 108px;
  }
}
