:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --bg-accent: #e8eef8;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --surface-muted: rgba(255, 255, 255, 0.62);
  --text: #112033;
  --text-soft: #5d6b7f;
  --border: rgba(17, 32, 51, 0.09);
  --shadow: 0 18px 50px rgba(14, 23, 38, 0.10);
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --accent-2: #c58a2b;
  --accent-2-soft: rgba(197, 138, 43, 0.12);
  --focus: #2563eb;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08111d;
  --bg-accent: #0d1728;
  --surface: rgba(13, 20, 33, 0.84);
  --surface-strong: #121c2d;
  --surface-muted: rgba(18, 28, 45, 0.56);
  --text: #f3f7fc;
  --text-soft: #a9b6c8;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 18px 54px rgba(0, 0, 0, 0.36);
  --accent: #34d399;
  --accent-strong: #6ee7b7;
  --accent-soft: rgba(52, 211, 153, 0.12);
  --accent-2: #fbbf24;
  --accent-2-soft: rgba(251, 191, 36, 0.12);
  --focus: #93c5fd;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.13), transparent 26%),
    radial-gradient(circle at top right, rgba(197, 138, 43, 0.12), transparent 22%),
    linear-gradient(180deg, var(--bg), var(--bg-accent));
  font-family: "Aptos", "Segoe UI", system-ui, sans-serif;
  position: relative;
}

body.chat-lock {
  overflow: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  width: 36rem;
  height: 36rem;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  opacity: 0.28;
  z-index: -1;
}

body::before {
  top: -12rem;
  left: -10rem;
  background: rgba(15, 118, 110, 0.22);
}

body::after {
  right: -12rem;
  bottom: -14rem;
  background: rgba(197, 138, 43, 0.20);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  width: min(1600px, calc(100% - 32px));
  margin: 16px auto;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 30px;
  background: linear-gradient(180deg, var(--surface), transparent);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.brand-card,
.sidebar-panel,
.stat-card,
.topic-banner,
.qa-item,
.empty-state,
.hero-copy,
.hero-controls {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand-card {
  padding: 22px;
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(15, 118, 110, 0.12), rgba(197, 138, 43, 0.08)),
    var(--surface-strong);
}

.brand-card h1,
.hero-copy h2,
.topic-banner h3 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  letter-spacing: -0.03em;
}

.brand-card h1 {
  font-size: 2rem;
  line-height: 1;
}

.brand-kicker,
.eyebrow,
.banner-label,
.stat-label,
.sidebar-panel__header span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-soft);
}

.brand-card p,
.hero-copy p,
.sidebar-note p,
.topic-banner p,
.empty-state p {
  margin: 10px 0 0;
  color: var(--text-soft);
  line-height: 1.75;
}

.sidebar-panel {
  margin-top: 16px;
  padding: 18px;
  border-radius: 22px;
}

.sidebar-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.sidebar-panel__header h2 {
  margin: 0;
  font-size: 1rem;
}

.category-nav {
  display: grid;
  gap: 10px;
}

.category-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid transparent;
  border-radius: 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.category-btn:hover,
.category-btn:focus-visible,
.toggle-btn:hover,
.toggle-btn:focus-visible,
.secondary-btn:hover,
.secondary-btn:focus-visible,
.search-box input:focus,
.filter-box select:focus,
.translate-btn:hover,
.translate-btn:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--focus) 45%, transparent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.category-btn:hover {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--surface-strong) 92%, transparent);
}

.category-btn.is-active {
  background: linear-gradient(145deg, var(--accent-soft), transparent);
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
}

.category-btn__title {
  font-weight: 700;
}

.category-btn__count,
.banner-pill {
  flex-shrink: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-soft) 82%, transparent);
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 700;
}

.content {
  display: grid;
  gap: 18px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.hero-copy,
.hero-controls,
.stats-grid,
.topic-banner,
.question-list {
  animation: rise 0.45s ease both;
}

.hero-copy {
  padding: 28px;
  border-radius: 30px;
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.12), transparent 28%),
    linear-gradient(145deg, var(--surface-strong), var(--surface));
}

.hero-copy h2 {
  margin-top: 10px;
  font-size: clamp(1.9rem, 2.5vw, 3.5rem);
  line-height: 1.02;
}

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

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 700;
}

.hero-controls {
  display: grid;
  gap: 14px;
  padding: 22px;
  border-radius: 30px;
  background:
    linear-gradient(160deg, rgba(15, 118, 110, 0.06), transparent 40%),
    var(--surface);
}

.search-box,
.filter-box {
  display: grid;
  gap: 8px;
}

.search-box span,
.filter-box span {
  font-size: 0.9rem;
  font-weight: 700;
}

.search-box input,
.filter-box select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 15px;
  color: var(--text);
  background: var(--surface-strong);
  transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.search-box input::placeholder {
  color: var(--text-soft);
}

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

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toggle-btn,
.secondary-btn {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text);
  background: var(--surface-strong);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.toggle-btn:hover,
.secondary-btn:hover {
  transform: translateY(-1px);
}

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

.stat-card {
  padding: 18px 20px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent),
    var(--surface);
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.95rem;
  line-height: 1;
}

.topic-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
  border-radius: 24px;
  background:
    linear-gradient(120deg, rgba(15, 118, 110, 0.08), transparent 35%),
    var(--surface);
}

.topic-banner h3 {
  margin-top: 8px;
  font-size: 1.35rem;
}

.question-list {
  display: grid;
  gap: 14px;
}

.category-section {
  display: grid;
  gap: 12px;
}

.category-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 4px;
}

.category-section__header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.category-section__header p {
  margin: 6px 0 0;
  color: var(--text-soft);
}

.category-section__header span {
  flex-shrink: 0;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.category-section__items {
  display: grid;
  gap: 14px;
}

.qa-item {
  border-radius: 22px;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.qa-item:hover {
  transform: translateY(-1px);
}

.qa-item[open] {
  border-color: color-mix(in srgb, var(--accent) 26%, var(--border));
}

.qa-item summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  cursor: pointer;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 92%, transparent), var(--surface));
}

.qa-item summary::-webkit-details-marker {
  display: none;
}

.qa-item summary::after {
  content: "+";
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 1.2rem;
  line-height: 1;
}

.qa-item[open] summary::after {
  content: "-";
}

.question-title {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.5;
}

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

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 700;
}

.answer {
  padding: 0 20px 18px;
  color: var(--text-soft);
  line-height: 1.75;
}

.answer-toolbar {
  display: flex;
  justify-content: flex-start;
  margin-top: 6px;
}

.translate-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  color: var(--accent-strong);
  background:
    linear-gradient(145deg, var(--accent-soft), color-mix(in srgb, var(--accent-2-soft) 50%, transparent)),
    var(--surface-strong);
  font-weight: 700;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.translate-btn__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  line-height: 1;
  font-weight: 800;
}

.answer-text {
  margin: 12px 0 0;
}

.answer pre {
  overflow: auto;
  margin: 14px 0 0;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  color: var(--text);
  background: rgba(0, 0, 0, 0.06);
}

.practice-block {
  margin-top: 16px;
}

.practice-label {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 700;
}

.empty-state {
  padding: 36px 24px;
  border-radius: 24px;
  text-align: center;
}

.empty-state h3 {
  margin: 0;
}

.empty-state .empty-actions {
  margin-top: 18px;
}

.empty-state button {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  color: var(--text);
  background: var(--surface-strong);
}

.chat-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  width: 68px;
  height: 68px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--border));
  border-radius: 22px;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.32), transparent 34%),
    linear-gradient(135deg, #0f766e 0%, #2563eb 46%, #7c3aed 100%);
  color: #fff;
  box-shadow: 0 24px 50px rgba(37, 99, 235, 0.28);
  display: grid;
  place-items: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.chat-launcher:hover,
.chat-launcher:focus-visible {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 24px 48px rgba(37, 99, 235, 0.34);
}

.chat-launcher__dot {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.16);
}

.chat-launcher__icon {
  font-size: 0.98rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1;
}

.chat-widget {
  position: fixed;
  right: 22px;
  bottom: 98px;
  z-index: 39;
  width: min(560px, calc(100vw - 32px));
  height: min(84vh, 820px);
  max-height: min(84vh, 820px);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 34px;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.18), transparent 24%),
    radial-gradient(circle at bottom left, rgba(15, 118, 110, 0.18), transparent 26%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 92%, #0f172a), var(--surface));
  box-shadow: 0 26px 70px rgba(11, 18, 31, 0.28);
  backdrop-filter: blur(24px);
}

.chat-widget.is-open {
  display: flex;
}

.chat-widget.is-fullscreen {
  inset: 12px;
  right: 12px;
  bottom: 12px;
  width: auto;
  height: auto;
  max-height: none;
  border-radius: 34px;
}

.chat-widget__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.14), transparent 56%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 90%, transparent), transparent);
}

.chat-widget__title {
  min-width: 0;
}

.chat-widget__header h2 {
  margin: 4px 0 0;
  font-size: 1.25rem;
}

.chat-widget__eyebrow {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.chat-widget__status {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.45;
}

.chat-widget__controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.chat-icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-strong) 92%, var(--accent-soft));
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.chat-icon-btn--toggle[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  color: var(--accent-strong);
  background: linear-gradient(145deg, var(--accent-soft), var(--surface-strong));
}

.chat-icon-btn:hover,
.chat-icon-btn:focus-visible {
  transform: translateY(-1px);
}

.chat-widget__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.chat-widget__hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 42%),
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 94%, var(--accent-soft)), var(--surface));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.chat-voice-orb {
  position: relative;
  width: 84px;
  height: 84px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.4), transparent 28%),
    linear-gradient(135deg, #0f766e 0%, #2563eb 60%, #7c3aed 100%);
  color: #fff;
  box-shadow: 0 18px 36px rgba(37, 99, 235, 0.28);
  overflow: hidden;
}

.chat-voice-orb::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid rgba(37, 99, 235, 0.18);
  opacity: 0.7;
}

.chat-voice-orb__inner {
  position: relative;
  z-index: 1;
  font-size: 1.55rem;
}

.chat-voice-orb__ring {
  position: absolute;
  inset: auto;
  width: 130%;
  height: 130%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  opacity: 0.55;
  animation: orbPulse 2.2s ease-in-out infinite;
}

.chat-voice-orb.is-listening .chat-voice-orb__ring {
  border-color: rgba(255, 255, 255, 0.36);
  animation-duration: 1.1s;
}

.chat-voice-orb:hover,
.chat-voice-orb:focus-visible {
  transform: translateY(-1px) scale(1.02);
}

.chat-widget__hero-copy {
  display: grid;
  gap: 8px;
}

.chat-widget__live {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.chat-widget__hero-copy h3 {
  margin: 0;
  font-size: 1.16rem;
  line-height: 1.4;
}

.chat-widget__hero-copy p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.chat-settings {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: color-mix(in srgb, var(--surface-strong) 94%, var(--accent-soft));
  overflow: hidden;
}

.chat-settings summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 800;
  color: var(--text);
}

.chat-settings summary::-webkit-details-marker {
  display: none;
}

.chat-settings__body {
  display: grid;
  gap: 14px;
  padding: 0 16px 16px;
}

.chat-settings__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chat-pill-button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--text);
  background: linear-gradient(135deg, var(--accent-soft), var(--surface-strong));
  font-weight: 800;
}

.chat-pill-button[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  color: var(--accent-strong);
}

.chat-pill-button--muted {
  background: var(--surface-strong);
}

.chat-widget__notice strong {
  display: block;
  margin-bottom: 4px;
  color: var(--accent-strong);
}

.chat-key {
  display: grid;
  gap: 8px;
}

.chat-key span {
  font-size: 0.88rem;
  font-weight: 700;
}

.chat-key__row {
  display: flex;
  gap: 8px;
}

.chat-key__row input,
.chat-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  color: var(--text);
  background: var(--surface-strong);
  resize: none;
}

.secondary-btn--compact {
  padding: 12px 14px;
  white-space: nowrap;
}

.chat-messages {
  display: grid;
  flex: 1 1 auto;
  gap: 12px;
  align-content: start;
  overflow: auto;
  min-height: 0;
  max-height: none;
  padding: 2px 2px 2px 0;
}

.chat-message {
  display: grid;
  gap: 8px;
  padding: 14px 15px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  max-width: min(92%, 100%);
}

.chat-message--user {
  background: color-mix(in srgb, var(--accent-soft) 78%, var(--surface));
  justify-self: end;
  border-bottom-right-radius: 8px;
}

.chat-message--assistant {
  background: color-mix(in srgb, var(--accent-2-soft) 72%, var(--surface));
  justify-self: start;
  border-bottom-left-radius: 8px;
}

.chat-message__role {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-soft);
}

.chat-message__content {
  display: grid;
  gap: 10px;
}

.chat-message__text {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
  font-size: 0.96rem;
}

.chat-message__error {
  color: #c2410c;
}

.chat-message__text p {
  margin: 0;
}

.chat-message__text ul,
.chat-message__text ol {
  margin: 0;
  padding-left: 1.25rem;
}

.chat-message__text li + li {
  margin-top: 0.35rem;
}

.chat-message__text pre {
  overflow: auto;
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.06);
}

.chat-message__text code {
  padding: 0.12rem 0.32rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.08);
  font-size: 0.95em;
}

.chat-message__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-message-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--text);
  background: var(--surface-strong);
  font-size: 0.84rem;
  font-weight: 700;
}

.chat-message-btn:hover,
.chat-message-btn:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--border));
  color: var(--accent-strong);
}

.chat-form {
  display: grid;
  gap: 12px;
  padding-top: 2px;
  border-top: 1px solid var(--border);
}

.chat-form__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-form__hint {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.84rem;
}

.chat-form__hint--accent {
  color: var(--accent-strong);
  font-weight: 800;
}

.chat-input-shell {
  position: relative;
}

.chat-form textarea {
  min-height: 112px;
  padding: 14px 60px 14px 14px;
  border-radius: 20px;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.06), transparent 28%),
    var(--surface-strong);
}

.chat-form__actions {
  display: flex;
  gap: 10px;
}

.chat-send,
.chat-clear {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  font-weight: 700;
}

.chat-send {
  color: #fff;
  background: linear-gradient(135deg, #0f766e, #2563eb 62%, #7c3aed);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.26);
}

.chat-clear {
  color: var(--text);
  background: var(--surface-strong);
}

.chat-clear--compact {
  flex: 0 0 auto;
  padding-inline: 12px;
}

.chat-voice {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.22), transparent 36%),
    linear-gradient(135deg, var(--accent-soft), var(--surface-strong));
  display: grid;
  place-items: center;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
}

.chat-voice.is-listening {
  border-color: color-mix(in srgb, #dc2626 24%, var(--border));
  color: #dc2626;
  background: linear-gradient(145deg, rgba(220, 38, 38, 0.12), var(--surface-strong));
}

.chat-voice-orb.is-listening {
  box-shadow: 0 0 0 10px rgba(37, 99, 235, 0.1), 0 18px 36px rgba(37, 99, 235, 0.32);
  transform: scale(1.02);
}

.chat-widget.is-fullscreen .chat-messages {
  max-height: none;
}

.chat-widget.is-fullscreen .chat-widget__body {
  gap: 16px;
  padding: 18px;
}

.chat-widget.is-fullscreen .chat-form {
  padding-bottom: 4px;
}

.chat-widget.is-fullscreen .chat-messages {
  min-height: 0;
}

@keyframes orbPulse {
  0% {
    transform: scale(0.92);
    opacity: 0.28;
  }
  50% {
    transform: scale(1);
    opacity: 0.55;
  }
  100% {
    transform: scale(0.92);
    opacity: 0.28;
  }
}

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

@media (max-width: 1180px) {
  .page-shell {
    width: min(100% - 24px, 1400px);
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: none;
  }

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

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 16px, 1400px);
    margin: 8px auto;
    gap: 14px;
  }

  .sidebar {
    padding: 14px;
    border-radius: 24px;
  }

  .content {
    gap: 14px;
  }

  .hero-copy,
  .hero-controls,
  .topic-banner {
    padding: 18px;
    border-radius: 24px;
  }

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

  .topic-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .category-section__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .action-row {
    flex-direction: column;
  }

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

  .toggle-btn,
  .secondary-btn {
    width: 100%;
  }

  .category-nav {
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 1fr);
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
  }

  .category-btn {
    min-height: 100%;
    scroll-snap-align: start;
  }

  .chat-launcher {
    right: 14px;
    bottom: 14px;
    width: 58px;
    height: 58px;
    border-radius: 16px;
  }

  .chat-widget {
    right: 8px;
    left: 8px;
    bottom: 80px;
    width: auto;
    height: calc(100dvh - 96px);
    max-height: calc(100dvh - 96px);
    border-radius: 22px;
  }

  .chat-messages {
    max-height: none;
  }

  .chat-widget__header {
    padding: 16px;
    gap: 12px;
  }

  .chat-widget__controls {
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .chat-widget__status {
    font-size: 0.82rem;
  }

  .chat-widget__body {
    padding: 14px;
  }

  .chat-widget__hero {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .chat-voice-orb {
    width: 72px;
    height: 72px;
  }

  .chat-settings summary {
    padding: 13px 14px;
  }

  .chat-settings__body {
    padding: 0 14px 14px;
  }

  .chat-key__row,
  .chat-form__actions {
    flex-direction: column;
  }

  .chat-send,
  .chat-clear,
  .chat-clear--compact {
    width: 100%;
  }

  .chat-form__topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .chat-voice {
    right: 8px;
    bottom: 8px;
  }

  .chat-widget.is-fullscreen {
    inset: 0;
    right: 0;
    bottom: 0;
    border-radius: 0;
  }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .hero-controls,
  .banner-pill {
    display: none;
  }

  .page-shell,
  .hero,
  .stats-grid,
  .topic-banner,
  .question-list {
    display: block;
  }

  .qa-item {
    break-inside: avoid;
    box-shadow: none;
  }
}
