/* HelpMe calm-card-v0 — warm charcoal · diya-glow · 375×844 locked */
:root {
  --bg: #1a1714;
  --bg-elev: #24201c;
  --cream: #f3e6d0;
  --cream-dim: #c9b89a;
  --gold: #e8c47a;
  --gold-soft: #d4a84b;
  --diya: #ffd27a;
  --strip: #2e2822;
  --danger: #c43c2c;
  --safe: #3d6b4f;
  --chip: #3a342c;
  --gap: 12px;
  --hit: 64px;
  --hit-min: 56px;
  --radius: 20px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Devanagari", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  background: var(--bg); color: var(--cream);
  font-family: var(--font); font-size: 17px; line-height: 1.3;
  -webkit-tap-highlight-color: transparent;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--gold); text-decoration: none; }

.app {
  max-width: 375px;
  width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 28%, #2a2218 0%, var(--bg) 62%);
  position: relative;
}

/* Honesty strip — permanent, non-dismissible ~48px */
.demo-strip {
  flex: 0 0 auto;
  z-index: 50;
  background: var(--strip); color: var(--cream);
  padding: 8px 12px; text-align: center;
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  border-bottom: 1px solid #4a4034;
  display: flex; flex-direction: column; gap: 1px;
}
.demo-strip .sim-speed { font-weight: 500; font-size: 10px; color: var(--cream-dim); }

.main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding: 8px 14px 4px;
  min-height: 0;
  overflow: hidden;
}

/* Panels — NEVER overflow auto (hard wall: no page scroll at 375×844) */
.panel {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.panel.active { display: flex; }

/* Orb / Talk */
.orb-wrap {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  min-height: 0;
}
.orb {
  width: 132px; height: 132px; border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #fff6df 0%, var(--diya) 28%, var(--gold-soft) 58%, #8a5a20 100%);
  box-shadow:
    0 0 28px rgba(255, 210, 122, 0.45),
    0 0 64px rgba(212, 168, 75, 0.25),
    inset 0 -8px 20px rgba(80, 40, 10, 0.35);
  position: relative; touch-action: none;
  transition: box-shadow 0.4s ease, transform 0.3s ease;
}
.orb.listening { animation: breathe 3.6s ease-in-out infinite; }
.orb.idle { animation: breathe 4.8s ease-in-out infinite; opacity: 0.92; }
.orb.connecting { box-shadow: 0 0 36px rgba(255, 210, 122, 0.55); }
.orb.thinking {
  animation: pulse 1.4s ease-in-out infinite;
  background: radial-gradient(circle at 40% 35%, #ffe8b0 0%, #c9a05a 55%, #6a4818 100%);
}
.orb.speaking {
  box-shadow: 0 0 40px rgba(255, 220, 140, 0.65), 0 0 80px rgba(232, 196, 122, 0.3);
}
.orb.error {
  background: radial-gradient(circle at 40% 35%, #f0c0a0 0%, #a05040 60%, #4a2018 100%);
  box-shadow: 0 0 24px rgba(196, 60, 44, 0.35);
}
@keyframes breathe {
  0%, 100% { transform: scale(1); box-shadow: 0 0 28px rgba(255, 210, 122, 0.4); }
  50% { transform: scale(1.04); box-shadow: 0 0 48px rgba(255, 210, 122, 0.55); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(0.96); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .orb.listening, .orb.idle, .orb.thinking { animation: none; }
}

.orb-status {
  text-align: center; color: var(--cream-dim); font-size: 14px; min-height: 1.4em;
  max-width: 300px; margin: 0;
}
.spoken-line {
  text-align: center; color: var(--cream); font-size: 17px; max-width: 300px;
  min-height: 1.2em; margin: 0;
}
.spoken-line.hi-line { font-size: 14px; color: var(--cream-dim); }

/* Bottom nav — quiet Help until active */
.nav {
  flex: 0 0 auto;
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px;
  padding: 8px 14px calc(8px + env(safe-area-inset-bottom, 0));
  background: var(--bg-elev); border-top: 1px solid #3a342c;
}
.nav button {
  min-height: 64px; border-radius: var(--radius);
  background: var(--chip); color: var(--cream);
  font-size: 14px; font-weight: 650; padding: 6px 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.nav button.active { outline: 2px solid var(--gold); background: #3f362c; }
/* Idle Help = neutral chip (same as Talk/People). Danger only when helpActive */
.nav button.help-active {
  background: linear-gradient(180deg, #5a3028 0%, #3a1e1a 100%);
  color: #ffe8e0; outline: 1px solid #8a4034;
}
.nav .hi { font-size: 11px; font-weight: 500; color: var(--cream-dim); }

.settings-btn {
  position: absolute; top: 52px; right: 8px; z-index: 40;
  width: 40px; height: 40px; border-radius: 12px;
  background: transparent; color: var(--cream-dim); font-size: 18px;
}

/* Help disclosure ~52px */
.disclosure {
  flex: 0 0 auto;
  background: #3a2a18; border: 1px solid var(--gold-soft); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 8px; font-size: 13px; text-align: center;
  line-height: 1.25;
}

.help-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.help-chrome {
  flex: 0 0 auto;
  display: flex; flex-direction: column; gap: 8px;
  padding-top: 6px;
}

.exit-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn {
  min-height: var(--hit); border-radius: var(--radius); padding: 8px 12px;
  font-size: 16px; font-weight: 700; text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.btn .hi { font-size: 12px; font-weight: 500; opacity: 0.85; }
.btn-primary { background: var(--chip); color: var(--cream); border: 1px solid #564a3c; min-height: var(--hit-min); }
.btn-danger { background: var(--danger); color: #fff; min-height: var(--hit); }
.btn-safe { background: var(--safe); color: #e8f5ec; min-height: var(--hit-min); }
.btn-ghost {
  background: transparent; border: 1px solid #564a3c; color: var(--cream-dim);
  min-height: var(--hit-min);
}
.exit-row .btn { min-height: var(--hit-min); font-size: 14px; }
.exit-row .btn .hi { font-size: 11px; }
.btn:disabled { opacity: 0.45; }

/* Fog doors — 3 chips only */
.fog-wrap {
  flex: 1; display: flex; flex-direction: column;
  justify-content: center; gap: 10px; min-height: 0;
}
.fog-title {
  text-align: center; font-size: 14px; color: var(--cream-dim); margin: 0 0 4px;
}
.fog-chip {
  min-height: var(--hit-min);
  border-radius: 16px;
  padding: 10px 14px;
  background: var(--bg-elev);
  border: 1px solid #3a342c;
  color: var(--cream);
  font-size: 16px; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-align: center;
}
.fog-chip .hi { font-size: 13px; font-weight: 500; color: var(--cream-dim); }
.fog-chip.fog-call {
  border-color: #8a4034;
  background: #2a1c1a;
}

/* Calm Card */
.calm-card {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-elev);
  border: 1px solid #3a342c;
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.calm-card h2 {
  margin: 0; font-size: 15px; color: var(--gold); font-weight: 700;
}
.calm-script {
  font-size: 14px; margin: 0; line-height: 1.3;
}
.calm-script .hi { display: block; font-size: 12px; color: var(--cream-dim); font-weight: 500; margin-top: 2px; }
.people-plan-block {
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px solid #3a342c;
  font-size: 13px;
  line-height: 1.25;
}
.people-plan-block strong { color: var(--gold); font-size: 12px; display: block; margin-bottom: 2px; }
.people-plan-names { font-size: 13px; margin: 0 0 2px; }
.people-plan-line { font-size: 12px; color: var(--cream-dim); margin: 0; }

.chip {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.03em;
  background: #4a3a20; color: var(--gold); padding: 2px 7px; border-radius: 999px;
  margin: 0 4px 0 0; text-transform: uppercase;
}

/* Safe phase */
.safe-wrap {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; text-align: center;
}
.safe-wrap p { margin: 0; font-size: 15px; }

/* People tab */
.people-head { flex: 0 0 auto; }
.people-head h1 { font-size: 18px; margin: 0 0 4px; }
.people-sub { font-size: 12px; color: var(--cream-dim); margin: 0 0 6px; }
.people-plan { font-size: 13px; color: var(--gold); margin: 0 0 8px; }
.people-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.person {
  background: var(--bg-elev); border-radius: 14px; padding: 10px 12px; border: 1px solid #3a342c;
  flex: 0 0 auto;
}
.person strong { font-size: 15px; }
.person .rel { font-size: 12px; color: var(--cream-dim); }
.person .plan { font-size: 12px; margin-top: 4px; line-height: 1.25; }
.btn-edit-people { flex: 0 0 auto; margin-top: 8px; min-height: 56px; }

/* Modals */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.72); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  width: 100%; max-width: 375px; background: var(--bg-elev);
  border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0));
  max-height: 85dvh;
  overflow: hidden;
}
.modal h2 { margin: 0 0 10px; font-size: 18px; }
.modal-copy { font-size: 13px; color: var(--cream-dim); margin: 0 0 10px; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.pin-input, .settings-panel input, .settings-panel select {
  width: 100%; min-height: 52px; border-radius: 12px; border: 1px solid #564a3c;
  background: #12100e; color: var(--cream); padding: 10px 12px; margin-bottom: 10px;
}
.settings-panel label { display: block; margin: 4px 0; font-size: 13px; color: var(--cream-dim); }
.settings-panel select { appearance: none; }
.pin-error { color: #f0a090; font-size: 13px; margin: 0 0 8px; }
.pe-row { margin-bottom: 10px; }
.pe-row label { font-size: 12px; color: var(--cream-dim); }

.footer-proto {
  flex: 0 0 auto;
  text-align: center; font-size: 11px; color: #7a6e5e;
  padding: 4px 12px 6px; margin: 0;
  line-height: 1.2;
}

.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%);
  z-index: 120; max-width: 340px; width: calc(100% - 32px);
  background: #3a342c; color: var(--cream); border: 1px solid var(--gold-soft);
  border-radius: 14px; padding: 12px 14px; font-size: 14px; text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.toast.hidden { display: none; }

.hidden { display: none !important; }

.app:has(#panelHelp.active) .footer-proto { display: none; }
.calm-card { gap: 4px; padding: 8px 10px; }
.calm-script { font-size: 13px; }
.calm-script .hi { display: inline; font-size: 12px; margin-top: 0; }
.calm-script.say { font-size: 13px; }
.people-plan-block { flex: 0 0 auto; }
.people-plan-line { font-size: 13px; color: var(--cream); line-height: 1.25; }
.people-plan-line strong { color: var(--gold); }
.people-plan-line .hi { color: var(--cream-dim); font-size: 11px; }
.help-chrome { gap: 6px; }
.btn-primary { min-height: 56px; }
