/* Sahay app (/app). Tokens: /css/tokens.css. Shapes are circles, pills, blobs and curves;
   glass only for things that float over content (nav, edge orb, sheets, the Yes card).
   Motion: 150/200/300 ms, ease-out in, ease-in out; loops only where something is live. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 120px; overflow-x: clip; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ink-0);
  color: var(--text-hi);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
svg { flex: none; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus); border-radius: var(--r-pill); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noscript { padding: 24px; }

/* One aurora wash, fixed behind everything. Not animated. */
.aurora {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vmax 40vmax at 82% -8%, var(--aurora-a), transparent 60%),
    radial-gradient(50vmax 36vmax at -10% 30%, var(--aurora-b), transparent 62%),
    radial-gradient(40vmax 30vmax at 70% 110%, var(--aurora-c), transparent 60%),
    var(--ink-0);
}

.skip-link {
  position: fixed; left: 16px; top: -80px; z-index: 100;
  padding: 14px 22px; border-radius: var(--r-pill);
  background: var(--marigold); color: var(--on-accent); font-weight: 600; text-decoration: none;
  transition: top var(--t-med) var(--ease-out);
}
.skip-link:focus-visible { top: 16px; }

/* ------------------------------------------------------------ glass -- */
.glass {
  background: var(--glass-strong);
  border: 1px solid var(--edge);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow-float), inset 0 1px 0 rgba(255, 255, 255, .08);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .pillnav, .edge-trigger, .edge-bubble, .sheet, .yes-card { background: var(--ink-1) !important; }
}

/* ---------------------------------------------------------- buttons -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--touch); padding: 0 26px;
  border-radius: var(--r-pill); border: 1px solid transparent;
  font-weight: 600; font-size: var(--fs-body); text-decoration: none; line-height: 1.2;
  transition: transform var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: default; transform: none; }
.btn-lg { min-height: 64px; padding: 0 30px; font-size: 1.25rem; }
.btn-sm { min-height: 48px; padding: 0 18px; font-size: 1rem; }
.btn-primary { background: var(--marigold); color: var(--on-accent); box-shadow: var(--glow-marigold); }
.btn-primary:hover { background: #FFBF47; }
.btn-ghost { background: var(--glass); border-color: var(--edge); color: var(--text-hi); }
.btn-ghost:hover { background: rgba(255, 255, 255, .1); }
:root[data-theme="light"] .btn-ghost:hover { background: rgba(18, 24, 38, .07); }
.btn-yes { background: var(--leaf); color: var(--on-accent); }
.btn-no { background: transparent; border-color: var(--coral); color: var(--coral-text); }

.icon-btn {
  position: relative;
  display: inline-grid; place-items: center;
  width: var(--touch); height: var(--touch); padding: 0;
  border-radius: 50%; border: 1px solid var(--edge);
  background: var(--glass); color: var(--text-hi);
  transition: background-color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.icon-btn:hover { background: rgba(255, 255, 255, .1); }
.icon-btn:active { transform: scale(.95); }
.icon-btn-lg { width: 64px; height: 64px; }

/* Real tooltip for icon-only controls: on hover and keyboard focus (never title=). */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; left: 50%; bottom: calc(100% + 10px);
  transform: translateX(-50%);
  padding: 8px 14px; border-radius: 14px;
  background: var(--ink-2); color: var(--text-hi); border: 1px solid var(--edge);
  font: 600 .95rem/1.3 var(--font-body); white-space: nowrap;
  pointer-events: none; z-index: 60;
  display: none; /* not laid out while hidden, so it never widens the page */
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { display: block; animation: tip-in var(--t-fast) var(--ease-out) 300ms both; }
[data-tip]:focus-visible::after { animation-delay: 0ms; }
@keyframes tip-in { from { opacity: 0; margin-bottom: -4px; } }
.tip-below[data-tip]::after { bottom: auto; top: calc(100% + 10px); }
.tip-end[data-tip]::after { left: auto; right: 0; transform: none; }
@media (hover: none) { [data-tip]:hover:not(:focus-visible)::after { display: none; } }

.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid currentColor; border-right-color: transparent;
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------- top strip -- */
.topstrip {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 18px 24px; pointer-events: none;
}
.topstrip > * { pointer-events: auto; }
.top-brand { display: none; align-items: center; gap: 10px; min-width: 0; }
.shop-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 30vw; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.ai-notice {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 6px 16px 6px 8px; border-radius: var(--r-pill);
  background: var(--glass); border: 1px solid var(--glass-border);
  color: var(--text-hi); font-size: 1rem; font-weight: 600; max-width: calc(50vw - 340px);
}
.ai-ico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: rgba(79, 209, 232, .16); color: var(--cyan-text); }
.ai-long { display: none; }
@media (min-width: 1680px) {
  .ai-short { display: none; }
  .ai-long { display: inline; font-weight: 500; font-size: .95rem; line-height: 1.3; }
}
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 1rem; color: var(--text-lo); white-space: nowrap; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-lo); }
.live[data-state="open"] .live-dot { background: var(--leaf); box-shadow: 0 0 0 4px rgba(61, 220, 151, .2); }
.live[data-state="connecting"] .live-dot, .live[data-state="reconnecting"] .live-dot { background: var(--marigold); }
.live[data-state="closed"] .live-dot { background: transparent; border: 2px solid var(--coral); }
.live[data-state="closed"] { color: var(--coral-text); }
.live-in-top { display: none; }

.logo-orb {
  display: inline-block; width: 36px; height: 36px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #FFE3A3 0 10%, var(--marigold) 38%, var(--saffron) 78%, #C2410C 100%);
  box-shadow: 0 0 18px rgba(255, 150, 30, .45);
}

/* -------------------------------------------------------- pill nav -- */
.pillnav {
  position: fixed; z-index: 40; left: 50%; top: 16px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px 6px 6px; border-radius: var(--r-pill);
  background: var(--glass-strong); border: 1px solid var(--edge);
  -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow-float), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.nav-logo { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; }
.nav-links { display: flex; gap: 2px; }
.nav-link {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  min-height: 52px; padding: 0 18px; border-radius: var(--r-pill);
  color: var(--text-lo); text-decoration: none; font-weight: 600; white-space: nowrap;
  transition: color var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out);
}
.nav-link:hover { color: var(--text-hi); background: var(--glass); }
.nav-link[aria-current="page"] { color: var(--on-accent); background: var(--marigold); }
.nav-ico { position: relative; display: grid; place-items: center; }
.nav-badge {
  position: absolute; top: -8px; right: -10px; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: var(--r-pill); background: var(--coral); color: var(--on-coral);
  font: 700 .8rem/22px var(--font-body); text-align: center; border: 2px solid var(--ink-1);
}
.live-in-nav { padding-left: 10px; }

/* --------------------------------------------------------- layout -- */
#main { display: block; padding: 112px 24px 64px; min-height: 100dvh; }
#main:focus { box-shadow: none; }
.screen { max-width: 1120px; margin: 0 auto; }
.screen-in { animation: screen-in var(--t-slow) var(--ease-out); }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } }
.screen-title {
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-title);
  letter-spacing: -.02em; line-height: 1.1; margin: 8px 0 24px;
}
:lang(hi) .screen-title, .screen-title:lang(hi) { font-family: var(--font-deva); letter-spacing: 0; }
:lang(kn) .screen-title, .screen-title:lang(kn) { font-family: var(--font-kn); letter-spacing: 0; }
.boot-view { display: grid; place-items: center; min-height: 70dvh; }
.banner-slot { position: fixed; z-index: 45; left: 50%; top: 92px; transform: translateX(-50%); width: min(560px, calc(100% - 32px)); }

.toast {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 12px 12px 22px; border-radius: var(--r-soft);
  background: var(--ink-2); border: 1px solid var(--edge); box-shadow: var(--shadow-float);
}
.toast > span { flex: 1 1 200px; }
.toast-warn { border-color: var(--marigold); }

/* Mid widths: the notice sits under the nav so the two never overlap. */
@media (min-width: 761px) and (max-width: 1180px) {
  .topstrip { top: 78px; justify-content: center; padding-top: 8px; }
  .top-right { position: fixed; right: 20px; top: 18px; }
  .ai-notice { max-width: none; }
  #main { padding-top: 160px; }
  .banner-slot { top: 140px; }
}

/* Phones: nav becomes a bottom pill with 4 icons + words; top strip carries brand + live. */
@media (max-width: 760px) {
  .topstrip { padding: 12px 16px; gap: 8px; background: linear-gradient(var(--ink-0) 55%, transparent); }
  .top-brand { display: inline-flex; }
  .shop-name { display: none; }
  .top-brand .logo-orb { width: 32px; height: 32px; }
  .ai-notice { max-width: none; flex: 0 1 auto; min-width: 0; font-size: .95rem; }
  .ai-short { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .live-in-top { display: inline-flex; }
  .live-in-top .live-text { display: none; }
  .theme-btn { width: 48px; height: 48px; }
  .pillnav {
    top: auto; bottom: max(12px, env(safe-area-inset-bottom)); width: calc(100% - 24px);
    padding: 6px; justify-content: center;
  }
  .nav-logo, .live-in-nav { display: none; }
  .nav-links { flex: 1; justify-content: space-between; }
  .nav-link {
    flex: 1; flex-direction: column; gap: 2px; min-height: 64px; padding: 6px 4px;
    font-size: .9rem; border-radius: 30px; text-align: center;
  }
  .nav-word { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  #main { padding: 84px 16px 128px; }
  .banner-slot { top: 76px; }
}

/* ------------------------------------------------------ state views -- */
.state {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 14px; padding: 48px 16px; max-width: 520px; margin: 0 auto;
}
.state-compact { padding: 24px 12px; }
.state-blob {
  display: grid; place-items: center; width: 128px; height: 128px; margin-bottom: 8px;
  border-radius: var(--r-blob);
  background: radial-gradient(circle at 40% 35%, rgba(255, 176, 32, .32), rgba(255, 122, 26, .12) 60%, transparent 72%);
  border: 1px solid rgba(255, 176, 32, .35);
  color: var(--marigold-text);
}
.state-error .state-blob { background: radial-gradient(circle at 40% 35%, rgba(255, 107, 107, .28), transparent 70%); border-color: var(--coral); color: var(--coral-text); }
.state-title { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.state-title:lang(hi), :lang(hi) .state-title { font-family: var(--font-deva); }
.state-title:lang(kn), :lang(kn) .state-title { font-family: var(--font-kn); }
.state-text { color: var(--text-lo); font-size: var(--fs-body); max-width: 40ch; }
.state .btn { margin-top: 10px; }
.state-orbit { position: relative; width: 96px; height: 96px; margin-bottom: 8px; animation: spin 2.4s linear infinite; }
.state-orbit i { position: absolute; width: 18px; height: 18px; border-radius: 50%; background: var(--marigold); left: 39px; top: 0; }
.state-orbit i:nth-child(2) { top: auto; bottom: 6px; left: 6px; background: var(--cyan); }
.state-orbit i:nth-child(3) { top: auto; bottom: 6px; left: auto; right: 6px; background: var(--leaf); }

/* -------------------------------------------------------- edge orb -- */
.edge { position: fixed; right: 0; top: 50%; z-index: 50; width: 0; height: 0; }
.edge::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background: rgba(5, 7, 12, .55); opacity: 0; pointer-events: none;
  transition: opacity var(--t-med) var(--ease-in);
}
:root[data-theme="light"] .edge::before { background: rgba(18, 24, 38, .25); }
.edge.is-fanned::before { opacity: 1; transition-timing-function: var(--ease-out); }
.edge-trigger {
  position: absolute; right: 0; top: -56px; width: 60px; height: 112px; padding: 0 0 0 14px;
  border-radius: 56px 0 0 56px; border: 1px solid var(--edge); border-right: 0;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow-float);
  display: grid; place-items: center start;
  transition: width var(--t-med) var(--ease-out);
}
.edge-trigger:focus-visible { border-radius: 56px 0 0 56px; }
.edge-core {
  width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #FFE3A3 0 10%, var(--marigold) 40%, var(--saffron) 85%);
  box-shadow: 0 0 16px rgba(255, 150, 30, .5);
  transition: transform var(--t-slow) var(--ease-out);
}
.edge.is-open .edge-core { transform: scale(.7); }
.edge[data-call="live"] .edge-core { box-shadow: 0 0 0 4px rgba(61, 220, 151, .45), 0 0 18px rgba(255, 150, 30, .5); }
.edge-count {
  position: absolute; top: 10px; left: 6px; min-width: 24px; height: 24px; padding: 0 6px;
  border-radius: var(--r-pill); background: var(--coral); color: var(--on-coral);
  font: 700 .85rem/24px var(--font-body); text-align: center;
}
.edge-fan { position: absolute; right: 30px; top: 0; width: 0; height: 0; --r: 170px; }
.edge-bubble {
  position: absolute; left: -44px; top: -44px; width: 88px; height: 88px; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 50%; border: 1px solid var(--edge);
  background: var(--glass-strong); color: var(--text-hi);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: var(--shadow-float);
  font-size: .9rem; font-weight: 600; line-height: 1.1;
  opacity: 0;
  transform: translate(0, 0) scale(.4);
  transition: transform var(--t-slow) var(--ease-out), opacity var(--t-med) var(--ease-out), background-color var(--t-fast);
  transition-delay: calc(var(--i) * 30ms);
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.edge.is-fanned .edge-bubble {
  opacity: 1;
  transform: translate(calc(cos(var(--a)) * var(--r)), calc(sin(var(--a)) * var(--r) * -1)) scale(1);
}
.edge-bubble:focus-visible { border-radius: 50%; }
.edge-bubble:hover { background: var(--ink-2); }
.edge-bubble[data-id="talk"] { background: var(--marigold); color: var(--on-accent); border-color: transparent; }
.edge-bubble[data-id="talk"][data-active="true"] { box-shadow: 0 0 0 4px rgba(61, 220, 151, .5); }
.edge-bubble[aria-disabled="true"] { opacity: .5 !important; }
.edge-bubble[aria-disabled="true"] .eb-ico { opacity: .7; }
.eb-ico { position: relative; display: grid; place-items: center; }
.eb-word { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eb-soon { position: absolute; bottom: -10px; padding: 1px 8px; border-radius: var(--r-pill); background: var(--ink-3); color: var(--text-hi); font-size: .75rem; }
.eb-badge {
  position: absolute; top: -10px; right: -16px; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: var(--r-pill); background: var(--coral); color: var(--on-coral);
  font: 700 .8rem/22px var(--font-body);
}
.edge-bubble[data-tip]::after, .edge-trigger[data-tip]::after { left: auto; right: calc(100% + 10px); bottom: 50%; transform: translateY(50%); }
.edge-bigword {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  padding: 22px 36px; border-radius: var(--r-pill);
  background: var(--ink-2); border: 1px solid var(--marigold); color: var(--text-hi);
  font-family: var(--font-display); font-size: 2.4rem; font-weight: 700; white-space: nowrap; z-index: 70;
}
@media (max-width: 760px) {
  .edge { top: 46%; }
  .edge-trigger { width: 48px; height: 96px; top: -48px; padding-left: 9px; }
  .edge-core { width: 30px; height: 30px; }
  /* 5 bubbles 34deg apart: chord 2r*sin(17deg) = 103px for 78px bubbles, so they never touch. */
  .edge-fan { --r: 176px; right: 22px; }
  .edge-bubble { width: 78px; height: 78px; left: -39px; top: -39px; font-size: .85rem; }
  .edge-bubble .eb-word { max-width: 70px; }
}

/* ------------------------------------------------------------ welcome -- */
body[data-boot="welcome"] .topstrip, body[data-boot="welcome"] .pillnav, body[data-boot="welcome"] .edge,
body[data-boot="welcome"] #main, body[data-boot="welcome"] .banner-slot { display: none; }
body[data-boot="loading"] .pillnav, body[data-boot="error"] .pillnav,
body[data-boot="loading"] .edge, body[data-boot="error"] .edge { display: none; }
.welcome {
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 28px; padding: 40px 20px 32px;
}
.wel-orb {
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #FFE3A3 0 8%, var(--marigold) 36%, var(--saffron) 74%, #B4380A 100%);
  box-shadow: 0 0 60px rgba(255, 150, 30, .45), 0 0 0 14px rgba(255, 176, 32, .08), 0 0 0 30px rgba(255, 176, 32, .04);
}
.wel-card { width: min(560px, 100%); display: flex; flex-direction: column; gap: 22px; }
.wel-progress { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; justify-content: center; }
.wel-progress li { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--text-lo); }
.wel-progress li.is-done { background: var(--leaf); border-color: var(--leaf); }
.wel-progress li.is-now { width: 34px; border-radius: var(--r-pill); background: var(--marigold); border-color: var(--marigold); }
.wel-q {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  font-family: var(--font-display); font-weight: 700; font-size: clamp(1.8rem, 1.3rem + 2vw, 2.6rem);
  line-height: 1.15; text-align: center; letter-spacing: -.01em;
}
.wel-q-ico { display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--r-blob); background: rgba(255, 176, 32, .16); color: var(--marigold-text); }
.wel-q-tri { flex-direction: column; gap: 2px; }
.wel-q-tri span:nth-child(n+2) { font-size: .62em; color: var(--text-lo); font-weight: 600; }
.wel-why { text-align: center; color: var(--text-lo); }
.lang-tiles { display: flex; flex-direction: column; gap: 14px; }
.lang-tile {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 96px; padding: 0 28px 0 36px; border-radius: var(--r-pill);
  border: 1px solid var(--edge); background: var(--glass); color: var(--text-hi);
  transition: background-color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
  animation: rise var(--t-slow) var(--ease-out) both; animation-delay: calc(var(--i) * 60ms);
}
.lang-tile:hover, .lang-tile[aria-pressed="true"] { border-color: var(--marigold); background: rgba(255, 176, 32, .12); }
.lang-tile:active { transform: scale(.98); }
.lt-script { font-size: 2.4rem; font-weight: 600; line-height: 1.2; }
.lang-tile-en .lt-script { font-family: var(--font-display); font-weight: 700; }
.lt-go { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--marigold); color: var(--on-accent); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.wel-field { display: flex; gap: 12px; align-items: center; }
.wel-input {
  flex: 1; min-width: 0; height: 72px; padding: 0 28px;
  border-radius: var(--r-pill); border: 2px solid var(--edge); background: var(--ink-1);
  font-size: 1.5rem; color: var(--text-hi);
}
.wel-input:focus-visible { border-color: var(--marigold); box-shadow: 0 0 0 4px rgba(255, 176, 32, .25); border-radius: var(--r-pill); }
.wel-input[aria-invalid="true"] { border-color: var(--coral); }
.dictate[data-state="listening"] { background: var(--coral); color: var(--on-coral); border-color: var(--coral); }
.wel-field-err, .wel-error { display: flex; gap: 10px; align-items: center; color: var(--coral-text); font-weight: 600; }
.wel-error { padding: 14px 20px; border-radius: var(--r-soft); border: 1px solid var(--coral); background: rgba(255, 107, 107, .08); }
.wel-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.wel-actions .btn-primary { flex: 1 1 220px; max-width: 360px; }
.wel-notice { display: flex; gap: 10px; align-items: center; color: var(--text-lo); font-size: 1rem; max-width: 560px; text-align: left; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .edge-bubble { transition: opacity var(--t-med) var(--ease-out) !important; transition-delay: 0ms !important; }
  .edge-bubble, .edge.is-fanned .edge-bubble { transform: translate(calc(cos(var(--a)) * var(--r)), calc(sin(var(--a)) * var(--r) * -1)); }
  .screen-in { animation: fade-in var(--t-med) linear; animation-duration: var(--t-med) !important; }
  .spinner, .state-orbit { animation: none; }
}
@keyframes fade-in { from { opacity: 0; } }

/* Fan open: the trigger's own tooltip would sit on the middle bubble. */
.edge.is-open .edge-trigger::after { display: none; }
.edge-bubble:not([data-id="talk"]) { background: color-mix(in srgb, var(--ink-2) 88%, transparent); }

/* ================================================================ talk -- */
.talk {
  display: grid; gap: 40px; align-items: center;
  min-height: calc(100dvh - 200px);
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
}
.talk-stage { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.talk-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (max-width: 999px) {
  .talk { grid-template-columns: 1fr; gap: 28px; min-height: 0; }
}

/* The orb */
.orb {
  --size: clamp(210px, 26vw, 340px); --level: 0;
  position: relative; width: var(--size); height: var(--size); padding: 0;
  border: 0; border-radius: 50%; background: transparent;
  -webkit-tap-highlight-color: transparent;
}
.orb:focus-visible { box-shadow: 0 0 0 4px var(--ink-0), 0 0 0 8px var(--marigold); }
.orb[disabled] { cursor: progress; }
.orb > * { position: absolute; border-radius: 50%; pointer-events: none; }
.orb-halo {
  inset: 2%;
  background: radial-gradient(circle, rgba(255, 176, 32, .34) 0%, rgba(255, 122, 26, .12) 45%, transparent 70%);
  transform: scale(calc(1 + var(--level) * .22));
  transition: transform 120ms var(--ease-out), opacity var(--t-slow) var(--ease-out);
}
.orb-core {
  inset: 20%;
  background: radial-gradient(circle at 34% 28%, #FFF1CC 0 6%, #FFC94D 22%, var(--marigold) 44%, var(--saffron) 76%, #B4380A 100%);
  box-shadow: 0 20px 60px -10px rgba(255, 122, 26, .55), inset -14px -18px 40px rgba(120, 30, 0, .35);
  transform: scale(calc(1 + var(--level) * .07));
  transition: transform 100ms var(--ease-out), filter var(--t-slow) var(--ease-out);
}
.orb-shine { position: absolute; left: 22%; top: 14%; width: 30%; height: 18%; border-radius: 50%; background: rgba(255, 255, 255, .35); filter: blur(6px); }
.orb-arc { inset: 6%; width: 88%; height: 88%; opacity: 0; color: var(--marigold); stroke: currentColor; transition: opacity var(--t-med) var(--ease-out); }
.orb-ripple { inset: 20%; border: 2px solid var(--marigold); opacity: 0; }
.orb-sats { inset: 0; opacity: 0; transition: opacity var(--t-slow) var(--ease-out); }
.orb-sats i { position: absolute; width: 16px; height: 16px; border-radius: 50%; left: calc(50% - 8px); top: 2%; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.orb-sats i:nth-child(2) { top: auto; bottom: 14%; left: 8%; background: var(--leaf); box-shadow: 0 0 12px var(--leaf); }
.orb-sats i:nth-child(3) { top: auto; bottom: 14%; left: auto; right: 8%; background: var(--marigold); }
.orb[data-state="idle"] .orb-core { filter: saturate(.92); }
.orb[data-state="listening"] .orb-core { animation: breathe 2400ms ease-in-out infinite; }
.orb[data-state="listening"]::after {
  content: ""; position: absolute; inset: 14%; border-radius: 50%; border: 3px solid var(--leaf);
  transform: scale(calc(1 + var(--level) * .12)); transition: transform 100ms var(--ease-out);
}
.orb[data-state="thinking"] .orb-arc, .orb[data-state="connecting"] .orb-arc { opacity: 1; animation: spin 1600ms linear infinite; }
.orb[data-state="connecting"] .orb-core { filter: saturate(.6) brightness(.9); }
.orb[data-state="speaking"] .orb-ripple { animation: ripple 1800ms var(--ease-out) infinite; }
.orb[data-state="speaking"] .r2 { animation-delay: 600ms; }
.orb[data-state="speaking"] .r3 { animation-delay: 1200ms; }
.orb[data-working="true"] .orb-sats { opacity: 1; animation: spin 7s linear infinite; }
.orb[data-state="error"] .orb-core { filter: grayscale(.6) brightness(.8); }
.orb[data-state="error"]::after { content: ""; position: absolute; inset: 14%; border-radius: 50%; border: 3px solid var(--coral); }
@keyframes breathe { 50% { transform: scale(calc(1.04 + var(--level) * .07)); } }
@keyframes ripple { from { opacity: .7; transform: scale(1); } to { opacity: 0; transform: scale(1.75); } }

.orb-label { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem); line-height: 1.2; }
:lang(hi) .orb-label { font-family: var(--font-deva); }
:lang(kn) .orb-label { font-family: var(--font-kn); }
.orb-label[data-state="error"], .orb-label[data-tone="bad"] { color: var(--coral-text); font-size: 1.3rem; max-width: 30ch; }

.now { display: flex; align-items: center; gap: 10px; justify-content: center; max-width: 100%; }
.now-line {
  display: inline-flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 20px;
  border-radius: var(--r-pill); background: var(--glass); border: 1px solid var(--glass-border);
  font-size: var(--fs-body); max-width: 100%; text-align: left;
}
.now-text { overflow-wrap: anywhere; }
.now-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--text-lo); flex: none; }
.tone-busy .now-dot { background: var(--marigold); box-shadow: 0 0 0 4px rgba(255, 176, 32, .22); }
.tone-needs .now-dot { background: var(--coral); box-shadow: 0 0 0 4px rgba(255, 107, 107, .25); }
.tone-done .now-dot { background: var(--leaf); }
.tone-bad .now-dot { background: transparent; border: 3px solid var(--coral); }

.talk-issues { display: flex; flex-direction: column; gap: 10px; align-items: center; width: 100%; max-width: 480px; }
.talk-issues:empty { display: none; }
.issue {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center;
  padding: 12px 18px; border-radius: var(--r-soft); background: var(--glass); border: 1px solid var(--glass-border); text-align: left;
}
.issue > span { flex: 1 1 180px; }
.issue-bad { border-color: var(--coral); }
.issue-bad > svg { color: var(--coral-text); }
.issue-warn { border-color: var(--marigold); }
.issue-line { flex-wrap: nowrap; }
.issue-line > span { flex: 0 1 auto; }

.talk-controls { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 5px; gap: 4px; border-radius: var(--r-pill); background: var(--glass); border: 1px solid var(--edge); }
.seg-btn {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: var(--r-pill); border: 0;
  background: transparent; color: var(--text-lo); font-weight: 600;
  transition: background-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.seg-btn[aria-pressed="true"] { background: var(--text-hi); color: var(--ink-0); }
.seg-btn[aria-disabled="true"] { opacity: .5; cursor: default; }
.seg-soon { font-size: .8rem; padding: 1px 8px; border-radius: var(--r-pill); background: var(--ink-3); color: var(--text-hi); }
.btn-end { background: var(--coral); color: var(--on-coral); }
.mute-btn[aria-pressed="true"] { background: var(--coral); color: var(--on-coral); border-color: var(--coral); }

/* Conversation bubbles */
.convo { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.bubble { max-width: 88%; padding: 14px 20px 16px; display: flex; flex-direction: column; gap: 4px; animation: rise var(--t-slow) var(--ease-out); }
.bubble-agent { align-self: flex-start; background: var(--ink-2); border: 1px solid var(--glass-border); border-radius: 28px 28px 28px 8px; }
.bubble-owner { align-self: flex-end; background: rgba(255, 176, 32, .14); border: 1px solid rgba(255, 176, 32, .4); border-radius: 28px 28px 8px 28px; }
.bubble.is-pinned { background: transparent; border: 1px dashed var(--edge); }
.bubble.is-live .bubble-text { opacity: .75; }
.bubble-who { display: inline-flex; align-items: center; gap: 8px; color: var(--text-lo); font-size: .95rem; font-weight: 600; }
.who-orb { width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 34% 30%, #FFE3A3 0 10%, var(--marigold) 40%, var(--saffron)); }
.bubble-text { font-size: 1.2rem; line-height: 1.45; overflow-wrap: anywhere; }
.bubble-flag { font-size: .9rem; color: var(--coral-text); }
.convo-earlier { align-self: center; }
.earlier-toggle { color: var(--text-lo); }
.talk-hint { color: var(--text-lo); padding: 4px 8px; font-size: var(--fs-body); }
.type-row { display: flex; flex-direction: column; gap: 6px; }
.type-pill { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 22px; border-radius: var(--r-pill); background: var(--ink-1); border: 2px solid var(--edge); }
.type-pill:focus-within { border-color: var(--marigold); }
.type-input { flex: 1; min-width: 0; height: 56px; border: 0; background: transparent; font-size: 1.25rem; }
.type-input:focus-visible { box-shadow: none; }
.send-btn { background: var(--marigold); color: var(--on-accent); border-color: transparent; }
.type-note { color: var(--text-lo); font-size: 1rem; padding: 0 12px; }
.type-note:empty { display: none; }
@media (max-width: 760px) {
  .orb { --size: 220px; }
  .bubble { max-width: 94%; }
  .bubble-text { font-size: 1.125rem; }
  .seg-btn { padding: 0 18px; }
}

/* ============================================================ yes card -- */
.yes-layer { position: fixed; z-index: 55; right: 108px; bottom: 28px; width: min(460px, calc(100% - 140px)); }
.yes-layer[data-mode="none"] { display: none; }
.yes-card {
  position: relative; padding: 22px 24px 24px; border-radius: 40px 40px 56px 56px;
  border-color: var(--coral); display: flex; flex-direction: column; gap: 14px;
  animation: yes-in var(--t-slow) var(--ease-out);
}
@keyframes yes-in { from { opacity: 0; transform: translateY(16px) scale(.98); } }
.yes-head { display: flex; align-items: center; gap: 10px; }
.yes-pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--coral); animation: pulse 1600ms var(--ease-out) infinite; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 107, 107, .6); } 70%, 100% { box-shadow: 0 0 0 12px rgba(255, 107, 107, 0); } }
.yes-title { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; flex: 1; }
.yes-title:focus-visible { border-radius: 8px; }
:lang(hi) .yes-title { font-family: var(--font-deva); }
:lang(kn) .yes-title { font-family: var(--font-kn); }
.yes-count { color: var(--text-lo); font-weight: 600; }
.yes-later { min-height: 48px; }
.yes-who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.yes-who-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(79, 209, 232, .16); color: var(--cyan-text); flex: none; }
.yes-vendor { font-weight: 700; font-size: 1.2rem; overflow-wrap: anywhere; min-width: 0; }
.sim-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: var(--r-pill); border: 1px solid var(--cyan); color: var(--cyan-text); font-size: .95rem; font-weight: 600; }
.yes-sum { display: flex; flex-direction: column; gap: 4px; }
.yes-eq { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-family: var(--font-display); font-weight: 700; font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); }
.yes-op { color: var(--text-lo); }
.yes-total { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.yes-total-label { color: var(--text-lo); font-size: 1.2rem; font-weight: 600; }
.yes-total-num { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-number); line-height: 1.05; color: var(--marigold-text); letter-spacing: -.02em; }
.yes-meta { display: flex; gap: 8px; align-items: center; color: var(--text-lo); }
.yes-readback { color: var(--text-lo); font-size: 1rem; line-height: 1.5; }
.yes-error { display: flex; gap: 8px; align-items: center; color: var(--coral-text); font-weight: 600; }
.yes-actions { display: flex; justify-content: space-around; align-items: center; padding-top: 6px; }
.yes-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 50%; border: 2px solid transparent; font-weight: 700; font-size: 1.1rem; transition: transform var(--t-fast) var(--ease-out); }
.yes-btn:active { transform: scale(.95); }
.yes-btn[disabled] { opacity: .6; }
.yes-btn:focus-visible { border-radius: 50%; }
.yes-btn-no { width: 96px; height: 96px; background: transparent; border-color: var(--coral); color: var(--coral-text); }
.yes-btn-yes { width: 120px; height: 120px; background: var(--leaf); color: var(--on-accent); box-shadow: 0 12px 40px -10px rgba(61, 220, 151, .7); }
.yes-mini { display: inline-flex; align-items: center; gap: 10px; min-height: 60px; padding: 0 24px 0 18px; border-radius: var(--r-pill); border: 1px solid var(--coral); background: var(--ink-2); color: var(--text-hi); font-weight: 700; box-shadow: var(--shadow-float); float: right; }
@media (max-width: 760px) {
  .yes-layer { left: 12px; right: 12px; width: auto; bottom: calc(96px + env(safe-area-inset-bottom)); }
  .yes-card { padding: 18px 18px 20px; }
  .yes-btn-no { width: 84px; height: 84px; }
  .yes-btn-yes { width: 104px; height: 104px; }
}

/* =========================================================== speak-it -- */
.speak-wrap { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; position: relative; }
.speak { display: grid; place-items: center; width: var(--touch); height: var(--touch); border-radius: 50%; border: 1px solid var(--edge); background: var(--glass); color: var(--text-hi); padding: 0; }
.speak-sm { width: 48px; height: 48px; }
.speak:focus-visible { border-radius: 50%; }
.speak[data-state="loading"] { opacity: .6; cursor: progress; }
.speak[data-state="playing"] { background: var(--marigold); color: var(--on-accent); border-color: transparent; }
.speak[data-state="error"] { border-color: var(--coral); color: var(--coral-text); }
.speak-note { position: absolute; top: 100%; right: 0; width: max-content; max-width: 240px; margin-top: 4px; font-size: .9rem; color: var(--text-lo); text-align: right; z-index: 5; }
.speak-note:empty { display: none; }
.speak[data-state="error"] + .speak-note { color: var(--coral-text); background: var(--ink-2); padding: 6px 10px; border-radius: 12px; border: 1px solid var(--coral); }

@media (prefers-reduced-motion: reduce) {
  .orb[data-state] .orb-core, .orb .orb-arc, .orb .orb-ripple, .orb .orb-sats, .yes-pulse { animation: none !important; }
  .orb[data-state="speaking"] .r1 { opacity: .5; transform: scale(1.2); }
  .orb[data-state="thinking"] .orb-arc { opacity: .7; }
}
@media (max-width: 760px) {
  .talk[data-live="true"] .orb { --size: 150px; }
  .talk[data-live="true"] .talk-stage { gap: 12px; }
  .talk[data-mode="text"] .type-row { position: sticky; bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 5; }
  .talk[data-mode="text"] .type-pill { background: var(--ink-1); box-shadow: var(--shadow-float); }
}

/* ================================================================ work -- */
.work { display: flex; flex-direction: column; gap: 28px; }
.work-head > * { min-width: 0; }
.work-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.need { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.need-kicker { display: inline-flex; align-items: center; gap: 8px; color: var(--marigold-text); font-weight: 600; }
.need-title { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-title); line-height: 1.1; letter-spacing: -.02em; overflow-wrap: anywhere; }
.need-title:lang(hi) { font-family: var(--font-deva); letter-spacing: 0; }
.need-title:lang(kn) { font-family: var(--font-kn); letter-spacing: 0; }
.need-metas { display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--text-lo); }
.need-meta { display: inline-flex; align-items: center; gap: 6px; }

/* The river */
.river { position: relative; width: 100%; height: 300px; }
/* While a price talk exists, the river gives room so the ladder starts above the fold (1440x900). */
.work.has-ladder { gap: 20px; }
.work.has-ladder .river:not(.river-v) { height: 250px; }
.river-v { height: 900px; max-width: 420px; margin: 0 auto; }
.river-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.river-base { fill: none; stroke: var(--ink-3); stroke-width: 6; stroke-linecap: round; stroke-dasharray: .012 .012; }
.river-glow { fill: none; stroke: url(#river-grad); stroke-width: 18; stroke-linecap: round; opacity: .22; filter: blur(6px); }
.river-flow { fill: none; stroke: url(#river-grad); stroke-width: 6; stroke-linecap: round; transition: stroke-dasharray 600ms var(--ease-out); }
.river-stations { list-style: none; margin: 0; padding: 0; position: absolute; inset: 0; }
.station-item { position: absolute; left: calc(var(--x) * 100%); top: calc(var(--y) * 100%); transform: translate(-50%, -36px); }
.station {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: 0; padding: 0; color: var(--text-hi); min-width: 96px;
  -webkit-tap-highlight-color: transparent;
}
.station:focus-visible { box-shadow: none; }
.station:focus-visible .station-dot { box-shadow: var(--focus); }
.station-dot {
  display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%;
  background: var(--ink-1); border: 2px dashed var(--edge); color: var(--text-lo);
  transition: transform var(--t-fast) var(--ease-out);
}
.station:hover .station-dot { transform: scale(1.06); }
.station:active .station-dot { transform: scale(.96); }
.station-word { font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.station-state { display: inline-flex; align-items: center; gap: 4px; font-size: .9rem; color: var(--text-lo); }
.station[data-status="done"] .station-dot { background: var(--leaf); border: 0; color: var(--on-accent); }
.station[data-status="active"] .station-dot { background: var(--marigold); border: 0; color: var(--on-accent); box-shadow: var(--glow-marigold); }
.station[data-status="active"] .station-dot svg { animation: breathe 2400ms ease-in-out infinite; }
.station[data-status="needs"] .station-dot { background: var(--coral); border: 0; color: var(--on-coral); animation: pulse 1600ms var(--ease-out) infinite; }
.station[data-status="needs"] .station-state { color: var(--coral-text); font-weight: 700; }
.station[data-status="failed"] .station-dot { background: transparent; border: 3px solid var(--coral); color: var(--coral-text); }
.station[data-status="upcoming"] .station-word { color: var(--text-lo); }
.river-vendors { position: absolute; inset: 0; pointer-events: none; }
.vbub {
  position: absolute; left: calc(var(--x) * 100%); top: calc(var(--y) * 100%); transform: translate(-50%, -50%);
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(79, 209, 232, .16); border: 1px solid var(--cyan); color: var(--cyan-text);
  font: 700 .85rem/1 var(--font-body);
}
.vbub.sim { border-style: dashed; }
/* Seller names hang under the Searching station label, in the free space before Bargaining. */
.river-sellers {
  position: absolute; left: calc(var(--x) * 100%); top: calc(var(--y) * 100%); transform: translate(-50%, 98px);
  list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.vname {
  display: inline-flex; align-items: center; height: 30px; max-width: 116px; padding: 0 12px;
  border-radius: var(--r-pill); background: var(--ink-1); border: 1px solid var(--cyan); color: var(--cyan-text);
  font: 700 .9rem/1 var(--font-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: auto; cursor: default;
}
.vname [lang="hi"] { font-family: var(--font-deva); }
.vname [lang="kn"] { font-family: var(--font-kn); }
.vname.sim { border-style: dashed; }
.vname.more { border-color: var(--edge); color: var(--text-hi); background: var(--ink-2); }
.vname.pop { animation: rise var(--t-slow) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 60ms); }
/* Wide river: the pocket under Searching is wider than tall, so the names wrap into rows. */
.river:not(.river-v) .river-sellers { flex-direction: row; flex-wrap: wrap; justify-content: center; width: 220px; transform: translate(-50%, 100px); }
.vbub.more { background: var(--ink-2); color: var(--text-hi); border-color: var(--edge); }
.vbub.pop { animation: pop var(--t-slow) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 60ms); }
.vbub.static { position: static; transform: none; flex: none; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -50%) scale(.3); } }
.river-v .station-item { transform: translate(-50%, -36px); }

.listen-box:empty, .ladder-box:empty, .earlier:empty { display: none; }
.listen { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.listen-live { display: inline-flex; align-items: center; gap: 8px; color: var(--leaf-text); font-weight: 600; }
.listen-live .now-dot { background: var(--leaf); }
.listen-err { display: flex; gap: 8px; align-items: center; color: var(--coral-text); flex-basis: 100%; }

/* Price ladder */
.ladder { display: flex; flex-direction: column; gap: 12px; padding: 22px 24px; border-radius: var(--r-card); background: var(--glass); border: 1px solid var(--glass-border); }
.ladder-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ladder-title { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; }
:lang(hi) .ladder-title { font-family: var(--font-deva); }
:lang(kn) .ladder-title { font-family: var(--font-kn); }
.ladder-vendor { display: inline-flex; align-items: center; gap: 6px; color: var(--text-lo); font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.ladder-legend { display: flex; gap: 18px; flex-wrap: wrap; color: var(--text-lo); font-size: 1rem; }
.lg { display: inline-flex; align-items: center; gap: 8px; }
.lg-dot { width: 14px; height: 14px; border-radius: 50%; }
.lg-ask .lg-dot { background: var(--cyan); }
.lg-offer .lg-dot { background: var(--marigold); border-radius: 4px; }
.ladder-plot { position: relative; height: 240px; margin: 12px 28px 8px; }
.ladder-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ladder-ask, .ladder-offer { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.ladder-ask { stroke: var(--cyan); stroke-dasharray: 6 6; }
.ladder-offer { stroke: var(--marigold); }
.ladder-chips { list-style: none; margin: 0; padding: 0; position: absolute; inset: 0; }
.pchip {
  position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); transform: translate(-50%, -50%);
  padding: 6px 14px; border-radius: var(--r-pill); font: 700 1.05rem/1.2 var(--font-display); white-space: nowrap;
  animation: rise var(--t-slow) var(--ease-out);
}
.pchip-ask { background: var(--ink-1); border: 2px solid var(--cyan); color: var(--cyan-text); transform: translate(-50%, calc(-50% - 18px)); }
.pchip-offer { background: var(--marigold); color: var(--on-accent); border-radius: 12px 12px 12px 4px; transform: translate(-50%, calc(-50% + 18px)); }
.pchip.is-meet { background: var(--leaf); color: var(--on-accent); border-color: var(--leaf); box-shadow: 0 0 0 6px rgba(61, 220, 151, .2), 0 0 30px rgba(61, 220, 151, .5); z-index: 2; }
.ladder-result { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.2rem; }
.ladder-result.is-agreed { color: var(--leaf-text); }
.ladder-result.is-nodeal { color: var(--coral-text); }
.ladder-empty { display: flex; align-items: center; gap: 14px; color: var(--text-lo); }
.state-orbit.mini { width: 36px; height: 36px; margin: 0; }
.state-orbit.mini i { width: 8px; height: 8px; left: 14px; }
.state-orbit.mini i:nth-child(2), .state-orbit.mini i:nth-child(3) { bottom: 2px; }
.state-orbit.mini i:nth-child(2) { left: 2px; } .state-orbit.mini i:nth-child(3) { left: auto; right: 2px; }

.earlier { display: flex; flex-direction: column; gap: 12px; }
.earlier-title { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: var(--text-lo); }
.earlier-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.earlier-need { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 4px 18px; border-radius: var(--r-pill); background: var(--glass); border: 1px solid var(--glass-border); color: var(--text-lo); max-width: 100%; }
.earlier-need:has(.earlier-x) { padding-right: 4px; }
.earlier-text { overflow-wrap: anywhere; min-width: 0; }
.earlier-x {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px; margin-left: 2px;
  border-radius: 50%; border: 1px solid transparent; background: transparent; color: var(--text-lo);
  transition: background-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}
.earlier-x:hover { background: var(--ink-2); color: var(--coral-text); border-color: var(--coral); }
.earlier-x:focus-visible { border-radius: 50%; }
@media (min-width: 900px) {
  .work.has-ladder .ladder { padding: 18px 24px; gap: 8px; }
  .work.has-ladder .ladder-plot { height: 190px; margin: 26px 28px 14px; }
}
@media (max-width: 760px) {
  .ladder { padding: 18px 16px; }
  .ladder-plot { height: 220px; margin: 8px 24px; }
  .pchip { font-size: .95rem; padding: 5px 10px; }
  .work-head { flex-direction: row; }
}

/* =============================================================== sheet -- */
.sheet-root { position: fixed; inset: 0; z-index: 80; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(5, 7, 12, .6); opacity: 0; transition: opacity var(--t-med) var(--ease-out); }
.sheet {
  position: absolute; left: 50%; bottom: 0; width: min(640px, 100%); max-height: 86dvh; overflow: auto;
  padding: 10px 24px calc(28px + env(safe-area-inset-bottom)); border-radius: 36px 36px 0 0; border-bottom: 0;
  transform: translate(-50%, 24px); opacity: 0;
  transition: transform var(--t-slow) var(--ease-out), opacity var(--t-med) var(--ease-out);
}
.sheet:focus-visible { box-shadow: none; }
.sheet-root.is-open .sheet { transform: translate(-50%, 0); opacity: 1; }
.sheet-root.is-open .sheet-scrim { opacity: 1; }
.sheet-root.is-closing .sheet { transition-timing-function: var(--ease-in); transition-duration: var(--t-fast); }
.sheet-grip { display: block; width: 48px; height: 5px; border-radius: 3px; background: var(--edge); margin: 4px auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sheet-title { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; }
:lang(hi) .sheet-title { font-family: var(--font-deva); }
:lang(kn) .sheet-title { font-family: var(--font-kn); }
.sheet-body { display: flex; flex-direction: column; gap: 14px; }
.sheet-big { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.8rem, 1.4rem + 1.6vw, 2.6rem); line-height: 1.15; overflow-wrap: anywhere; }
.sheet-big:lang(hi), .sheet-big :lang(hi) { font-family: var(--font-deva); }
.sheet-big :lang(kn) { font-family: var(--font-kn); }
.fact { display: flex; align-items: center; gap: 10px; font-size: var(--fs-body); overflow-wrap: anywhere; }
.fact svg { color: var(--marigold-text); }
.fact.muted, .fact-text { color: var(--text-lo); }
.sheet-speak, .sheet-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.seller-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.seller { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--glass-border); }
.seller-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.seller-name { font-weight: 600; overflow-wrap: anywhere; }
.seller-sub { color: var(--text-lo); font-size: 1rem; }
@media (prefers-reduced-motion: reduce) {
  .station-dot svg, .station[data-status="needs"] .station-dot, .vbub.pop, .pchip { animation: none !important; }
  .sheet { transform: translate(-50%, 0) !important; }
}
.wait-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--marigold); animation: pulse-amber 1600ms var(--ease-out) infinite; flex: none; }
@keyframes pulse-amber { 0% { box-shadow: 0 0 0 0 rgba(255, 176, 32, .6); } 70%, 100% { box-shadow: 0 0 0 12px rgba(255, 176, 32, 0); } }
@media (prefers-reduced-motion: reduce) { .wait-dot { animation: none; } }
.work-head .need { flex: 1 1 0; }
.work-head > .speak-wrap { flex: none; }
.river-v { margin-bottom: 48px; }
.work-head .speak[data-tip]::after, .yes-head .speak[data-tip]::after { left: auto; right: 0; transform: none; }
.theme-btn[data-tip]::after { left: auto; right: 0; transform: none; bottom: auto; top: calc(100% + 10px); }
.vbub { background: color-mix(in srgb, var(--cyan) 18%, var(--ink-1)); }
.vbub.more { background: var(--ink-2); }

/* ============================================================== orders -- */
.orders { display: flex; flex-direction: column; gap: 24px; }
.receipts { list-style: none; margin: 0; padding: 0; display: grid; gap: 28px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }
.receipt {
  position: relative; display: flex; flex-direction: column; gap: 12px;
  padding: 22px 24px 40px; background: var(--ink-1); border-radius: 32px 32px 0 0;
  /* torn bottom edge */
  -webkit-mask: radial-gradient(11px at 12px 100%, #0000 98%, #000) -12px 0 / 24px 100% repeat-x;
  mask: radial-gradient(11px at 12px 100%, #0000 98%, #000) -12px 0 / 24px 100% repeat-x;
  box-shadow: inset 0 1px 0 var(--glass-border);
}
.receipt::before { content: ""; position: absolute; left: 24px; right: 24px; bottom: 26px; border-top: 2px dashed var(--ink-3); }
.rc-top { display: flex; align-items: center; gap: 12px; }
.rc-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-blob); background: rgba(255, 176, 32, .16); color: var(--marigold-text); flex: none; }
.rc-id { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.rc-po { font-weight: 700; overflow-wrap: anywhere; }
.rc-date { color: var(--text-lo); font-size: 1rem; }
.rc-vendor { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; overflow-wrap: anywhere; }
.rc-vendor > svg { color: var(--cyan-text); }
.rc-amount { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-number); line-height: 1.05; letter-spacing: -.02em; }
.rc-status { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 6px 16px 6px 10px; border-radius: var(--r-pill); font-weight: 700; }
.rc-status.ok { background: rgba(61, 220, 151, .16); color: var(--leaf-text); }
.rc-status.due { background: rgba(255, 107, 107, .12); color: var(--coral-text); }
.rc-sub { font-weight: 500; color: var(--text-lo); }
.rc-remind { display: flex; align-items: center; gap: 12px; }
.rc-remind-what { font-weight: 600; }
.rc-remind-when { color: var(--text-lo); font-size: 1rem; }
.rc-bell { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--ink-2); color: var(--text-lo); }
.clock-arc { flex: none; }
.clock-track { fill: none; stroke: var(--ink-3); stroke-width: 5; }
.clock-fill { fill: none; stroke: var(--marigold); stroke-width: 5; stroke-linecap: round; }
.clock-hands { fill: none; stroke: var(--text-hi); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.rc-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.rc-nolink { color: var(--text-lo); align-self: center; }
.telegram { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tg-on { display: inline-flex; align-items: center; gap: 8px; color: var(--leaf-text); font-weight: 600; }
.tg-note { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--text-lo); }
.tg-err { display: flex; gap: 8px; align-items: center; color: var(--coral-text); flex-basis: 100%; }

/* ============================================================== my sahay -- */
.me { display: grid; gap: 28px 48px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); grid-template-areas: "head stars" "profile stars" "actions stars"; align-items: start; }
.me-head { grid-area: head; display: flex; align-items: center; gap: 18px; }
.me-profile { grid-area: profile; display: flex; flex-direction: column; gap: 26px; }
.me-stars { grid-area: stars; display: flex; flex-direction: column; gap: 12px; }
.me-actions { grid-area: actions; display: flex; gap: 12px; flex-wrap: wrap; }
.me-head .screen-title { margin: 0; }
.me-orb { width: 72px; height: 72px; border-radius: 50%; flex: none; background: radial-gradient(circle at 34% 28%, #FFF1CC 0 6%, #FFC94D 22%, var(--marigold) 44%, var(--saffron) 80%); box-shadow: 0 10px 30px -8px rgba(255, 122, 26, .6); }
.me-shop { color: var(--text-lo); overflow-wrap: anywhere; }
.me-note { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-radius: var(--r-soft); border: 1px solid var(--marigold); background: rgba(255, 176, 32, .08); }
.pref { display: flex; flex-direction: column; gap: 12px; }
.pref-title { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; font-weight: 700; }
.pref-title > svg { color: var(--marigold-text); }
.saved { display: inline-flex; align-items: center; gap: 4px; color: var(--leaf-text); font-size: .95rem; font-weight: 600; }
.field-err { display: flex; gap: 8px; align-items: center; color: var(--coral-text); font-weight: 600; }
.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--touch); padding: 0 22px;
  border-radius: var(--r-pill); border: 1px solid var(--edge); background: var(--glass); color: var(--text-hi); font-weight: 600;
  transition: background-color var(--t-fast) var(--ease-out);
}
.chip-btn[aria-pressed="true"] { background: var(--text-hi); color: var(--ink-0); border-color: transparent; }
.chip-btn[disabled] { opacity: .6; }
.chip-script { font-size: 1.3rem; }
.chip-script:lang(en) { font-family: var(--font-display); }
/* Bargaining dial: a half circle with a needle on three stops. */
.dial { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 360px; }
.dial-arc { position: relative; width: 220px; height: 110px; border-radius: 110px 110px 0 0; overflow: hidden;
  background: conic-gradient(from -90deg at 50% 100%, var(--leaf) 0deg 60deg, var(--marigold) 60deg 120deg, var(--coral) 120deg 180deg, transparent 180deg);
  -webkit-mask: radial-gradient(circle at 50% 100%, #0000 62px, #000 63px); mask: radial-gradient(circle at 50% 100%, #0000 62px, #000 63px); }
.dial-needle { position: absolute; left: calc(50% - 3px); bottom: 0; width: 6px; height: 104px; border-radius: 3px; background: var(--text-hi); transform-origin: 50% 100%; transform: rotate(calc(-60deg + var(--pos) * 60deg)); transition: transform var(--t-slow) var(--ease-out); }
.dial-stops { display: flex; gap: 8px; }
.dial-stop { min-height: var(--touch); padding: 0 18px; border-radius: var(--r-pill); border: 1px solid var(--edge); background: var(--glass); color: var(--text-hi); font-weight: 600; }
.dial-stop[aria-checked="true"] { background: var(--text-hi); color: var(--ink-0); border-color: transparent; }
.dial-stop[disabled] { opacity: .6; }

/* Constellation */
.constellation { position: relative; width: min(100%, 520px); aspect-ratio: 1; margin: 0 auto; }
.const-lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.const-line { stroke: var(--glass-border); stroke-width: 1.5; }
.const-line.is-suggested { stroke: var(--coral); stroke-dasharray: 4 5; }
.const-line.is-active { stroke: var(--leaf); opacity: .6; }
.const-line.is-memory { stroke: var(--cyan); opacity: .5; }
.const-core { position: absolute; left: 50%; top: 50%; width: 96px; height: 96px; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle at 34% 28%, #FFF1CC 0 6%, #FFC94D 22%, var(--marigold) 44%, var(--saffron) 80%); box-shadow: 0 0 50px rgba(255, 150, 30, .45); }
.const-items { list-style: none; margin: 0; padding: 0; position: absolute; inset: 0; }
.const-item { position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); transform: translate(-50%, -50%); }
.star {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: 84px; height: 84px; padding: 0; border-radius: 50%; border: 2px solid var(--edge);
  background: var(--ink-1); color: var(--text-hi); font-size: .85rem; font-weight: 700; line-height: 1.1;
  transition: transform var(--t-fast) var(--ease-out);
}
.star:hover { transform: scale(1.06); }
.star:focus-visible { border-radius: 50%; }
.star-word { max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.star.is-active { border-color: var(--leaf); color: var(--leaf-text); }
.star.is-memory { border-color: var(--cyan); color: var(--cyan-text); border-radius: var(--r-blob); }
.star.is-suggested { border: 3px solid var(--coral); color: var(--coral-text); box-shadow: 0 0 0 6px rgba(255, 107, 107, .14); }
.star.is-new { animation: pop var(--t-slow) var(--ease-out) both; }
.rule-sentence { font-size: clamp(1.4rem, 1.2rem + 1vw, 1.9rem); }
.why { align-items: flex-start; }
.rule-actions { display: flex; justify-content: space-around; padding: 6px 0; }
@media (max-width: 999px) {
  .me { grid-template-columns: 1fr; grid-template-areas: "head" "stars" "profile" "actions"; }
}
@media (max-width: 760px) {
  .star { width: 70px; height: 70px; font-size: .75rem; }
  .star-word { max-width: 60px; }
  .const-core { width: 72px; height: 72px; }
}

/* ============================================================== history -- */
.hist-head { display: flex; align-items: center; gap: 14px; }
.hist-head .screen-title { margin: 0; }
.history { display: flex; flex-direction: column; gap: 24px; max-width: 760px; margin: 0 auto; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 21px; top: 12px; bottom: 12px; width: 2px; background: linear-gradient(var(--marigold), var(--ink-3)); border-radius: 2px; }
.tl-item { position: relative; display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: start; padding: 10px 0; }
.tl-dot { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--ink-2); border: 1px solid var(--edge); color: var(--text-hi); z-index: 1; }
.tl-ok .tl-dot { background: var(--leaf); color: var(--on-accent); border-color: transparent; }
.tl-bad .tl-dot { border: 2px solid var(--coral); color: var(--coral-text); }
.tl-needs .tl-dot { background: var(--coral); color: var(--on-coral); border-color: transparent; }
.tl-text { min-width: 0; padding-top: 8px; }
.tl-label { font-weight: 700; }
.tl-detail { color: var(--text-lo); overflow-wrap: anywhere; }
.tl-time { color: var(--text-lo); font-size: .95rem; padding-top: 10px; white-space: nowrap; }
@media (max-width: 520px) {
  .tl-item { grid-template-columns: 44px 1fr; }
  .tl-time { grid-column: 2; padding-top: 0; }
}
@media (prefers-reduced-motion: reduce) { .star.is-new { animation: none; } .dial-needle { transition: none; } }
