/* ui.css — components added in the modular rebuild.
   (Palette tokens, console, lenses, audio + glitch live in app.css.) */

/* ---- avatar: just the talking video, in the head window.
   app.css already sets .bg-avatar to position:absolute / inset:0 — do NOT override
   that here (doing so collapses the box and hides the face). ---- */
.bg-avatar .bg-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; border-radius: inherit; z-index: 3; pointer-events: none;
}

/* splash environment backdrop (BG's ledger-terminal lair, dimmed for legibility) */
.splash-bg {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: url(../assets/brand/splash.png) center/cover no-repeat;
  opacity: 0.34;
  -webkit-mask-image: radial-gradient(120% 100% at 50% 40%, #000 35%, transparent 92%);
  mask-image: radial-gradient(120% 100% at 50% 40%, #000 35%, transparent 92%);
}
.splash-inner { position: relative; z-index: 1; }

/* splash wordmark image (falls back to the text "CODED" on error) */
.splash-logo { line-height: 0; }
.splash-logo img {
  display: block; width: min(440px, 82vw); height: auto; margin: 0 auto;
  filter: drop-shadow(0 0 26px rgba(37,245,154,0.35));
}

/* ---- mic button "listening" state ---- */
#micBtn.live {
  color: var(--danger); border-color: rgba(255,93,115,0.6);
  box-shadow: 0 0 12px rgba(255,93,115,0.35); animation: micpulse 1s ease-in-out infinite;
}
@keyframes micpulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }

/* ---- the over-engineered calculator extras ---- */
.calc-sub { height: 4px; margin-top: 6px; border-radius: 3px; background: rgba(37,245,154,0.10); overflow: hidden; }
.calc-sub > i { display: block; height: 100%; width: 0%; background: var(--blue); transition: width .18s ease; }
.calc-grid {
  margin-top: 6px; font: 10px/1.4 var(--mono); letter-spacing: 1px;
  color: rgba(37,245,154,0.35); white-space: nowrap; overflow: hidden; text-overflow: clip;
}
.calc-rows .dots { color: var(--gold); }
.calc-rows .ok { color: var(--green); }
.calc-rows .warn { color: var(--danger); animation: micpulse .5s steps(2) infinite; }

/* ---- hamburger menu ---- */
.menu-btn {
  position: fixed; top: calc(12px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right)); z-index: 60;
  width: 40px; height: 40px; border-radius: 11px; cursor: pointer;
  background: var(--glass); color: var(--green); border: 1px solid var(--line);
  font-size: 20px; line-height: 1; backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px); box-shadow: 0 6px 20px rgba(0,0,0,.4);
  display: none;                       /* hidden behind the splash until the app is entered */
}
body.app-live .menu-btn { display: block; }
.menu-btn:active { transform: translateY(1px); }
.menu-veil { position: fixed; inset: 0; z-index: 58; background: rgba(2,6,11,0.55); opacity: 0; pointer-events: none; transition: opacity .2s; }
.menu-veil.show { opacity: 1; pointer-events: auto; }
.menu-panel {
  position: fixed; top: 0; right: 0; z-index: 59; height: 100%; width: min(320px, 86vw);
  background: rgba(6,18,14,0.92); border-left: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transform: translateX(100%); transition: transform .26s cubic-bezier(.2,.8,.2,1);
  padding: calc(64px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) 16px;
  display: flex; flex-direction: column; gap: 8px; overflow-y: auto;
}
.menu-panel.show { transform: translateX(0); }
.menu-title { font-family: var(--display); color: var(--green); font-size: 26px; letter-spacing: 2px; margin-bottom: 8px; }
.menu-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; cursor: pointer;
  background: rgba(37,245,154,0.05); border: 1px solid var(--line); border-radius: 12px;
  color: var(--ink); font: 600 15px/1.2 var(--mono); padding: 13px 14px;
}
.menu-row:hover { border-color: rgba(37,245,154,0.4); }
.menu-hint { color: var(--muted); font-size: 11px; letter-spacing: .5px; }
.menu-row .sw { font-size: 11px; font-weight: 800; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; }
.menu-row .sw.on { color: #02120c; background: var(--green); border-color: var(--green); }

/* iOS "Add to Home Screen" instructions (Safari can't fire an install prompt) */
.ios-install-veil {
  position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center;
  background: rgba(2,6,11,0.72); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  padding: calc(20px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left));
}
.ios-install-card {
  width: min(360px, 100%); background: rgba(6,18,14,0.96); border: 1px solid var(--line);
  border-radius: 16px; padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.ios-install-title { font-family: var(--display); color: var(--green); font-size: 22px; margin-bottom: 12px; }
.ios-install-steps { margin: 0 0 12px; padding-left: 20px; font: 400 14px/1.5 var(--mono); color: var(--ink); }
.ios-install-steps li { margin-bottom: 8px; }
.ios-share-ico { display: inline-flex; vertical-align: -3px; color: var(--blue); }
.ios-install-note { color: var(--muted); font-size: 12px; line-height: 1.45; margin-bottom: 16px; }
.ios-install-ok {
  width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--green);
  background: var(--green); color: #02120c; font-family: var(--display); font-size: 17px; cursor: pointer;
}
.ios-install-ok:active { transform: translateY(1px); }

/* ---- BG-narrated tutorial coachmarks ---- */
.coach-veil { position: fixed; inset: 0; z-index: 40; background: rgba(2,6,11,0.6); }
.coach-target {
  outline: 2px solid var(--green); outline-offset: 3px; border-radius: 10px;
  box-shadow: 0 0 0 6px rgba(37,245,154,0.18), 0 0 30px rgba(37,245,154,0.4);
  animation: coachpulse 1.4s ease-in-out infinite;
}
/* lift a static/relative target above the dimming veil (fixed ones are already above) */
.coach-lift { position: relative; z-index: 45 !important; }
@keyframes coachpulse { 0%,100% { box-shadow: 0 0 0 6px rgba(37,245,154,0.18), 0 0 24px rgba(37,245,154,0.35); } 50% { box-shadow: 0 0 0 9px rgba(37,245,154,0.10), 0 0 38px rgba(37,245,154,0.55); } }
.coach-hot { outline-color: #ffd23a; box-shadow: 0 0 0 6px rgba(255,210,58,0.22), 0 0 34px rgba(255,210,58,0.5); }
@media (prefers-reduced-motion: reduce) { .coach-target, .ghost.games.pulse, #micBtn.live, .calc-rows .warn { animation: none; } }

/* tooltip card for the spotlight tour */
.coach-card {
  position: fixed; z-index: 46; max-width: 340px;
  background: rgba(6,18,14,0.97); border: 1px solid rgba(37,245,154,0.45);
  border-radius: 14px; padding: 13px 14px 11px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.55), 0 0 26px rgba(37,245,154,0.16);
  color: var(--ink); font-family: var(--mono);
}
.coach-card .coach-text { font-size: 14px; line-height: 1.5; }
.coach-card .coach-row { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; gap: 10px; }
.coach-card .coach-count { color: var(--muted); font-size: 11px; letter-spacing: 1px; }
.coach-card .coach-btns { display: flex; gap: 8px; }
.coach-card button {
  appearance: none; cursor: pointer; font-family: var(--mono); font-size: 13px; font-weight: 700;
  border-radius: 9px; padding: 8px 13px; border: 1px solid var(--line); background: rgba(2,8,6,0.7); color: var(--muted);
}
.coach-card .coach-next { border-color: var(--green); color: #02140c; background: linear-gradient(90deg, var(--green), #6bffc0); }
.coach-card .coach-skip:hover { color: var(--ink); }

/* the on-screen 🎮 Games button — made obvious */
.ghost.games { color: var(--green); border-color: rgba(37,245,154,0.55); background: rgba(37,245,154,0.07); font-weight: 700; }
.ghost.games:hover { color: #6bffc0; border-color: var(--green); box-shadow: 0 0 16px rgba(37,245,154,0.25); }
.ghost.games.pulse { animation: gamesPulse 1.8s ease-in-out infinite; }
@keyframes gamesPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(37,245,154,0.0); border-color: rgba(37,245,154,0.55); }
  50% { box-shadow: 0 0 0 5px rgba(37,245,154,0.16), 0 0 18px rgba(37,245,154,0.4); border-color: var(--green); }
}
