/* Partner – "Indigo" theme (app shell): white surfaces, one blue accent, small line icons, large readable text */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f0f3fa;
  --line: #e3e7f0;
  --text: #0f172a;
  --muted: #5b6478;
  --accent: #2563eb;
  --accent-soft: #e8efff;
  --cyan: #0ea5e9;
  --green: #16a34a;
  --green-soft: #e8f7ee;
  --red: #dc2626;
  --red-soft: #fdecec;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --font: "Plus Jakarta Sans", "Noto Sans Gujarati", "Noto Sans Devanagari", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 var(--font);
  display: flex; flex-direction: column; min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.aurora { display: none; }

/* ---------- header ---------- */
.top { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px 6px; max-width: 900px; width: 100%; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand b { font-size: 22px; font-weight: 800; letter-spacing: -.3px; color: var(--text); }
.brand small { display: none; }
.logo { width: 30px; height: 30px; border-radius: 9px; background: url(icons/icon-192.png) center / cover; flex-shrink: 0; }
.spacer { flex: 1; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); white-space: nowrap; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.status.off i { background: var(--red); }
.status svg { width: 14px; height: 14px; }
.hf, .iconbtn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; }
.iconbtn { padding: 7px; }
.hf svg, .iconbtn svg { width: 18px; height: 18px; }
.hf.on { color: #fff; background: var(--accent); border-color: var(--accent); }

.langs { display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); width: fit-content; max-width: 100%; }
.chip { background: transparent; border: 0; border-radius: 999px; padding: 6px 14px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 15px; }
.chip.on { background: var(--accent); color: #fff; }
select.chip { appearance: none; }
select.chip option { background: #fff; color: var(--text); }

/* ---------- main stage ---------- */
main#stage { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 8px 16px 16px; cursor: pointer; text-align: center; max-width: 900px; width: 100%; margin: 0 auto; }
.ring-wrap { position: relative; width: 168px; height: 168px; margin: 18px 0 8px; display: grid; place-items: center; }
.halo { position: absolute; inset: -18px; border-radius: 50%; background: var(--accent); opacity: .08; }
.ring { position: relative; width: 150px; height: 150px; border-radius: 50%; padding: 6px; background: conic-gradient(var(--cyan), var(--accent), var(--cyan)); box-shadow: var(--shadow); transition: transform .2s ease; }
.ring:hover { transform: scale(1.02); }
.ring-inner { width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--accent); }
.ring-inner svg { width: 46px; height: 46px; stroke-width: 1.8; }
body.listening .ring { animation: spin 2.4s linear infinite; }
body.listening .ring-inner svg { animation: spin-back 2.4s linear infinite; }
body.listening .halo { opacity: .18; animation: breathe 1.1s ease-in-out infinite; }
body.thinking .ring { animation: spin 1s linear infinite; background: conic-gradient(var(--accent), transparent 40%, var(--accent)); }
body.thinking .ring-inner svg { animation: spin-back 1s linear infinite; }
body.speaking .ring { background: conic-gradient(var(--green), #4ade80, var(--green)); animation: talk .5s ease-in-out infinite alternate; }
body.speaking .ring-inner { color: var(--green); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spin-back { to { transform: rotate(-360deg); } }
@keyframes talk { to { transform: scale(1.04); } }
@keyframes breathe { 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .ring, .ring-inner svg, .halo { animation: none !important; } }

.state { margin: 6px 0 0; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--accent); font-weight: 700; }
html:not([lang="en"]) .state { letter-spacing: 0; text-transform: none; font-size: 13px; }
.hint { color: var(--muted); margin: 2px 0 14px; font-size: 18px; }
.suggest { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 0 10px; max-width: 640px; }
.suggest button { max-width: 100%; white-space: normal; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font-size: 14px; cursor: pointer; color: var(--text); text-align: left; }
.suggest button:hover { border-color: var(--accent); }
.you { color: var(--muted); font-style: italic; margin: 4px 0; min-height: 1em; }
.reply { font-size: 22px; font-weight: 700; margin: 6px 0 12px; max-width: 720px; line-height: 1.45; }

/* ---------- cards ---------- */
#card { width: 100%; max-width: 720px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 10px 0; text-align: left; cursor: default; box-shadow: var(--shadow); animation: rise .25s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.card h3 { margin: 0 0 8px; font-size: 18px; }
.card .meta { color: var(--muted); font-size: 14px; }
.card pre { background: #0f172a; color: #e2e8f0; border-radius: 12px; padding: 12px; overflow: auto; max-height: 320px; font-size: 13px; white-space: pre; }
.card.scam { border-color: #f5b5b5; background: var(--red-soft); }
.card.scam h3 { color: var(--red); }
.options { display: grid; gap: 8px; }
.big { display: block; width: 100%; font-size: 18px; font-weight: 700; padding: 15px; border-radius: 14px; border: 0; cursor: pointer; text-align: center; text-decoration: none; background: var(--accent); color: #fff; }
.big:hover { filter: brightness(1.05); }
.big.alt { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.big.yes { background: var(--green); }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.row > * { flex: 1; min-width: 130px; }
iframe.preview { width: 100%; height: 360px; border: 1px solid var(--line); border-radius: 12px; background: #fff; margin-bottom: 10px; }

/* ---------- bottom bar ---------- */
.bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 16px 10px; max-width: 900px; width: 100%; margin: 0 auto; }
.tool { display: flex; align-items: center; justify-content: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 10px; cursor: pointer; font-size: 15px; font-weight: 600; color: var(--text); }
.tool svg { width: 20px; height: 20px; color: var(--accent); }
.tool.sos { background: var(--red); border-color: var(--red); color: #fff; }
.tool.sos svg { color: #fff; }
.typebar { display: flex; gap: 8px; padding: 0 16px 14px; max-width: 900px; width: 100%; margin: 0 auto; }
.typebar input { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; outline: none; }
.typebar input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.typebar button { display: grid; place-items: center; background: var(--accent); color: #fff; border: 0; border-radius: 14px; width: 50px; cursor: pointer; }

/* ---------- overlays & panels ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 10; display: flex; flex-direction: column; padding: 16px; overflow: auto; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.hidden { display: none !important; }
#confirm { background: var(--bg); }
.confirm-go { flex: 1; border: 0; border-radius: 28px; background: var(--green); color: #fff; font-size: 30px; font-weight: 800; padding: 24px; cursor: pointer; }
.confirm-go.danger { background: var(--red); }
.confirm-cancel { margin-top: 12px; padding: 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); font-size: 18px; cursor: pointer; }
.panel { background: var(--surface); border-radius: 22px; padding: 20px; max-width: 620px; width: 100%; margin: auto; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 6px; font-size: 22px; }
.panel h3 { margin: 20px 0 8px; font-size: 15px; color: var(--accent); }
.small { color: var(--muted); font-size: 14px; }
.cform { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.cform .check, .cform .primary { grid-column: 1 / -1; }
.cform input, textarea, .panel select { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; width: 100%; outline: none; }
.cform input:focus, textarea:focus { border-color: var(--accent); }
.panel select.chip { color: var(--text); font-size: 14px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 15px; }
.primary { background: var(--accent); color: #fff; border: 0; border-radius: 12px; padding: 11px 14px; font-weight: 700; cursor: pointer; }
.ghost { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; cursor: pointer; font-weight: 600; }
.ghost.wide { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; }
.contact { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.contact small { color: var(--muted); display: block; }
.contact > div:last-child { display: flex; gap: 6px; flex-shrink: 0; }
.contact button { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.mem { padding-left: 20px; color: var(--muted); }
.mem li { margin: 4px 0; }
.mem button { margin-left: 8px; background: none; border: 0; color: var(--red); cursor: pointer; }
.toast { position: fixed; left: 50%; bottom: 140px; transform: translateX(-50%); background: #0f172a; color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; z-index: 20; max-width: 90vw; text-align: center; box-shadow: var(--shadow); animation: rise .25s ease; }

/* ---------- camera ---------- */
.overlay.cam { padding: 0; background: #000; }
.cam video, .cam img { width: 100%; height: 100%; object-fit: cover; flex: 1; min-height: 0; }
.cam video.mirror { transform: scaleX(-1); }
.cam-count { position: absolute; inset: 0; display: grid; place-items: center; font-size: 130px; font-weight: 800; color: #fff; text-shadow: 0 4px 30px rgba(0,0,0,.5); pointer-events: none; }
.cam-count.flash { background: #fff; animation: flash .35s ease forwards; }
@keyframes flash { to { background: transparent; } }
.cam-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 10px; padding: 16px; background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.cam-bar .big { flex: 1; }

/* ---------- first-run setup ---------- */
.setup { text-align: center; }
.setup-logo { width: 56px; height: 56px; margin: 0 auto 8px; border-radius: 16px; background: url(icons/icon-192.png) center / cover; }
.setup .setup-langs { margin: 10px auto 12px; flex-wrap: wrap; justify-content: center; }
#allowAll { margin: 4px 0 6px; }
.perm { display: flex; align-items: center; gap: 12px; text-align: left; padding: 11px 12px; margin: 8px 0; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.perm .pi { font-size: 20px; width: 30px; text-align: center; }
.perm > div { flex: 1; min-width: 0; }
.perm b { font-size: 15px; }
.perm small { display: block; color: var(--muted); font-size: 13px; }
.perm > button { flex-shrink: 0; min-width: 90px; }
.perm.ok { border-color: #b7e4c7; background: var(--green-soft); }
.perm.ok > button { background: transparent; border: 1px solid #b7e4c7; color: var(--green); }
.perm.ok:has(.switch) > button { display: none; }
.perm.no > button { background: transparent; border: 1px solid #f5b5b5; color: var(--red); }
.perm-btns { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.perm-btns button { min-width: 112px; padding: 8px 10px; font-size: 14px; }
.perm.ok .perm-btns .primary { background: transparent; border: 1px solid #b7e4c7; color: var(--green); }
#setupDone { margin-top: 12px; }
.switch { position: relative; display: none; width: 50px; height: 30px; flex-shrink: 0; cursor: pointer; }
.perm.ok .switch { display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #cbd5e1; transition: background .2s; }
.switch span::before { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
#nightBadge { padding: 4px 8px; }

@media (max-width: 560px) {
  .top { padding: 10px 14px 4px; }
  .hf span { display: none; }
  .hf { padding: 7px; }
  .langs { width: 100%; justify-content: space-between; }
  .chip { padding: 6px 10px; font-size: 14px; }
  .ring-wrap { width: 150px; height: 150px; margin-top: 10px; }
  .ring { width: 134px; height: 134px; }
  .reply { font-size: 20px; }
  .cform { grid-template-columns: 1fr; }
  .bottom, .typebar { padding-left: 14px; padding-right: 14px; }
}


/* ===== Indigo theme + app shell: fixed top bar, scrolling middle, fixed bottom bar, fits every phone ===== */
:root {
  --bg: #f4f5fb; --surface: #ffffff; --surface-2: #f1f2fa; --line: #e4e6f2;
  --text: #111433; --muted: #5d6280; --accent: #4f46e5; --accent-soft: #eceafe; --cyan: #7c3aed;
}
html, body { height: 100%; overscroll-behavior: none; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { height: 100dvh; min-height: 0; overflow: hidden; }
.top { position: relative; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--line); max-width: none; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
.top > * { width: 100%; max-width: 860px; margin: 0 auto; }
.langs { width: fit-content; margin: 0 auto 0 0; }
main#stage { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; max-width: none; padding: 12px 16px 16px; }
main#stage > * { max-width: 720px; }
.appfoot { position: relative; z-index: 2; background: var(--surface); border-top: 1px solid var(--line); padding-top: 10px; }
.appfoot .bottom, .appfoot .typebar { max-width: 860px; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); max-width: 860px; margin: 0 auto; padding: 4px 8px calc(6px + env(safe-area-inset-bottom)); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 0; padding: 6px 4px; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; border-radius: 12px; }
.tab svg { width: 22px; height: 22px; }
.tab.on { color: var(--accent); }
.tab.on svg { fill: var(--accent-soft); }
.ring { background: conic-gradient(#4f46e5, #7c3aed, #4f46e5); }
.halo { background: #4f46e5; }
.tool.sos { background: #e11d48; border-color: #e11d48; }
.big { background: var(--accent); }
.big.yes { background: #16a34a; }
.primary { background: var(--accent); }
.chip.on { background: var(--accent); }
.hf.on { background: var(--accent); border-color: var(--accent); }
.sendbtn { background: var(--accent) !important; }

/* full-screen pages (Features) */
.page { position: fixed; inset: 0; z-index: 9; background: var(--bg); display: flex; flex-direction: column; overflow-y: auto; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.pagehead { position: sticky; top: 0; display: flex; align-items: center; gap: 10px; background: var(--surface); border-bottom: 1px solid var(--line); padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
.pagehead h2 { margin: 0; font-size: 19px; }
.pad { padding: 12px 16px 0; margin: 0; }
.flist { display: grid; gap: 10px; padding: 12px 16px; max-width: 860px; width: 100%; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.fcard { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; text-align: left; }
.fcard h3 { margin: 0 0 4px; font-size: 16px; display: flex; gap: 8px; align-items: center; }
.fcard p { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.fcard button { width: 100%; text-align: left; background: var(--accent-soft); color: var(--accent); border: 0; border-radius: 10px; padding: 9px 12px; font-size: 14px; font-weight: 600; cursor: pointer; }
/* Allow / Don't allow choices */
.choice { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.choice label { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.choice input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.choice label:has(input[value="deny"]:checked) { border-color: #d6d9e6; background: var(--surface-2); color: var(--muted); }
.perm small.blocked { color: var(--red); font-weight: 600; margin-top: 2px; }
.linkbtn { background: none; border: 0; padding: 4px 0 0; color: var(--accent); font-weight: 700; font-size: 13px; cursor: pointer; }
.pulse { animation: pulse-btn 1s ease-in-out infinite; }
@keyframes pulse-btn { 50% { transform: scale(1.04); box-shadow: 0 0 0 8px #16a34a33; } }
.fcard .soon { display: inline-block; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--surface-2); border-radius: 6px; padding: 2px 6px; margin-left: auto; }

/* never squeeze the texts in the scrolling middle area (they overlapped on small phones) */
main#stage > * { flex-shrink: 0; }
.you { line-height: 1.4; }

/* email details menu */
.details { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.details summary { cursor: pointer; font-weight: 700; color: var(--accent); list-style: none; }
.details summary::-webkit-details-marker { display: none; }
.dgrid { display: grid; gap: 8px; margin-top: 10px; }
.dfield { display: grid; gap: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.dfield > label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; cursor: pointer; }
.dfield input[type="checkbox"] { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.dfield input[type="text"], .dfield input[type="email"], .dfield input[type="tel"], .details select { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 15px; }
.dfield .dinputs { display: none; gap: 6px; }
.dfield.on .dinputs { display: grid; }

/* Back button at the top of every screen */
.backbtn { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 4px 6px 4px 0; margin-bottom: 4px; color: var(--accent); font-weight: 700; font-size: 15px; cursor: pointer; }
.panel.setup .backbtn { float: left; }

/* Yes / No pop-up */
#ask { align-items: center; justify-content: center; z-index: 15; }
.askbox { text-align: center; max-width: 420px; margin: auto; }
.askicon { font-size: 40px; margin-bottom: 4px; }
.askbox h2 { margin-bottom: 4px; }
