/* Clickpit — Minimalism theme
   Near-monochrome, spacious, precise, restrained. */

:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --bg-elevated: #ffffff;
  --fg: #17181a;
  --fg-2: #8a8d92;
  --fg-3: #b9bcc0;
  --line: #e6e6e3;
  --line-2: #d6d6d2;
  --line-strong: #c8cbc9;
  --surface-soft: #f0f1ef;
  --danger: #b3261e;
  /* Contextual fills & effects (dark values in the block below) */
  --overlay-glow: #ffffff;          /* radial glow behind the startup card */
  --glass: rgba(255, 255, 255, 0.72); /* phone connection pill */
  --zone-hover: rgba(255, 255, 255, 0.6); /* phone tap-zone hover */
  --scrim: rgba(23, 24, 26, 0.35);  /* bottom-sheet backdrop */
  --qr-bg: #ffffff;                 /* QR must stay light for scanners */
  --shadow-card: 0 18px 50px rgba(23, 24, 26, 0.06);
  --shadow-soft: 0 8px 20px rgba(23, 24, 26, 0.14);
  --shadow-hover: 0 12px 28px rgba(23, 24, 26, 0.08);
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
  --r: 10px;
}

/* Dark palette, applied two ways:
   - data-theme='dark' on <html>: an explicit pick (home-page toggle, stored
     in localStorage by theme.js), always wins;
   - under prefers-color-scheme: dark, for data-theme='system' (no pick yet)
     and for no-JS browsers. theme.js sets data-theme on every page.
   The palette is duplicated because media conditions can't be part of a
   selector; keep both blocks in sync. */
:root[data-theme='dark'] {
    color-scheme: dark;
    --bg: #16181b;
    --bg-elevated: #1e2024;
    --fg: #f2f3f5;
    --fg-2: #9a9ea6;
    --fg-3: #63676e;
    --line: #303338;
    --line-2: #3b3f45;
    --line-strong: #4a4f56;
    --surface-soft: #26292e;
    --danger: #f2b8b5;
    --overlay-glow: #2a2c30;
    --glass: rgba(30, 32, 35, 0.72);
    --zone-hover: rgba(255, 255, 255, 0.05);
    --scrim: rgba(0, 0, 0, 0.5);
    --shadow-card: 0 18px 50px rgba(0, 0, 0, 0.5);
    --shadow-soft: 0 8px 20px rgba(0, 0, 0, 0.45);
    --shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.45);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #16181b;
    --bg-elevated: #1e2024;
    --fg: #f2f3f5;
    --fg-2: #9a9ea6;
    --fg-3: #63676e;
    --line: #303338;
    --line-2: #3b3f45;
    --line-strong: #4a4f56;
    --surface-soft: #26292e;
    --danger: #f2b8b5;
    --overlay-glow: #2a2c30;
    --glass: rgba(30, 32, 35, 0.72);
    --zone-hover: rgba(255, 255, 255, 0.05);
    --scrim: rgba(0, 0, 0, 0.5);
    --shadow-card: 0 18px 50px rgba(0, 0, 0, 0.5);
    --shadow-soft: 0 8px 20px rgba(0, 0, 0, 0.45);
    --shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.45);
  }
}

* { box-sizing: border-box; }

/* Author display rules below (.display, .overlay use display:flex) would
   otherwise override the UA's [hidden] rule and keep overlays visible. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

/* Gentle color cross-fade when the theme flips. Animations are disabled
   globally under prefers-reduced-motion (see below). */
body, .card, .btn, .btn.ghost, #dropzone, .role, .role-icon, #conn, .sheet {
  transition-property: background-color, color, border-color, box-shadow;
  transition-duration: 0.2s;
  transition-timing-function: ease;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

::selection {
  background: var(--fg);
  color: var(--bg-elevated);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:focus-visible {
  outline: 1px solid var(--fg);
  outline-offset: 2px;
}

/* ------------------------------------------------ small shared pieces */

.kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-2);
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-card);
}

.hint {
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg-2);
}

.hint strong { color: var(--fg); font-weight: 600; }

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fg-3);
  vertical-align: 1px;
}
.dot.ok { background: var(--fg); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ------------------------------------------------------ display (laptop) */

.display-body {
  background: var(--bg-elevated);
  overflow: hidden;
}

.display {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#pdfCanvas {
  max-width: 100vw;
  max-height: 100vh;
  width: auto;
  height: auto;
  display: block;
}

/* Image stage: same fit-the-screen behavior as the PDF canvas. */
#imgStage {
  max-width: 100vw;
  max-height: 100vh;
  width: auto;
  height: auto;
  display: block;
}

/* PPTX host: fill the screen; pptx-preview renders inside its own
   wrapper box which we scale to fit below. */
#pptxHost {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

/* pptx-preview injects its own pager and prev/next buttons; the phone
   is the remote, so hide them. (Both buttons share this class.) */
#pptxHost .pptx-preview-wrapper-next {
  display: none !important;
}
#pptxHost .pptx-preview-wrapper-pagination {
  display: none !important;
}

/* pdfCanvas is hidden via the [hidden] attribute in display.html. */

.chrome {
  position: fixed;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.chrome.visible {
  opacity: 1;
  pointer-events: auto;
}

#badge {
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--fg-2);
}

.btn-home {
  min-height: 0;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
}

.doc-title {
  max-width: 40vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Library list on the startup card */
.doc-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}
.doc-list:empty { margin: 0; }
.doc-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.doc-item:hover { border-color: var(--fg-2); background: var(--surface-soft); }
.doc-item.current { border-color: var(--fg); }
.doc-item .doc-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: var(--fg);
}
.doc-item .doc-meta { flex: none; color: var(--fg-2); font-family: var(--font-mono); font-size: 12px; }
.doc-item .doc-delete {
  flex: none;
  margin-left: -4px; /* keep meta/delete optically together next to the flexible name */
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--fg-2);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.doc-item .doc-delete:hover { background: var(--surface-soft); color: var(--fg); border-color: var(--fg); }
.doc-item .doc-delete:active { background: var(--surface-soft); color: var(--fg); border-color: var(--fg); }

#pageno {
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-2);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 999px;
  letter-spacing: 0.08em;
}

/* "Click anywhere for fullscreen" — shown when the phone asks the laptop to
   go fullscreen (the phone's gesture can't grant it; one local click does). */
#fsHint {
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--bg-elevated);
  background: var(--fg);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
}

/* "Kept alive" — persistent pill while auto-extend holds the session open
   (any phone connected or waiting). Bottom-center, out of the chrome's way;
   always visible while presenting, no fade — it is server-stamped state. */
#keptAlive {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 7px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-2);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  pointer-events: none;
  white-space: nowrap;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 0%, var(--overlay-glow) 0, var(--bg) 58%);
  padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  overflow: auto;
}

.startup {
  position: relative; /* anchors the theme toggle */
  width: min(520px, 100%);
  padding: 40px 44px 36px;
  /* Center via auto margins, not the overlay's align-items: when the card
     is taller than the viewport, auto margins collapse to 0 so the top of
     the card stays reachable by scrolling (flex centering would clip it). */
  margin: auto;
}

.startup h1 {
  margin: 10px 0 0;
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.startup .rule {
  height: 1px;
  background: var(--line);
  margin: 24px 0;
}

.startup .step { margin-bottom: 22px; }
.startup .step p { margin: 6px 0 0; }

.startup .step:last-of-type { margin-bottom: 0; }

.startup .row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
}

.url {
  flex: 1 1 240px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 10px 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  max-width: 100%;
}

/* Copy button for the pairing URL: sized to the url pill, brief confirm state */
.btn-copy {
  flex: none;
  min-height: 0;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
}
.btn-copy.copied { border-color: var(--fg); color: var(--fg); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--bg-elevated);
  background: var(--fg);
  border-radius: 8px;
  min-height: 42px;
  transition: opacity 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.btn:hover { opacity: 0.88; }
.btn:active { transform: translateY(1px); }
.btn:disabled { cursor: wait; opacity: 0.55; }

.btn.ghost {
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--line-2);
}
.btn.ghost:hover { border-color: var(--fg); }

a.btn { text-decoration: none; } /* the controller's Home link is an anchor */

.btn.danger {
  color: var(--danger);
  background: transparent;
  border: 1px solid var(--line);
}
.btn.danger:hover { border-color: var(--danger); }

#qr {
  margin-top: 12px;
  padding: 12px;
  width: 152px;
  height: 152px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--qr-bg);
  object-fit: contain;
  box-shadow: var(--shadow-soft);
}
#qr canvas { display: block; image-rendering: pixelated; }

#dropzone {
  border: 1px dashed var(--line-2);
  border-radius: var(--r);
  padding: 22px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--fg-2);
  cursor: default;
  transition: border-color 0.15s ease, background 0.15s ease;
}
#dropzone:hover { border-color: var(--fg); }
#startup.dragover #dropzone {
  border-color: var(--fg);
  color: var(--fg);
  background: var(--surface-soft);
}
#startup.dragover #dropzone .dz-icon { color: var(--fg); }

#uploadFile { display: none; }

#loadedName {
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ------------------------------------------------- controller (phone) */

.controller {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overscroll-behavior: none; /* no pull-to-refresh mid-presentation */
}

.controller header {
  flex: none;
  padding: calc(16px + env(safe-area-inset-top)) 20px 15px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.controller h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.controller header {
  user-select: none;
  -webkit-user-select: none;
}

#conn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--fg-2);
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
}

.deck-row {
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.btn-decks {
  flex: none;
  min-height: 0;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
}

/* Home sits beside Decks in the phone header; same pill style */
.deck-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-home {
  min-height: 0;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
}

/* Theme toggle (home card + phone header): quiet circular icon button.
   Sun/moon icon follows the theme; theme.js stores the pick. */
.btn-theme {
  flex: none;
  width: 34px;
  height: 34px;
  min-height: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--fg-2);
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.btn-theme:hover { border-color: var(--fg); color: var(--fg); }
.btn-theme:active { transform: scale(0.94); }
.btn-theme svg { display: block; }
.btn-theme .icon-sun { display: none; }
[data-theme='dark'] .btn-theme .icon-moon { display: none; }
[data-theme='dark'] .btn-theme .icon-sun { display: block; }

/* Compact size inside the phone header row (matches the pill heights) */
.btn-theme.sm { width: 28px; height: 28px; }

#docName {
  margin-top: 0;
  font-size: 12px;
  color: var(--fg-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* -------------------------------------------------- deck sheet (phone) */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: var(--scrim);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.sheet-backdrop.open { opacity: 1; }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 31;
  background: var(--bg-elevated);
  border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  padding: 14px 20px calc(18px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.18s ease;
}
.sheet.open { transform: translateY(0); }

.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--line-2);
  margin: 0 auto 12px;
}

.sheet h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
}

.deck-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
}

.deck-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.deck-item:active { background: var(--surface-soft); }
.deck-item.current { border-color: var(--fg); }
.deck-item .deck-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: var(--fg);
}
.deck-item .deck-meta { flex: none; color: var(--fg-2); font-family: var(--font-mono); font-size: 12px; }
.deck-item.current .deck-meta.live { color: var(--fg); font-weight: 600; }

/* Deck row thumbnail: a page-1 preview rendered by the laptop, or a type
   chip until one exists (PDFs/images appear on their own; PPTX decks get
   theirs the first time they are shown from slide 1). */
.deck-item .deck-thumb {
  flex: none;
  width: 46px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--fg-3);
}
.deck-item .deck-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.deck-item .deck-delete {
  flex: none;
  margin-left: -4px; /* keep meta/delete optically together next to the flexible name */
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--fg-2);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.deck-item .deck-delete:active { background: var(--surface-soft); color: var(--fg); border-color: var(--fg); }

.sheet-empty { margin: 0 0 14px; }

.sheet-close { width: 100%; }

.zones {
  position: relative; /* anchors the progress bar */
  flex: 1;
  display: flex;
  min-height: 0;
  isolation: isolate;
}

/* Thin deck progress bar along the top of the tap area */
.progress-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--surface-soft);
  pointer-events: none;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--fg);
  transition: width 0.2s ease;
}

/* Soft gradient from the screen edges — makes the (invisible) tap
   targets feel like edges you press, not empty halves */
.zone::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.zone.next::before { background: linear-gradient(to right, transparent 55%, var(--line) 100%); }
.zone.prev::before { background: linear-gradient(to left, transparent 55%, var(--line) 100%); }
.zone:active::before { opacity: 1; }

.zone {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none; /* taps belong to us: no scroll/zoom/pull-to-refresh */
  -webkit-touch-callout: none;
  transition: background 0.12s ease;
  position: relative;
  gap: 18px;
  flex-direction: column;
  color: var(--fg-2);
}
.zone:hover { background: var(--zone-hover); }
.zone:active { background: var(--surface-soft); }

.zone.prev { border-right: 1px solid var(--line); }
.zone .arrow {
  width: 30px;
  height: 30px;
  border-top: 2.5px solid var(--fg-2);
  border-left: 2.5px solid var(--fg-2);
  transition: border-color 0.12s ease, transform 0.12s ease;
}
.zone.prev .arrow { transform: rotate(-45deg) translate(2px, 2px); }
.zone.next .arrow { transform: rotate(135deg) translate(2px, 2px); }
.zone:active .arrow { border-color: var(--fg); }

/* At the deck's edges the exhausted direction dims, so a tap that can't
   move reads as "start/end reached" instead of a dead button. */
.zone.edge .arrow,
.zone.edge:active .arrow { border-color: var(--line-2); }
.zone.edge::after,
.zone.edge:active::after { color: var(--fg-3); }

.zone::after {
  content: attr(data-label);
  margin-top: 6px; /* breathing room under the arrow */
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.zone:active::after { color: var(--fg-2); }

.controller footer {
  flex: none;
  padding: 15px 20px calc(18px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  text-align: center;
}

#counter {
  display: inline-block; /* transformable for the change pulse */
  font-family: var(--font-mono);
  font-size: 20px;
  letter-spacing: 0.12em;
  color: var(--fg);
  font-weight: 600;
}

@keyframes counter-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.16); }
  100% { transform: scale(1); }
}
#counter.bump { animation: counter-bump 0.22s ease; }

#counter .sep { color: var(--fg-3); }

/* ---- page scrubber (drag the rail to jump between pages) ---------- */

.scrub {
  position: relative;
  margin-top: 12px;
  padding: 10px 6px 6px;
  touch-action: none; /* the drag belongs to us, not the browser */
}

.scrub-rail {
  position: relative;
  height: 22px;
}

.scrub-rail::before { /* rail line */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  border-radius: 1px;
  background: var(--line);
}

.scrub-fill {
  position: absolute;
  left: 0;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  border-radius: 1px;
  background: var(--fg);
  width: 0;
}

.scrub-knob {
  position: absolute;
  top: 50%;
  left: 0;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px; /* centered on the fraction point */
  border-radius: 999px;
  background: var(--fg);
  border: 2px solid var(--bg-elevated);
  box-shadow: 0 1px 4px rgba(23, 24, 26, 0.25);
  transition: transform 0.12s ease;
}

.scrub:focus-visible .scrub-knob {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

.scrub.scrubbing .scrub-knob {
  transform: scale(1.35); /* grows while you drag */
}

.scrub-pop {
  position: absolute;
  bottom: calc(100% - 2px);
  left: 0;
  transform: translateX(-50%);
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--fg);
  color: var(--bg-elevated);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  white-space: nowrap;
  z-index: 2;
}

/* Two-step deck delete: armed state turns the ✕ into an explicit confirm */
.deck-item .deck-delete {
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
  overflow: hidden;
}
.deck-item .deck-delete.armed {
  width: auto;
  padding: 0 9px;
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.04em;
}
.deck-item .deck-delete.armed:active { background: #8f1d17; }

.controller.idle .zones {
  align-items: center;
  justify-content: center;
}

.controller.idle .zone { display: none; }

.controller.idle .zones::after {
  content: attr(data-idle);
  font-size: 13px;
  color: var(--fg-2);
  padding: 0 32px;
  text-align: center;
  line-height: 1.6;
}

@media (max-width: 560px) {
  .home { padding: 16px; }
  .home .card { padding: 28px 24px 24px; }
  .startup { padding: 28px 24px 24px; }
  .startup h1 { font-size: 23px; }
  .startup .row { align-items: stretch; }
  .startup .row .btn { flex: 1 1 auto; }
  #qr { width: 144px; height: 144px; }
}

/* Landscape phone: slim the header/footer so the tap halves get the space */
@media (orientation: landscape) and (max-height: 480px) {
  .controller header { padding: 8px 16px 7px; }
  .deck-row { margin-top: 0; }
  .controller footer { padding: 8px 16px calc(10px + env(safe-area-inset-bottom)); }
  #counter { font-size: 15px; }
  .scrub { margin-top: 6px; padding: 6px 6px 2px; }
  .zone .arrow { width: 22px; height: 22px; }
  .zone::after { margin-top: 2px; font-size: 10px; }
}

/* Brand lockup: logo mark with the name beside it (home + display cards).
   The descendant selector outranks the per-page .home-mark/.startup-mark
   margin-bottom so the row, not the mark, owns the spacing. */
.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.brand-row .home-mark,
.brand-row .startup-mark { margin-bottom: 0; }

/* Phone header: compact lockup, same mark in a tiny chip next to the title */
.brand-row.sm { margin-bottom: 0; gap: 8px; }
.header-mark {
  flex: none;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--fg);
  color: var(--bg-elevated); /* bar inverts with the theme, like the other marks */
}
.header-mark svg { display: block; }
