  :root {
    --bezel: #0d0d0f;
    --screen: #ffffff;
    --pagebg: #ffffff;
    --pageedge: #e3e5ea;
    --muted: #d7d9de;
    --bubble-bg: #1f6feb;
    --bubble-ink: #ffffff;
    --thumb: #9aa0aa;
    --track: rgba(0,0,0,0.06);
    --topbar: #f4f5f7;
    --topbar-ink: #6b7078;
  }
  /* Dark palette is driven by a data-theme attribute that phone.js keeps in
     sync with Quartz's own theme (which is independent of the OS setting).
     Falls back to the OS preference when the prototype is viewed standalone. */
  :root[data-theme="dark"] {
    --bezel: #000000;
    --screen: #16171b;
    --pagebg: #1c1d22;
    --pageedge: #2a2c32;
    --muted: #2f313a;
    --bubble-bg: #2f81f7;
    --bubble-ink: #ffffff;
    --thumb: #4a4d55;
    --track: rgba(255,255,255,0.07);
    --topbar: #1a1b20;
    --topbar-ink: #8b9099;
  }
  * { box-sizing: border-box; }
  /* color-scheme lets the transparent iframe show the (light or dark) page
     through instead of the browser forcing an opaque white backdrop in dark mode */
  html { color-scheme: light dark; }
  html, body { margin: 0; height: 100%; background: transparent; }
  body {
    background: transparent;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: flex; align-items: center; justify-content: center;
    -webkit-user-select: none; user-select: none;
  }
  /* Anthropometric scale: 300px device width = 71.5mm mean smartphone body
     width => 4.2px/mm. Body aspect ~2.07 (iPhone-class) => ~620px tall.
     The fingertip below is sized off this same scale so the occlusion the
     note demonstrates is honestly proportioned, not exaggerated. */
  .phone {
    position: relative;
    width: 300px; height: 620px;
    background: var(--bezel);
    border-radius: 42px;
    padding: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.18), inset 0 0 0 2px rgba(255,255,255,0.04);
  }
  .notch {
    position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
    width: 120px; height: 24px; background: var(--bezel);
    border-bottom-left-radius: 14px; border-bottom-right-radius: 14px;
    z-index: 5;
  }
  .screen {
    position: relative; width: 100%; height: 100%;
    background: var(--screen); border-radius: 32px; overflow: hidden;
  }
  .topbar {
    position: absolute; top: 0; left: 0; right: 0; height: 46px;
    background: var(--topbar); color: var(--topbar-ink);
    display: flex; align-items: flex-end; justify-content: center;
    padding-bottom: 9px; font-size: 12px; font-weight: 600; letter-spacing: .02em;
    z-index: 4; border-bottom: 1px solid var(--pageedge);
  }
  .doc {
    position: absolute; top: 46px; left: 0; right: 0; bottom: 0;
    overflow-y: auto; overflow-x: hidden;
    scrollbar-width: none;
    padding: 14px 16px 40px;
  }
  .doc::-webkit-scrollbar { width: 0; height: 0; display: none; }
  .page {
    background: var(--pagebg);
    border: 1px solid var(--pageedge);
    border-radius: 6px;
    padding: 16px 14px 20px;
    margin-bottom: 14px;
    position: relative;
  }
  .page .pno { position: absolute; bottom: 6px; right: 10px; font-size: 9px; color: var(--topbar-ink); opacity: .55; }
  .line { height: 7px; border-radius: 4px; background: var(--muted); margin: 0 0 9px; }
  .line.short { width: 46%; }
  .line.title { height: 11px; width: 68%; margin-bottom: 15px; }

  /* right-edge scrollbar */
  .track {
    position: absolute; top: 56px; right: 6px; bottom: 10px; width: 6px;
    background: var(--track); border-radius: 3px; z-index: 6;
  }
  .thumb {
    position: absolute; right: 0; width: 6px; border-radius: 3px;
    background: var(--thumb); top: 0; height: 70px;
    touch-action: none;
  }
  .interactive .thumb { width: 10px; right: -1px; cursor: grab; }
  .interactive .thumb:active { cursor: grabbing; }
  /* invisible, generous grab zone so the slim scrollbar is easy to grab
     (extends the hit area left into the page and past the thumb ends) */
  .interactive .thumb::before {
    content: "";
    position: absolute;
    top: -12px; bottom: -12px; right: -10px; left: -40px;
    cursor: grab;
  }

  /* page indicator, pinned beside the thumb */
  .bubble {
    position: absolute; right: 12px;
    transform: translateY(-50%);
    background: var(--bubble-bg); color: var(--bubble-ink);
    font-size: 12px; font-weight: 600;
    padding: 5px 10px; border-radius: 8px; white-space: nowrap;
    z-index: 7; box-shadow: 0 3px 10px rgba(0,0,0,.25);
    top: 0; pointer-events: none;
  }
  .bubble::after {
    content: ""; position: absolute; right: -5px; top: 50%; transform: translateY(-50%);
    border: 5px solid transparent; border-left-color: var(--bubble-bg);
  }

  /* simulated fingertip — desktop only, shown while dragging.
     84px = 20mm mean adult thumb-tip breadth at 4.2px/mm (see .phone). */
  .finger {
    position: absolute; right: -8px; width: 84px; height: 84px;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 34%, rgba(255,206,176,.9), rgba(232,159,118,.93) 55%, rgba(190,112,72,.96));
    box-shadow: 0 8px 22px rgba(0,0,0,.34), inset 0 0 20px rgba(120,60,30,.4);
    transform: translateY(-50%);
    top: 0; z-index: 9; pointer-events: none;
    opacity: 0; transition: opacity .2s ease;
    display: none;
  }

  .hint {
    position: absolute; bottom: 13px; left: 50%; transform: translateX(-50%);
    font-size: 11px; color: var(--topbar-ink); background: var(--topbar);
    padding: 5px 12px; border-radius: 20px; z-index: 8;
    border: 1px solid var(--pageedge); white-space: nowrap;
    transition: opacity .25s ease;
  }
