/* Layout concept: an Indian drawing room. A mint, stencilled wall with a
   ceiling fan, a wall clock and a sweet-shop calendar; the host (Aunty or
   Uncle) sits on the left, and a ruled school notebook on the right holds the
   conversation and the game. A TV-news ticker carries the live numbers. */

:root {
  --wall: #cfe8de;
  --wall-deep: #aed6c8;
  --stencil: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='%23ffffff' fill-opacity='.38'%3E%3Ccircle cx='28' cy='28' r='3'/%3E%3Cellipse cx='28' cy='19' rx='3' ry='6'/%3E%3Cellipse cx='28' cy='37' rx='3' ry='6'/%3E%3Cellipse cx='19' cy='28' rx='6' ry='3'/%3E%3Cellipse cx='37' cy='28' rx='6' ry='3'/%3E%3Ccircle cx='0' cy='0' r='2'/%3E%3Ccircle cx='56' cy='0' r='2'/%3E%3Ccircle cx='0' cy='56' r='2'/%3E%3Ccircle cx='56' cy='56' r='2'/%3E%3C/g%3E%3C/svg%3E");
  --floor-a: #ecdcbc;
  --floor-b: #b8523f;
  --floor-c: #2f6f62;
  --wood: #7b4a2a;
  --wood-dark: #4f2c15;
  --maroon: #8a1c2b;
  --on-maroon: #f8c65a;
  --marigold: #f2a20c;
  --kumkum: #c62839;
  --heading: #8a1c2b;
  --teal: #11524a;
  --ink: #2a1d15;
  --ink-soft: #5e4a3b;
  --muted: #7d6856;
  --paper: #fffdf5;
  --rule: #cfdff0;
  --margin-line: #eaa4ab;
  --chip: #f4ead5;
  --host-bubble: #fff1cf;
  --user-bubble: #11524a;
  --user-ink: #fffaf0;
  --care-bg: #eef6ff;
  --care-line: #3f6fb5;
  --focus: #1a5fd6;
  --news-red: #c4161c;
  --news-yellow: #ffcc29;
  --shadow: 0 1px 0 rgba(42, 29, 21, 0.06), 0 10px 28px rgba(42, 29, 21, 0.12);

  --display: "Yatra One", "Trebuchet MS", serif;
  --hand: "Kalam", "Segoe Print", cursive;
  --body: "Hind", "Segoe UI", system-ui, sans-serif;

  --fs-xs: 0.8125rem;
  --fs-sm: 0.9375rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.625rem;
  --fs-2xl: 2.125rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --wall: #16332f;
    --wall-deep: #0f2724;
    --stencil: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='%23ffffff' fill-opacity='.05'%3E%3Ccircle cx='28' cy='28' r='3'/%3E%3Cellipse cx='28' cy='19' rx='3' ry='6'/%3E%3Cellipse cx='28' cy='37' rx='3' ry='6'/%3E%3Cellipse cx='19' cy='28' rx='6' ry='3'/%3E%3Cellipse cx='37' cy='28' rx='6' ry='3'/%3E%3C/g%3E%3C/svg%3E");
    --floor-a: #3b3226;
    --floor-b: #6c2d24;
    --floor-c: #1d4a41;
    --wood: #6b4128;
    --wood-dark: #3a2010;
    --maroon: #6e1522;
    --on-maroon: #f8c65a;
    --marigold: #f5b234;
    --kumkum: #ef6170;
    --heading: #f5b234;
    --teal: #5cc2b0;
    --ink: #f3e9d6;
    --ink-soft: #d0bfa8;
    --muted: #a8977f;
    --paper: #201d19;
    --rule: #2c3644;
    --margin-line: #6a3a41;
    --chip: #2c2721;
    --host-bubble: #3a2e1c;
    --user-bubble: #2a7f71;
    --user-ink: #fffaf0;
    --care-bg: #1b2a3d;
    --care-line: #8ab4ff;
    --focus: #8ab4ff;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --wall: #16332f;
  --wall-deep: #0f2724;
  --stencil: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='%23ffffff' fill-opacity='.05'%3E%3Ccircle cx='28' cy='28' r='3'/%3E%3Cellipse cx='28' cy='19' rx='3' ry='6'/%3E%3Cellipse cx='28' cy='37' rx='3' ry='6'/%3E%3Cellipse cx='19' cy='28' rx='6' ry='3'/%3E%3Cellipse cx='37' cy='28' rx='6' ry='3'/%3E%3C/g%3E%3C/svg%3E");
  --floor-a: #3b3226;
  --floor-b: #6c2d24;
  --floor-c: #1d4a41;
  --wood: #6b4128;
  --wood-dark: #3a2010;
  --maroon: #6e1522;
  --on-maroon: #f8c65a;
  --marigold: #f5b234;
  --kumkum: #ef6170;
  --heading: #f5b234;
  --teal: #5cc2b0;
  --ink: #f3e9d6;
  --ink-soft: #d0bfa8;
  --muted: #a8977f;
  --paper: #201d19;
  --rule: #2c3644;
  --margin-line: #6a3a41;
  --chip: #2c2721;
  --host-bubble: #3a2e1c;
  --user-bubble: #2a7f71;
  --user-ink: #fffaf0;
  --care-bg: #1b2a3d;
  --care-line: #8ab4ff;
  --focus: #8ab4ff;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--wall);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--fs-md);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
img, svg { max-width: 100%; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------ Loader */
.loader {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; align-content: center; gap: 18px;
  background: var(--wall) var(--stencil);
  padding-inline: 16px;
  transition: opacity 0.45s ease, visibility 0.45s;
}
.loader.is-done { opacity: 0; visibility: hidden; }
.loader-host { width: min(240px, 60vw); }
.loader-host .host { animation: bob 2.8s ease-in-out infinite; }
.loader-line {
  font-family: var(--hand); font-size: var(--fs-lg); color: var(--ink-soft);
  min-height: 2em; text-align: center; max-width: 30ch;
}
.loader-bar { display: flex; align-items: center; gap: 12px; }
.loader-bar .chai-glass { width: 34px; }
.loader-bar span { font-family: var(--display); font-size: var(--fs-xl); color: var(--maroon); letter-spacing: 0.02em; }
.chai-fill { transform: translateY(100%); animation: fill-glass var(--load-ms, 1800ms) ease-out forwards; }
@keyframes fill-glass { to { transform: translateY(12%); } }

/* ------------------------------------------------------------ App shell */
.app { min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-block: 10px; padding-inline: 16px;
  background: var(--maroon);
  border-bottom: 4px solid var(--marigold);
  color: var(--on-maroon);
}
.brand { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.brand-mark {
  font-family: var(--display); font-size: 2rem; line-height: 1;
  color: var(--on-maroon); text-decoration: none;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.28);
}
.brand-mark b { color: #fff; font-weight: 400; }
.brand-tag { font-family: var(--hand); font-size: var(--fs-sm); color: #f3dcb0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.account-name { font-size: var(--fs-sm); color: #f3dcb0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 8px 18px;
  border-radius: 10px; border: 0;
  font-weight: 600; font-size: var(--fs-sm); letter-spacing: 0.01em;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--marigold); color: #2a1d15; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18); }
.btn-maroon { background: var(--maroon); color: var(--on-maroon); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25); }
.btn-ghost { background: transparent; color: inherit; border: 2px solid currentColor; }
.btn-quiet { background: var(--chip); color: var(--ink); }
.btn-danger { background: var(--kumkum); color: #fff; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: var(--fs-xs); }
.topbar .btn-ghost { color: var(--on-maroon); border-color: rgba(248, 198, 90, 0.6); }

/* TV-news ticker with the live numbers */
.ticker {
  display: flex; align-items: stretch; overflow: hidden;
  background: var(--news-yellow); color: #1a1a1a;
  border-bottom: 2px solid #1a1a1a;
  font-weight: 600; font-size: var(--fs-sm);
}
.ticker-live {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
  padding-block: 6px; padding-inline: 14px;
  background: var(--news-red); color: #fff;
  font-weight: 700; letter-spacing: 0.08em; font-size: var(--fs-xs);
}
.ticker-live i { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: pulse 1.4s infinite; }
.ticker-track { display: flex; flex: 1; min-width: 0; overflow: hidden; }
.ticker-items { display: flex; gap: 0; white-space: nowrap; padding-block: 6px; animation: crawl 38s linear infinite; }
.ticker-items span { padding-inline: 22px; position: relative; }
.ticker-items span + span::before { content: "◆"; position: absolute; left: -6px; color: var(--news-red); font-size: 0.7em; top: 50%; transform: translateY(-50%); }
.ticker-items b { font-variant-numeric: tabular-nums; }
@keyframes crawl { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ------------------------------------------------------------ Room */
.room {
  flex: 1; display: grid; grid-template-columns: minmax(320px, 440px) minmax(0, 1fr);
  max-width: 1240px; width: 100%; margin-inline: auto;
}

.stage {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  min-height: 560px;
  background: var(--wall) var(--stencil);
  padding-inline: 16px;
}
.stage .fan { position: absolute; top: -78px; left: 50%; width: 170px; translate: -50% 0; opacity: 0.95; }
.fan-blades { transform-box: view-box; transform-origin: 100px 100px; animation: spin 1.1s linear infinite; }
.stage .clock { position: absolute; top: 34px; left: 22px; width: 78px; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.18)); }
.clock line { transform-box: view-box; transform-origin: 50px 50px; }

.calendar {
  position: absolute; top: 26px; right: 20px; width: 120px;
  background: #fffaf0; color: #2a1d15;
  border-radius: 4px; box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
  text-align: center; transform: rotate(2deg); overflow: hidden;
}
.calendar::before { content: ""; position: absolute; top: -10px; left: 50%; width: 10px; height: 10px; border-radius: 50%; background: #6b6b6b; translate: -50% 0; }
.cal-head { background: var(--kumkum); color: #fff; font-family: var(--hand); font-size: 0.72rem; line-height: 1.2; padding: 6px 4px 4px; }
.cal-month { font-weight: 700; font-size: var(--fs-xs); letter-spacing: 0.12em; text-transform: uppercase; padding-top: 4px; }
.cal-day { font-family: var(--display); font-size: 2.6rem; line-height: 1; color: #8a1c2b; }
.cal-note { font-family: var(--hand); font-size: 0.78rem; padding: 2px 6px 8px; line-height: 1.25; color: #5e4a3b; }

.speech {
  position: absolute; left: 50%; top: 150px; translate: -50% 0; z-index: 3;
  max-width: min(300px, 86%);
  background: var(--paper); color: var(--ink);
  border: 2.5px solid #2a1d15; border-radius: 18px;
  padding: 8px 14px; font-family: var(--hand); font-size: var(--fs-md); line-height: 1.3; text-align: center;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.08);
  animation: pop 0.25s ease-out;
}
.speech::after {
  content: ""; position: absolute; bottom: -12px; left: 50%; translate: -50% 0;
  border: 10px solid transparent; border-top-color: #2a1d15; border-bottom: 0;
}

.host-wrap { position: relative; z-index: 2; width: min(300px, 100%); margin-bottom: -6px; }
.host-wrap .host { display: block; width: 100%; height: auto; }
.host-wrap.is-happy { animation: hop 0.5s ease-out 2; }

.floor {
  align-self: stretch; margin-inline: -16px; min-height: 72px;
  display: flex; align-items: center; justify-content: center; padding-block: 12px;
  background:
    conic-gradient(from 45deg, var(--floor-b) 25%, var(--floor-a) 0 50%, var(--floor-c) 0 75%, var(--floor-a) 0) 0 0 / 32px 32px;
  border-top: 6px solid var(--wood);
}

.cast {
  position: relative; z-index: 4; display: flex; gap: 4px; padding: 6px;
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
  background: var(--paper); border-radius: 18px; box-shadow: var(--shadow);
}
.cast::-webkit-scrollbar { display: none; }
.cast button {
  flex: 0 0 auto; display: grid; justify-items: center; gap: 2px; width: 64px;
  border: 0; border-radius: 12px; padding: 5px 2px; background: transparent; color: var(--ink);
}
.cast button[aria-pressed="true"] { background: var(--maroon); color: var(--on-maroon); }
.cast .mini { width: 38px; height: 38px; border-radius: 50%; overflow: hidden; background: var(--wall-deep); display: block; }
.cast .mini svg { width: 100%; height: 100%; display: block; }
.cast-name { font-size: 0.6875rem; font-weight: 700; line-height: 1.15; text-align: center; }

/* ------------------------------------------------------------ Notebook panel */
.panel {
  display: flex; flex-direction: column; min-width: 0;
  background-color: var(--paper);
  background-image:
    linear-gradient(90deg, transparent 54px, var(--margin-line) 54px, var(--margin-line) 56px, transparent 56px),
    repeating-linear-gradient(transparent 0 31px, var(--rule) 31px 32px);
  border-left: 8px solid var(--wood);
  box-shadow: inset 12px 0 18px -14px rgba(0, 0, 0, 0.35);
}

.tabs { display: flex; gap: 6px; padding-block: 12px 0; padding-inline: 16px 16px; overflow-x: auto; background: var(--wall-deep); }
.tab {
  flex-shrink: 0; border: 0; border-radius: 10px 10px 0 0;
  padding: 10px 16px 9px; font-weight: 700; font-size: var(--fs-sm);
  background: color-mix(in srgb, var(--paper) 55%, var(--wall-deep)); color: var(--ink-soft);
}
.tab[aria-selected="true"] { background: var(--paper); color: var(--heading); box-shadow: inset 0 3px 0 var(--marigold); }
.tab small { display: block; font-family: var(--hand); font-weight: 400; font-size: 0.75rem; line-height: 1; color: var(--muted); }

.view { flex: 1; display: flex; flex-direction: column; min-height: 0; padding-block: 18px 12px; padding-inline: 72px 22px; }
.view-head { margin-bottom: 10px; }
.view-head h1, .view-head h2 { font-family: var(--display); font-weight: 400; font-size: var(--fs-2xl); line-height: 1.1; margin: 0; color: var(--heading); text-wrap: balance; }
.view-head p { margin: 6px 0 0; color: var(--ink-soft); max-width: 60ch; }

/* chat */
.log { flex: 1; min-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-block: 6px 12px; scroll-behavior: smooth; }
.msg { max-width: min(560px, 88%); padding: 10px 14px; border-radius: 16px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; animation: pop 0.22s ease-out; }
.msg .who { display: block; font-family: var(--hand); font-size: var(--fs-xs); color: var(--muted); margin-bottom: 2px; }
.msg.host { align-self: flex-start; background: var(--host-bubble); border: 2px solid color-mix(in srgb, var(--marigold) 55%, transparent); border-bottom-left-radius: 4px; }
.msg.user { align-self: flex-end; background: var(--user-bubble); color: var(--user-ink); border-bottom-right-radius: 4px; }
.msg.user .who { color: rgba(255, 250, 240, 0.75); }
.msg.care { align-self: stretch; max-width: none; background: var(--care-bg); border-left: 5px solid var(--care-line); border-radius: 10px; }
.msg.care a { color: var(--care-line); font-weight: 700; }
.msg .tag { display: inline-block; margin-top: 6px; font-size: 0.72rem; color: var(--muted); font-family: var(--hand); }
.typing { align-self: flex-start; font-family: var(--hand); color: var(--muted); display: flex; align-items: center; gap: 8px; }
.typing .dots { display: inline-flex; gap: 4px; }
.typing .dots b { width: 7px; height: 7px; border-radius: 50%; background: var(--marigold); animation: blink-dot 1.1s infinite; }
.typing .dots b:nth-child(2) { animation-delay: 0.15s; }
.typing .dots b:nth-child(3) { animation-delay: 0.3s; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; padding-block: 8px; }
.chip { border: 1.5px dashed var(--muted); background: transparent; color: var(--ink-soft); border-radius: 999px; padding: 6px 12px; font-size: var(--fs-xs); }
.chip:hover { border-style: solid; color: var(--ink); background: var(--chip); }

.composer { display: flex; gap: 8px; align-items: center; padding-top: 6px; }
.composer input {
  flex: 1; min-width: 0; min-height: 48px; padding: 10px 14px;
  border: 2px solid var(--ink-soft); border-radius: 12px; background: var(--paper);
  font-size: var(--fs-md);
}
.composer input::placeholder { color: var(--muted); font-family: var(--hand); }
.hint { font-size: var(--fs-xs); color: var(--muted); margin: 6px 0 0; }
.hint button { border: 0; background: none; padding: 0; color: var(--heading); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; font-size: inherit; }

/* game */
.game { flex: 1; display: flex; flex-direction: column; gap: 16px; }
.game-hero { display: flex; flex-wrap: wrap; gap: 10px; }
.game-hero .face-chip { width: 52px; height: 56px; border-radius: 12px; background: var(--chip); padding: 4px; }
.meter { display: grid; gap: 6px; }
.meter-row { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--muted); }
.meter-track { height: 12px; border-radius: 999px; background: var(--chip); overflow: hidden; }
.meter-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--marigold), var(--kumkum)); transition: width 0.5s ease; }
.q-num { font-family: var(--hand); color: var(--muted); font-size: var(--fs-md); margin: 0; }
.q-text { font-size: clamp(1.4rem, 2.6vw, 1.9rem); line-height: 1.25; font-weight: 600; margin: 0; text-wrap: balance; max-width: 30ch; }
.answers { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.answers .btn { min-height: 52px; font-size: var(--fs-md); }
.ans-yes { background: #1e7a5a; color: #fff; }
.ans-no { background: var(--kumkum); color: #fff; }
.ans-maybe { background: var(--chip); color: var(--ink); border: 2px solid color-mix(in srgb, var(--ink) 18%, transparent); }
.game-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.polaroid {
  align-self: flex-start; display: grid; justify-items: center; gap: 6px;
  width: min(260px, 100%); padding: 14px 14px 18px;
  background: #fffaf0; color: #2a1d15; border-radius: 6px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.22); rotate: -2deg;
  animation: reveal 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.polaroid .face { width: 100%; background: #cfe8de; border-radius: 4px; }
.polaroid .who-name { font-family: var(--display); font-size: var(--fs-xl); line-height: 1.1; text-align: center; color: #8a1c2b; }
.polaroid .prop { position: absolute; }
.guess-lead { font-family: var(--hand); font-size: var(--fs-lg); color: var(--ink-soft); margin: 0; }
.result-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 22px; align-items: start; }
.result-copy h3 { font-family: var(--display); font-weight: 400; font-size: var(--fs-2xl); color: var(--heading); margin: 0; line-height: 1.1; }
.result-copy .tagline { font-size: var(--fs-lg); margin: 8px 0 12px; }
.sticky-note {
  background: #fff3a8; color: #3b2f12; padding: 12px 14px; border-radius: 2px; rotate: 1deg;
  font-family: var(--hand); font-size: var(--fs-md); line-height: 1.35; box-shadow: 0 6px 12px rgba(0, 0, 0, 0.12);
}
.sticky-note b { font-family: var(--body); font-size: var(--fs-xs); letter-spacing: 0.08em; text-transform: uppercase; display: block; margin-bottom: 4px; }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.pick-grid button { display: grid; justify-items: center; gap: 4px; padding: 10px 8px; border-radius: 12px; border: 2px solid transparent; background: var(--chip); font-size: var(--fs-xs); font-weight: 600; line-height: 1.25; text-align: center; }
.pick-grid button:hover { border-color: var(--marigold); }
.pick-grid .face { width: 64px; }

/* kundli */
.kundli { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 26px; align-items: start; }
.kundli-chart { width: 100%; height: auto; }
.kundli-chart .frame { fill: #fff6dd; stroke: #8a1c2b; stroke-width: 3; }
.kundli-chart .line { stroke: #8a1c2b; stroke-width: 2; }
.kundli-chart .house-n { font-family: var(--hand); font-size: 11px; fill: #b0896a; }
.kundli-chart .k-label { font-family: var(--body); font-size: 11px; fill: #7d6856; text-anchor: middle; }
.kundli-chart .k-value { font-family: var(--display); font-size: 22px; fill: #8a1c2b; text-anchor: middle; }
.kundli-chart .k-name { font-family: var(--display); font-size: 17px; fill: #2a1d15; text-anchor: middle; }
.rel-list { display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 8px 0 0; list-style: none; }
.rel-list li { display: flex; align-items: center; gap: 8px; background: var(--chip); border-radius: 12px; padding: 6px 12px 6px 6px; font-size: var(--fs-sm); font-weight: 600; }
.rel-list .face { width: 40px; height: 44px; }
.rel-list small { color: var(--muted); font-weight: 400; }
.pitch { display: grid; gap: 14px; max-width: 60ch; }
.pitch ul { margin: 0; padding-left: 1.2em; }
.pitch li { margin-block: 4px; }
.danger { margin-top: 26px; padding-top: 14px; border-top: 2px dashed color-mix(in srgb, var(--kumkum) 45%, transparent); }
.danger summary { cursor: pointer; color: var(--kumkum); font-weight: 600; }
.danger form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.btn-block { width: 100%; }
.field-inline { min-height: 40px; padding: 8px 12px; border-radius: 10px; border: 2px solid color-mix(in srgb, var(--ink) 25%, transparent); background: var(--paper); flex: 1; min-width: 160px; }
.msg.care ul { margin: 8px 0; padding-left: 1.1em; }
.msg.care li { margin-block: 4px; }
.kundli h3 { margin: 0; font-size: var(--fs-lg); }

.view-head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.view-head-row > div { min-width: 0; }
.voice-toggle { flex-shrink: 0; }
.voice-toggle[aria-pressed="true"] { background: var(--teal); color: #fff; }
.msg-foot { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.msg .say { border: 0; background: none; padding: 0; font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.msg .say:hover { color: var(--heading); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: var(--fs-sm); margin: 4px 0 8px; line-height: 1.4; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--maroon); flex-shrink: 0; }
.check a { color: var(--heading); font-weight: 600; }
.forgot-row { margin: -4px 0 8px; text-align: right; }
.forgot-row button, .form-note button { border: 0; background: none; padding: 0; color: var(--heading); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; font-size: var(--fs-sm); }
.form-note { font-size: var(--fs-sm); color: var(--ink-soft); margin: 0 0 10px; }
.form-note:empty, .form-error:empty { display: none; }
.field select, .field textarea { min-height: 46px; padding: 10px 12px; border-radius: 10px; border: 2px solid color-mix(in srgb, var(--ink) 25%, transparent); background: var(--paper); color: var(--ink); font: inherit; }
.field textarea { resize: vertical; min-height: 110px; }

/* notebook footer */
.notebook-foot {
  display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center;
  padding-block: 10px 14px; padding-inline: 72px 22px;
  font-size: var(--fs-xs); color: var(--muted); border-top: 1px solid var(--rule);
}
.notebook-foot button, .notebook-foot a { border: 0; background: none; padding: 0; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; font-size: inherit; }

/* ------------------------------------------------------------ Dialogs */
dialog {
  width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto;
  padding: 0; border: 0; border-radius: 14px; background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
dialog::backdrop { background: rgba(20, 12, 8, 0.55); backdrop-filter: blur(2px); }
.biodata { padding: 22px 24px 24px; border: 3px double var(--maroon); margin: 8px; border-radius: 10px; }
.biodata-head { text-align: center; margin-bottom: 14px; }
.biodata-head .om { font-family: var(--display); font-size: var(--fs-xl); color: var(--heading); }
.biodata-head p { margin: 2px 0 0; font-family: var(--hand); color: var(--ink-soft); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--chip); margin-bottom: 16px; }
.seg button { border: 0; border-radius: 9px; padding: 8px; font-weight: 700; background: transparent; color: var(--ink-soft); }
.seg button[aria-selected="true"] { background: var(--paper); color: var(--heading); box-shadow: var(--shadow); }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field label { font-weight: 600; font-size: var(--fs-sm); }
.field label span { font-family: var(--hand); font-weight: 400; color: var(--muted); }
.field input { min-height: 46px; padding: 10px 12px; border-radius: 10px; border: 2px solid color-mix(in srgb, var(--ink) 25%, transparent); background: var(--paper); }
.field input:focus-visible { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent); }
.form-error { min-height: 1.4em; color: var(--kumkum); font-size: var(--fs-sm); font-weight: 600; margin: 4px 0 8px; }
.fine { font-size: var(--fs-xs); color: var(--muted); margin: 12px 0 0; }
.dialog-close { position: absolute; top: 10px; right: 12px; border: 0; background: var(--chip); border-radius: 50%; width: 34px; height: 34px; font-size: 18px; line-height: 1; }
.prose { padding: 26px 24px; }
.prose h2 { font-family: var(--display); font-weight: 400; color: var(--heading); margin: 0 0 10px; font-size: var(--fs-xl); }
.prose h3 { margin: 16px 0 4px; font-size: var(--fs-md); }
.prose p, .prose li { color: var(--ink-soft); font-size: var(--fs-sm); }

/* ------------------------------------------------------------ Toast + petals */
.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); translate: -50% 0; z-index: 90;
  max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 12px;
  background: #2a1d15; color: #fff6e3; font-size: var(--fs-sm); box-shadow: var(--shadow);
  animation: pop 0.25s ease-out;
}
.petal {
  position: fixed; top: -20px; z-index: 80; width: 14px; height: 10px; pointer-events: none;
  border-radius: 60% 40% 60% 40%; background: var(--marigold);
  animation: fall var(--fall, 2.6s) linear forwards;
}
.petal:nth-child(3n) { background: #ff7a1a; }
.petal:nth-child(4n) { background: #ffd23f; }

/* ------------------------------------------------------------ Character animation */
.host .u-arm, .host .u-fore, .host .u-glass, .host .u-belly, .host .u-head,
.host .a-head, .host .a-phone, .host .a-brow, .host .u-brows,
.host .look, .host .u-eyes, .host .a-eyes, .host .u-stache, .host .a-mouth, .host .u-mouth, .host .steam path {
  transform-box: view-box;
}
.host .u-arm { transform-origin: 203px 168px; animation: u-arm 6.5s ease-in-out infinite; }
.host .u-fore { transform-origin: 212px 222px; animation: u-fore 6.5s ease-in-out infinite; }
.host .u-glass { transform-origin: 172px 252px; animation: u-glass 6.5s ease-in-out infinite; }
@keyframes u-arm { 0%, 30% { transform: rotate(0); } 45%, 66% { transform: rotate(74deg); } 82%, 100% { transform: rotate(0); } }
@keyframes u-fore { 0%, 30% { transform: rotate(0); } 45%, 66% { transform: rotate(82deg); } 82%, 100% { transform: rotate(0); } }
@keyframes u-glass { 0%, 30% { transform: rotate(0); } 45%, 66% { transform: rotate(-191deg); } 82%, 100% { transform: rotate(0); } }
.host .u-belly { transform-origin: 150px 300px; animation: breathe 3.4s ease-in-out infinite; }
.host .u-head { transform-origin: 150px 150px; animation: nod 7s ease-in-out infinite; }
.host .u-eyes { transform-origin: 150px 104px; animation: blink 5.2s infinite; }
.host .a-eyes { transform-origin: 150px 99px; animation: blink 4.6s infinite 0.8s; }
.host .a-head { transform-origin: 150px 140px; animation: tilt 6s ease-in-out infinite; }
.host .a-brow { transform-origin: 168px 80px; animation: judge 5s ease-in-out infinite; }
.host-aunty .look { animation: side-eye 8s ease-in-out infinite; }
.host .a-phone { transform-origin: 169px 258px; animation: buzz 7s ease-in-out infinite; }
.host .a-screen { animation: glow 7s ease-in-out infinite; }
.host .steam path { transform-origin: 172px 214px; opacity: 0; animation: steam 2.4s ease-out infinite; }
.host .steam .s2 { animation-delay: 0.6s; }
.host .steam .s3 { animation-delay: 1.2s; }
.host .eyes-happy { opacity: 0; }
.host .think-dots { opacity: 0; transition: opacity 0.2s; }

.host .s-head, .host .s-body, .host .s-offer, .host .f-mouth { transform-box: view-box; }
.host .s-head { transform-origin: 150px 150px; animation: nod 7s ease-in-out infinite; }
.host-fufa .s-head { animation: sulk 6s ease-in-out infinite; }
.host .s-body { transform-origin: 150px 300px; animation: breathe 3.6s ease-in-out infinite; }
.host .s-offer { animation: offer 3.2s ease-in-out infinite; }
.host .f-eyes { transform-box: fill-box; transform-origin: center; animation: blink 5s infinite 0.4s; }
.host.is-talking .f-mouth { transform-box: fill-box; transform-origin: center; animation: talk 0.22s ease-in-out infinite alternate; }
.host.is-happy .f-eyes { opacity: 0; }
@keyframes sulk { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(3deg); } }
@keyframes offer { 0%, 70%, 100% { transform: translateY(0); } 80%, 90% { transform: translateY(-6px); } }

.host.is-thinking .think-dots { opacity: 1; animation: float 1.6s ease-in-out infinite; }
.host.is-thinking .look { transform: translate(3px, -4px); animation: none; }
.host.is-thinking .u-brows { transform: translateY(-4px); }
.host.is-thinking .u-arm, .host.is-thinking .u-fore, .host.is-thinking .u-glass { animation-duration: 3.2s; }
.host.is-talking .u-stache { animation: talk 0.22s ease-in-out infinite alternate; transform-origin: 150px 130px; }
.host.is-talking .u-mouth, .host.is-talking .a-mouth { animation: talk 0.22s ease-in-out infinite alternate; transform-origin: 150px 140px; }
.host.is-happy .u-eyes, .host.is-happy .a-eyes { opacity: 0; }
.host.is-happy .eyes-happy { opacity: 1; }

@keyframes breathe { 50% { transform: scale(1.02, 1.012); } }
@keyframes nod { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-2deg); } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.1); } }
@keyframes tilt { 0%, 100% { transform: rotate(-2.5deg); } 50% { transform: rotate(3deg); } }
@keyframes judge { 0%, 60%, 100% { transform: translateY(0); } 70%, 85% { transform: translateY(-4px); } }
@keyframes side-eye { 0%, 55%, 100% { transform: translateX(0); } 62%, 80% { transform: translateX(3px); } }
@keyframes buzz { 0%, 80%, 100% { transform: rotate(0); } 82% { transform: rotate(-6deg); } 84% { transform: rotate(6deg); } 86% { transform: rotate(-6deg); } 88% { transform: rotate(5deg); } 90% { transform: rotate(0); } }
@keyframes glow { 0%, 78%, 100% { fill: #7fd3ff; } 82%, 92% { fill: #e6f7ff; } }
@keyframes steam { 0% { opacity: 0; transform: translateY(6px) scaleY(0.7); } 30% { opacity: 0.85; } 100% { opacity: 0; transform: translateY(-16px) scaleY(1.2); } }
@keyframes talk { from { transform: translateY(0); } to { transform: translateY(2px) scaleY(1.15); } }
@keyframes float { 50% { transform: translateY(-4px); } }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { 50% { transform: translateY(-6px); } }
@keyframes hop { 40% { transform: translateY(-16px); } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes reveal { from { opacity: 0; transform: scale(0.6) rotate(-12deg); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { opacity: 0.25; } }
@keyframes blink-dot { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@keyframes fall { to { transform: translate(var(--drift, 40px), 110vh) rotate(var(--spin, 540deg)); } }

/* ------------------------------------------------------------ Desktop: fixed room, notebook scrolls */
@media (min-width: 961px) {
  .app { height: 100dvh; }
  .room { min-height: 0; }
  .panel { min-height: 0; }
  .view { overflow-y: auto; }
}

/* ------------------------------------------------------------ Tablet & phone */
@media (max-width: 960px) {
  .room { grid-template-columns: 1fr; }
  .stage { min-height: 360px; }
  .stage .fan { width: 130px; top: -62px; }
  .host-wrap { width: min(230px, 62vw); }
  .speech { top: 96px; }
  .panel { border-left: 0; border-top: 8px solid var(--wood); background-image: repeating-linear-gradient(transparent 0 31px, var(--rule) 31px 32px); }
  .view, .notebook-foot { padding-inline: 16px; }
  .log { max-height: 62vh; }
  .result-grid, .kundli { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .brand-tag { display: none; }
  .brand-mark { font-size: 1.7rem; }
  .account-name { display: none; }
  .stage .clock { width: 58px; top: 22px; left: 12px; }
  .calendar { width: 96px; right: 10px; top: 18px; }
  .cal-day { font-size: 2rem; }
  .cal-note { display: none; }
  .cast button { width: 56px; }
  .stage { min-height: 0; padding-top: 70px; }
  .stage .fan { display: none; }
  .host-wrap { width: min(190px, 52vw); }
  .speech { top: 14px; max-width: calc(100% - 200px); min-width: 120px; font-size: var(--fs-sm); padding: 6px 10px; }
  .floor { min-height: 62px; padding-block: 10px; }
  .tabs { padding-inline: 12px; gap: 4px; }
  .tab { padding: 9px 12px 8px; font-size: var(--fs-xs); }
  .tab small { display: none; }
  .answers { grid-template-columns: 1fr 1fr; }
  .answers .ans-maybe:last-child { grid-column: 1 / -1; }
  .view-head h1, .view-head h2 { font-size: var(--fs-xl); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .chai-fill { transform: translateY(12%); }
  .ticker-items { animation: none; }
}

/* ------------------------------------------------------------ Legal pages */
.legal-page { background: var(--wall) var(--stencil); }
.legal {
  max-width: 760px; margin: 0 auto; padding-block: 32px 56px; padding-inline: 16px;
}
.legal article {
  background-color: var(--paper);
  border-radius: 14px; box-shadow: var(--shadow);
  padding: clamp(20px, 5vw, 44px);
}
.legal h1 { font-family: var(--display); font-weight: 400; color: var(--heading); font-size: clamp(1.9rem, 5vw, 2.6rem); margin: 0 0 4px; line-height: 1.1; }
.legal .meta { color: var(--muted); font-size: var(--fs-sm); margin: 0 0 18px; }
.legal .summary { background: var(--host-bubble); border-radius: 10px; padding: 14px 16px; margin-bottom: 22px; }
.legal .summary h2 { margin-top: 0; }
.legal h2 { font-size: var(--fs-lg); margin: 28px 0 8px; color: var(--ink); }
.legal p, .legal li { color: var(--ink-soft); max-width: 68ch; }
.legal ul { padding-left: 1.2em; }
.legal li { margin-block: 4px; }
.legal a { color: var(--heading); font-weight: 600; }
.legal table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); margin-block: 8px; }
.legal th, .legal td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; color: var(--ink-soft); }
.legal th { color: var(--ink); }
.legal .table-wrap { overflow-x: auto; }
.legal-back { display: inline-flex; margin-bottom: 14px; }
