:root {
  color-scheme: dark;
  --bg0: #0a0b12;
  --bg1: #12142a;
  --text: #e8e9f2;
  --muted: #9aa0c0;
  --accent: #c9a227;
  --accent2: #6b8cff;
  --card: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.1);
  --radius: 16px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg0);
  line-height: 1.55;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(107, 140, 255, 0.22), transparent 55%),
    radial-gradient(700px 420px at 95% 10%, rgba(201, 162, 39, 0.18), transparent 50%),
    linear-gradient(165deg, var(--bg0), var(--bg1));
}

h1,
h2,
h3 {
  font-family: "Fraunces", Georgia, serif;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.1rem clamp(1rem, 4vw, 2.5rem);
  padding-top: max(1.1rem, env(safe-area-inset-top, 0px));
  padding-left: max(clamp(1rem, 4vw, 2.5rem), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(1rem, 4vw, 2.5rem), env(safe-area-inset-right, 0px));
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  background: rgba(10, 11, 18, 0.65);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 1.25rem;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.nav a {
  color: var(--text);
}

.pill {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(201, 162, 39, 0.25), rgba(107, 140, 255, 0.25));
  border: 1px solid var(--border);
  text-decoration: none;
}

.pill:hover {
  text-decoration: none;
  border-color: rgba(255, 255, 255, 0.22);
}

.inline {
  display: inline;
  margin: 0;
}

.linkish {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.linkish:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.shell {
  width: min(960px, 100% - 2rem);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) 0 calc(4rem + env(safe-area-inset-bottom, 0px));
}

.site-footer {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.5rem clamp(1rem, 4vw, 2.5rem) calc(2rem + env(safe-area-inset-bottom, 0px));
  padding-left: max(clamp(1rem, 4vw, 2.5rem), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(1rem, 4vw, 2.5rem), env(safe-area-inset-right, 0px));
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

.footer-disclaimer {
  line-height: 1.5;
  max-width: 72ch;
}

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  font-size: 0.88rem;
}

.footer-legal a {
  color: var(--accent2);
  text-decoration: none;
  font-weight: 500;
}

.footer-legal a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-dot {
  color: var(--border);
  user-select: none;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 2rem);
  box-shadow: var(--shadow);
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

input {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font: inherit;
}

input:focus {
  outline: 2px solid rgba(107, 140, 255, 0.45);
  outline-offset: 2px;
}

.field {
  margin-bottom: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.15rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(201, 162, 39, 0.35), rgba(107, 140, 255, 0.28));
  color: var(--text);
  font-weight: 600;
  font: inherit;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.06);
}

a.btn:hover,
a.btn:focus-visible {
  text-decoration: none;
}

.error {
  color: #ffb4b4;
  font-size: 0.9rem;
}

.reading {
  white-space: pre-wrap;
  color: #dfe2ff;
  margin-top: 1rem;
}

.reading strong {
  color: #fff6cf;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin: 0 0 1rem;
}

.lede {
  color: var(--muted);
  max-width: 62ch;
  margin: 0 0 1.5rem;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.grid h2 {
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
}

.muted {
  color: var(--muted);
  margin: 0;
  font-size: 0.95rem;
}

code {
  font-size: 0.85em;
  color: #d6dcff;
}

.narrow {
  max-width: 420px;
  margin: 0 auto;
}

.stack {
  margin-top: 1.25rem;
}

.foot {
  margin-top: 1.25rem;
}

.panel {
  margin-top: 1.25rem;
}

.panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
}

.small {
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.grow {
  flex: 1 1 220px;
  margin-bottom: 0;
}

.msg {
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.msg.ok {
  color: #b8f5c5;
}

.msg.err {
  color: #ffb4b4;
}

.muted strong {
  color: var(--text);
}

.nav-main {
  flex-wrap: wrap;
  row-gap: 0.5rem;
}

.nav-toggle {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  cursor: pointer;
}

.nav-toggle:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

.nav-toggle:focus-visible {
  outline: 2px solid rgba(107, 140, 255, 0.55);
  outline-offset: 2px;
}

.nav-toggle-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 1.15rem;
}

.nav-toggle-bar {
  display: block;
  height: 2px;
  border-radius: 1px;
  background: var(--text);
  transition: transform 0.2s ease, opacity 0.2s ease;
  transform-origin: center;
}

.nav-toggle.is-open .nav-toggle-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle.is-open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle.is-open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.nav-backdrop {
  display: none;
}

body.nav-drawer-open {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .nav-toggle-bar {
    transition: none;
  }

  .home-feature-card {
    transition: none;
  }

  .home-feature-card:hover {
    box-shadow: var(--shadow);
  }
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.25rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border);
  font-size: 0.88rem;
}

.lang-switch a {
  color: var(--muted);
  text-decoration: none;
}

.lang-switch a:hover {
  color: var(--text);
}

.lang-switch a.is-active {
  color: var(--accent);
  font-weight: 600;
}

.lang-sep {
  color: var(--border);
  user-select: none;
}

.reading-stack {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.reading-block-title {
  font-size: 1rem;
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 600;
}

.reading-sub {
  font-size: 0.9rem;
  margin: 0.75rem 0 0.35rem;
  color: var(--muted);
  font-family: "DM Sans", system-ui, sans-serif;
}

.hi-block .reading,
.hi-block .reading-block-title,
.hi-block .reading-sub {
  font-family: "Noto Sans Devanagari", "DM Sans", system-ui, sans-serif;
}

.stellae-details {
  margin-top: 0.25rem;
  padding: 0.75rem 1rem 1rem;
}

.stellae-details > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent2);
  list-style-position: outside;
}

.stellae-details[open] > summary {
  margin-bottom: 0.35rem;
}

.details-hint {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.card.inner {
  background: rgba(0, 0, 0, 0.2);
  box-shadow: none;
  margin-top: 0.5rem;
}

.period-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.period-title {
  font-size: 1.05rem;
  margin: 0 0 0.75rem;
}

.reading-tight {
  font-size: 0.95rem;
}

.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;
}

.chat-disclaimer {
  margin-bottom: 1rem;
}

.chat-thread {
  max-height: min(55vh, 520px);
  overflow-y: auto;
  padding: 0.75rem 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.chat-bubble {
  max-width: min(100%, 34rem);
  padding: 0.75rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.22);
}

.chat-bubble-user {
  align-self: flex-end;
  border-color: rgba(107, 140, 255, 0.35);
}

.chat-bubble-assistant {
  align-self: flex-start;
  border-color: rgba(201, 162, 39, 0.28);
}

.chat-bubble-assistant .chat-body {
  font-family: "DM Sans", "Noto Sans Devanagari", system-ui, sans-serif;
}

.chat-bubble-user .chat-body {
  text-align: left;
}

.chat-meta {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.chat-compose textarea {
  width: 100%;
  min-height: 5.5rem;
  resize: vertical;
  margin-bottom: 0.75rem;
}

.chat-actions {
  display: flex;
  justify-content: flex-end;
}

.chat-clear-form {
  margin-top: 0.75rem;
  padding: 0 0.25rem;
}

.chat-wallet .wallet-h2 {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
}

.wallet-balance {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.wallet-recharge-btn {
  margin-left: 0.5rem;
  vertical-align: middle;
}

.recharge-prompt {
  margin-top: 0.75rem;
  margin-bottom: 0;
}

.recharge-list {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.recharge-instr {
  white-space: pre-wrap;
}

/* --- Home landing --- */
.home-page {
  padding-bottom: 0.5rem;
}

.hero--home {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.055) 0%, transparent 45%),
    var(--card);
}

.hero--home::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(201, 162, 39, 0.95), rgba(107, 140, 255, 0.88));
}

.hero--home .eyebrow {
  color: #a8b8ff;
}

.home-trust {
  margin: -0.15rem 0 1.65rem;
  padding: 0.65rem 0 0.65rem 1rem;
  border-left: 3px solid rgba(201, 162, 39, 0.5);
  font-size: 0.88rem;
  line-height: 1.45;
  color: #b4bad8;
  max-width: 58ch;
}

.home-section {
  margin-top: 2.5rem;
}

.home-section-title {
  margin: 0 0 1.1rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border);
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.22rem, 2.4vw, 1.52rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.home-feature-grid {
  margin-top: 0;
  align-items: stretch;
}

.home-feature-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.home-feature-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
}

.home-feature-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  margin-bottom: 0.25rem;
  border: 1px solid var(--border);
}

.home-feature-icon--read {
  background: radial-gradient(circle at 28% 28%, rgba(107, 140, 255, 0.38), rgba(0, 0, 0, 0.12) 58%);
  border-color: rgba(107, 140, 255, 0.38);
}

.home-feature-icon--tone {
  background: radial-gradient(circle at 28% 28%, rgba(201, 162, 39, 0.34), rgba(0, 0, 0, 0.12) 58%);
  border-color: rgba(201, 162, 39, 0.38);
}

.home-feature-icon--chat {
  background: linear-gradient(135deg, rgba(107, 140, 255, 0.22), rgba(201, 162, 39, 0.2));
  border-color: rgba(255, 255, 255, 0.14);
}

.home-feature-h {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.home-feature-card .muted {
  flex: 1;
}

.home-how {
  margin-top: 2.75rem;
}

.home-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.home-step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.1rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
}

.home-step-num {
  flex-shrink: 0;
  width: 2.4rem;
  height: 2.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  background: linear-gradient(135deg, rgba(201, 162, 39, 0.35), rgba(107, 140, 255, 0.28));
  border: 1px solid var(--border);
}

.home-step-title {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.98rem;
}

.home-step-body p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.home-legal-row {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  max-width: 68ch;
}

.home-legal-label {
  margin-right: 0.15rem;
}

.home-legal-links a {
  color: var(--accent2);
  text-decoration: none;
  font-weight: 500;
}

.home-legal-links a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.home-ops {
  margin-top: 1rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border);
  max-width: 68ch;
}

.legal-page h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.legal-updated {
  margin: 0 0 1rem;
}

.legal-page .lede {
  margin-bottom: 1.5rem;
}

.legal-section {
  margin-top: 1.35rem;
  padding-top: 1.15rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.legal-section:first-of-type {
  margin-top: 0.5rem;
  padding-top: 0;
  border-top: 0;
}

.legal-section h2 {
  margin: 0 0 0.45rem;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 1.02rem;
  font-weight: 600;
  color: #d2d6f0;
}

.legal-section p {
  margin: 0;
  line-height: 1.55;
}

.faq-list {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.faq-details {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.faq-details > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.85rem 1rem;
  font-weight: 600;
  color: var(--text);
}

.faq-details > summary::-webkit-details-marker {
  display: none;
}

.faq-details[open] > summary {
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.12);
}

.faq-answer {
  padding: 0.85rem 1rem 1rem;
  font-size: 0.92rem;
  line-height: 1.55;
}

@media (max-width: 900px) {
  .home-steps {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .site-header {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    column-gap: 0.5rem;
  }

  .brand {
    min-width: 0;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav-main:not(.is-open) {
    display: none !important;
  }

  .nav-main.is-open {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    gap: 0.2rem;
  }

  .nav-main.is-open > a,
  .nav-main.is-open > .pill {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    border-radius: 12px;
  }

  .nav-main.is-open > form.inline {
    display: block;
    width: 100%;
    margin: 0;
  }

  .nav-main.is-open .nav-logout-btn {
    min-height: 44px;
    width: 100%;
    text-align: left;
    padding: 0.65rem 0.75rem;
    border-radius: 12px;
    -webkit-tap-highlight-color: transparent;
  }

  .nav-main.is-open .lang-switch {
    margin-left: 0;
    margin-top: 0.35rem;
    padding: 0.65rem 0 0.25rem;
    padding-left: 0;
    border-left: none;
    border-top: 1px solid var(--border);
    justify-content: center;
    gap: 1rem;
  }

  .nav-main.is-open .lang-switch a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.85rem;
    -webkit-tap-highlight-color: transparent;
  }

  .nav-backdrop.is-visible {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 15;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(5, 6, 12, 0.52);
    backdrop-filter: blur(4px);
    -webkit-tap-highlight-color: transparent;
  }

  .btn {
    min-height: 44px;
    padding: 0.65rem 1.15rem;
    -webkit-tap-highlight-color: transparent;
  }

  .linkish {
    min-height: 44px;
    padding: 0.35rem 0.5rem;
  }

  .chat-compose {
    padding-bottom: max(0.25rem, env(safe-area-inset-bottom, 0px));
  }

  .chat-actions .btn {
    min-width: 6.5rem;
  }

  .hero--home .cta {
    flex-direction: column;
    align-items: stretch;
  }

  .hero--home .cta .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (min-width: 721px) {
  .nav-backdrop {
    display: none !important;
  }

  body.nav-drawer-open {
    overflow: unset;
  }
}
