/* Mitr voice call (v5). The sky IS the interface: one sky per inner weather,
   an orb that breathes, listens and speaks, captions, breathing + grounding. */

.voice-btn {
  /* composer call button; same family as .mic-btn */
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--teal-deep); color: #fff; flex: none;
  box-shadow: 0 4px 14px rgba(142, 30, 45, .28);
  transition: transform .15s ease, box-shadow .2s ease;
}
.voice-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(142, 30, 45, .36); }
.voice-btn:active { transform: scale(.94); }
.voice-btn svg { width: 20px; height: 20px; }
.voice-btn[hidden] { display: none; }

#voice {
  --fg: #fff; --fg-dim: rgba(255,255,255,.72); --glass: rgba(255,255,255,.14); --glass-line: rgba(255,255,255,.28);
  --sky-top: #2a2433; --sky-bot: #6b3a47; --blob-a: rgba(239,137,134,.35); --blob-b: rgba(142,30,45,.35);
  --orb-hi: #fff2ee; --orb-a: #ef8986; --orb-b: #8e1e2d; --orb-glow: rgba(239,137,134,.55);
  position: fixed; inset: 0; z-index: 200; display: none; flex-direction: column;
  color: var(--fg); font-family: var(--font-body);
  background: linear-gradient(180deg, var(--sky-top), var(--sky-bot));
  transition: background .8s ease;
  overflow: hidden; -webkit-tap-highlight-color: transparent;
}
#voice.open { display: flex; animation: vFade .35s ease both; }
@keyframes vFade { from { opacity: 0; } to { opacity: 1; } }

#voice[data-sky="storm"]    { --sky-top:#141b2b; --sky-bot:#3b2a4a; --blob-a:rgba(120,110,200,.30); --blob-b:rgba(60,70,120,.45); --orb-hi:#e7e4ff; --orb-a:#8f86d8; --orb-b:#3b2f77; --orb-glow:rgba(143,134,216,.55); }
#voice[data-sky="fog"]      { --sky-top:#9aa6b2; --sky-bot:#d6dadd; --blob-a:rgba(255,255,255,.55); --blob-b:rgba(190,200,210,.6); --fg:#1e232a; --fg-dim:rgba(30,35,42,.68); --glass:rgba(255,255,255,.4); --glass-line:rgba(30,35,42,.2); --orb-hi:#ffffff; --orb-a:#b8c4cf; --orb-b:#74869a; --orb-glow:rgba(116,134,154,.5); }
#voice[data-sky="grey"]     { --sky-top:#6f737a; --sky-bot:#a9acb1; --blob-a:rgba(255,255,255,.28); --blob-b:rgba(90,95,105,.4); --orb-hi:#f4f4f4; --orb-a:#b9bcc2; --orb-b:#5d6169; --orb-glow:rgba(185,188,194,.5); }
#voice[data-sky="clearing"] { --sky-top:#34506b; --sky-bot:#e3b189; --blob-a:rgba(255,224,170,.45); --blob-b:rgba(80,120,160,.45); --orb-hi:#fff6e6; --orb-a:#f2c28c; --orb-b:#c2693f; --orb-glow:rgba(242,194,140,.55); }
#voice[data-sky="sunny"]    { --sky-top:#ffd98a; --sky-bot:#ff9d6c; --blob-a:rgba(255,255,255,.5); --blob-b:rgba(255,120,80,.45); --fg:#2a1a12; --fg-dim:rgba(42,26,18,.7); --glass:rgba(255,255,255,.42); --glass-line:rgba(42,26,18,.2); --orb-hi:#fffbe8; --orb-a:#ffd062; --orb-b:#f0623a; --orb-glow:rgba(255,160,70,.6); }

/* drifting light behind everything */
#voice .sky::before, #voice .sky::after {
  content: ''; position: absolute; width: 90vmax; height: 90vmax; border-radius: 50%;
  filter: blur(60px); opacity: .9; pointer-events: none; transition: background .8s ease;
}
#voice .sky::before { background: radial-gradient(circle, var(--blob-a), transparent 60%); top: -40vmax; left: -30vmax; animation: vDrift 26s ease-in-out infinite alternate; }
#voice .sky::after  { background: radial-gradient(circle, var(--blob-b), transparent 60%); bottom: -45vmax; right: -30vmax; animation: vDrift 34s ease-in-out infinite alternate-reverse; }
@keyframes vDrift { to { transform: translate3d(8vmax, 6vmax, 0) scale(1.1); } }
#voice .sky { position: absolute; inset: 0; pointer-events: none; }

#voice .screen { position: relative; flex: 1; display: none; flex-direction: column; align-items: center; padding: max(18px, env(safe-area-inset-top)) 22px max(22px, env(safe-area-inset-bottom)); min-height: 0; }
#voice .screen.on { display: flex; animation: vRise .5s cubic-bezier(.2,.7,.2,1) both; }
@keyframes vRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

#voice .v-top { width: 100%; max-width: 520px; display: flex; justify-content: space-between; align-items: center; min-height: 40px; }
#voice .v-close, #voice .v-back {
  background: var(--glass); border: 1px solid var(--glass-line); color: var(--fg); border-radius: 999px;
  padding: 8px 14px; font: 500 .85rem var(--font-body); cursor: pointer; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
#voice .v-timer { font: 700 .85rem var(--font-mono); color: var(--fg-dim); letter-spacing: .04em; }

/* ---- mood screen ---- */
#voice h2.v-title { font: 500 clamp(1.7rem, 6vw, 2.3rem)/1.15 var(--font-display); text-align: center; margin: clamp(18px, 7vh, 60px) 0 6px; letter-spacing: -.01em; }
#voice .v-sub { color: var(--fg-dim); text-align: center; margin: 0 0 22px; font-size: .95rem; }
#voice .tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; width: 100%; max-width: 520px; }
#voice .tile {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 4px 12px;
  background: var(--glass); border: 1px solid var(--glass-line); border-radius: 20px; color: var(--fg);
  font: 600 .78rem var(--font-body); cursor: pointer; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: transform .18s ease, background .2s ease, border-color .2s ease;
}
#voice .tile:hover { transform: translateY(-2px); }
#voice .tile:active { transform: scale(.95); }
#voice .tile.on { border-color: var(--fg); background: var(--glass); transform: translateY(-3px); box-shadow: 0 10px 28px rgba(0,0,0,.18); }
#voice .tile i { width: 34px; height: 34px; border-radius: 50%; display: block; box-shadow: inset 0 -6px 10px rgba(0,0,0,.18); }
#voice .tile[data-m="storm"] i { background: radial-gradient(circle at 35% 30%, #e7e4ff, #8f86d8 55%, #3b2f77); }
#voice .tile[data-m="fog"] i { background: radial-gradient(circle at 35% 30%, #fff, #c4ced7 55%, #7f91a3); }
#voice .tile[data-m="grey"] i { background: radial-gradient(circle at 35% 30%, #f4f4f4, #b9bcc2 55%, #6a6e76); }
#voice .tile[data-m="clearing"] i { background: radial-gradient(circle at 35% 30%, #fff6e6, #f2c28c 55%, #6a93b8); }
#voice .tile[data-m="sunny"] i { background: radial-gradient(circle at 35% 30%, #fffbe8, #ffd062 55%, #f0623a); }
#voice .topics { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 520px; margin-top: 22px; min-height: 40px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .4s ease, transform .4s ease; }
#voice .topics.show { opacity: 1; transform: none; pointer-events: auto; }
#voice .chip { background: transparent; border: 1px solid var(--glass-line); color: var(--fg); border-radius: 999px; padding: 8px 14px; font: 500 .85rem var(--font-body); cursor: pointer; }
#voice .chip.on { background: var(--fg); color: var(--sky-top); }
#voice[data-sky="fog"] .chip.on, #voice[data-sky="sunny"] .chip.on { color: #fff; background: #1e232a; }
#voice .v-go, #voice .v-primary {
  margin-top: 22px; background: var(--fg); color: var(--sky-top); border: 0; border-radius: 999px;
  padding: 15px 34px; font: 700 1rem var(--font-body); cursor: pointer; box-shadow: 0 10px 30px rgba(0,0,0,.22);
  transition: transform .15s ease, opacity .3s ease;
}
#voice[data-sky="fog"] .v-go, #voice[data-sky="sunny"] .v-go, #voice[data-sky="fog"] .v-primary, #voice[data-sky="sunny"] .v-primary { background: #1e232a; color: #fff; }
#voice .v-go:active, #voice .v-primary:active { transform: scale(.96); }
#voice .v-go[disabled] { opacity: .5; }
#voice .v-skip { background: none; border: 0; color: var(--fg-dim); text-decoration: underline; text-underline-offset: 3px; font: 500 .9rem var(--font-body); margin-top: 14px; cursor: pointer; }
#voice .v-note { color: var(--fg-dim); font-size: .8rem; text-align: center; max-width: 340px; margin-top: auto; padding-top: 18px; line-height: 1.5; }

/* ---- call screen ---- */
#voice .stage { flex: 1; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; gap: 18px; }
#voice .orb { --lvl: 0; position: relative; width: min(60vw, 270px); aspect-ratio: 1; cursor: pointer; flex: none; }
#voice .orb .halo { position: absolute; inset: -14%; border-radius: 50%; border: 1px solid var(--glass-line); opacity: calc(.15 + var(--lvl) * .7); transform: scale(calc(1 + var(--lvl) * .35)); transition: opacity .15s linear; }
#voice .orb .halo.h2 { inset: -30%; opacity: calc(.08 + var(--lvl) * .45); transform: scale(calc(1 + var(--lvl) * .5)); }
#voice .orb .core {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, var(--orb-hi), var(--orb-a) 52%, var(--orb-b) 100%);
  box-shadow: 0 0 calc(50px + var(--lvl) * 90px) var(--orb-glow), inset 0 -18px 40px rgba(0,0,0,.2);
  transform: scale(calc(1 + var(--lvl) * .16));
  transition: background .8s ease, box-shadow .2s linear;
}
#voice .orb .shimmer { position: absolute; inset: 0; border-radius: 50%; opacity: 0; mix-blend-mode: soft-light; background: conic-gradient(from 0deg, transparent, rgba(255,255,255,.8), transparent 40%); transition: opacity .4s ease; }
#voice .orb-wrap { transition: transform .5s ease; }
#voice[data-phase="connecting"] .orb-wrap, #voice[data-phase="listening"] .orb-wrap { animation: vBreath 5.5s ease-in-out infinite; }
#voice[data-phase="thinking"] .orb .shimmer { opacity: .85; animation: vSpin 2.2s linear infinite; }
#voice[data-phase="muted"] .orb { filter: saturate(.3) brightness(.85); }
@keyframes vBreath { 0%, 100% { transform: scale(.96); } 50% { transform: scale(1.04); } }
@keyframes vSpin { to { transform: rotate(360deg); } }

#voice .state { font: 600 .8rem var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--fg-dim); min-height: 1.2em; }
#voice .caption { width: 100%; max-width: 520px; min-height: 5.2em; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 8px; text-align: center; }
#voice .cap-mitr { font: 400 clamp(1.15rem, 4.6vw, 1.5rem)/1.35 var(--font-display); animation: vFade .4s ease both; text-wrap: balance; }
#voice .cap-you { font: italic 500 1rem/1.4 var(--font-body); color: var(--fg-dim); text-wrap: balance; }
#voice .cap-hint { font-size: .8rem; color: var(--fg-dim); }

#voice .controls { display: flex; gap: 18px; align-items: center; justify-content: center; padding-top: 10px; }
#voice .ctl { display: flex; flex-direction: column; align-items: center; gap: 7px; background: none; border: 0; color: var(--fg); font: 600 .75rem var(--font-body); cursor: pointer; }
#voice .ctl .ic { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transition: transform .15s ease, background .2s ease; }
#voice .ctl:active .ic { transform: scale(.92); }
#voice .ctl svg { width: 24px; height: 24px; }
#voice .ctl.on .ic { background: var(--fg); color: var(--sky-top); }
#voice .ctl.end .ic { background: #d93a3a; border-color: #d93a3a; color: #fff; width: 66px; height: 66px; box-shadow: 0 10px 26px rgba(217,58,58,.4); }
#voice .typebar { width: 100%; max-width: 520px; display: none; gap: 8px; margin-top: 12px; }
#voice .typebar.on { display: flex; animation: vRise .3s ease both; }
#voice .typebar input { flex: 1; background: var(--glass); border: 1px solid var(--glass-line); border-radius: 999px; padding: 13px 18px; color: var(--fg); font: 500 1rem var(--font-body); outline: none; min-width: 0; }
#voice .typebar input::placeholder { color: var(--fg-dim); }
#voice .typebar button { background: var(--fg); color: var(--sky-top); border: 0; border-radius: 999px; padding: 0 20px; font: 700 .9rem var(--font-body); cursor: pointer; }
#voice[data-sky="fog"] .typebar button, #voice[data-sky="sunny"] .typebar button { background: #1e232a; color: #fff; }
#voice .toast { position: absolute; left: 50%; top: 70px; transform: translateX(-50%); background: rgba(20,20,24,.72); color: #fff; padding: 10px 16px; border-radius: 14px; font-size: .85rem; max-width: 86vw; text-align: center; z-index: 5; animation: vRise .3s ease both; }

/* ---- breathing + grounding (full-stage takeovers) ---- */
#voice .exercise { position: absolute; inset: 0; z-index: 4; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 22px; background: linear-gradient(180deg, color-mix(in srgb, var(--sky-top) 82%, #000), color-mix(in srgb, var(--sky-bot) 82%, #000)); }
#voice .exercise.on { display: flex; animation: vFade .5s ease both; }
#voice .b-orb { position: relative; width: min(62vw, 280px); aspect-ratio: 1; display: grid; place-items: center; }
#voice .b-orb .ring { position: absolute; inset: 0; border-radius: 50%; border: 1px solid var(--glass-line); }
#voice .b-orb .b-core { width: 100%; height: 100%; border-radius: 50%; background: radial-gradient(circle at 34% 28%, var(--orb-hi), var(--orb-a) 55%, var(--orb-b)); box-shadow: 0 0 80px var(--orb-glow); transform: scale(.45); transition: transform 4s cubic-bezier(.45,0,.55,1); }
#voice .b-cue { font: 500 clamp(1.8rem, 7vw, 2.4rem) var(--font-display); }
#voice .b-sub { color: var(--fg-dim); font-size: .95rem; min-height: 1.3em; }
#voice .b-dots { display: flex; gap: 8px; }
#voice .b-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--glass-line); transition: background .4s ease, transform .4s ease; }
#voice .b-dots i.done { background: var(--fg); transform: scale(1.2); }
#voice .g-n { font: 500 clamp(5rem, 24vw, 8rem)/1 var(--font-display); }
#voice .g-cue { font: 500 1.35rem var(--font-display); text-align: center; max-width: 320px; }

/* ---- takeaway ---- */
#voice .take { width: 100%; max-width: 520px; margin-top: clamp(16px, 6vh, 50px); display: flex; flex-direction: column; gap: 14px; }
#voice .take .card { background: var(--glass); border: 1px solid var(--glass-line); border-radius: 22px; padding: 18px 20px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); animation: vRise .6s cubic-bezier(.2,.7,.2,1) both; }
#voice .take .card:nth-child(2) { animation-delay: .15s; }
#voice .take .lbl { font: 700 .7rem var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--fg-dim); margin-bottom: 8px; }
#voice .take .txt { font: 400 1.25rem/1.4 var(--font-display); }
#voice .take-actions { display: flex; flex-direction: column; align-items: center; margin-top: auto; padding-top: 10px; }
#voice .spinner { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--glass-line); border-top-color: var(--fg); animation: vSpin 0.9s linear infinite; margin-top: 30px; }

@media (max-width: 380px) { #voice .tiles { gap: 6px; } #voice .tile { font-size: .7rem; } #voice .controls { gap: 12px; } }
@media (prefers-reduced-motion: reduce) {
  #voice *, #voice *::before, #voice *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

#voice .ctl .slash { opacity: 0; transition: opacity .2s; }
#voice .ctl.on .slash { opacity: 1; }

/* v6.3 (24 Nov 2026): the call overlay must never scroll or shift sideways.
   The two blurred "sky" blobs are 90vmax wide, which made #voice ~700px wide inside a 390px phone; the browser then
   scrolled it sideways when the type bar was focused, cutting off the reply and the input. The blobs are now clipped
   inside .sky, the overlay can't be scrolled at all, and it follows the visible area when the keyboard opens. */
#voice { overflow: hidden; overflow: clip; overscroll-behavior: none; max-width: 100vw; }
#voice .sky { overflow: hidden; }
#voice.kb { top: var(--vvt, 0px); bottom: auto; height: var(--vvh, 100dvh); }
#voice .screen { min-width: 0; max-width: 100%; overflow-x: clip; }
#voice .stage { justify-content: safe center; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: none; }
#voice .stage::-webkit-scrollbar { display: none; }
#voice .caption, #voice .cap-mitr, #voice .cap-you { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
#voice .typebar { flex: none; }
#voice .controls { flex: none; }
@media (max-height: 700px) { #voice .orb { width: min(46vw, 190px); } }
#voice.kb .orb { width: min(30vw, 110px); }
#voice.kb .stage { gap: 10px; }
