/* =========================================================================
   deck-control.css — companion chrome for any <deck-stage> deck:
   floating toolbar, edit-mode affordances, drawing overlay, notes peek.
   Brand: Adrian Goldner design tokens (ink pills, gold accent, mono labels).
   These tokens come from assets/colors_and_type.css; fallbacks keep the
   chrome usable on decks that don't load that sheet.
   ========================================================================= */

:root {
  --dc-ink: var(--dark-25, #141210);
  --dc-paper: var(--surface-0, #fff);
  --dc-gold: var(--accent, #E8B931);
  --dc-mono: var(--font-mono, ui-monospace, "SF Mono", Menlo, monospace);
}

/* ---------- floating toolbar ------------------------------------------- */
.dc-toolbar {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 2147483100;          /* above the notes peek so the button stays clickable */
  display: flex;
  gap: 6px;
  padding: 6px;
  background: rgba(20, 18, 16, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  box-shadow: 0 8px 28px rgba(20, 18, 16, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0.35;
  transition: opacity 180ms ease, transform 180ms ease;
  font-family: var(--dc-mono);
}
.dc-toolbar:hover { opacity: 1; }
.dc-toolbar[data-active] { opacity: 1; }
/* hidden entirely on the clean audience/stage view + during print */
body[data-dc-role="stage"] .dc-toolbar,
.dc-toolbar[hidden] { display: none; }
/* in edit mode the top-center edit bar carries the actions — hide the floating toolbar */
body.dc-editing .dc-toolbar { display: none; }
@media print { .dc-toolbar, .dc-draw, .dc-notespeek, .dc-editbar, .dc-abc-pop { display: none !important; } }

.dc-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  height: 38px;
  min-width: 38px;
  padding: 0 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-family: var(--dc-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: background 140ms ease, color 140ms ease;
}
.dc-btn:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.dc-btn[data-on] { background: var(--dc-gold); color: var(--dc-ink); }
.dc-btn svg { width: 16px; height: 16px; display: block; flex: none; }
.dc-btn .dc-lbl { white-space: nowrap; }
@media (max-width: 720px) { .dc-btn .dc-lbl { display: none; } }

/* pen colour swatches — shown only while pen is active */
.dc-swatches {
  display: none;
  align-items: center;
  gap: 5px;
  padding: 0 4px 0 8px;
  margin-left: 2px;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
}
.dc-swatches[data-on] { display: inline-flex; }
.dc-swatch {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  cursor: pointer; padding: 0; appearance: none;
  transition: transform 120ms ease, border-color 120ms ease;
}
.dc-swatch:hover { transform: scale(1.12); }
.dc-swatch[data-sel] { border-color: #fff; box-shadow: 0 0 0 2px rgba(20,18,16,0.6); }

/* ---------- edit mode -------------------------------------------------- */
body.dc-editing [data-dc-text] {
  outline: 1px dashed rgba(232, 185, 49, 0.55);
  outline-offset: 3px;
  border-radius: 2px;
  transition: outline-color 120ms ease, background 120ms ease;
  cursor: text;
}
body.dc-editing [data-dc-text]:hover { outline-color: var(--dc-gold); background: rgba(232, 185, 49, 0.08); }
body.dc-editing [data-dc-text]:focus {
  outline: 2px solid var(--dc-gold);
  background: rgba(232, 185, 49, 0.1);
}
/* notation blocks get a pencil affordance instead of contenteditable */
body.dc-editing .notation[data-abc-render] {
  outline: 1px dashed rgba(232, 185, 49, 0.55);
  outline-offset: 6px;
  cursor: pointer;
  position: relative;
}
body.dc-editing .notation[data-abc-render]:hover { outline-color: var(--dc-gold); }
body.dc-editing .notation[data-abc-render]::after {
  content: "ABC \270E";
  position: absolute;
  top: -10px; right: -6px;
  font-family: var(--dc-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  background: var(--dc-gold); color: var(--dc-ink);
  padding: 2px 7px; border-radius: 999px;
  pointer-events: none;
}

/* edit-mode status bar (top center) */
.dc-editbar {
  position: fixed;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  z-index: 2147482001;
  display: none;
  align-items: center;
  flex-wrap: nowrap;
  max-width: calc(100vw - 32px);
  gap: 14px;
  padding: 8px 8px 8px 16px;
  background: rgba(20, 18, 16, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  box-shadow: 0 8px 28px rgba(20, 18, 16, 0.35);
  font-family: var(--dc-mono);
  color: rgba(255, 255, 255, 0.82);
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
}
body.dc-editing .dc-editbar { display: flex; }
.dc-editbar > span:first-child { flex: none; white-space: nowrap; }
.dc-editbar .dc-editbar-hint { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; opacity: 0.6; text-transform: none; letter-spacing: 0.02em; font-weight: 500; }
.dc-editbar .dc-btn { flex: none; height: 30px; white-space: nowrap; background: rgba(255,255,255,0.08); }
.dc-editbar .dc-btn:hover { background: rgba(255,255,255,0.16); }
.dc-editbar .dc-btn.dc-primary { background: var(--dc-gold); color: var(--dc-ink); }
@media (max-width: 680px) { .dc-editbar .dc-editbar-hint { display: none; } }

/* ---------- ABC editor popover ----------------------------------------- */
.dc-abc-pop {
  position: fixed;
  z-index: 2147483000;
  width: 380px; max-width: calc(100vw - 32px);
  background: var(--dc-paper);
  border: 1px solid rgba(20, 18, 16, 0.16);
  border-radius: 10px;
  box-shadow: 0 18px 48px rgba(20, 18, 16, 0.4);
  overflow: hidden;
  display: none;
}
.dc-abc-pop[data-open] { display: block; }
.dc-abc-pop header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid rgba(20,18,16,0.1);
  font-family: var(--dc-mono); font-size: 11px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--dc-ink);
}
.dc-abc-pop header button { appearance: none; border: 0; background: transparent; cursor: pointer; font-size: 16px; color: rgba(20,18,16,0.5); }
.dc-abc-pop textarea {
  width: 100%; min-height: 150px; resize: vertical; border: 0; outline: none;
  padding: 12px 14px; box-sizing: border-box;
  font-family: var(--dc-mono); font-size: 12.5px; line-height: 1.6; color: var(--dc-ink);
  background: var(--dc-paper);
}
.dc-abc-pop footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 10px 14px; border-top: 1px solid rgba(20,18,16,0.1); background: var(--surface-50, #faf8f4);
}
.dc-abc-pop footer button {
  font-family: var(--dc-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 7px 14px; border-radius: 999px; cursor: pointer; border: 1px solid rgba(20,18,16,0.18); background: var(--dc-paper); color: var(--dc-ink);
}
.dc-abc-pop footer button.dc-primary { background: var(--dc-ink); color: var(--dc-paper); border-color: var(--dc-ink); }

/* ---------- drawing overlay -------------------------------------------- */
.dc-draw {
  position: fixed;
  z-index: 2147481500;          /* above slides, below toolbar/editbar */
  pointer-events: none;          /* only captures when pen is on */
  touch-action: none;
}
.dc-draw[data-pen] { pointer-events: auto; cursor: crosshair; }

/* ---------- notes peek (single-screen glance) -------------------------- */
.dc-notespeek {
  position: fixed;
  left: 24px; bottom: 22px;
  transform: translateY(8px);
  z-index: 2147482002;
  width: min(720px, calc(100vw - 320px));   /* leave the bottom-right toolbar clear */
  max-height: 32vh; overflow-y: auto;
  background: rgba(20, 18, 16, 0.96);
  color: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(20, 18, 16, 0.5);
  padding: 16px 20px 18px;
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: 16px; line-height: 1.55;
  opacity: 0; pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}
.dc-notespeek[data-open] { opacity: 1; pointer-events: auto; transform: translateY(0); }
.dc-notespeek .dc-np-label {
  font-family: var(--dc-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--dc-gold);
  margin-bottom: 8px; padding-right: 28px;
}
.dc-notespeek .dc-np-empty { opacity: 0.5; font-style: italic; }
.dc-notespeek .dc-np-close {
  position: absolute; top: 10px; right: 12px;
  appearance: none; border: 0; background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7); width: 26px; height: 26px; border-radius: 50%;
  font-size: 18px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 140ms ease, color 140ms ease;
}
.dc-notespeek .dc-np-close:hover { background: var(--dc-gold); color: var(--dc-ink); }

/* ---------- presenter popup-blocked fallback toast --------------------- */
.dc-presenter-toast {
  position: fixed; left: 50%; top: 18px; transform: translateX(-50%);
  z-index: 2147483200;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 16px;
  background: rgba(20, 18, 16, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  box-shadow: 0 10px 32px rgba(20, 18, 16, 0.45);
  font-family: var(--dc-mono); font-size: 12px; color: rgba(255, 255, 255, 0.82);
}
.dc-presenter-toast a {
  font-weight: 700; letter-spacing: 0.04em; color: var(--dc-ink);
  background: var(--dc-gold); text-decoration: none;
  padding: 7px 14px; border-radius: 999px; white-space: nowrap;
}
.dc-presenter-toast .dc-pt-x {
  appearance: none; border: 0; background: transparent; color: rgba(255, 255, 255, 0.55);
  font-size: 18px; cursor: pointer; padding: 0 4px;
}

/* ---------- PROBE MODE — single-window rehearsal ----------------------- */
/* page goes black so the transformed deck's letterbox is seamless; the
   floating toolbar + native deck-stage bottom nav are hidden (the panel
   drives navigation), leaving a clean rehearsal layout. */
body.dc-probe { background: #000 !important; }
body.dc-probe .dc-toolbar { display: none; }

.dc-probe-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 380px;
  z-index: 2147482500;
  display: none; flex-direction: column;
  background: #141210;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.4);
  color: #f3f0ea;
  font-family: var(--font-body, system-ui, sans-serif);
  padding: 18px 20px 16px;
  box-sizing: border-box;
  gap: 14px;
}
body.dc-probe .dc-probe-panel { display: flex; }

.dc-pp-top { display: flex; align-items: center; gap: 14px; }
.dc-pp-timer {
  font-family: var(--dc-mono); font-size: 30px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums; cursor: pointer; color: #fff;
}
.dc-pp-timer small {
  display: block; font-size: 9px; font-weight: 600; letter-spacing: 0.16em;
  text-transform: uppercase; color: rgba(255, 255, 255, 0.4); margin-top: 4px;
}
.dc-pp-clock {
  font-family: var(--dc-mono); font-size: 15px; color: rgba(255, 255, 255, 0.55);
  font-variant-numeric: tabular-nums;
}
.dc-pp-exit {
  margin-left: auto; appearance: none; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.06);
  color: #fff; font-family: var(--dc-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; padding: 8px 12px; border-radius: 999px;
}
.dc-pp-exit:hover { background: var(--dc-gold); color: var(--dc-ink); border-color: var(--dc-gold); }

.dc-pp-notehead { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-top: 4px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.dc-pp-label {
  font-family: var(--dc-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--dc-gold);
}
.dc-pp-nbtns { display: flex; gap: 5px; }
.dc-pp-nbtns button {
  appearance: none; cursor: pointer; border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06); color: #fff;
  font-family: var(--dc-mono); font-size: 11px; font-weight: 600;
  padding: 4px 9px; border-radius: 999px;
}
.dc-pp-nbtns button:hover { background: rgba(255, 255, 255, 0.14); }
.dc-pp-nbtns button[data-on] { background: var(--dc-gold); color: var(--dc-ink); border-color: var(--dc-gold); }

.dc-pp-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.dc-pp-scroll::-webkit-scrollbar { width: 8px; }
.dc-pp-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 4px; }
.dc-pp-note { font-size: 18px; line-height: 1.62; color: rgba(255, 255, 255, 0.94);
  white-space: pre-wrap; text-wrap: pretty; }
.dc-pp-note.dc-pp-empty { color: rgba(255, 255, 255, 0.34); font-style: italic; }

.dc-pp-next { padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 14px; line-height: 1.5; color: rgba(255, 255, 255, 0.5); white-space: pre-wrap; }
.dc-pp-next.dc-pp-empty { display: none; }
.dc-pp-next .dc-pp-nl { display: block; font-family: var(--dc-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255, 255, 255, 0.4); margin-bottom: 5px; }

.dc-pp-nav { display: flex; align-items: center; justify-content: center; gap: 16px;
  padding-top: 6px; }
.dc-pp-navbtn {
  appearance: none; cursor: pointer; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.06);
  color: #fff; font-size: 22px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.dc-pp-navbtn:hover { background: var(--dc-gold); color: var(--dc-ink); border-color: var(--dc-gold); }
.dc-pp-count { font-family: var(--dc-mono); font-size: 14px; font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.8); min-width: 70px; text-align: center; }
