:root {
  --night: #121c34;
  --night-soft: #1c2b4a;
  --indigo: #27395c;
  --ivory: #fbf8ef;
  --ivory-deep: #f3ecdf;
  --ink: #1d2941;
  --ink-soft: #657083;
  --gold: #c7a15a;
  --gold-light: #e3c98c;
  --saffron: #cf8244;
  --lotus: #b56376;
  --peacock: #297178;
  --line: rgba(29, 41, 65, 0.13);
  --shadow: 0 24px 70px rgba(17, 28, 52, 0.12);
  --serif: "Newsreader", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
  --devanagari: "Noto Serif Devanagari", serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html.welcome-view { scrollbar-width: none; }
html.welcome-view::-webkit-scrollbar { display: none; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -8rem, rgba(199, 161, 90, 0.18), transparent 24rem),
    linear-gradient(180deg, #f7f2e8 0%, var(--ivory) 48%, #f5f1e8 100%);
  font-family: var(--sans);
  line-height: 1.6;
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: 23rem;
  z-index: -2;
  background:
    radial-gradient(circle at 18% 22%, rgba(41, 113, 120, 0.2), transparent 18rem),
    radial-gradient(circle at 82% 8%, rgba(181, 99, 118, 0.15), transparent 20rem),
    linear-gradient(135deg, #111b32, #1c3050 70%, #203e57);
}
button, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.sky-glow {
  position: fixed;
  z-index: -1;
  pointer-events: none;
  border: 1px solid rgba(227, 201, 140, 0.09);
  border-radius: 50%;
}
.sky-glow-one { width: 28rem; height: 28rem; top: -18rem; right: 8%; }
.sky-glow-two { width: 16rem; height: 16rem; top: 7rem; left: -10rem; }

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 100;
  padding: 0.65rem 0.9rem;
  color: var(--night);
  background: white;
  border-radius: 0.5rem;
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.pull-refresh {
  --pull-distance: 0px;
  position: fixed;
  top: calc(env(safe-area-inset-top) + 0.55rem);
  left: 50%;
  z-index: 80;
  min-height: 2.35rem;
  padding: 0.4rem 0.75rem 0.4rem 0.45rem;
  display: none;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink);
  background: rgba(255, 252, 245, 0.96);
  border: 1px solid rgba(199, 161, 90, 0.28);
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(9, 19, 38, 0.2);
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 0.75rem + var(--pull-distance)));
  transition: opacity 120ms ease, transform 120ms ease;
}
.pull-refresh.is-visible { opacity: 1; }
.pull-refresh-icon {
  width: 1.5rem;
  height: 1.5rem;
  display: grid;
  place-items: center;
  color: #fff9e9;
  background: linear-gradient(145deg, #2b7980, #1e5865);
  border-radius: 50%;
  transition: transform 160ms ease;
}
.pull-refresh-icon svg {
  width: 0.9rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pull-refresh.is-ready .pull-refresh-icon { transform: rotate(180deg); }
.pull-refresh.is-refreshing {
  --pull-distance: 4rem;
  opacity: 1;
}
.pull-refresh.is-refreshing .pull-refresh-icon { animation: pull-refresh-spin 700ms linear infinite; }

.topbar {
  position: relative;
  z-index: 10;
  max-width: 1240px;
  margin: 0 auto;
  padding: 1.15rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 0.8rem; color: #fff; text-decoration: none; }
.brand-symbol {
  width: 3.5rem;
  height: 3.5rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--gold-light);
  background: linear-gradient(145deg, rgba(181, 99, 118, 0.95), rgba(130, 62, 88, 0.95));
  box-shadow: 0 8px 25px rgba(7, 13, 28, 0.26);
}
.brand-symbol svg { width: 2.3rem; height: 2.3rem; fill: currentColor; }
.brand-copy strong { display: block; font: 600 1.35rem/1.1 var(--devanagari); }
.brand-copy small { display: block; margin-top: 0.18rem; color: #c8d0df; font-size: 0.9rem; letter-spacing: 0.04em; }
.topbar nav { display: flex; align-items: center; gap: 0.75rem; }
.nav-button, .about-button {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 0.62rem 0.85rem;
  color: #eef1f5;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  transition: background 160ms ease, border-color 160ms ease;
}
.nav-button { display: inline-flex; align-items: center; gap: 0.4rem; }
.nav-button svg {
  width: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-button:hover, .about-button:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.28); }

main { width: min(100% - 2rem, 940px); margin: 0 auto; padding: 2rem 0 10rem; }
.conversation-heading { max-width: 880px; margin: 0 auto 3rem; text-align: center; color: white; }
.sanskrit-kicker { margin: 0 0 0.45rem; color: var(--gold-light); font: 500 1.2rem var(--devanagari); letter-spacing: 0.16em; }
.conversation-heading h1 { margin: 0; font: 400 clamp(3rem, 6vw, 4.8rem)/0.94 var(--serif); letter-spacing: -0.035em; }
.conversation-heading h1 em { color: #b9d0c7; font-weight: 400; }
.conversation-heading > p:not(.sanskrit-kicker) { max-width: 610px; margin: 1.5rem auto 0; color: #ced5df; }
.interpretive-note {
  margin-top: 1.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #aeb9c9;
  font-size: 0.7rem;
  letter-spacing: 0.025em;
}
.interpretive-note svg { width: 1rem; fill: none; stroke: var(--gold-light); stroke-width: 1.8; }

.chat-shell { position: relative; }
.conversation-scroll { min-height: 0; }
.conversation { display: flex; flex-direction: column; gap: 2.2rem; }
.response-scroll-space {
  flex: 0 0 auto;
  width: 1px;
  min-height: 0;
  pointer-events: none;
}
.message { display: flex; align-items: flex-start; gap: 0.85rem; }
.message-me { flex-direction: row-reverse; }
.speaker-avatar {
  flex: 0 0 2.45rem;
  width: 2.45rem;
  height: 2.45rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 600;
  box-shadow: 0 7px 20px rgba(17, 28, 52, 0.12);
}
.krishna-avatar {
  color: #fff9e9;
  background: linear-gradient(145deg, #2b7980, #1e5865);
  font-family: var(--devanagari);
}
.me-avatar {
  color: #fffaf6;
  background: linear-gradient(145deg, #bd6b7d, #965066);
  font-size: 0.74rem;
  letter-spacing: -0.02em;
}
.message-content { min-width: 0; max-width: min(100% - 3.3rem, 780px); }
.message-me .message-content {
  max-width: min(82%, 650px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.speaker-name { margin: 0 0 0.35rem; color: var(--ink-soft); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.message-bubble {
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 0.45rem 1.3rem 1.3rem 1.3rem;
  padding: 1.05rem 1.2rem;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 40px rgba(17, 28, 52, 0.08);
  backdrop-filter: blur(16px);
}
.message-bubble p { margin: 0; }
.message-bubble p + p { margin-top: 0.9rem; }
.response-typing::after {
  content: "";
  width: 0.08em;
  height: 0.95em;
  margin-left: 0.12em;
  display: inline-block;
  vertical-align: -0.08em;
  background: var(--peacock);
  border-radius: 999px;
  animation: response-cursor 760ms steps(1, end) infinite;
}
.message-me .message-bubble {
  max-width: 650px;
  color: white;
  background: linear-gradient(135deg, #283c60, #1f3150);
  border-color: transparent;
  border-radius: 1.3rem 0.45rem 1.3rem 1.3rem;
}
.welcome-message .message-bubble {
  padding: 1.15rem 1.35rem;
  font: 400 1.45rem/1.43 var(--serif);
}
.welcome-message {
  width: min(100%, 900px);
  align-self: center;
}
.welcome-message .speaker-avatar {
  flex-basis: 2.8rem;
  width: 2.8rem;
  height: 2.8rem;
  font-size: 1rem;
}
.welcome-message .speaker-name { font-size: 0.78rem; }
.welcome-message .message-content {
  flex: 1 1 auto;
  max-width: none;
}
.conversation-starters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }
.conversation-starters button {
  padding: 0.64rem 0.95rem;
  border: 1px solid rgba(29, 41, 65, 0.14);
  border-radius: 999px;
  color: #475368;
  background: rgba(255, 255, 255, 0.58);
  cursor: pointer;
  font-size: 0.84rem;
  transition: 150ms ease;
}
.conversation-starters button:hover { border-color: rgba(41, 113, 120, 0.4); color: #225e65; background: white; }

.krishna-response { padding: 1.3rem 1.4rem; }
.krishna-opening { color: var(--ink); font: 500 1.32rem/1.42 var(--serif); }
.krishna-teaching { color: #3c485c; }
.krishna-reflection { color: #3c485c; }
.krishna-question {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--indigo);
  font: 500 1.16rem/1.45 var(--serif);
}
.krishna-question::before { content: "Śrī Krishna asks"; display: block; margin-bottom: 0.2rem; color: var(--saffron); font: 600 0.65rem var(--sans); letter-spacing: 0.12em; text-transform: uppercase; }
.clarifying-response {
  max-width: 42rem;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(248, 243, 232, 0.96));
}
.clarifying-response .krishna-question {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  border: 0;
  border-left: 3px solid var(--gold);
  border-radius: 0 0.7rem 0.7rem 0;
  background: rgba(199, 161, 90, 0.09);
}
.redirect-response {
  border-left: 3px solid rgba(25, 119, 126, 0.42);
}
.redirect-response .redirect-question {
  border-left-color: var(--peacock);
  background: rgba(25, 119, 126, 0.055);
}
.redirect-response .redirect-question::before {
  content: "A way back";
  color: var(--peacock);
}
.refocus-response {
  border-left: 3px solid rgba(199, 161, 90, 0.55);
}
.refocus-response .refocus-question::before {
  content: "Return to what matters";
  color: var(--saffron);
}
.scripture-response {
  border-left: 3px solid rgba(41, 113, 120, 0.48);
}
.scripture-response .krishna-teaching::before {
  content: "What the text supports";
  display: block;
  margin-bottom: 0.25rem;
  color: var(--peacock);
  font: 600 0.65rem var(--sans);
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.support-notice {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  color: var(--ink);
  background: rgba(181, 91, 104, 0.1);
  border: 1px solid rgba(181, 91, 104, 0.24);
  border-radius: 0.75rem;
}

.verse-inline {
  margin: 1.2rem 0;
  border: 1px solid rgba(199, 161, 90, 0.26);
  border-radius: 1rem;
  overflow: hidden;
  background: linear-gradient(145deg, #fffdf7, #f7f0e3);
}
.verse-inline-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem 0.9rem; border-bottom: 1px solid rgba(199, 161, 90, 0.18); }
.verse-reference { color: #985565; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; }
.verified { display: inline-flex; align-items: center; gap: 0.3rem; color: #667663; font-size: 0.68rem; }
.verified svg { width: 0.95rem; fill: none; stroke: currentColor; stroke-width: 1.8; }
.verse-sanskrit { margin: 0; padding: 1.3rem 1rem 1.1rem; color: var(--ink); font: 500 clamp(1.4rem, 3.3vw, 2.05rem)/1.75 var(--devanagari); text-align: center; white-space: pre-line; }
.verse-inline details { margin: 0 0.9rem; padding: 0.65rem 0; border-top: 1px solid rgba(29, 41, 65, 0.1); }
.verse-inline summary { color: var(--ink-soft); cursor: pointer; font-size: 0.72rem; font-weight: 600; }
.verse-transliteration { color: var(--ink-soft); font: italic 0.95rem/1.55 var(--serif); white-space: pre-line; }
.verse-meaning { margin: 0; padding: 0 0.9rem 0.95rem; color: #4b5669; font-size: 0.82rem; }
.verse-meaning strong { color: var(--saffron); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; }
.verse-audio { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.75rem 1rem; padding: 0.9rem; border-top: 1px solid rgba(29, 41, 65, 0.1); }
.recite-button {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 5.25rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid rgba(183, 95, 116, 0.2);
  border-radius: 1rem;
  color: var(--ink);
  background: rgba(244, 229, 231, 0.56);
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.recite-button .recite-icon { width: 3.75rem; height: 3.75rem; display: grid; flex: 0 0 auto; place-items: center; border-radius: 50%; color: white; background: linear-gradient(145deg, var(--lotus), #934e65); box-shadow: 0 9px 22px rgba(147, 78, 101, 0.24); transition: transform 160ms ease, background 160ms ease; }
.recite-copy { display: grid; gap: 0.12rem; min-width: 0; }
.recite-label { color: var(--ink); font-size: 0.98rem; font-weight: 700; line-height: 1.25; }
.recite-hint { color: var(--ink-soft); font-size: 0.74rem; font-weight: 500; line-height: 1.35; }
.recite-button:hover { border-color: rgba(183, 95, 116, 0.38); background: rgba(244, 229, 231, 0.8); transform: translateY(-1px); }
.recite-button:hover .recite-icon { transform: scale(1.04); }
.recite-button:focus-visible { outline: 3px solid rgba(41, 113, 120, 0.3); outline-offset: 3px; }
.recite-button.is-playing .recite-icon { background: linear-gradient(145deg, var(--peacock), #155b63); }
.recite-button.is-playing { border-color: rgba(41, 113, 120, 0.3); background: rgba(41, 113, 120, 0.09); }
.recite-button svg { width: 1.95rem; fill: currentColor; }
.recite-button:disabled { opacity: 0.55; cursor: wait; }
.audio-progress { width: 100%; height: 0.3rem; accent-color: var(--peacock); cursor: pointer; }
.audio-progress:disabled { cursor: default; opacity: 0.38; }
.audio-status { min-width: 4.9rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; font-size: 0.68rem; text-align: right; }

@media (max-width: 560px) {
  .verse-audio { padding: 0.85rem; gap: 0.8rem; }
  .recite-button { min-height: 6rem; gap: 1rem; padding: 0.75rem; }
  .recite-button .recite-icon { width: 4.5rem; height: 4.5rem; }
  .recite-button svg { width: 2.3rem; }
  .recite-label { font-size: 1.05rem; }
  .recite-hint { font-size: 0.78rem; }
  .audio-progress { grid-column: 1; }
  .audio-status { grid-column: 2; }
}
.related-passages {
  margin: 1rem 0;
  padding: 0.85rem 0.95rem;
  border: 1px solid rgba(41, 113, 120, 0.14);
  border-radius: 0.8rem;
  background: rgba(41, 113, 120, 0.045);
}
.related-passages-title {
  color: var(--peacock);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.related-passages-list {
  margin: 0.55rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
  list-style: none;
}
.related-passages-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  color: #4b5669;
  font-size: 0.78rem;
  line-height: 1.45;
}
.related-passages-list strong {
  color: #985565;
  font-size: 0.72rem;
}

.typing-message { margin-top: 2rem; }
.typing-bubble { display: flex; align-items: center; gap: 0.32rem; min-height: 3rem; }
.typing-bubble span { width: 0.42rem; height: 0.42rem; border-radius: 50%; background: var(--peacock); animation: typing 1.1s ease-in-out infinite; }
.typing-bubble span:nth-child(2) { animation-delay: 130ms; }
.typing-bubble span:nth-child(3) { animation-delay: 260ms; }
.conversation-error { margin: 1rem 0 0 3.3rem; padding: 0.8rem 1rem; border-left: 3px solid var(--lotus); color: #793e4e; background: #fff2f3; border-radius: 0.55rem; font-size: 0.82rem; }
.daily-limit-notice {
  width: min(100%, 47rem);
  margin: 1.5rem auto 0;
  padding: clamp(1.1rem, 3vw, 1.5rem);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1rem;
  border: 1px solid rgba(199, 161, 90, 0.34);
  border-radius: 1.25rem;
  color: var(--ink);
  background:
    radial-gradient(circle at 100% 0, rgba(199, 161, 90, 0.14), transparent 10rem),
    rgba(255, 253, 247, 0.96);
  box-shadow: 0 18px 48px rgba(17, 28, 52, 0.12);
}
.daily-limit-mark {
  width: 2.7rem;
  height: 2.7rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff7dd;
  background: var(--peacock);
  font-family: var(--devanagari);
  font-size: 1rem;
}
.daily-limit-content h2 {
  margin: 0.15rem 0 0.45rem;
  font: 500 clamp(1.4rem, 3vw, 1.8rem)/1.1 var(--serif);
}
.daily-limit-content p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
}
.daily-limit-kicker {
  color: var(--saffron) !important;
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.daily-limit-pro {
  margin-top: 0.6rem !important;
  color: var(--peacock) !important;
  font-weight: 600;
}
.nav-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.composer {
  position: sticky;
  bottom: 1rem;
  z-index: 20;
  margin-top: 3rem;
  padding: 0.7rem 4.3rem 1.65rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 55px rgba(17, 28, 52, 0.16);
  backdrop-filter: blur(18px);
}
.composer textarea {
  display: block;
  width: 100%;
  max-height: 10rem;
  resize: none;
  overflow-y: auto;
  padding: 0.65rem 0.55rem;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  line-height: 1.45;
}
.composer textarea::placeholder { color: #8b93a0; }
.composer > button {
  position: absolute;
  right: 0.75rem;
  top: 0.75rem;
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: white;
  background: linear-gradient(145deg, #2b7980, #1e5865);
  box-shadow: 0 8px 20px rgba(30, 88, 101, 0.24);
  cursor: pointer;
}
.composer > button:disabled { opacity: 0.5; cursor: not-allowed; }
.composer > button .send-icon {
  display: grid;
  place-items: center;
}
.composer > button svg {
  width: 1.35rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.send-progress {
  display: none;
  align-items: center;
  gap: 0.2rem;
}
.send-progress span {
  width: 0.28rem;
  height: 0.28rem;
  border-radius: 50%;
  background: currentColor;
  animation: send-wait 1s ease-in-out infinite;
}
.send-progress span:nth-child(2) { animation-delay: 120ms; }
.send-progress span:nth-child(3) { animation-delay: 240ms; }
.composer > button.is-responding:disabled {
  opacity: 1;
  cursor: wait;
  background: linear-gradient(145deg, #286d75, #1b5260);
}
.composer > button.is-responding .send-icon { display: none; }
.composer > button.is-responding .send-progress { display: flex; }
.composer-meta { position: absolute; left: 1.35rem; right: 4.7rem; bottom: 0.4rem; display: flex; justify-content: space-between; gap: 1rem; color: #939aa5; font-size: 0.62rem; }

body.conversation-active {
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(160deg, #f5efe2, #fbf9f2 58%, #eee8dc);
}
body.conversation-active::before { height: 5.7rem; }
body.conversation-active .sky-glow-two { display: none; }
body.conversation-active .topbar {
  height: 5.7rem;
  padding-block: 0.7rem;
}
body.conversation-active .brand-symbol { width: 2.65rem; height: 2.65rem; }
body.conversation-active main {
  width: min(100% - 2rem, 1040px);
  height: calc(100vh - 5.7rem);
  padding: 1rem 0 1.2rem;
}
body.conversation-active .conversation-heading { display: none; }
body.conversation-active .chat-shell {
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 1.45rem;
  background: rgba(251, 248, 239, 0.76);
  box-shadow: 0 22px 70px rgba(17, 28, 52, 0.14);
  backdrop-filter: blur(18px);
}
body.conversation-active .conversation-scroll {
  overflow-y: auto;
  padding: 2rem 2rem 1rem;
  scrollbar-color: rgba(39, 57, 92, 0.22) transparent;
  scrollbar-width: thin;
}
body.conversation-active .conversation-starters { display: none; }
body.conversation-active .composer {
  position: relative;
  bottom: auto;
  margin: 0.75rem;
  border-color: rgba(29, 41, 65, 0.1);
  box-shadow: 0 12px 35px rgba(17, 28, 52, 0.12);
}
body.conversation-active .typing-message { margin: 2rem 0 0; }
body.conversation-active .conversation-error { margin-bottom: 0.5rem; }

html.welcome-view body.keyboard-open {
  position: fixed;
  top: var(--app-top, 0px);
  right: 0;
  bottom: auto;
  left: 0;
  height: var(--app-height, 100dvh);
}
html.welcome-view body.keyboard-open main {
  height: 100%;
  grid-template-rows: minmax(0, 1fr);
}
html.welcome-view body.keyboard-open .conversation-heading {
  display: none;
}
html.welcome-view body.keyboard-open .chat-shell {
  grid-row: 1;
  min-height: 0;
}

dialog { width: min(92vw, 35rem); border: 1px solid rgba(199, 161, 90, 0.25); border-radius: 1.4rem; padding: 2.2rem; color: var(--ink); background: var(--ivory); box-shadow: 0 30px 90px rgba(8, 14, 29, 0.3); }
dialog::backdrop { background: rgba(10, 18, 35, 0.68); backdrop-filter: blur(5px); }
.dialog-close { position: absolute; right: 1rem; top: 0.8rem; border: 0; color: var(--ink-soft); background: transparent; cursor: pointer; font-size: 1.7rem; }
.dialog-symbol { width: 3.2rem; height: 3.2rem; display: grid; place-items: center; border-radius: 50%; color: var(--gold); background: var(--night); }
.dialog-symbol svg { width: 2rem; fill: currentColor; }
.dialog-kicker { margin: 1.2rem 0 0.45rem; color: var(--saffron); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
dialog h2 { margin: 0 0 1rem; font: 400 2.35rem/1.05 var(--serif); }
dialog p { color: #536073; }
.primary-button { margin-top: 0.7rem; padding: 0.75rem 1rem; border: 0; border-radius: 999px; color: white; background: var(--night-soft); cursor: pointer; font-weight: 600; }
.secondary-button {
  padding: 0.7rem 0.95rem;
  border: 1px solid rgba(39, 57, 92, 0.2);
  border-radius: 999px;
  color: var(--indigo);
  background: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  font-weight: 600;
}
.text-button {
  padding: 0.65rem 0.35rem;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  font-weight: 600;
}
.dialog-actions {
  margin-top: 1.2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}
.dialog-actions .primary-button { margin-top: 0; }

.install-card {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 90;
  width: min(calc(100% - 2rem), 34rem);
  padding: 1rem 1.15rem;
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  gap: 0.9rem;
  color: var(--ink);
  border: 1px solid rgba(199, 161, 90, 0.28);
  border-radius: 1.2rem;
  background: rgba(255, 253, 247, 0.97);
  box-shadow: 0 24px 70px rgba(8, 14, 29, 0.24);
  backdrop-filter: blur(20px);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  transform: translateX(-50%);
  animation: install-arrive 220ms ease-out;
}
.install-card[hidden] { display: none; }
.install-card img {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 0.9rem;
  box-shadow: 0 8px 22px rgba(17, 28, 52, 0.16);
}
.install-close {
  position: absolute;
  top: 0.55rem;
  right: 0.7rem;
  padding: 0.2rem 0.45rem;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
}
.install-kicker {
  margin: 0 1.5rem 0.15rem 0;
  color: var(--saffron);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.install-card h2 {
  margin: 0;
  font: 500 1.42rem/1.1 var(--serif);
}
.install-card #install-copy {
  margin: 0.4rem 0 0;
  color: #596577;
  font-size: 0.78rem;
  line-height: 1.45;
}
.install-steps {
  margin: 0.65rem 0 0 1rem;
  padding: 0;
  color: #596577;
  font-size: 0.75rem;
  line-height: 1.4;
}
.install-steps li + li { margin-top: 0.2rem; }
.install-actions {
  margin-top: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.install-actions .primary-button { margin-top: 0; padding: 0.62rem 0.9rem; }

@media (display-mode: standalone) {
  #install-from-about,
  #install-card {
    display: none !important;
  }
}

.orientation-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  padding:
    max(1rem, env(safe-area-inset-top))
    max(1rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
  display: grid;
  place-items: center;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 15%, rgba(181, 99, 118, 0.16), transparent 18rem),
    linear-gradient(145deg, #111b32, #1b3150 65%, #244a5a);
}
.orientation-card {
  width: min(100%, 29rem);
  padding: clamp(1.5rem, 5vw, 2.5rem);
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 1.5rem;
  background: rgba(251, 248, 239, 0.97);
  box-shadow: 0 28px 90px rgba(6, 12, 27, 0.3);
}
.orientation-device {
  width: 4.2rem;
  height: 6.4rem;
  margin: 0 auto 1.25rem;
  padding: 0.35rem;
  display: grid;
  place-items: end center;
  border: 0.22rem solid var(--peacock);
  border-radius: 0.85rem;
  transform-origin: center;
  box-shadow: 0 10px 28px rgba(41, 113, 120, 0.2);
}
.tablet-device .orientation-device { transform: rotate(90deg); }
.orientation-device span {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--gold);
}
.orientation-kicker {
  margin: 0 0 0.4rem;
  color: var(--saffron);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.orientation-card h2 {
  margin: 0;
  font: 500 clamp(1.9rem, 6vw, 2.7rem)/1.05 var(--serif);
}
.orientation-card > p:not(.orientation-kicker) {
  max-width: 23rem;
  margin: 0.8rem auto 0;
  color: #596577;
}
.orientation-card .primary-button { margin-top: 1.25rem; }
body.orientation-blocked { overflow: hidden !important; }

@media (max-height: 520px) and (orientation: landscape) {
  .orientation-card {
    width: min(94vw, 48rem);
    padding: 1rem 1.25rem;
    display: grid;
    grid-template-columns: 3.8rem minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto;
    align-items: center;
    column-gap: 1.1rem;
    text-align: left;
  }
  .orientation-device {
    grid-row: 1 / 4;
    width: 2.6rem;
    height: 4rem;
    margin: 0;
    border-width: 0.16rem;
    border-radius: 0.6rem;
  }
  .orientation-kicker {
    grid-column: 2;
    margin: 0;
    font-size: 0.55rem;
  }
  .orientation-card h2 {
    grid-column: 2;
    font-size: clamp(1.45rem, 5vw, 2rem);
  }
  .orientation-card > p:not(.orientation-kicker) {
    grid-column: 2;
    max-width: none;
    margin: 0.25rem 0 0;
    font-size: 0.72rem;
    line-height: 1.35;
  }
  .orientation-card .primary-button {
    grid-column: 3;
    grid-row: 1 / 4;
    margin: 0;
    white-space: nowrap;
  }
}

.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; }
:focus-visible { outline: 3px solid rgba(207, 130, 68, 0.48); outline-offset: 3px; }

@keyframes typing { 0%, 70%, 100% { transform: translateY(0); opacity: 0.35; } 35% { transform: translateY(-0.25rem); opacity: 1; } }
@keyframes send-wait { 0%, 70%, 100% { transform: translateY(0); opacity: 0.45; } 35% { transform: translateY(-0.18rem); opacity: 1; } }
@keyframes install-arrive { from { opacity: 0; transform: translate(-50%, 0.8rem); } }
@keyframes pull-refresh-spin { to { transform: rotate(360deg); } }
@keyframes response-cursor { 50% { opacity: 0; } }

@media (any-pointer: coarse) {
  .pull-refresh { display: flex; }
}

@media (min-width: 681px) {
  html.welcome-view,
  html.welcome-view body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }
  html.welcome-view body {
    display: grid;
    grid-template-rows: 5.25rem minmax(0, 1fr);
  }
  html.welcome-view body::before {
    height: max(23.5rem, calc(46vh + 2.85rem));
  }
  html.welcome-view .topbar {
    width: 100%;
    height: 5.25rem;
    padding-block: 0.8rem;
  }
  html.welcome-view main {
    width: min(100% - 2rem, 940px);
    height: 100%;
    min-height: 0;
    margin: 0 auto;
    padding: 0 0 1rem;
    display: grid;
    grid-template-rows: minmax(18rem, 46%) minmax(0, 1fr);
    overflow: visible;
  }
  html.welcome-view .conversation-heading {
    align-self: center;
    width: 100%;
    max-height: 100%;
    margin: 0 auto;
    padding: 0 1rem;
  }
  html.welcome-view .conversation-heading h1 {
    font-size: clamp(3rem, 5.2vw, 4.4rem);
  }
  html.welcome-view .conversation-heading > p:not(.sanskrit-kicker) {
    margin-top: 1rem;
  }
  html.welcome-view .interpretive-note { margin-top: 0.8rem; }
  html.welcome-view .chat-shell {
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    overflow: visible;
  }
  html.welcome-view .conversation-scroll {
    min-height: 0;
    overflow-y: auto;
    padding: 0.75rem 0.25rem;
    scrollbar-width: none;
  }
  html.welcome-view .conversation-scroll::-webkit-scrollbar { display: none; }
  html.welcome-view .conversation {
    min-height: 100%;
    justify-content: center;
  }
  html.welcome-view .composer {
    position: relative;
    bottom: auto;
    margin-top: 0.65rem;
  }
}

/*
 * Landscape tablets and shorter laptop windows need a height-led layout.
 * Keep the composer in its own grid row and let only the message region
 * absorb overflow, so the input cannot be pushed below the viewport.
 */
@media (min-width: 681px) and (max-height: 900px) {
  html.welcome-view body {
    grid-template-rows: 4.4rem minmax(0, 1fr);
  }
  html.welcome-view body::before {
    height: max(20rem, calc(40vh + 2.2rem));
  }
  html.welcome-view .topbar {
    height: 4.4rem;
    padding-block: 0.55rem;
  }
  html.welcome-view .brand-symbol {
    width: 3rem;
    height: 3rem;
  }
  html.welcome-view .brand-symbol svg {
    width: 1.95rem;
    height: 1.95rem;
  }
  html.welcome-view .brand-copy strong { font-size: 1.16rem; }
  html.welcome-view .brand-copy small { font-size: 0.76rem; }
  html.welcome-view main {
    padding-bottom: 0.65rem;
    grid-template-rows: minmax(12.5rem, 40%) minmax(0, 1fr);
    overflow: hidden;
  }
  html.welcome-view .conversation-heading {
    padding-inline: 1rem;
  }
  html.welcome-view .conversation-heading h1 {
    font-size: clamp(2.65rem, 4.5vw, 3.75rem);
  }
  html.welcome-view .conversation-heading > p:not(.sanskrit-kicker) {
    max-width: 560px;
    margin-top: 0.65rem;
    font-size: 0.82rem;
    line-height: 1.45;
  }
  html.welcome-view .sanskrit-kicker {
    margin-bottom: 0.3rem;
    font-size: 1.05rem;
  }
  html.welcome-view .interpretive-note {
    margin-top: 0.45rem;
    font-size: 0.64rem;
  }
  html.welcome-view .chat-shell {
    overflow: hidden;
  }
  html.welcome-view .conversation-scroll {
    padding-block: 0.4rem;
  }
  html.welcome-view .conversation {
    gap: 1rem;
  }
  html.welcome-view .welcome-message .message-bubble {
    padding-block: 0.95rem;
    font-size: 1.26rem;
    line-height: 1.38;
  }
  html.welcome-view .conversation-starters {
    margin-top: 0.55rem;
  }
  html.welcome-view .conversation-starters button {
    padding-block: 0.52rem;
  }
  html.welcome-view .composer {
    flex: 0 0 auto;
    margin-top: 0.4rem;
  }
}

/*
 * iPad and Android tablets in landscape. Do not depend on viewport height:
 * mobile browser chrome and pull-to-refresh can change that value between loads.
 * The composer is anchored to the visible viewport so it cannot fall below it.
 */
@media (min-width: 681px) and (max-width: 1800px) and (orientation: landscape) {
  html.welcome-view body {
    grid-template-rows: 4.5rem minmax(0, 1fr);
  }
  html.welcome-view body::before {
    height: max(20rem, 40vh);
  }
  html.welcome-view .topbar {
    width: min(100% - 2rem, 70rem);
    height: 4.5rem;
    padding-block: 0.55rem;
  }
  html.welcome-view .brand-symbol {
    width: 3rem;
    height: 3rem;
  }
  html.welcome-view .brand-symbol svg {
    width: 1.95rem;
    height: 1.95rem;
  }
  html.welcome-view .brand-copy strong { font-size: 1.16rem; }
  html.welcome-view .brand-copy small { font-size: 0.76rem; }
  html.welcome-view main {
    width: min(100% - 2rem, 70rem);
    padding-bottom: 6.5rem;
    grid-template-rows: minmax(13rem, 38%) minmax(0, 1fr);
    overflow: hidden;
  }
  html.welcome-view .conversation-heading {
    padding-inline: 1rem;
  }
  html.welcome-view .conversation-heading h1 {
    font-size: clamp(2.9rem, 4.6vw, 3.9rem);
  }
  html.welcome-view .conversation-heading > p:not(.sanskrit-kicker) {
    max-width: 43rem;
    margin-top: 0.7rem;
    font-size: 0.82rem;
    line-height: 1.45;
  }
  html.welcome-view .sanskrit-kicker {
    margin-bottom: 0.25rem;
    font-size: 1.05rem;
  }
  html.welcome-view .interpretive-note {
    display: none;
  }
  html.welcome-view .chat-shell {
    display: block;
    height: 100%;
    overflow: hidden;
  }
  html.welcome-view .conversation-scroll {
    height: 100%;
    padding: 0.5rem 0.25rem;
    overflow-y: auto;
  }
  html.welcome-view .conversation {
    min-height: 100%;
    gap: 0.75rem;
    justify-content: center;
  }
  html.welcome-view .welcome-message .message-bubble {
    padding: 0.9rem 1.1rem;
    font-size: 1.22rem;
    line-height: 1.4;
  }
  html.welcome-view .conversation-starters {
    margin-top: 0.5rem;
  }
  html.welcome-view .conversation-starters button {
    padding: 0.52rem 0.8rem;
    font-size: 0.79rem;
  }
  html.welcome-view .composer {
    position: fixed;
    right: auto;
    bottom: max(0.6rem, env(safe-area-inset-bottom));
    left: 50%;
    z-index: 30;
    width: min(calc(100% - 2rem), 70rem);
    margin: 0;
    padding-block: 0.65rem 1.55rem;
    transform: translateX(-50%);
  }
  html.welcome-view .composer textarea {
    min-height: 2.75rem;
    max-height: 5.5rem;
  }
}

/*
 * Touch tablets use a much shorter visual viewport while their software
 * keyboard is visible. Override only that state: keep the composer in-flow
 * above the keyboard and give the remaining height to the message scroller.
 */
@media (min-width: 681px) {
  html.tablet-device.welcome-view body.keyboard-open {
    grid-template-rows: 4.5rem minmax(0, 1fr);
  }
  html.tablet-device.welcome-view body.keyboard-open main {
    width: min(100% - 2rem, 70rem);
    height: auto;
    min-height: 0;
    padding: 0.45rem 0 max(0.45rem, env(safe-area-inset-bottom));
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
  }
  html.tablet-device.welcome-view body.keyboard-open .chat-shell {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    overflow: hidden;
  }
  html.tablet-device.welcome-view body.keyboard-open .conversation-scroll {
    height: auto;
    min-height: 0;
    padding: 0.35rem 0.25rem;
    overflow-y: auto;
  }
  html.tablet-device.welcome-view body.keyboard-open .conversation {
    min-height: 100%;
    justify-content: end;
  }
  html.tablet-device.welcome-view body.keyboard-open .conversation-starters {
    display: none;
  }
  html.tablet-device.welcome-view body.keyboard-open .composer {
    position: relative;
    right: auto;
    bottom: auto;
    left: auto;
    z-index: 30;
    width: 100%;
    margin: 0.35rem 0 0;
    padding-block: 0.55rem 1.35rem;
    transform: none;
  }
}

/* Refine the spacious welcome composition on desktop without affecting touch devices. */
@media (min-width: 901px) and (hover: hover) and (pointer: fine) {
  html:not(.tablet-device).welcome-view main {
    width: min(100% - 2rem, 1040px);
  }
  html:not(.tablet-device).welcome-view .welcome-message {
    width: min(100%, 1000px);
  }
  html:not(.tablet-device).welcome-view .welcome-message .speaker-name {
    font-size: 0.88rem;
  }
  html:not(.tablet-device).welcome-view .welcome-message .message-bubble {
    padding: 1.1rem 1.35rem;
    font-size: 1.5rem;
    line-height: 1.42;
  }
  html:not(.tablet-device).welcome-view .conversation-starters {
    gap: 0.65rem;
    margin-top: 0.75rem;
  }
  html:not(.tablet-device).welcome-view .conversation-starters button {
    min-height: 3rem;
    padding: 0.68rem 1.08rem;
    font-size: 0.98rem;
    line-height: 1.3;
  }
  html:not(.tablet-device).welcome-view .composer textarea {
    font-size: 1.05rem;
  }
}

@media (max-width: 680px) {
  html,
  body {
    width: 100%;
    min-height: 100%;
    overflow: hidden;
    overscroll-behavior-x: none;
    overscroll-behavior-y: auto;
  }
  html { height: 100%; }
  body {
    position: fixed;
    top: var(--app-top, 0px);
    right: 0;
    bottom: auto;
    left: 0;
    height: var(--app-height, 100dvh);
    min-height: 0;
    display: grid;
    grid-template-rows: 4.35rem minmax(0, 1fr);
    background: var(--ivory);
  }
  body::before {
    display: none;
  }
  .sky-glow {
    display: none;
  }
  .topbar {
    width: 100%;
    height: 4.35rem;
    padding: 0.6rem 0.85rem;
    background:
      radial-gradient(circle at 90% -60%, rgba(181, 99, 118, 0.2), transparent 12rem),
      linear-gradient(135deg, #111b32, #1c3050);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
  }
  .brand { gap: 0.6rem; }
  .brand-symbol {
    width: 3rem;
    height: 3rem;
    box-shadow: 0 5px 16px rgba(7, 13, 28, 0.22);
  }
  .brand-symbol svg { width: 1.95rem; height: 1.95rem; }
  .brand-copy strong { font-size: 1.14rem; }
  .brand-copy small { margin-top: 0.08rem; font-size: 0.76rem; }
  .topbar nav { gap: 0.45rem; }
  .nav-button {
    width: 2.45rem;
    height: 2.45rem;
    gap: 0;
    justify-content: center;
    padding: 0;
    color: #f0d38f;
    border-color: rgba(227, 201, 140, 0.25);
    background: linear-gradient(
      145deg,
      rgba(227, 201, 140, 0.12),
      rgba(255, 255, 255, 0.045)
    );
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    font-size: 0;
  }
  .nav-button svg {
    width: 1.18rem;
    height: 1.18rem;
  }
  .about-button {
    min-height: 2.45rem;
    padding: 0.5rem 0.7rem;
    font-size: 0.72rem;
  }

  main {
    width: 100%;
    height: calc(var(--app-height, 100dvh) - 4.35rem);
    max-height: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }
  .conversation-heading {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0.7rem 1.1rem 0.9rem;
    color: white;
    background:
      radial-gradient(circle at 12% 15%, rgba(41, 113, 120, 0.18), transparent 12rem),
      linear-gradient(135deg, #111b32, #1c3050 74%, #203e57);
  }
  .sanskrit-kicker {
    margin-bottom: 0.18rem;
    font-size: 0.9rem;
  }
  .conversation-heading h1 {
    font-size: clamp(2.05rem, 10vw, 2.7rem);
    line-height: 0.94;
    letter-spacing: -0.025em;
  }
  .conversation-heading > p:not(.sanskrit-kicker) {
    max-width: 22rem;
    margin-top: 0.65rem;
    font-size: 0.76rem;
    line-height: 1.45;
  }
  .interpretive-note { display: none; }

  .chat-shell {
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background:
      radial-gradient(circle at 100% 0, rgba(199, 161, 90, 0.08), transparent 14rem),
      linear-gradient(180deg, var(--ivory), #f6f1e8);
  }
  .conversation-scroll {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
    padding: 1rem 0.75rem 0.65rem;
    scrollbar-width: none;
  }
  .conversation-scroll::-webkit-scrollbar { display: none; }
  .conversation {
    width: 100%;
    max-width: 100%;
    gap: 1rem;
    overflow-x: clip;
  }
  .message {
    width: 100%;
    min-width: 0;
    gap: 0.55rem;
    padding-inline: 0.2rem;
  }
  .speaker-avatar {
    flex-basis: 2rem;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    font-size: 0.78rem;
  }
  .message-content {
    flex: 0 1 auto;
    max-width: calc(100% - 2.9rem);
  }
  .message-me .message-content {
    max-width: min(86%, calc(100% - 2.9rem));
  }
  .speaker-name { margin-bottom: 0.25rem; font-size: 0.63rem; }
  .message-bubble {
    padding: 0.82rem 0.9rem;
    border-radius: 0.35rem 1rem 1rem 1rem;
    box-shadow: 0 8px 24px rgba(17, 28, 52, 0.07);
    overflow-wrap: anywhere;
  }
  .welcome-message .speaker-avatar {
    flex-basis: 2.35rem;
    width: 2.35rem;
    height: 2.35rem;
    font-size: 0.9rem;
  }
  .welcome-message .speaker-name { font-size: 0.68rem; }
  .welcome-message .message-bubble {
    padding: 0.95rem 1rem;
    font-size: 1.14rem;
    line-height: 1.42;
  }
  .conversation-starters {
    flex-wrap: nowrap;
    gap: 0.42rem;
    margin: 0.65rem -2.55rem 0 0;
    padding-bottom: 0.25rem;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .conversation-starters::-webkit-scrollbar { display: none; }
  .conversation-starters button {
    flex: 0 0 auto;
    min-height: 2.75rem;
    padding: 0.62rem 0.78rem;
    font-size: 0.88rem;
    line-height: 1.3;
    scroll-snap-align: start;
  }
  html.welcome-view .conversation-scroll {
    display: grid;
    align-items: center;
  }
  html.welcome-view .conversation { width: 100%; }
  html.welcome-view .conversation-starters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-right: 0;
    overflow: visible;
  }
  html.welcome-view .conversation-starters button {
    min-width: 0;
    white-space: normal;
    line-height: 1.25;
  }
  .krishna-response { padding: 0.9rem; }
  .krishna-opening { font-size: 1.15rem; }
  .krishna-question { font-size: 1.02rem; }
  .verse-inline { margin-inline: -0.2rem; }
  .verse-sanskrit { padding-inline: 0.65rem; font-size: 1.24rem; }
  .verse-inline-header { align-items: flex-start; }
  .verse-audio { flex-wrap: wrap; }
  .verse-audio audio { width: 100%; }

  .composer {
    position: relative;
    bottom: auto;
    z-index: 20;
    margin: 0.45rem 0.65rem calc(0.45rem + env(safe-area-inset-bottom));
    padding: 0.45rem 3.7rem 1.35rem 0.65rem;
    border-color: rgba(29, 41, 65, 0.1);
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(17, 28, 52, 0.14);
  }
  .composer textarea {
    min-height: 2.65rem;
    max-height: 7rem;
    padding: 0.55rem 0.35rem;
    font-size: 0.95rem;
  }
  .composer > button {
    top: 0.5rem;
    right: 0.5rem;
    width: 2.8rem;
    height: 2.8rem;
  }
  .composer-meta {
    left: 1rem;
    right: 4.15rem;
    bottom: 0.28rem;
  }
  .composer-meta span:first-child { display: none; }
  .composer-meta { justify-content: flex-end; }
  dialog { max-height: calc(100dvh - 2rem); padding: 1.5rem; overflow-y: auto; }
  .install-card {
    bottom: max(0.65rem, env(safe-area-inset-bottom));
    width: calc(100% - 1rem);
    padding: 1rem;
    grid-template-columns: 3.1rem minmax(0, 1fr);
    gap: 0.8rem;
    border-radius: 1rem;
  }
  .install-card img { width: 3.1rem; height: 3.1rem; border-radius: 0.8rem; }
  .install-kicker {
    margin-bottom: 0.22rem;
    font-size: 0.68rem;
  }
  .install-card h2 {
    font-size: 1.45rem;
    line-height: 1.12;
  }
  .install-card #install-copy {
    margin-top: 0.55rem;
    font-size: 0.94rem;
    line-height: 1.48;
  }
  .install-steps {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    line-height: 1.48;
  }
  .install-steps li + li { margin-top: 0.28rem; }
  .install-actions {
    margin-top: 0.85rem;
    gap: 0.75rem;
  }
  .install-actions .primary-button,
  .install-actions .text-button {
    min-height: 2.75rem;
    font-size: 0.96rem;
  }

  body.conversation-active {
    height: var(--app-height, 100dvh);
    grid-template-rows: 4.35rem minmax(0, 1fr);
  }
  body.conversation-active::before { display: none; }
  body.conversation-active .topbar {
    height: 4.35rem;
    padding-block: 0.6rem;
  }
  body.conversation-active .brand-symbol { width: 2.55rem; height: 2.55rem; }
  body.conversation-active main {
    width: 100%;
    height: calc(var(--app-height, 100dvh) - 4.35rem);
    max-height: 100%;
    padding: 0;
    display: block;
  }
  body.conversation-active .chat-shell {
    height: 100%;
    border: 0;
    border-radius: 0;
  }
  body.conversation-active .conversation-scroll { padding: 1rem 0.75rem 0.65rem; }
  body.conversation-active .composer {
    margin: 0.45rem 0.65rem calc(0.45rem + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
