/**
 * Android camera-overlay UI parity — chrome circles, voice orb, stop pill, nav panel, fullscreen menu.
 * Tokens align with CameraOverlayControls.kt + VoiceListenHud.kt + Material Purple40 default primary.
 */
:root {
  --rv-android-primary: var(--rv-accent, #6650a4);
  --rv-chrome-size: 48px;
  --rv-chrome-icon: 24px;
  --rv-orb-size: 88px;
  --rv-orb-read-size: 110px;
  --rv-stop-pill-height: 80px;
  --rv-panel-btn-height: 52px;
  --rv-listening-green: #34d399;
  --rv-menu-title: #2d3436;
  --rv-menu-close-bg: #e7e9f5;
}

/* ── Top chrome row (Info · Voice · Menu) ───────────────────────────── */
.rv-chrome-top-nav {
  justify-content: flex-end;
}

.rv-chrome-top-nav.top-nav--with-back {
  justify-content: space-between;
}

.rv-chrome-end {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.rv-chrome-btn {
  width: var(--rv-chrome-size);
  height: var(--rv-chrome-size);
  border-radius: 50%;
  border: none;
  padding: 0;
  margin: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #fff;
  font-size: var(--rv-chrome-icon);
  line-height: 1;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.38);
  transition: transform 0.14s ease, opacity 0.14s ease;
}

.rv-chrome-btn:active {
  transform: scale(0.96);
}

.rv-chrome-primary {
  background: color-mix(in srgb, var(--rv-android-primary) 90%, transparent);
}

.rv-chrome-exit {
  background: rgba(0, 0, 0, 0.72);
}

.rv-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--rv-chrome-icon, 24px);
  height: var(--rv-chrome-icon, 24px);
  line-height: 0;
  flex-shrink: 0;
}

.rv-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
  display: block;
}

.menu-btn .rv-icon,
.rv-chrome-btn .rv-icon {
  pointer-events: none;
}

.rv-fs-menu-close .rv-icon {
  width: 22px;
  height: 22px;
}

body.rv-camera-screen .menu-btn {
  width: var(--rv-chrome-size);
  height: var(--rv-chrome-size);
  border-radius: 50%;
  border: none !important;
  background: color-mix(in srgb, var(--rv-android-primary) 90%, transparent) !important;
  color: #fff !important;
  font-size: 20px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.38);
}

body.rv-camera-screen .back-btn {
  border-radius: 50%;
  border: none !important;
  background: rgba(0, 0, 0, 0.72) !important;
  color: #fff !important;
}

.rv-chrome-primary {
  background: color-mix(in srgb, var(--rv-android-primary) 90%, transparent) !important;
  color: #fff !important;
}

/* ── Online / local status chip (nav) ───────────────────────────────── */
.rv-online-chip {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 28;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
}

.rv-online-chip__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.rv-online-chip--online .rv-online-chip__dot {
  background: #ef4444;
}

.rv-online-chip--local .rv-online-chip__dot {
  background: #22c55e;
}

body.rv-nav-screen .rv-online-chip {
  top: calc(max(12px, env(safe-area-inset-top)) + var(--revision-install-banner-offset, 0px));
  right: calc(max(12px, env(safe-area-inset-right)) + var(--rv-chrome-size) * 3 + 24px);
}

/* ── Voice HUD + capture orb ────────────────────────────────────────── */
.rv-voice-hud {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(36px + env(safe-area-inset-bottom));
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.rv-voice-hud > * {
  pointer-events: auto;
}

.rv-voice-hud--nav {
  bottom: calc(52px + env(safe-area-inset-bottom));
}

.rv-voice-hud--indoor {
  bottom: calc(200px + env(safe-area-inset-bottom));
}

body.rv-indoor-walking .rv-voice-hud--indoor {
  bottom: calc(52px + env(safe-area-inset-bottom));
}

.rv-voice-hud--read {
  bottom: calc(110px + env(safe-area-inset-bottom));
}

.rv-voice-hud__caption {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
  text-align: center;
  max-width: 280px;
}

.rv-capture-orb {
  position: relative;
  width: var(--rv-orb-size);
  height: var(--rv-orb-size);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.22);
  padding: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.42);
  transition: transform 0.12s ease, box-shadow 0.16s ease;
}

.rv-capture-orb::before {
  content: "";
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--rv-android-primary) 55%, transparent);
  border-radius: 50%;
}

.rv-capture-orb img,
.rv-capture-orb__logo {
  position: relative;
  z-index: 1;
  /* Wide logo.svg — fit inside the circle (not 1.32× overflow like square launcher art). */
  width: calc(var(--rv-orb-size) * 0.72);
  height: calc(var(--rv-orb-size) * 0.72);
  max-width: calc(var(--rv-orb-size) * 0.72);
  max-height: calc(var(--rv-orb-size) * 0.72);
  object-fit: contain;
  object-position: center;
  display: block;
  pointer-events: none;
}

.rv-capture-orb--read {
  width: var(--rv-orb-read-size);
  height: var(--rv-orb-read-size);
}

.rv-capture-orb--read img,
.rv-capture-orb--read .rv-capture-orb__logo {
  width: calc(var(--rv-orb-read-size) * 0.72);
  height: calc(var(--rv-orb-read-size) * 0.72);
  max-width: calc(var(--rv-orb-read-size) * 0.72);
  max-height: calc(var(--rv-orb-read-size) * 0.72);
}

.rv-capture-orb:active {
  transform: scale(0.97);
}

.rv-capture-orb.conversing {
  border-color: rgba(231, 76, 60, 0.9);
  box-shadow:
    0 0 0 2px rgba(231, 76, 60, 0.4),
    0 10px 36px rgba(0, 0, 0, 0.42);
}

.rv-capture-orb.holding-press {
  border-color: color-mix(in srgb, var(--rv-android-primary) 95%, white);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--rv-android-primary) 45%, transparent),
    0 10px 36px rgba(0, 0, 0, 0.42);
}

.rv-capture-orb.listening {
  border-color: var(--rv-listening-green);
  box-shadow:
    0 0 0 3px rgba(52, 211, 153, 0.35),
    0 10px 36px rgba(0, 0, 0, 0.42);
}

.rv-follow-chip {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(12, 18, 24, 0.66);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 18px;
  cursor: pointer;
  touch-action: manipulation;
}

.rv-voice-hud__transcript {
  max-width: min(92vw, 360px);
  padding: 12px 16px;
  border-radius: 24px;
  background: rgba(12, 18, 24, 0.6);
  border: 1px solid rgba(232, 241, 245, 0.25);
  color: #f4f7fa;
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

/* ── Stop pill (CameraStopPill) ─────────────────────────────────────── */
.rv-stop-pill,
.stop-btn.rv-stop-pill {
  position: fixed;
  left: 20%;
  right: 20%;
  bottom: calc(36px + env(safe-area-inset-bottom));
  z-index: 30;
  width: 60%;
  max-width: 420px;
  margin: 0 auto;
  height: var(--rv-stop-pill-height);
  border: none;
  border-radius: 999px;
  background: #b3261e;
  color: #fff;
  font-size: 24px;
  font-weight: 800;
  cursor: pointer;
  display: none;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  touch-action: manipulation;
}

/* ── Nav panel buttons + status strip ───────────────────────────────── */
.rv-status-strip {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 68px + var(--revision-install-banner-offset, 0px));
  left: 12px;
  right: 12px;
  z-index: 26;
  max-width: 640px;
  margin: 0 auto;
  padding: 11px 13px;
  border-radius: 14px;
  background: rgba(8, 16, 28, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.rv-nav-controls {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  bottom: calc(52px + env(safe-area-inset-bottom) + var(--rv-orb-size) + 28px);
  z-index: 26;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 220px;
}

.rv-panel-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--rv-panel-btn-height);
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  color: #fff;
}

.rv-panel-btn--primary {
  background: color-mix(in srgb, var(--rv-android-primary) 88%, black);
  border-color: color-mix(in srgb, var(--rv-android-primary) 60%, white);
}

.rv-panel-btn--secondary {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.rv-panel-btn--danger {
  background: rgba(170, 36, 36, 0.9);
  border-color: rgba(255, 140, 140, 0.6);
}

.rv-panel-btn:disabled {
  opacity: 0.55;
}

.rv-nav-ask-orb {
  /* nav ask wired to hidden button; orb in voice hud */
}

/* ── Read mode dock ─────────────────────────────────────────────────── */
.rv-read-dock {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 5;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.rv-read-dock .rv-panel-btn {
  flex: 1;
  max-width: 160px;
  min-height: 52px;
  font-size: 16px;
}

/* ── Fullscreen white menu (camera screens) ─────────────────────────── */
body.rv-camera-screen .menu-panel.rv-fs-menu-panel {
  border-radius: 0;
}

body.rv-camera-screen .menu-panel.is-open {
  position: fixed;
  inset: 0;
  top: 0;
  right: 0;
  width: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-content: start;
  background: #fff;
  border: none;
  box-shadow: none;
  z-index: 100;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.rv-camera-screen .menu-panel.is-open .rv-fs-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  flex-shrink: 0;
}

body.rv-camera-screen .menu-panel.is-open .rv-fs-menu-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--rv-menu-title);
}

body.rv-camera-screen .menu-panel.is-open .rv-fs-menu-close {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--rv-menu-close-bg);
  color: var(--rv-android-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

body.rv-camera-screen .menu-panel.is-open .menu-card {
  background: #fff;
  border: none;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  color: #2d3436;
  font-weight: 700;
  min-height: 56px;
  justify-content: flex-start;
  text-align: left;
  padding: 0 14px;
  gap: 12px;
}

body.rv-camera-screen .menu-panel.is-open .menu-card.active {
  background: color-mix(in srgb, var(--rv-android-primary) 8%, white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  color: var(--rv-android-primary);
}

body.rv-camera-screen .menu-panel.is-open .menu-card--current {
  opacity: 0.45;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

body.rv-camera-screen .menu-panel.is-open .menu-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #f4f6fa;
}

body.rv-camera-screen .menu-panel.is-open .menu-card__icon--read { color: var(--rv-android-primary); }
body.rv-camera-screen .menu-panel.is-open .menu-card__icon--nav { color: #16a085; }
body.rv-camera-screen .menu-panel.is-open .menu-card__icon--indoor { color: #6c5ce7; }
body.rv-camera-screen .menu-panel.is-open .menu-card__icon--pdf { color: #9b59b6; }
body.rv-camera-screen .menu-panel.is-open .menu-card__icon--settings { color: var(--rv-android-primary); }
body.rv-camera-screen .menu-panel.is-open .menu-card__icon--profile { color: #0984e3; }
body.rv-camera-screen .menu-panel.is-open .menu-card__icon--history { color: #2d9cdb; }
body.rv-camera-screen .menu-panel.is-open .menu-card__icon--manual { color: #00b894; }
body.rv-camera-screen .menu-panel.is-open .menu-card__icon--announcements { color: var(--rv-android-primary); }
body.rv-camera-screen .menu-panel.is-open .menu-card__icon--help { color: #e17055; }

body.rv-camera-screen .menu-panel.is-open .menu-card__svg {
  width: 22px;
  height: 22px;
}

body.rv-camera-screen .menu-panel.is-open .menu-card__svg svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

body.rv-camera-screen .menu-panel.is-open .menu-section-label {
  color: #636e72;
}

body.rv-camera-screen .menu-panel.is-open .menu-close-btn {
  margin-top: 8px;
  flex-shrink: 0;
}

/* legacy tile hook — unused on Android menu */
body.rv-camera-screen .menu-panel.is-open .menu-tile {
  background: #f4f6fa;
  border: 1px solid #e2e8f0;
  color: #2d3436;
  font-weight: 700;
}

body.rv-camera-screen .menu-panel.is-open .menu-tile.active {
  background: color-mix(in srgb, var(--rv-android-primary) 12%, white);
  border-color: color-mix(in srgb, var(--rv-android-primary) 35%, white);
  color: var(--rv-android-primary);
}

body.rv-camera-screen .menu-panel.is-open .menu-panel-divider {
  grid-column: 1 / -1;
  border-color: #e2e8f0;
}

body.rv-camera-screen .menu-panel.is-open::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: -1;
}

/* PDF reader dark surface */
body.rv-pdf-screen {
  background: #1e1e1e !important;
}

/* ── Startup permission gate ─────────────────────────────────────────── */
.revision-permissions-gate {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.revision-permissions-gate--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.revision-permissions-card {
  width: 100%;
  max-width: 360px;
  padding: 24px 20px;
  border-radius: 20px;
  background: rgba(28, 36, 48, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  text-align: center;
  color: #fff;
}

.revision-permissions-logo {
  display: block;
  margin: 0 auto 12px;
}

.revision-permissions-title {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 800;
}

.revision-permissions-sub {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.86);
}

.revision-permissions-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.72);
}

.revision-permissions-list li {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.revision-permissions-status {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.78);
  min-height: 1.35em;
}

.revision-permissions-btn {
  width: 100%;
  padding: 16px 18px;
  border: none;
  border-radius: 14px;
  background: color-mix(in srgb, var(--rv-accent, #6650a4) 88%, black);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.revision-permissions-btn:disabled {
  opacity: 0.65;
}

html.revision-permissions-active .revision-route-frame,
html.revision-permissions-active .top-nav,
html.revision-offline-models-active .revision-route-frame,
html.revision-offline-models-active .top-nav {
  pointer-events: none !important;
}

html.revision-permissions-active .revision-permissions-gate,
html.revision-offline-models-active .revision-offline-models-gate {
  pointer-events: auto !important;
}

.revision-permissions-btn:active:not(:disabled) {
  transform: scale(0.98);
  opacity: 0.9;
}

/* Offline models gate (after permissions) */
.revision-offline-models-gate {
  position: fixed;
  inset: 0;
  z-index: 255;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.revision-offline-models-gate--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.revision-offline-models-skip {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.revision-offline-models-skip:disabled {
  opacity: 0.55;
}

.revision-offline-models-progress {
  margin: 0 0 12px;
}

.revision-offline-models-progress__track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.revision-offline-models-progress__bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2a8fd4, #6650a4);
  transition: width 0.25s ease;
}

/* Permissions gate (z-index 250) already covers the iframe; do not block iframe pointer events globally. */
