/* View base */
.view {
  position: absolute;
  inset: 0;
  padding: var(--pad-md);
  display: flex;
  flex-direction: column;
}

/* Status bar */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--type-label-size);
  letter-spacing: var(--type-label-tracking);
  text-transform: uppercase;
  opacity: 0.6;
  height: 16px;
}

/* Buttons (pill) */
.btn { background: transparent; border: 1px solid rgba(255,255,255,0.3); color: var(--fg); padding: 6px 16px; border-radius: 999px; font-size: var(--type-label-size); letter-spacing: var(--type-label-tracking); text-transform: uppercase; cursor: pointer; }
.btn-primary { background: var(--fg); color: var(--bg); border-color: var(--fg); font-weight: 600; }
.btn-accent { background: var(--rabbit-orange); color: var(--bg); border-color: var(--rabbit-orange); font-weight: 600; }

/* Menu cursor */
.menu-list { list-style: none; padding: 0; margin: 0; }
.menu-item { padding: 5px 0; font-size: 16px; font-weight: 500; opacity: 0.55; transition: opacity var(--transition-fast); }
.menu-item.active { opacity: 1; }
.menu-item.active::before { content: '> '; color: var(--rabbit-orange); font-weight: 700; }

/* Toast */
.toast { background: var(--surface); color: var(--fg); padding: 10px 14px; border-radius: 8px; font-size: 12px; max-width: 280px; box-shadow: 0 4px 12px rgba(0,0,0,0.4); animation: toast-in 200ms ease-out; }
.toast.error { border-left: 3px solid var(--data-bad); }
.toast.success { border-left: 3px solid var(--data-go); }
@keyframes toast-in { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ============== Reusable view top bar (back button) ============== */
.view-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg);
  border-bottom: 1px solid #111;
  min-height: 38px;
  box-sizing: border-box;
}
.view-back {
  display: inline-flex; align-items: center; gap: 4px;
  background: transparent; border: none; color: var(--fg);
  font-family: inherit; font-size: 11px; letter-spacing: 1.5px;
  text-transform: uppercase; cursor: pointer;
  padding: 4px 6px; border-radius: 4px;
  min-width: 60px;
}
.view-back:active { background: rgba(255,255,255,0.08); }
.view-bar-title {
  font-size: 11px; opacity: 0.5;
  text-transform: uppercase; letter-spacing: 2px;
  flex: 1; text-align: center;
}
.view-bar-actions {
  min-width: 60px;
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
}
.view-bar-actions button {
  background: transparent; border: 1px solid rgba(255,255,255,0.3); color: var(--fg);
  border-radius: 50%; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
/* Floating variant for full-bleed views (camera, etc.) */
.view-bar.floating {
  position: absolute; top: 0; left: 0; right: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.6), transparent);
  border-bottom: none;
  z-index: 10;
}

/* ============== Mascot animations ============== */

/* Cross-fade in when state changes */
@keyframes mascot-fade-in {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
.mascot { transform-origin: center 60%; }
.mascot svg { display: block; }
.mascot { animation: mascot-fade-in 220ms cubic-bezier(0.34,1.56,0.64,1) both; }

/* IDLE: gentle breathing + occasional ear twitch + occasional blink */
@keyframes mascot-breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes ear-twitch-r {
  0%, 92%, 100% { transform: rotate(0); }
  94%, 98% { transform: rotate(-6deg); }
}
@keyframes ear-twitch-l {
  0%, 88%, 100% { transform: rotate(0); }
  90%, 96% { transform: rotate(4deg); }
}
@keyframes eye-blink {
  0%, 95%, 100% { transform: scaleY(1); }
  97%, 99% { transform: scaleY(0.1); }
}
.mascot-idle svg { animation: mascot-fade-in 220ms cubic-bezier(0.34,1.56,0.64,1) both, mascot-breathe 4.2s ease-in-out 220ms infinite; }
.mascot-idle .ear-r { transform-origin: 60px 24px; animation: ear-twitch-r 6s ease-in-out 1s infinite; }
.mascot-idle .ear-l { transform-origin: 22px 22px; animation: ear-twitch-l 7s ease-in-out 2s infinite; }
.mascot-idle .eye-l { transform-origin: 32px 44px; animation: eye-blink 5s ease-in-out 3s infinite; }

/* LISTEN: ears flick up + bounce body + sound waves pulse */
@keyframes mascot-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes ears-perk {
  from { transform: translateY(6px) scaleY(0.7); }
  to   { transform: translateY(0)   scaleY(1); }
}
@keyframes waves-pulse {
  0%, 100% { opacity: 0.25; transform: scale(0.92); }
  50% { opacity: 0.95; transform: scale(1.08); }
}
.mascot-listen svg { animation: mascot-fade-in 220ms cubic-bezier(0.34,1.56,0.64,1) both, mascot-bounce 600ms ease-in-out 220ms infinite; }
.mascot-listen .ears { transform-origin: 38px 30px; animation: ears-perk 260ms cubic-bezier(0.34,1.56,0.64,1) both; }
.mascot-listen .waves { transform-origin: 38px 44px; animation: waves-pulse 900ms ease-in-out infinite; }

/* THINK: gentle wobble + dots fade in sequentially */
@keyframes mascot-wobble {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-1.5deg); }
  75% { transform: rotate(1.5deg); }
}
@keyframes think-dot { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: scale(1); } }
.mascot-think svg { animation: mascot-fade-in 220ms cubic-bezier(0.34,1.56,0.64,1) both, mascot-wobble 2.4s ease-in-out 220ms infinite; }
.mascot-think .td { transform-origin: center; opacity: 0; animation: think-dot 400ms ease-out both; }
.mascot-think .td-1 { animation-delay: 200ms; }
.mascot-think .td-2 { animation-delay: 500ms; }
.mascot-think .td-3 { animation-delay: 800ms; }

/* SPEAK: mouth pulses open/close + tiny head bob */
@keyframes mouth-talk {
  0%, 100% { transform: scaleY(0.5); }
  25%       { transform: scaleY(1.4); }
  50%       { transform: scaleY(0.7); }
  75%       { transform: scaleY(1.2); }
}
@keyframes head-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1.5px); }
}
.mascot-speak svg { animation: mascot-fade-in 220ms cubic-bezier(0.34,1.56,0.64,1) both, head-bob 380ms ease-in-out 220ms infinite; }
.mascot-speak .speak-mouth { transform-origin: 40px 56px; animation: mouth-talk 320ms ease-in-out infinite; }

/* Respect reduced-motion: kill loops, keep crossfade */
@media (prefers-reduced-motion: reduce) {
  .mascot-idle svg, .mascot-listen svg, .mascot-think svg, .mascot-speak svg {
    animation: mascot-fade-in 150ms ease-out both !important;
  }
  .mascot-idle .ear-r, .mascot-idle .ear-l, .mascot-idle .eye-l,
  .mascot-listen .ears, .mascot-listen .waves,
  .mascot-think .td,
  .mascot-speak .speak-mouth { animation: none !important; }
}

@keyframes fade-in-stagger { from { opacity: 0; } to { opacity: var(--final-opacity, 1); } }

/* Battery indicator — larger to mimic the Rabbit R1 lock screen.
   NOTE: shell + fill MUST be inline-block / block so width/height apply
   (default <span> is `display: inline` which ignores both). */
.batt { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; }
.batt-pct { font-weight: 600; letter-spacing: 0.5px; }
.batt-shell {
  display: inline-block;
  width: 28px; height: 13px;
  border: 2px solid var(--fg);
  border-radius: 2px;
  position: relative;
  padding: 1.5px;
  box-sizing: border-box;
  vertical-align: middle;
  overflow: visible;
}
.batt-shell::after {
  content: '';
  position: absolute;
  right: -4px; top: 3px;
  width: 2px; height: 5px;
  background: var(--fg);
  border-radius: 0 1px 1px 0;
}
.batt-fill {
  display: block;
  height: 100%;
  background: var(--fg);
  border-radius: 1px;
  transition: width 400ms ease-out, background 300ms;
}
.batt-shell .batt-lightning {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
