/* Khalsa palette: surmai (greyish navy) and basanti (golden yellow) — the two Nishan Sahib colours
   in the Sikh Rehat Maryada — on a warm cream ground. Built on three rules:
   1. Light comes from the sky: raised things are lit on top and cast a shadow below; inputs are inset.
   2. Grayscale first: warm neutrals do the work; one blue hue (light → deep) is used only with purpose.
   3. Double the whitespace: generous space between lines, elements and groups. */
:root {
  color-scheme: light;
  /* warm neutrals (one beige hue, varied brightness) */
  --bg: #f4eee0; --panel: #fffcf5; --raised: #ece4d3; --hover: #e4d9c4;
  --text: #1f2933; --body: #3d4652; --muted: #646b74;
  --border: #e2d8c6; --control: #d3c7b2; --rule: #e9e0cf;
  /* surmai (main hue, light → deep) */
  --blue-50: #eef1f6; --blue-100: #e2e8f1; --blue-200: #cdd7e6; --blue-300: #b0bfd5;
  --blue-400: #8c9fbf; --blue-600: #3a5379; --blue-700: #2c4166; --blue-900: #18233a;
  --accent: var(--blue-700); --accent-line: rgba(44, 65, 102, .32); --accent-soft: rgba(58, 83, 121, .12);
  /* basanti (accent, used sparingly) */
  --basanti: #e2b13c; --basanti-light: #f3d98f; --basanti-soft: #f8ecc8; --basanti-deep: #7a5810;
  /* light from above */
  --highlight: inset 0 1px 0 rgba(255, 255, 255, .85);
  --shadow-sm: 0 1px 1px rgba(80, 60, 30, .06), 0 2px 4px -1px rgba(80, 60, 30, .08);
  --shadow-md: 0 1px 2px rgba(80, 60, 30, .06), 0 8px 20px -8px rgba(80, 60, 30, .18);
  --shadow-lg: 0 2px 4px rgba(80, 60, 30, .05), 0 18px 40px -16px rgba(80, 60, 30, .28);
  --inset: inset 0 1px 2px rgba(80, 60, 30, .10);
  --sans: "Geist", system-ui, sans-serif;
  --serif: "Newsreader", Georgia, serif;
  --mono: "Geist Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.65 var(--sans); background: var(--bg); color: var(--text);
       display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh;
       -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration-color: var(--accent-line); text-underline-offset: 3px; }
a:hover { color: var(--blue-900); }
button, select, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 2px; }
::selection { background: var(--blue-200); color: var(--blue-900); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Buttons: lit from above (lighter top, darker bottom edge, shadow below) ---- */
.btn-accent { height: 44px; padding: 0 20px; border: 1px solid #24375a; border-bottom-color: #172540;
              border-radius: 12px; background: linear-gradient(180deg, #415b84, var(--blue-700));
              color: #fbf6ea; font-weight: 600; font-size: 14px;
              display: inline-flex; align-items: center; justify-content: center; gap: 8px;
              box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 1px 2px rgba(24, 35, 58, .2), 0 4px 10px -4px rgba(24, 35, 58, .4);
              transition: filter .15s, transform .1s, box-shadow .1s; }
.btn-accent:hover { filter: brightness(1.08); }
.btn-accent svg { color: var(--basanti-light); }
.btn-accent:active { transform: translateY(1px); background: var(--blue-700);
                     box-shadow: inset 0 2px 4px rgba(0, 0, 0, .3); }
.btn-accent:disabled { opacity: .55; cursor: progress; }
/* Secondary (neutral) buttons: same light logic, no colour. */
.btn-ghost, .topbar .btn-accent { height: 40px; padding: 0 14px; border-radius: 10px; font-size: 14px; font-weight: 500; text-shadow: none;
             border: 1px solid var(--border); border-bottom-color: var(--control); color: var(--text);
             background: linear-gradient(180deg, var(--panel), #f8f3ea);
             box-shadow: var(--highlight), var(--shadow-sm); display: inline-flex; align-items: center; gap: 8px; }
.topbar .btn-accent svg { color: var(--basanti-deep); }
.btn-ghost:hover, .topbar .btn-accent:hover { filter: none; border-color: var(--control); background: var(--panel); }
.btn-ghost:active, .topbar .btn-accent:active { transform: translateY(1px); background: var(--raised); box-shadow: var(--inset); }

/* ---- Inputs: set into the surface (shadow inside the top edge) ---- */
select, .field input { height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--control);
         border-top-color: #c7b99f; background: var(--panel); font-size: 15px; box-shadow: var(--inset); min-width: 0; }
select { text-transform: capitalize; }
.field input::placeholder { color: var(--muted); }
select:focus, .field input:focus { outline: none; border-color: var(--blue-400); box-shadow: var(--inset), 0 0 0 4px var(--accent-soft); }

/* ---- Top bar ---- */
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
          padding: 14px 32px; background: rgba(243, 237, 226, .86); backdrop-filter: blur(14px);
          -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
          box-shadow: 0 1px 0 rgba(255, 255, 255, .6), 0 6px 16px -14px rgba(80, 60, 30, .35);
          position: sticky; top: 0; z-index: 2; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { width: 34px; height: 34px; border-radius: 10px; color: var(--basanti);
        background: linear-gradient(180deg, #2f4569, var(--blue-900)); border: 1px solid #101a2d;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 2px 4px -1px rgba(24, 35, 58, .4);
        display: flex; align-items: center; justify-content: center; flex: none; }
.name { font-weight: 600; font-size: 16px; letter-spacing: -.01em; }
.pill { font: 500 11px/1 var(--mono); color: var(--muted); border: 1px solid var(--border); border-radius: 999px;
        padding: 6px 10px; letter-spacing: .02em; }
.top-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.surprise-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0; }
.surprise-bar label { font-size: 13px; color: var(--muted); }
.surprise-bar select { height: 40px; font-size: 14px; }
body:not(.has-chat) .surprise-bar, body:not(.has-chat) .btn-ghost { display: none; }  /* home has its own Surprise card */

/* ---- Conversation (whitespace doubled) ---- */
main { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 56px 24px 40px;
       display: flex; flex-direction: column; gap: 48px; }
.user-msg { align-self: flex-end; max-width: 78%; padding: 12px 18px; border-radius: 20px 20px 6px 20px;
            background: var(--blue-100); border: 1px solid var(--blue-200); color: var(--blue-900);
            box-shadow: var(--highlight), var(--shadow-sm); white-space: pre-wrap; overflow-wrap: anywhere; }
.turn { display: flex; flex-direction: column; gap: 32px; margin-top: -16px; }
.answer { font-family: var(--serif); font-size: 20px; line-height: 1.75; color: var(--text); overflow-wrap: anywhere; }
.answer strong { font-weight: 600; }
.answer p { margin: 0 0 18px; }
.answer p:last-child { margin-bottom: 0; }
.answer ul, .answer ol { margin: 0 0 18px; padding-left: 1.4em; }
.answer li { margin-bottom: 6px; }
.answer li::marker { color: var(--basanti); }

/* While an answer is still streaming, a caret rides the last line so it reads
   as being written rather than as a page that finished loading oddly. */
.answer.streaming > :last-child::after {
  content: ""; display: inline-block; width: .5ch; height: 1.05em;
  margin-left: 2px; vertical-align: -2px; background: var(--accent);
  border-radius: 1px; animation: caret 1s steps(2, start) infinite;
}
@keyframes caret { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .answer.streaming > :last-child::after { animation: none; opacity: .6; }
}
.cite { font: 600 11px/1 var(--mono); border: 1px solid var(--blue-300); background: var(--blue-100);
        color: var(--blue-700); border-radius: 6px; padding: 3px 6px; vertical-align: 3px; margin: 0 2px;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7); transition: background .15s; }
.cite:hover { background: var(--blue-200); }
.cite.alt { border-color: var(--control); background: var(--raised); color: var(--body); }
.cite.alt:hover { background: var(--hover); }
/* Un-pop: small quiet labels so the answer stays loudest. */
.eyebrow { margin: 0; font: 500 11px/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
section.block { display: flex; flex-direction: column; gap: 16px; }

/* ---- Cards: raised from the page ---- */
.source, .perspectives, .notice, .loading, .option, .surprise-card {
  background: var(--panel); border: 1px solid var(--border); box-shadow: var(--highlight), var(--shadow-sm); }

/* R1 source cards */
.sources { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.source { border-radius: 14px; padding: 16px 18px; transition: box-shadow .2s, border-color .2s; }
.source:hover { box-shadow: var(--highlight), var(--shadow-md); }
.source.flash { border-color: var(--blue-400); box-shadow: var(--highlight), 0 0 0 4px var(--accent-soft); }
.source summary { cursor: pointer; display: flex; gap: 12px; align-items: flex-start; list-style: none; }
.source summary::-webkit-details-marker { display: none; }
.num { flex: none; width: 24px; height: 24px; border-radius: 7px; font: 600 11px/1 var(--mono);
       background: linear-gradient(180deg, var(--blue-100), var(--blue-200)); border: 1px solid var(--blue-300);
       color: var(--blue-700); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7);
       display: flex; align-items: center; justify-content: center; }
.source-head { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.source-q { font-weight: 500; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.source-meta { font: 400 11px/1.5 var(--mono); color: var(--muted); }
.source p { margin: 14px 0 10px; font-size: 14px; line-height: 1.65; color: var(--body); white-space: pre-wrap; overflow-wrap: anywhere; }
.source a { font-size: 13px; font-weight: 500; }

/* R4 perspectives */
.perspectives { border-radius: 14px; padding: 22px 24px; gap: 20px; }
.perspectives-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.perspectives h2 { margin: 0; font-family: var(--serif); font-size: 19px; font-weight: 500; }
.perspectives-head span { font: 400 11px/1.5 var(--mono); color: var(--muted); }
.view { display: flex; flex-direction: column; gap: 6px; }
.view + .view { border-top: 1px solid var(--rule); padding-top: 20px; }
.view-label { font: 500 11px/1.5 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--blue-700); }
.view p { margin: 0; font-size: 15px; line-height: 1.65; color: var(--body); }

/* R2 follow-ups, starters */
.option-list { display: flex; flex-direction: column; gap: 10px; }
.option { text-align: left; min-height: 52px; padding: 14px 18px; border-radius: 12px; font-size: 15px;
          display: flex; align-items: center; justify-content: space-between; gap: 16px;
          transition: box-shadow .15s, border-color .15s, transform .1s; }
.option:hover { border-color: var(--control); box-shadow: var(--highlight), var(--shadow-md); }
.option:active { transform: translateY(1px); box-shadow: var(--inset); background: #fbf7f0; }
.option svg { flex: none; color: var(--muted); transition: color .15s, transform .15s; }
.option:hover svg { color: var(--blue-600); transform: translateX(3px); }

/* Answer actions (un-popped until needed) */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: -16px; }
.action { height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid transparent; background: transparent;
          color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.action:hover { background: var(--panel); border-color: var(--border); color: var(--text); box-shadow: var(--shadow-sm); }
.actions .mode-note { margin-left: auto; }
@media (hover: hover) {
  .turn .actions .action { opacity: .6; transition: opacity .15s; }
  .turn:hover .actions .action, .actions .action:focus-visible { opacity: 1; }
}
.mode-note { font: 400 11px/1.5 var(--mono); color: var(--muted); }

/* ---- Home ---- */
.home { display: flex; flex-direction: column; gap: 28px; margin-top: 4vh; }
.home h1 { margin: 0; font-family: var(--serif); font-size: 56px; font-weight: 500; line-height: 1.05; letter-spacing: -.02em; }
.home h1 em { color: var(--blue-700); text-decoration: underline; text-decoration-color: var(--basanti);
              text-decoration-thickness: 4px; text-underline-offset: 8px; text-decoration-skip-ink: none; }
.lede { margin: -12px 0 12px; color: var(--muted); font-size: 17px; max-width: 34em; }
.surprise-card { border-radius: 18px; padding: 28px; display: flex; flex-direction: column; gap: 14px; margin: 0;
                 box-shadow: var(--highlight), var(--shadow-md); }
.surprise-card h2 { margin: 0; font-family: var(--serif); font-size: 22px; font-weight: 500; }
.surprise-card > p { margin: -6px 0 6px; font-size: 15px; color: var(--muted); }
.surprise-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field label { font-size: 13px; font-weight: 500; color: var(--body); }
.surprise-card .btn-accent { height: 48px; font-size: 15px; margin-top: 6px; }
.home .eyebrow { margin-top: 12px; }

/* Partial coverage (R1 honesty): quiet basanti note above the answer. */
.partial { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 12px;
           background: var(--basanti-soft); border: 1px solid #ecd48f; color: var(--basanti-deep); font-size: 14px; line-height: 1.5; }
.partial svg { flex: none; margin-top: 1px; }

/* ---- Loading, not found, error ---- */
.loading { display: flex; flex-direction: column; gap: 12px; border-radius: 14px; padding: 20px; margin-top: -16px; }
.loading-label { font: 400 12px/1.5 var(--mono); color: var(--muted); display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.loading-label svg { color: var(--blue-600); }
.bar { height: 10px; border-radius: 5px; background: var(--raised); box-shadow: var(--inset); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.notice { border-radius: 14px; padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }
.notice-head { display: flex; align-items: center; gap: 10px; color: var(--basanti-deep); }
.notice h2 { margin: 0; font-family: var(--serif); font-size: 20px; font-weight: 500; color: var(--text); }
.notice p { margin: 0; font-size: 15px; color: var(--body); }
.notice .option { box-shadow: var(--highlight), var(--shadow-sm); }

/* ---- Composer: the most raised surface on the page ---- */
.composer { position: sticky; bottom: 0; background: linear-gradient(rgba(243, 237, 226, 0), var(--bg) 30%);
            padding: 28px 24px 16px; margin: 0; }
.composer-box, .fineprint { max-width: 720px; margin: 0 auto; }
.composer-box { background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: 8px 10px 10px;
                box-shadow: var(--highlight), var(--shadow-lg); transition: border-color .15s, box-shadow .15s; cursor: text; }
.composer-box:focus-within { border-color: var(--blue-300); box-shadow: var(--highlight), 0 0 0 4px var(--accent-soft), var(--shadow-lg); }
textarea { display: block; width: 100%; resize: none; min-height: 48px; max-height: 200px; padding: 12px 10px 6px;
           border: 0; background: transparent; outline: none; font-size: 16px; line-height: 1.55; }
textarea::placeholder { color: var(--muted); }
textarea:focus-visible { outline: none; }  /* the composer box shows focus */
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-left: 10px; }
.hint { font: 400 11px/1.5 var(--mono); color: var(--muted); }
kbd { font: 500 10px/1 var(--mono); padding: 3px 6px; border: 1px solid var(--control); border-bottom-width: 2px;
      border-radius: 5px; color: var(--body); background: linear-gradient(180deg, var(--panel), var(--raised)); }
.send { width: 40px; height: 40px; flex: none; margin-left: auto; border-radius: 12px;
        border: 1px solid #24375a; border-bottom-color: #172540; color: var(--basanti-light);
        background: linear-gradient(180deg, #415b84, var(--blue-700));
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 2px 6px -2px rgba(24, 35, 58, .5);
        display: flex; align-items: center; justify-content: center; transition: filter .15s, transform .1s; }
.send:hover { filter: brightness(1.08); }
.send:active { transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .3); }
.send:disabled { background: var(--raised); border-color: var(--border); color: var(--muted); box-shadow: var(--inset); cursor: default; filter: none; }
.send.stop { background: linear-gradient(180deg, var(--basanti-light), var(--basanti)); border-color: #c99a2c; color: var(--blue-900); }
.send[hidden] { display: none; }
.fineprint { margin-top: 10px; font: 400 11px/1.5 var(--mono); color: var(--muted); text-align: center; }

/* Scroll-to-latest */
.to-bottom { position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%); z-index: 3;
             width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--border); color: var(--text);
             background: linear-gradient(180deg, var(--panel), #f8f3ea); box-shadow: var(--highlight), var(--shadow-md);
             display: flex; align-items: center; justify-content: center; }
.to-bottom:hover { color: var(--blue-700); }
.to-bottom[hidden] { display: none; }

/* Motion */
.turn, .user-msg, .notice { animation: rise .3s ease-out both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.elapsed { margin-left: auto; color: var(--muted); }
.spin { display: inline-flex; animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-2px) rotate(-8deg); } }
@media (prefers-reduced-motion: reduce) {
  .turn, .user-msg, .notice, .spin, .bar { animation: none; }
  * { transition: none !important; }
}

/* ---- Intro: Khanda on surmai, then fade into the app ---- */
.intro { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 24px;
         color: #f6efdc; cursor: pointer;
         background: radial-gradient(120% 80% at 50% 0%, #2b3d5f 0%, #1b2742 45%, #111a2e 100%);
         transition: opacity .8s ease, visibility 0s linear .8s; }
.intro[hidden] { display: none; }
.intro-inner { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; max-width: 520px;
               transition: transform .8s cubic-bezier(.2, .7, .2, 1), filter .8s ease; }
.intro-khanda { width: min(38vw, 170px); height: auto; fill: var(--basanti); color: var(--basanti); margin-bottom: 18px;
                filter: drop-shadow(0 1px 0 rgba(255, 238, 190, .35)) drop-shadow(0 14px 22px rgba(0, 0, 0, .45));
                animation: khanda-in 1.4s cubic-bezier(.2, .7, .2, 1) both; }
.intro-greet { margin: 0; font: 500 22px/1.4 "Noto Sans Gurmukhi", var(--sans); color: var(--basanti-light);
               animation: fade-up .9s .7s both; }
.intro-title { margin: 0; font: 500 44px/1.1 var(--serif); letter-spacing: -.01em; animation: fade-up .9s .85s both; }
.intro-sub { margin: 0; font-size: 16px; color: #c9d1e0; animation: fade-up .9s 1s both; }
.intro-enter { margin-top: 26px; display: inline-flex; align-items: center; gap: 10px; padding: 12px 22px; border-radius: 999px;
               border: 1px solid rgba(243, 217, 143, .35); background: rgba(255, 255, 255, .04); color: #f6efdc;
               font: 500 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase;
               box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08); animation: fade-up .9s 1.3s both; }
.intro-enter:hover { border-color: var(--basanti); background: rgba(226, 177, 60, .1); }
.intro-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--basanti); animation: breathe 2s ease-in-out infinite; }
.intro.leaving { opacity: 0; visibility: hidden; }
.intro.leaving .intro-inner { transform: scale(1.08); filter: blur(3px); }
@keyframes khanda-in { from { opacity: 0; transform: translateY(14px) scale(.92); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } }
@keyframes breathe { 50% { opacity: .35; transform: scale(.8); } }
/* App fades in underneath as the intro leaves. */
body > .topbar, body > main, body > .composer { transition: opacity .9s ease .15s; }
body.intro-active > .topbar, body.intro-active > main, body.intro-active > .composer { opacity: 0; }
body.intro-active { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  .intro-khanda, .intro-greet, .intro-title, .intro-sub, .intro-enter, .intro-dot { animation: none; }
  .intro.leaving .intro-inner { transform: none; filter: none; }
}

@media (max-width: 640px) {
  .intro-title { font-size: 34px; }
  .topbar { padding: 12px 16px; }
  .pill, .surprise-bar label, .btn-ghost span { display: none; }
  .top-actions, .top-actions .surprise-bar { width: 100%; flex-wrap: nowrap; }
  .top-actions .surprise-bar { flex: 1; min-width: 0; }
  .surprise-bar select { flex: 1; min-width: 0; }
  main { padding: 32px 18px 24px; gap: 36px; }
  .home h1 { font-size: 40px; }
  .surprise-card { padding: 20px; }
  .surprise-fields, .sources { grid-template-columns: minmax(0, 1fr); }
  .user-msg { max-width: 88%; }
  .answer { font-size: 18px; }
  .perspectives, .notice { padding: 18px; }
  .composer { padding: 20px 12px 12px; }
  .fineprint, .hint { display: none; }
  .to-bottom { bottom: 104px; }
}

/* =====================================================================
   Community, landing page, ratings, age groups, moderation — Bhajneek, decision 006.
   Same tokens and "light from above" rules as above.
   ===================================================================== */
.brand { text-decoration: none; color: inherit; }
.nav { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--raised); box-shadow: var(--inset); }
.nav-link { padding: 7px 14px; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--body); text-decoration: none; }
.nav-link:hover { color: var(--text); background: rgba(255, 255, 255, .5); }
.nav-link.active { background: var(--panel); color: var(--text); box-shadow: var(--highlight), var(--shadow-sm); }
.who-mini select { height: 40px; font-size: 14px; text-transform: none; }

/* Landing (home) gets more room than the conversation */
body:not(.has-chat) main:not(.board) { max-width: 1040px; }
.home { gap: 64px; }
.hero { display: flex; flex-direction: column; gap: 22px; padding-top: 2vh; }
.kicker { margin: 0; display: inline-flex; align-items: center; gap: 10px; align-self: flex-start;
          font: 500 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--basanti-deep);
          padding: 8px 12px; border-radius: 999px; background: var(--basanti-soft); border: 1px solid #ecd48f; }
.kicker-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--basanti); animation: breathe 2.4s ease-in-out infinite; }
.home h1 { font-size: clamp(42px, 7vw, 76px); }
.hero-soft { display: block; margin-top: 10px; font-size: .46em; line-height: 1.2; color: var(--muted); font-style: italic; letter-spacing: -.01em; }
.hero .lede { margin: 0; font-size: 19px; max-width: 38em; color: var(--body); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn-lg { height: 52px !important; padding: 0 24px !important; font-size: 15px !important; border-radius: 14px !important; text-decoration: none; }
a.btn-ghost { text-decoration: none; }
.who { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.who-label { font-size: 14px; color: var(--muted); margin-right: 4px; }
.who-opt { height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel);
           font-size: 14px; font-weight: 500; box-shadow: var(--highlight), var(--shadow-sm); display: inline-flex; align-items: center; gap: 6px; }
.who-opt small { color: var(--muted); font-weight: 400; font-size: 12px; }
.who-opt:hover { border-color: var(--control); }
.who-opt.on { background: var(--blue-700); border-color: #24375a; color: #fbf6ea; box-shadow: inset 0 1px 0 rgba(255,255,255,.2), var(--shadow-sm); }
.who-opt.on small { color: var(--blue-200); }
.stats { margin: 8px 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; border-radius: 16px; overflow: hidden;
         background: var(--border); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.stats div { background: var(--panel); padding: 18px 20px; display: flex; flex-direction: column-reverse; gap: 4px; }
.stats dt { font: 400 11px/1.4 var(--mono); color: var(--muted); letter-spacing: .04em; }
.stats dd { margin: 0; font: 500 32px/1 var(--serif); color: var(--blue-700); }

.landing-block { display: flex; flex-direction: column; gap: 20px; }
.block-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.block-note { font: 400 11px/1.5 var(--mono); color: var(--muted); }
.block-link { font-size: 14px; font-weight: 500; text-decoration: none; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.step { position: relative; padding: 22px 20px 20px; border-radius: 16px; background: var(--panel); border: 1px solid var(--border);
        box-shadow: var(--highlight), var(--shadow-sm); display: flex; flex-direction: column; gap: 8px; }
.step h3 { margin: 0; font: 500 19px/1.3 var(--serif); }
.step p { margin: 0; font-size: 14px; color: var(--body); line-height: 1.6; }
.step-n { width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
          font: 600 13px/1 var(--mono); color: var(--blue-900); background: linear-gradient(180deg, var(--basanti-light), var(--basanti));
          border: 1px solid #c99a2c; box-shadow: inset 0 1px 0 rgba(255,255,255,.5); margin-bottom: 4px; }
.cite.demo { cursor: default; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { height: 40px; padding: 0 8px 0 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel);
        box-shadow: var(--highlight), var(--shadow-sm); font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 10px;
        transition: transform .1s, box-shadow .15s; }
.chip:hover { box-shadow: var(--highlight), var(--shadow-md); transform: translateY(-1px); }
.chip-n { font: 500 11px/1 var(--mono); padding: 6px 8px; border-radius: 999px; background: var(--blue-100); color: var(--blue-700); }
.pop-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.pop-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pop-col h3 { margin: 0; font: 500 18px/1.3 var(--serif); }
.ask-count { margin-left: auto; flex: none; font: 500 11px/1 var(--mono); color: var(--muted); }
.empty-note { margin: 0; font-size: 14px; color: var(--muted); }
.board-preview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.preview-card { display: flex; flex-direction: column; gap: 8px; padding: 20px; border-radius: 16px; text-decoration: none; color: inherit;
                background: var(--panel); border: 1px solid var(--border); box-shadow: var(--highlight), var(--shadow-sm); transition: box-shadow .15s, transform .1s; }
.preview-card:hover { box-shadow: var(--highlight), var(--shadow-md); transform: translateY(-1px); color: inherit; }
.preview-card.empty { grid-column: 1 / -1; border-style: dashed; background: transparent; box-shadow: none; }
.preview-meta { font: 400 11px/1.4 var(--mono); color: var(--muted); }
.preview-title { font: 500 19px/1.35 var(--serif); }
.preview-reply { font-size: 14px; color: var(--body); line-height: 1.55; }
.muted { color: var(--muted); }
.trust { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.trust-item { padding: 20px; border-radius: 16px; background: linear-gradient(180deg, var(--blue-50), #e9eef5); border: 1px solid var(--blue-200); }
.trust-item h3 { margin: 0 0 6px; font: 500 18px/1.3 var(--serif); color: var(--blue-900); }
.trust-item p { margin: 0; font-size: 14px; color: var(--body); line-height: 1.6; }

/* Ratings: accuracy tag + 👍/👎 */
.rate-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: -16px; }
.acc-tag, .aud-tag { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font: 500 11px/1.3 var(--mono); }
.acc-tag.good { background: #e6efe4; color: #2f5a2c; border: 1px solid #c4d8bf; }
.acc-tag.partial { background: var(--basanti-soft); color: var(--basanti-deep); border: 1px solid #ecd48f; }
.aud-tag { background: var(--blue-100); color: var(--blue-700); border: 1px solid var(--blue-200); }
.votebar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.vote-label { font-size: 14px; color: var(--body); margin-right: 4px; }
.votebar.compact .vote-label { font-size: 12px; color: var(--muted); }
.vote { width: 36px; height: 34px; border-radius: 9px; border: 1px solid var(--border); background: var(--panel); color: var(--muted);
        display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--highlight), var(--shadow-sm); transition: color .15s, background .15s; }
.votebar.compact .vote { width: 30px; height: 28px; border-radius: 8px; }
.vote:hover { color: var(--text); border-color: var(--control); }
.vote.up.on { color: #2f5a2c; background: #e6efe4; border-color: #b8d0b2; box-shadow: var(--inset); }
.vote.down.on { color: #8a2f22; background: #f6e3de; border-color: #e3bfb6; box-shadow: var(--inset); }
.vote-count { min-width: 14px; text-align: center; font: 500 12px/1 var(--mono); color: var(--body); }
.rating-tag { font: 500 11px/1.3 var(--mono); color: var(--muted); }
.rating-tag.good { color: #2f5a2c; } .rating-tag.low { color: #8a2f22; }
.vote-why { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.vote-why[hidden] { display: none; }
.why-opt { height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); font-size: 12px; }
.why-opt:hover { border-color: var(--control); }
.rate-block { padding: 16px 18px; border-radius: 14px; border: 1px dashed var(--control); }
.source .votebar { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--rule); }
.src-tag { margin-left: 8px; padding: 2px 6px; border-radius: 6px; background: var(--raised); }
.src-tag.good { background: #e6efe4; color: #2f5a2c; } .src-tag.low { background: #f6e3de; color: #8a2f22; }

/* Crisis help: warm, unmistakable, never an AI answer */
.help-card { border-radius: 18px; padding: 24px 26px; background: linear-gradient(180deg, #fff7ea, #fbeedb); border: 1px solid #ecd48f;
             box-shadow: var(--highlight), var(--shadow-md); display: flex; flex-direction: column; gap: 14px; }
.help-head { display: flex; align-items: center; gap: 10px; color: #a1452f; }
.help-card h2 { margin: 0; font: 500 24px/1.2 var(--serif); color: var(--text); }
.help-card p { margin: 0; font-size: 15px; color: var(--body); }
.help-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.help-list li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 12px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); }
.help-list strong { font-weight: 600; }
.help-list span { color: var(--body); font-size: 14px; }
.help-list a { margin-left: auto; font-size: 13px; }
.help-human { font-style: italic; }

/* Community board */
.board { max-width: 860px; }
.board-hero { display: flex; flex-direction: column; gap: 16px; }
.board-hero h1 { margin: 0; font: 500 clamp(40px, 6vw, 60px)/1.05 var(--serif); letter-spacing: -.02em; }
.board-hero h1 em { color: var(--blue-700); text-decoration: underline; text-decoration-color: var(--basanti);
                    text-decoration-thickness: 4px; text-underline-offset: 8px; }
.board-hero .lede { margin: 0; font-size: 17px; color: var(--body); max-width: 40em; }
.board-rules { display: flex; flex-wrap: wrap; gap: 8px; }
.board-rules span { font: 400 11px/1 var(--mono); padding: 7px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.post-card { border-radius: 18px; padding: 24px; display: flex; flex-direction: column; gap: 14px; margin: 0;
             background: var(--panel); border: 1px solid var(--border); box-shadow: var(--highlight), var(--shadow-md); }
.post-card h2 { margin: 0; font: 500 22px/1.2 var(--serif); }
.post-card .field input, .post-card textarea { width: 100%; }
.post-card textarea { min-height: 90px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--control); border-top-color: #c7b99f;
                      background: var(--panel); box-shadow: var(--inset); font-size: 15px; resize: vertical; }
.post-card textarea:focus { outline: none; border-color: var(--blue-400); box-shadow: var(--inset), 0 0 0 4px var(--accent-soft); }
.post-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.post-row.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.post-row select { text-transform: none; width: 100%; }
.opt { color: var(--muted); font-weight: 400; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.post-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.fineprint-left { margin: 0; font: 400 11px/1.6 var(--mono); color: var(--muted); max-width: 44em; }
.form-msg { font-size: 14px; display: flex; flex-direction: column; gap: 12px; }
.form-msg:empty { display: none; }
.form-msg.err, .form-msg .err { color: #8a2f22; }
.form-msg .ok { color: #2f5a2c; margin: 0; } .form-msg .warn { color: var(--basanti-deep); margin: 0; }
.board-list-wrap { display: flex; flex-direction: column; gap: 16px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--raised); box-shadow: var(--inset); }
.tab { height: 34px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; font-size: 14px; font-weight: 500; color: var(--body); }
.tab.on { background: var(--panel); color: var(--text); box-shadow: var(--highlight), var(--shadow-sm); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.filters select, .filters input { height: 40px; font-size: 14px; text-transform: none; padding: 0 12px; border-radius: 10px;
                                  border: 1px solid var(--control); background: var(--panel); box-shadow: var(--inset); }
.thread-list { display: flex; flex-direction: column; gap: 12px; }
.thread-card { display: flex; gap: 16px; padding: 18px 20px; border-radius: 16px; background: var(--panel); border: 1px solid var(--border);
               box-shadow: var(--highlight), var(--shadow-sm); transition: box-shadow .15s; }
.thread-card:hover { box-shadow: var(--highlight), var(--shadow-md); }
.thread-vote .votebar { flex-direction: column; flex-wrap: nowrap; gap: 4px; }
.thread-vote .rating-tag { display: none; }
.thread-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: inherit; }
.thread-main:hover { color: inherit; }
.thread-main h3 { margin: 0; font: 500 21px/1.3 var(--serif); }
.thread-main:hover h3 { color: var(--blue-700); }
.thread-body { margin: 0; font-size: 14px; color: var(--body); line-height: 1.6; }
.thread-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font: 500 10px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 5px 8px; border-radius: 6px;
       background: var(--blue-100); color: var(--blue-700); border: 1px solid var(--blue-200); }
.tag.age-teen { background: var(--basanti-soft); color: var(--basanti-deep); border-color: #ecd48f; }
.tag.age-adult { background: #f6e3de; color: #8a2f22; border-color: #e3bfb6; }
.tag.verified { background: #e6efe4; color: #2f5a2c; border-color: #c4d8bf; }
.top-reply { margin: 2px 0 0; padding: 10px 14px; border-left: 3px solid var(--basanti); background: var(--bg); border-radius: 0 10px 10px 0;
             font-size: 14px; color: var(--body); display: flex; flex-direction: column; gap: 4px; }
.top-reply-label { font: 500 10px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--basanti-deep); }
.thread-meta { display: flex; flex-wrap: wrap; gap: 12px; font: 400 11px/1.5 var(--mono); color: var(--muted); }
.thread-meta .unanswered { color: var(--basanti-deep); }
.empty-board { padding: 40px 24px; border-radius: 16px; border: 1px dashed var(--control); text-align: center; color: var(--muted);
               display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-board h3 { margin: 0; font: 500 20px/1.3 var(--serif); color: var(--text); }
.empty-board p { margin: 0; font-size: 14px; }
.back { align-self: flex-start; font-size: 14px; font-weight: 500; text-decoration: none; }
.thread-view { gap: 28px; }
.thread-head { display: flex; flex-direction: column; gap: 12px; }
.thread-head h1 { margin: 0; font: 500 clamp(30px, 5vw, 42px)/1.15 var(--serif); letter-spacing: -.01em; }
.thread-full { margin: 0; font-size: 17px; color: var(--body); white-space: pre-wrap; overflow-wrap: anywhere; }
.thread-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.pending-note { margin: 0; padding: 8px 12px; border-radius: 10px; background: var(--basanti-soft); color: var(--basanti-deep); font-size: 13px; }
.archive-box { padding: 20px 22px; border-radius: 16px; background: linear-gradient(180deg, var(--blue-50), #e9eef5); border: 1px solid var(--blue-200);
               display: flex; flex-direction: column; gap: 12px; }
.archive-note { margin: -6px 0 0; font-size: 14px; color: var(--body); }
a.option { text-decoration: none; color: inherit; }
.replies { display: flex; flex-direction: column; gap: 12px; }
.replies-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.replies-head h2 { margin: 0; font: 500 22px/1.2 var(--serif); }
.reply { position: relative; padding: 18px 20px; border-radius: 16px; background: var(--panel); border: 1px solid var(--border);
         box-shadow: var(--highlight), var(--shadow-sm); display: flex; flex-direction: column; gap: 10px; }
.reply.verified { border-color: #b8d0b2; box-shadow: var(--highlight), 0 0 0 3px #e6efe4, var(--shadow-sm); }
.reply.best { border-color: #ecd48f; }
.reply-badge { align-self: flex-start; font: 500 10px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 5px 8px; border-radius: 6px;
               background: var(--basanti-soft); color: var(--basanti-deep); }
.reply-badge.verified { background: #e6efe4; color: #2f5a2c; }
.reply-body { margin: 0; font-size: 16px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.reply-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; }
.report { height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted);
          font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.report:hover { color: #8a2f22; border-color: var(--border); background: var(--panel); }
.report-menu { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.mod-btn { height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid #b8d0b2; background: #e6efe4; color: #2f5a2c; font-size: 12px; font-weight: 600; }
.site-foot { max-width: 860px; width: 100%; margin: 0 auto; padding: 24px; display: flex; justify-content: space-between; gap: 12px;
             font: 400 11px/1.5 var(--mono); color: var(--muted); }

/* Moderation */
.mod-login { max-width: 520px; }
.mod-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 8px; }
.mod-stats dd { font-size: 26px; }
#mod-app { display: flex; flex-direction: column; gap: 16px; }
#mod-app[hidden] { display: none; }
.mod-list { display: flex; flex-direction: column; gap: 12px; }
.mod-item { padding: 18px 20px; border-radius: 16px; background: var(--panel); border: 1px solid var(--border); box-shadow: var(--highlight), var(--shadow-sm);
            display: flex; flex-direction: column; gap: 10px; }
.mod-item.crisis { border-color: #e3bfb6; box-shadow: var(--highlight), 0 0 0 3px #f6e3de; }
.mod-item h3 { margin: 0; font: 500 19px/1.3 var(--serif); }
.mod-context { margin: 0; font-size: 13px; color: var(--muted); }
.mod-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mod-actions .btn-ghost { height: 34px; font-size: 13px; }
.btn-ghost.danger { color: #8a2f22; }
.log-row { display: grid; grid-template-columns: 90px 90px 1fr 2fr; gap: 10px; font: 400 12px/1.5 var(--mono); padding: 8px 4px; border-bottom: 1px solid var(--rule); }

@media (max-width: 900px) {
  .steps, .trust { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mod-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .nav-link { padding: 6px 10px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats dd { font-size: 26px; }
  .steps, .trust, .pop-grid, .board-preview, .post-row, .post-row.two { grid-template-columns: minmax(0, 1fr); }
  .home { gap: 48px; }
  .hero .lede { font-size: 17px; }
  .thread-card { padding: 14px; gap: 12px; }
  .log-row { grid-template-columns: 1fr 1fr; }
  .who-mini { flex: none; }
}
body:not(.has-chat) .hero .btn-ghost { display: inline-flex; }  /* the topbar rule above hides ghost buttons on home */
[hidden] { display: none !important; }  /* card styles set display; hidden must still win */

/* ---- Phone layout for the community additions (checked at 390px) ---- */
a.action { text-decoration: none; }
@media (max-width: 640px) {
  /* Top bar: [logo] [Ask | Community] [age] on one row; Surprise me controls (chat only) on the next. */
  .topbar { gap: 10px 8px; }
  .topbar .name { display: none; }
  .top-actions { display: contents; }
  .topbar .brand { order: 0; }
  .topbar .nav { order: 1; }
  .who-mini { order: 2; margin-left: auto; }
  .who-mini select { height: 36px; width: 100px; padding: 0 8px; font-size: 13px; }
  .top-actions .surprise-bar { order: 3; flex: 1 1 calc(100% - 56px); width: auto; }
  .topbar #new-chat { order: 4; }
  .nav-link { padding: 6px 12px; }
  .mod-stats div:last-child { grid-column: 1 / -1; }
  .rate-block { padding: 14px; }
  .rate-block .vote-label { width: 100%; }
  .hero-actions .btn-lg { flex: 1 1 100%; justify-content: center; }
  .thread-actions { gap: 8px; }
  .reply-foot { gap: 8px; }
  .board-hero h1 { font-size: 40px; }
  .toolbar, .filters { width: 100%; }
  .filters select, .filters input { flex: 1 1 0; min-width: 0; }
}
