/* shell.css — companion overlay. Design rules from .handoff-onthego-companion-web.md:
   fullscreen map iframe is the hero; everything else FLOATS on top; the overlay container is
   pointer-events:none so the map stays fully interactive (only .pe-auto children take touches). */
:root {
  /* Amity Robotics Brand 2026 — teal/green core + the signature cyan→green "flare" gradient. */
  --accent: #14C596;             /* brand green */
  --accent-2: #04BECB;           /* brand cyan — gradient start, speaking ring */
  --accent-ink: #053B45;         /* deep teal — text/foreground on the accent */
  --grad-a: #04BECB;             /* flare gradient: cyan → */
  --grad-b: #1CC99C;             /* → green */
  --ink: #08201C;                /* near-black teal ink */
  --paper: #ffffff;
  --shadow: 0 6px 24px rgba(5, 40, 36, .22);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --foot-h: 28px;                /* Amity branding strip at the very bottom */
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-optical-sizing: auto;
}
/* Use the variable font where the browser supports it (rsms.me recommended setup). */
@supports (font-variation-settings: normal) {
  :root { font-family: 'InterVariable', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b1413; color: var(--ink); }
[hidden] { display: none !important; }

/* ---------- Landing ---------- */
.landing {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(120% 120% at 50% 0%, var(--grad-a) 0%, var(--accent) 42%, #0B7858 100%);
  color: #fff; text-align: center; z-index: 50;
}
.landing-card { max-width: 340px; }
.landing-orb { font-size: 64px; filter: drop-shadow(0 6px 12px rgba(0,0,0,.25)); animation: bob 3s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.landing-title { font-size: 30px; font-weight: 800; margin: 14px 0 6px; letter-spacing: -.5px; }
.landing-sub { font-size: 16px; opacity: .92; margin: 0 0 26px; line-height: 1.45; }
.start-btn {
  width: 100%; border: 0; border-radius: 999px; padding: 18px 22px; font-size: 18px; font-weight: 700;
  color: var(--accent-ink); background: #fff; box-shadow: var(--shadow); cursor: pointer;
}
.start-btn:active { transform: scale(.98); }
.start-btn:disabled { opacity: .7; }
.landing-consent { font-size: 12px; opacity: .78; margin: 18px 4px 0; line-height: 1.5; }
.landing-err { margin-top: 14px; font-size: 14px; color: #ffe0e0; background: rgba(0,0,0,.22); padding: 10px 12px; border-radius: 10px; }

/* ---------- App shell ---------- */
.app { position: fixed; inset: 0; }
.map { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Branded loader over the venue-map iframe (hides the third-party splash while it boots). */
.maploader { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center;
  background: radial-gradient(120% 120% at 50% 30%, var(--grad-a) 0%, var(--accent) 45%, #0B7858 100%);
  color: #fff; transition: opacity .5s ease; }
.maploader.hide { opacity: 0; pointer-events: none; }
.maploader-spinner { width: 46px; height: 46px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,.28); border-top-color: #fff; animation: spin .9s linear infinite; }
.maploader-text { position: absolute; margin-top: 96px; font-size: 15px; font-weight: 650; letter-spacing: .2px; opacity: .95; }
@keyframes spin { to { transform: rotate(360deg); } }

/* The overlay layer is transparent to touches; children opt back in with .pe-auto. */
.overlay { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
.pe-auto { pointer-events: auto; }

/* ---------- Top strip: nav step + expiry ---------- */
.topstrip {
  position: absolute; top: 0; left: 0; right: 0;
  padding: calc(var(--safe-t) + 8px) 12px 8px;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(180deg, rgba(6,26,24,.82) 0%, rgba(6,26,24,0) 100%);
  color: #fff;
}
.nav { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.nav-arrow { font-size: 20px; color: #6FE3CC; }
.nav-text { font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-dist { font-size: 13px; opacity: .8; flex: none; }
.expiry { flex: none; display: flex; align-items: center; gap: 6px; font-size: 13px; font-variant-numeric: tabular-nums;
  background: rgba(0,0,0,.32); border-radius: 999px; padding: 5px 10px; }
.expiry-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 0 rgba(4,190,203,.6); animation: pulse 2s infinite; }
.expiry.warn .expiry-dot { background: #FFCB1D; animation-duration: 1s; } /* brand yellow */
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(4,190,203,.6); } 70% { box-shadow: 0 0 0 8px rgba(4,190,203,0); } 100% { box-shadow: 0 0 0 0 rgba(4,190,203,0); } }

/* ---------- Caption bubbles: last 1–2, auto-fade ---------- */
.captions { position: absolute; left: 12px; right: 96px; bottom: calc(108px + var(--foot-h)); display: flex; flex-direction: column; gap: 8px; }
.bubble {
  align-self: flex-start; max-width: 100%; padding: 10px 14px; border-radius: 16px 16px 16px 4px;
  background: rgba(255,255,255,.96); color: var(--ink); font-size: 15px; line-height: 1.4;
  box-shadow: var(--shadow); animation: rise .25s ease both; transition: opacity .6s ease;
}
.bubble.user { align-self: flex-end; background: var(--accent); color: #fff; border-radius: 16px 16px 4px 16px; }
.bubble.fade { opacity: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Avatar PiP ---------- */
.avatar-pip {
  position: absolute; right: 12px; bottom: calc(96px + var(--foot-h)); width: 84px; height: 84px; border-radius: 20px;
  overflow: hidden; background: #0b3b35; box-shadow: var(--shadow); border: 2px solid rgba(255,255,255,.85);
  touch-action: none; cursor: grab; transition: width .2s, height .2s, border-radius .2s;
}
.avatar-pip.expanded { width: 190px; height: 250px; border-radius: 24px; }
.avatar-pip.dragging { cursor: grabbing; transition: none; }
.avatar-pip.avatar-muted::after { content: '🔇'; position: absolute; top: 4px; left: 4px; font-size: 13px; background: rgba(0,0,0,.5); border-radius: 6px; padding: 1px 3px; }
.avatar-video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* CSS-orb fallback (no real clips configured) — idle breathes, speaking bounces. */
.avatar-orb { width: 100%; height: 100%; display: grid; place-items: center;
  background: radial-gradient(80% 80% at 50% 30%, var(--grad-a), #0B7858); }
.avatar-orb-face { font-size: 40px; }
.avatar-pip.expanded .avatar-orb-face { font-size: 90px; }
.avatar-pip[data-state="idle"] .avatar-orb { animation: breathe 3.2s ease-in-out infinite; }
.avatar-pip[data-state="speaking"] .avatar-orb { animation: talk .5s ease-in-out infinite; }
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes talk { 0%,100% { transform: scale(1); } 50% { transform: scale(1.09) translateY(-2px); } }
/* speaking ring */
.avatar-pip[data-state="speaking"] { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(4,190,203,.5), var(--shadow); }

/* ---------- Bottom bar (mic-first) ---------- */
.bottombar { position: absolute; left: 0; right: 0; bottom: calc(var(--foot-h) + var(--safe-b)); padding: 10px 12px 10px;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(0deg, rgba(6,26,24,.86) 0%, rgba(6,26,24,0) 100%); }
.history-handle, .text-toggle { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.16); color: #fff; font-size: 18px; cursor: pointer; }
.mic-btn { flex: 1; height: 56px; border: 0; border-radius: 999px; background: #fff; color: var(--accent-ink);
  font-size: 16px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: var(--shadow); cursor: pointer; user-select: none; }
.mic-btn .mic-icon { font-size: 20px; }
.mic-btn.recording { background: #ff4d4d; color: #fff; transform: scale(1.02); animation: rec 1s infinite; }
@keyframes rec { 0%,100% { box-shadow: 0 0 0 0 rgba(255,77,77,.5); } 50% { box-shadow: 0 0 0 10px rgba(255,77,77,0); } }
.text-form { position: absolute; left: 12px; right: 12px; bottom: calc(var(--foot-h) + var(--safe-b) + 76px); display: flex; gap: 8px; }

/* ---------- Amity Robotics footer (tap → website) ---------- */
.footer { position: absolute; left: 0; right: 0; bottom: 0; z-index: 12;
  min-height: var(--foot-h); padding: 4px 0 var(--safe-b);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; color: rgba(255,255,255,.9); font-size: 13px; letter-spacing: .01em;
  background: linear-gradient(0deg, rgba(6,20,19,.94) 0%, rgba(6,20,19,.55) 55%, rgba(6,20,19,0) 100%); }
.footer:active { opacity: .65; }
.foot-power { font-style: italic; font-weight: 500; opacity: .8; }
.foot-arc { font-weight: 800; color: var(--accent); font-size: 17px; letter-spacing: -.02em; }
.foot-amity { font-weight: 600; }
.text-input { flex: 1; height: 46px; border: 0; border-radius: 12px; padding: 0 14px; font-size: 16px; box-shadow: var(--shadow); }
.text-send { border: 0; border-radius: 12px; padding: 0 16px; background: var(--accent); color: #fff; font-weight: 700; font-size: 15px; }

/* ---------- Pull-up history sheet ---------- */
.sheet { position: absolute; left: 0; right: 0; bottom: 0; height: 78vh; z-index: 20;
  background: var(--paper); border-radius: 22px 22px 0 0; box-shadow: 0 -8px 30px rgba(0,0,0,.3);
  transform: translateY(calc(100% - 0px)); transition: transform .28s ease; display: flex; flex-direction: column;
  pointer-events: none; }
.sheet.open { transform: translateY(0); pointer-events: auto; }
.sheet-grip { padding: 10px 0 6px; display: grid; place-items: center; cursor: grab; pointer-events: auto; }
.sheet-grip span { width: 44px; height: 5px; border-radius: 3px; background: #d3ded9; display: block; }
.sheet-head { text-align: center; font-weight: 700; font-size: 14px; color: #5b6c68; padding-bottom: 6px; }
.thread { flex: 1; overflow-y: auto; padding: 8px 16px calc(var(--safe-b) + 20px); display: flex; flex-direction: column; gap: 8px; }
.thread .bubble { position: static; animation: none; }

/* ---------- Ended screen ---------- */
.ended { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 28px; text-align: center;
  background: linear-gradient(160deg, #23343f, #0f1a1f); color: #eaf5f2; }
.ended-card { max-width: 320px; }
.ended-icon { font-size: 56px; opacity: .8; }
.ended h1 { font-size: 24px; margin: 12px 0 8px; }
.ended p { font-size: 15px; opacity: .82; line-height: 1.5; }
