/* Puchho — stage dashboard styles. Restyle via the tokens in :root only. */
:root {
  --bg: #0d1015;
  --surface: #151a21;
  --surface-2: #1c232c;
  --border: #2a323d;
  --text: #f3f5f8;
  --muted: #9ba5b3;
  --faint: #6b7584;
  --accent: #ffb547;          /* the one accent colour */
  --accent-ink: #1a1204;      /* text on accent */
  --accent-soft: rgba(255, 181, 71, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --gap: clamp(12px, 1.4vw, 24px);
  --font: "Inter", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-base: clamp(15px, 1.05vw, 20px);
  --fs-small: clamp(12px, 0.8vw, 15px);
  --fs-big: clamp(22px, 2vw, 40px);
  --fs-huge: clamp(32px, 3.6vw, 72px);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  /* chat (phone mock) */
  --chat-bg: #0b141a;
  --bubble-in: #202c33;
  --bubble-out: #005c4b;
  --bubble-text: #e9edef;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- layout */
.stage {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  padding: var(--gap) calc(var(--gap) * 1.5);
}

.topbar {
  display: flex;
  align-items: center;
  gap: var(--gap);
  flex-wrap: wrap;
}
.wordmark { font-weight: 800; font-size: var(--fs-big); letter-spacing: -0.02em; }
.wordmark span { color: var(--accent); }
.request {
  flex: 1 1 400px;
  font-size: var(--fs-big);
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.request::before { content: "“"; color: var(--accent); }
.request::after { content: "”"; color: var(--accent); }
.request:empty { display: none; }

.chip, .pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.35em 0.85em;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--fs-small);
  white-space: nowrap;
}
.chip strong { color: var(--text); }
.pill.state { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.pill.conn[data-ok="false"] { border-color: var(--accent); color: var(--accent); }
.badge-local { border-color: var(--accent); color: var(--accent); }
.demo-badge { font-size: var(--fs-small); color: var(--faint); }

/* ---------------------------------------------------------------- idle */
.idle {
  flex: 1;
  display: grid;
  place-items: center;
  text-align: center;
}
.idle h1 { font-size: var(--fs-huge); margin: 0 0 0.3em; letter-spacing: -0.02em; }
.idle p { color: var(--muted); font-size: var(--fs-big); margin: 0.2em 0; }
.idle .example { color: var(--text); font-style: italic; }

.join-row { display: flex; gap: var(--gap); justify-content: center; flex-wrap: wrap; margin-top: 1.4em; }
.wa-join {
  display: inline-flex;
  align-items: center;
  gap: 1.2em;
  padding: 1em 1.4em;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: left;
}
.wa-qr { width: clamp(120px, 11vw, 200px); aspect-ratio: 1; background: #fff; border-radius: var(--radius-sm); padding: 8px; }
.wa-qr svg { width: 100%; height: 100%; display: block; }
.wa-text { display: flex; flex-direction: column; gap: 0.25em; }
.wa-step { color: var(--muted); font-size: var(--fs-small); text-transform: uppercase; letter-spacing: 0.08em; }
.wa-text strong { font-size: var(--fs-big); color: var(--accent); }
.wa-to { color: var(--muted); }
.wa-to b { color: var(--text); }
.demo-controls { display: flex; gap: 10px; justify-content: center; margin-top: 1.5em; flex-wrap: wrap; }
.btn, .btn-primary {
  padding: 0.6em 1.1em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
kbd { font-family: inherit; font-size: 0.8em; padding: 0.1em 0.4em; border: 1px solid var(--border); border-radius: 4px; color: var(--muted); }

/* ---------------------------------------------------------------- approval banner */
.banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8em;
  padding: 0.9em 1.2em;
  border-radius: var(--radius);
  border: 2px solid var(--accent);
  background: var(--accent-soft);
  font-size: var(--fs-big);
  font-weight: 600;
  text-align: center;
}
.spinner {
  width: 1em; height: 1em;
  border-radius: 50%;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- call cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
  align-items: stretch;
  min-height: 0;
  flex: 1;
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.7em;
  padding: calc(var(--gap) * 0.9);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  min-height: 0;
  transition: border-color 0.3s, opacity 0.3s, transform 0.3s;
}
.card.live { border-color: var(--muted); }
.card.winner { border: 2px solid var(--accent); }
.card.dim { opacity: 0.55; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.6em; }
.shop-name { font-weight: 700; font-size: calc(var(--fs-base) * 1.2); margin: 0; }
.shop-meta { color: var(--muted); font-size: var(--fs-small); }
.shop-meta .src { color: var(--accent); }
.timer { font-variant-numeric: tabular-nums; color: var(--muted); font-size: var(--fs-small); }
.status { align-self: flex-start; }
.status .icon { font-size: 1.05em; line-height: 1; }
.status[data-tone="active"] { border-color: var(--text); }
.status[data-tone="good"] { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.status[data-tone="off"] { color: var(--muted); }

.transcript {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4em;
  min-height: 7.5em;
  max-height: 15em;
  overflow-y: auto;
  padding: 0.6em;
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: var(--fs-small);
  scroll-behavior: smooth;
}
.line { margin: 0; }
.line .who { font-weight: 700; margin-right: 0.35em; }
.line.puchho .who { color: var(--accent); }
.line.shop .who { color: var(--text); }
.line.shop { color: var(--muted); }
.transcript:empty::before { content: "…"; color: var(--faint); }

.price { display: flex; align-items: baseline; gap: 0.6em; flex-wrap: wrap; min-height: 1.6em; }
.price .first { color: var(--muted); text-decoration: line-through; }
.price .final { font-size: var(--fs-big); font-weight: 800; }
.price .saved { padding: 0.15em 0.6em; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: var(--fs-small); }
.price .slot { color: var(--muted); font-size: var(--fs-small); }
.evidence { color: var(--faint); font-size: var(--fs-small); font-style: italic; margin: 0; }

.injected {
  align-self: flex-start;
  font-size: var(--fs-small);
  color: var(--accent);
  border: 1px dashed var(--accent);
  border-radius: 999px;
  padding: 0.2em 0.7em;
}
.pulse { animation: pulse 1.2s ease-out 2; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 181, 71, 0.6); }
  100% { box-shadow: 0 0 0 18px rgba(255, 181, 71, 0); }
}
.flash { animation: flash 0.8s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } to { background: var(--surface); } }

/* compact comparison row after ranking */
.cards.compact .transcript { display: none; }
.cards.compact .evidence { display: none; }

/* ---------------------------------------------------------------- result panel */
.result {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--gap);
  align-items: center;
  padding: calc(var(--gap) * 1.1);
  border-radius: var(--radius);
  background: var(--surface);
  border: 2px solid var(--accent);
}
.result h2 { margin: 0; font-size: var(--fs-huge); letter-spacing: -0.02em; }
.result .reason { color: var(--muted); margin: 0.3em 0 0; }
.result .facts { display: flex; gap: 1.5em; flex-wrap: wrap; margin-top: 0.6em; }
.result .facts div { display: flex; flex-direction: column; }
.result .facts span { color: var(--muted); font-size: var(--fs-small); }
.result .facts strong { font-size: var(--fs-big); }
.steps { display: flex; flex-direction: column; gap: 0.5em; font-size: var(--fs-big); font-weight: 700; }
.steps .step[data-done="false"] { color: var(--faint); }
.steps .step[data-done="true"] { color: var(--accent); }
.result.neutral { border-color: var(--border); }
.confirm-line { color: var(--muted); font-size: var(--fs-small); margin-top: 0.5em; }

/* ---------------------------------------------------------------- timeline */
.timeline {
  margin-top: auto;
  display: flex;
  gap: 1.4em;
  overflow-x: auto;
  padding: 0.7em 0.2em;
  border-top: 1px solid var(--border);
  font-size: var(--fs-small);
  scrollbar-width: thin;
  white-space: nowrap;
}
.timeline .ev { color: var(--muted); }
.timeline .ev time { color: var(--faint); margin-right: 0.4em; font-variant-numeric: tabular-nums; }
.timeline .ev:last-child { color: var(--text); }

/* ---------------------------------------------------------------- phone mock */
.phone-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.phone {
  width: min(430px, 100%);
  height: min(860px, calc(100vh - 32px));
  display: flex;
  flex-direction: column;
  border-radius: 36px;
  border: 10px solid #000;
  overflow: hidden;
  background: var(--chat-bg);
  box-shadow: var(--shadow);
}
.phone header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: #202c33;
  color: var(--bubble-text);
}
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 800;
}
.phone header small { display: block; color: var(--muted); font-size: 12px; }
.chat { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 6px; }
.bubble {
  max-width: 82%;
  padding: 8px 10px 6px;
  border-radius: 10px;
  color: var(--bubble-text);
  font-size: 16px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.bubble.in { align-self: flex-end; background: var(--bubble-out); border-top-right-radius: 2px; }
.bubble.out { align-self: flex-start; background: var(--bubble-in); border-top-left-radius: 2px; }
.bubble time { display: block; text-align: right; font-size: 11px; color: rgba(233, 237, 239, 0.6); margin-top: 2px; }
.bubble a { color: #53bdeb; }
.composer { display: flex; gap: 8px; padding: 10px; background: #202c33; }
.composer input {
  flex: 1; min-width: 0;
  padding: 10px 14px; border-radius: 999px; border: none;
  background: #2a3942; color: var(--bubble-text); font: inherit; font-size: 16px;
}
.composer button { border-radius: 999px; padding: 0 16px; border: none; background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer; }
.chat-empty { color: var(--muted); text-align: center; margin: auto; font-size: 14px; }

/* ---------------------------------------------------------------- sim checkout */
.paypage { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.paycard { width: min(420px, 100%); padding: 32px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); text-align: center; }
.paycard h1 { font-size: 48px; margin: 0.2em 0; }
.paycard .eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; font-size: 13px; margin: 0; }
.paycard .btn-primary { width: 100%; padding: 14px; font-size: 18px; margin-top: 12px; }

/* ---------------------------------------------------------------- responsive / motion */
@media (max-width: 900px) {
  .request { white-space: normal; font-size: var(--fs-base); }
  .result { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
