/* ========== ANIMATE PANEL ========== */
.animate-panel {
  position: absolute; bottom: 70px; left: 50%;
  transform: translateX(-50%); z-index: var(--z-editor);
  background: var(--panel); border: 1px solid var(--accent);
  border-radius: 14px; padding: 16px 20px;
  width: min(680px, 92vw);
  box-shadow: 0 20px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(0,184,212,0.2);
  display: none;
}
.animate-panel.show { display: block; animation: slideUp 0.25s ease-out; }
@keyframes slideUp {
  from { transform: translate(-50%,30px); opacity: 0; }
  to { transform: translate(-50%,0); opacity: 1; }
}
.anim-progress { display: flex; gap: 6px; margin-bottom: 12px; }
.anim-step {
  flex: 1; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.1); transition: background 0.3s;
}
.anim-step.active { background: var(--accent); }
.anim-step.done { background: var(--green); }
.anim-msg {
  font-size: 13.5px; font-weight: 600;
  margin-bottom: 14px; min-height: 20px;
}
.anim-msg .step-num {
  display: inline-block; background: var(--accent);
  color: white; width: 20px; height: 20px;
  border-radius: 50%; text-align: center;
  font-size: 11px; line-height: 20px;
  margin-right: 8px; font-weight: 700; vertical-align: middle;
}
.anim-msg .done-num { background: var(--green); }
.anim-controls {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.anim-control {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-dim);
  font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px;
}
.anim-speed {
  display: flex; gap: 0; background: var(--panel-2);
  border-radius: 6px; padding: 2px;
  border: 1px solid var(--border);
}
.anim-speed button {
  background: transparent; border: none;
  color: var(--text-dim); cursor: pointer;
  padding: 5px 11px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
  transition: all 0.12s; font-family: inherit;
}
.anim-speed button.active { background: var(--accent); color: white; }
.anim-toggle {
  display: flex; align-items: center; gap: 6px;
  background: var(--panel-2); border: 1px solid var(--border);
  padding: 5px 11px; border-radius: 6px;
  cursor: pointer; transition: all 0.12s;
  font-size: 11px; font-weight: 600;
}
.anim-toggle input { display: none; }
.anim-toggle.checked { background: var(--accent); color: white; border-color: var(--accent); }
.anim-toggle:hover { border-color: var(--accent); }
.anim-spacer { flex: 1; }

/* ========== EDIT PANEL ========== */
.edit-panel {
  position: absolute; bottom: 24px; left: 50%;
  transform: translateX(-50%); z-index: var(--z-editor);
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px;
  width: min(640px, 92vw);
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  display: none;
}
.edit-panel.show { display: block; animation: slideUp 0.25s ease-out; }
.edit-row {
  display: flex; gap: 10px; align-items: center; margin-bottom: 12px;
}
.edit-row:last-child { margin-bottom: 0; }
.edit-label {
  font-size: 11px; color: var(--text-dim);
  min-width: 56px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.edit-input {
  flex: 1; padding: 10px 14px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 7px; color: var(--text);
  font-family: inherit; font-size: 13px; outline: none;
  transition: border-color 0.15s;
}
.edit-input:focus { border-color: var(--accent); }
.icon-picker { display: flex; gap: 5px; flex-wrap: wrap; }
.icon-pick {
  width: 38px; height: 38px; border-radius: 7px;
  background: var(--panel-2); border: 2px solid transparent;
  cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  font-size: 18px; transition: all 0.15s;
}
.icon-pick:hover { background: var(--border); }
.icon-pick.selected { border-color: var(--accent); background: rgba(0,184,212,0.18); }
.btn-primary,.btn-secondary,.btn-danger {
  padding: 9px 18px; border-radius: 7px;
  cursor: pointer; font-family: inherit;
  font-weight: 600; font-size: 13px;
  border: 1px solid transparent; transition: all 0.15s;
}
.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--panel-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: rgba(255,59,48,0.12); color: #ff6b60; border-color: rgba(255,59,48,0.35); }
.btn-danger:hover { background: rgba(255,59,48,0.2); }
.btn-stop { background: #4a4a4a; color: white; border-color: #5a5a5a; }
.btn-stop:hover { background: #5a5a5a; }

/* =====================================================================
   MODE VISIBILITY CONTRACT — single source of truth (body[data-mode])
   build     → logo in top-bar; ALL build chrome + presenter-bar. Watermark hidden.
   presenter → map + presenter-bar + brand watermark + exit button. Build chrome hidden.
   clean     → map + presenter-bar + brand watermark. Build chrome hidden. No exit button.
   The presenter-bar (--z-presenter) and transient toast stay visible in every mode.
   ===================================================================== */
body[data-mode="presenter"] .top-bar,
body[data-mode="presenter"] .asset-palette,
body[data-mode="presenter"] .right-rail,
body[data-mode="presenter"] .rail-flyout,
body[data-mode="presenter"] .storyboard-panel,
body[data-mode="presenter"] .status-bar,
body[data-mode="presenter"] .instructions,
body[data-mode="presenter"] .edit-panel,
body[data-mode="presenter"] .asset-edit-panel,
body[data-mode="presenter"] .animate-panel,
body[data-mode="clean"] .top-bar,
body[data-mode="clean"] .toolbar,
body[data-mode="clean"] .asset-palette,
body[data-mode="clean"] .right-rail,
body[data-mode="clean"] .rail-flyout,
body[data-mode="clean"] .storyboard-panel,
body[data-mode="clean"] .status-bar,
body[data-mode="clean"] .instructions,
body[data-mode="clean"] .edit-panel,
body[data-mode="clean"] .asset-edit-panel,
body[data-mode="clean"] .animate-panel { display: none !important; }

/* Brand watermark: floating logo hidden in build (logo is in the top-bar there),
   revealed only in presenter/clean. */
.brand-header { display: none; }
body[data-mode="presenter"] .brand-header,
body[data-mode="clean"] .brand-header { display: flex; }

body[data-mode="presenter"] .exit-presenter { display: flex !important; }

.exit-presenter {
  display: none; position: absolute;
  top: 14px; right: 14px; z-index: var(--z-presenter);
  background: rgba(255,59,48,0.92); color: white;
  padding: 8px 14px; border: none; border-radius: 7px;
  cursor: pointer; font-family: inherit;
  font-size: 12px; font-weight: 600;
  align-items: center; gap: 5px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}
.exit-presenter:hover { background: #e63329; }

/* ===== ASSET ROTATION PANEL ===== */
.asset-edit-panel {
  position: absolute; bottom: 16px; left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  display: none; z-index: var(--z-editor); min-width: 360px;
  font-family: 'Inter', sans-serif;
}
.asset-edit-panel.show {
  display: block;
  animation: assetSlideUp 0.22s ease-out forwards;
}
@keyframes assetSlideUp {
  from { transform: translateX(-50%) translateY(120%); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}
.asset-edit-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.asset-edit-row:last-child { margin-bottom: 0; }
.asset-edit-row .asset-label-text {
  font-size: 11px; color: var(--text-dim); width: 60px;
  text-transform: uppercase; letter-spacing: 1px; font-weight: 700;
}
.asset-edit-input {
  flex: 1; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; color: var(--text);
  font-family: inherit; font-size: 13px;
}
.asset-edit-input:focus { outline: none; border-color: var(--accent); }
.rot-slider-wrap { flex: 1; display: flex; align-items: center; gap: 8px; }
.rot-slider {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 4px; background: var(--panel-2); border-radius: 2px; outline: none;
}
.rot-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; background: var(--accent);
  border-radius: 50%; cursor: pointer; border: 2px solid #fff;
}
.rot-slider::-moz-range-thumb {
  width: 18px; height: 18px; background: var(--accent);
  border-radius: 50%; cursor: pointer; border: 2px solid #fff;
}
.rot-value {
  background: var(--panel-2); padding: 4px 10px; border-radius: 6px;
  font-size: 12px; font-weight: 700; min-width: 48px; text-align: center;
  color: var(--accent); font-variant-numeric: tabular-nums;
}
.rot-quick-btns { display: flex; gap: 4px; }
.rot-btn {
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 7px; padding: 6px 10px;
  cursor: pointer; font-size: 12px; font-family: inherit;
  transition: all 0.15s; font-weight: 600;
}
.rot-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }
.asset-edit-row .btn-danger,
.asset-edit-row .btn-secondary,
.asset-edit-row .btn-primary {
  font-family: inherit; font-size: 12px; font-weight: 600;
  padding: 8px 14px; border-radius: 8px; cursor: pointer; border: none;
  transition: all 0.15s;
}
.asset-edit-row .btn-danger { background: #cc2244; color: white; }
.asset-edit-row .btn-danger:hover { background: #ee3355; }
.asset-edit-row .btn-secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
.asset-edit-row .btn-primary { background: var(--accent); color: white; }


/* ===== STORYBOARD PANEL (multi-step scenarios) ===== */
.storyboard-panel {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-storyboard);
  background: rgba(15,18,30,0.6);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 7px;
  padding: 3px 5px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 420px;
  font-size: 10px;
  user-select: none;
}
.storyboard-panel .storyboard-header {
  gap: 4px !important;
}
.storyboard-panel .storyboard-title {
  font-size: 9px !important;
  letter-spacing: 1px !important;
  padding-right: 4px;
}
.storyboard-panel .storyboard-btn {
  padding: 2px 6px !important;
  font-size: 9.5px !important;
  border-radius: 4px !important;
  min-height: 18px !important;
  font-weight: 600;
}
.storyboard-header {
  display: flex; align-items: center; gap: 8px;
}
.storyboard-title {
  font-size: 10px; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: 1.2px; font-weight: 700; padding-right: 6px;
}
.storyboard-btn {
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 7px; padding: 5px 9px;
  cursor: pointer; font-size: 11px; font-family: inherit; font-weight: 600;
  transition: all 0.15s;
}
.storyboard-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }
.storyboard-btn.primary { background: var(--accent); color: white; border-color: var(--accent); }
.storyboard-btn.primary:hover { filter: brightness(1.15); }
.storyboard-btn.danger:hover { background: #cc2244; border-color: #cc2244; }
.storyboard-list {
  display: flex; gap: 6px; max-width: 100%; overflow-x: auto;
  padding: 2px; min-height: 38px;
}
.storyboard-list:empty::before {
  content: "No steps yet — click + Capture step to start";
  color: var(--text-dim); font-size: 11px; padding: 10px 4px;
  font-style: italic;
}
.sb-step {
  display: flex; align-items: center; gap: 6px;
  background: var(--panel-2); border: 1.5px solid var(--border);
  border-radius: 8px; padding: 6px 10px; cursor: pointer;
  font-size: 12px; min-width: 80px; max-width: 200px;
  transition: all 0.15s;
  position: relative; flex-shrink: 0;
}
.sb-step:hover { border-color: var(--accent); }
.sb-step.active {
  background: rgba(0,184,212,0.15); border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0,184,212,0.3);
}
.sb-step-num {
  background: var(--accent); color: white;
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; flex-shrink: 0;
}
.sb-step-name {
  flex: 1; outline: none; min-width: 60px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-step-name[contenteditable="true"]:focus {
  background: var(--bg); padding: 0 4px; border-radius: 4px;
  white-space: normal; overflow: visible; text-overflow: clip;
}
.sb-step-del {
  background: transparent; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 14px; padding: 0; width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; flex-shrink: 0;
}
.sb-step-del:hover { background: #cc2244; color: white; }


/* Storyboard collapses to a single 38px pill like every other panel (unified). */
.storyboard-panel.is-collapsed {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  padding: 0 !important;
  overflow: hidden !important;
  cursor: pointer !important;
  align-items: center !important;
  justify-content: center !important;
}
.storyboard-panel.is-collapsed > *:not(.storyboard-header),
.storyboard-panel.is-collapsed .storyboard-title,
.storyboard-panel.is-collapsed .storyboard-btn {
  display: none !important;
}
.storyboard-panel.is-collapsed .storyboard-header {
  width: 100%; height: 100%; padding: 0 !important; gap: 0 !important;
  align-items: center; justify-content: center;
}
.storyboard-panel.is-collapsed .panel-collapse-btn {
  position: absolute !important; inset: 0 !important;
  width: 100% !important; height: 100% !important;
  background: transparent !important; border: none !important;
  font-size: 0 !important;
  display: flex !important; align-items: center; justify-content: center;
}
.storyboard-panel.is-collapsed .panel-collapse-btn::before {
  content: "🎬"; font-size: 18px; line-height: 1;
}

/* While a transient editor is open, fade the storyboard out so its Save/Cancel
   row is never covered or click-blocked (belt-and-suspenders with the z-scale). */
body.editor-open .storyboard-panel {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.15s;
}


/* Brand watermark (floating) — shown only in presenter/clean via the mode contract */
.brand-header {
  position: absolute;
  top: 12px;
  left: 14px;
  z-index: var(--z-brand);
  display: flex;
  align-items: center;
  padding: 4px 8px;
  background: rgba(15,17,22,0.55);
  border: 1px solid rgba(255,145,0,0.10);
  border-radius: 6px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  user-select: none;
  height: 36px;
  box-sizing: border-box;
}
.brand-logo-img {
  height: 26px;
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}






body[data-mode="presenter"] .brand-header { opacity: 0.6; }

/* STORYBOARD — minimal pill bar */
.storyboard-panel {
  padding: 4px 6px !important;
  border-radius: var(--radius-md) !important;
  background: var(--panel-glass) !important;
  border: 1px solid var(--border) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-lg) !important;
  max-width: 480px !important;
}
.storyboard-panel .storyboard-title {
  font-size: 8.5px !important;
  letter-spacing: 1.5px !important;
  color: var(--text-dim) !important;
}
.storyboard-panel .storyboard-btn {
  padding: 2px 6px !important;
  font-size: 9.5px !important;
  border-radius: 4px !important;
  min-height: 18px !important;
  font-weight: 600;
}
.storyboard-panel .storyboard-btn.primary {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}
.storyboard-panel .storyboard-btn.primary:hover {
  background: var(--accent-hover) !important;
}
/* Brand header — match new theme */
.brand-header {
  background: var(--panel-glass) !important;
  border: 1px solid var(--border) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm) !important;
}


/* ===== PRESENTER BAR — broadcast control center ===== */
.presenter-bar {
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-presenter);
  display: flex !important;
  align-items: center;
  gap: 0;
  padding: 4px 6px;
  background: rgba(15, 18, 30, 0.85);
  border: 1px solid rgba(0, 184, 212, 0.2);
  border-radius: 10px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 184, 212, 0.1);
  user-select: none;
  font-size: 11px;
  height: 36px;
  box-sizing: border-box;
  opacity: 1;
  transition: opacity 0.2s, top 0.3s;
}
.presenter-bar:hover { opacity: 1; }
.pb-section {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 0 4px;
}
.pb-brand-section {
  padding-right: 8px;
  border-right: none;
}
.pb-handle {
  width: 12px;
  height: 24px;
  cursor: move;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 14px;
  letter-spacing: -1px;
  margin-right: 4px;
}
.pb-handle:hover { color: var(--accent); }
.pb-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
  animation: pbLivePulse 1.6s ease-in-out infinite;
}
@keyframes pbLivePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}
.pb-live-text {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--danger);
  margin-left: 6px;
  margin-right: 2px;
}
.pb-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 2px;
}
.pb-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.12s;
}
.pb-btn svg {
  width: 14px;
  height: 14px;
}
.pb-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}
.pb-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.pb-btn:active { transform: scale(0.92); }
.pb-btn.pb-capture {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}
.pb-btn.pb-capture:hover {
  background: var(--accent);
  color: #fff;
}
.pb-step-display {
  min-width: 32px;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  font-family: 'SF Mono', monospace;
  color: var(--text-dim);
  padding: 0 4px;
}
/* Next-step preview — dim hint so the anchor knows what's coming */
.pb-next {
  max-width: 110px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-dim);
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 2px;
}
.pb-next:empty { display: none; }
/* Auto-tour running state */
.pb-btn.touring {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  animation: pbTourPulse 1.4s ease-in-out infinite;
}
@keyframes pbTourPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,184,212,0.5); }
  50% { box-shadow: 0 0 0 5px rgba(0,184,212,0); }
}
/* PRESENTER-MODE HIT TARGETS — the anchor is under pressure (or on touch):
   every presenter-bar button grows to a ≥40px hit area. */
body[data-mode="presenter"] .pb-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;    /* flex items must never shrink below the hit target */
  min-height: 40px;
  flex: 0 0 auto;
  border-radius: 8px;
}
body[data-mode="presenter"] .pb-btn svg { width: 20px; height: 20px; }
body[data-mode="presenter"] .pb-step-display { font-size: 13px; min-width: 44px; }
body[data-mode="presenter"] .pb-next { max-width: 150px; font-size: 11px; }
.presenter-bar.is-dragging { opacity: 0.7; cursor: grabbing; }
