body.demo-page { margin: 0; background: #0e0e12; color: #e0e0e0; overflow-x: hidden; }

.demo-layout {
    display: grid;
    grid-template-columns: var(--sidebar-w, 340px) 6px 1fr;
    min-height: 100dvh;
}

/* ── Resizer handles ── */
.demo-resizer {
    cursor: col-resize;
    flex-shrink: 0;
    z-index: 10;
    touch-action: none;
    -webkit-touch-callout: none;
    background: transparent;
}
.demo-resizer-v {
    width: 6px;
    background: transparent;
}
.demo-resizer-v:hover { background: rgba(255,255,255,0.08); }
.demo-resizer-h {
    cursor: row-resize;
    padding: 2px 0;
    background: transparent;
}
.demo-resizer-h-line {
    height: 1px;
    background: rgba(255,255,255,0.06);
}
.demo-resizer-h:hover .demo-resizer-h-line { background: rgba(253,255,141,0.25); }

/* ── Picker sidebar ── */
.demo-picker {
    background: #16161c;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: sticky;
    top: 0;
    align-self: start;
    height: 100dvh;
    border-right: 1px solid rgba(255,255,255,0.06);
}
.demo-picker-header {
    padding: 8px 20px 4px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.demo-logo {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
}
.demo-logo-img {
    height: 72px;
    filter: drop-shadow(0 0 8px var(--nb-accent)) drop-shadow(0 0 30px rgba(253,255,141,0.8)) drop-shadow(0 0 80px rgba(253,255,141,0.45));
}
.demo-logo-sub {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.35);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    align-self: flex-end;
    margin-bottom: 10px;
}
.demo-picker-header p {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: rgba(255,255,255,0.45);
    margin: 0;
    text-align: center;
}

.demo-category {
    padding: 14px 20px 10px;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--nb-accent);
    border-top: 1px solid rgba(253,255,141,0.15);
    margin-top: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 8px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: background 0.15s ease;
    flex-shrink: 0;
    background: rgb(30, 30, 28);
}
.demo-category:hover { background: rgba(253,255,141,0.06); }
.demo-section-group:first-child .demo-category { border-top: none; }
.demo-category-label { flex: 1; min-width: 0; }
.demo-category-count {
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(253,255,141,0.5);
    background: rgba(253,255,141,0.1);
    padding: 1px 7px;
    border-radius: 8px;
    flex-shrink: 0;
}
.demo-category-chevron {
    width: 0; height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid rgba(253,255,141,0.5);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}
.demo-category.collapsed .demo-category-chevron { transform: rotate(-90deg); }
.demo-category-sub {
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: rgba(255,255,255,0.4);
    font-style: italic;
    width: 100%;
}
.demo-category.collapsed .demo-category-sub { display: none; }

.demo-section-group {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 0 0 auto;
}
.demo-section-group.expanded {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
}
.demo-section-cards {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.demo-section-cards.collapsed {
    display: none;
}

.demo-cards {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 12px 10px;
}

.demo-picker-footer {
    flex-shrink: 0;
    padding: 8px 16px 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.demo-how-btn {
    display: block;
    width: 100%;
    padding: 7px 0;
    font-family: var(--font-ui);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: rgba(255,255,255,0.45);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.demo-how-btn:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.7); }

/* ── How it works modal ── */
.demo-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
}
.demo-modal {
    position: relative;
    background: var(--nb-modal-bg);
    border: 1px solid var(--nb-popover-border);
    border-radius: var(--nb-radius-md);
    max-width: 540px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 28px 32px 24px;
    box-shadow: var(--nb-popover-shadow);
    font-family: var(--nb-font-family);
    color: var(--nb-text-secondary);
    font-size: 0.85rem;
    line-height: 1.55;
    text-align: left;
}
.demo-modal:has(.demo-noahs-ark-logo:hover) {
    overflow: visible;
}
.demo-modal-scroll {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.demo-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}
.demo-modal-close:hover { color: #fff; }
.demo-modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--nb-accent);
    margin: 0 0 14px;
}
.demo-modal-body p { margin: 0 0 10px; text-align: justify; hyphens: auto; }
.demo-modal-body h3 {
    font-size: 0.82rem;
    font-weight: 700;
    color: rgba(255,255,255,0.95);
    margin: 16px 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.demo-modal-body em { color: var(--nb-accent); font-style: normal; }
.demo-modal-link { margin-top: 16px; }
.demo-modal-link a {
    color: var(--nb-accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.8rem;
}
.demo-modal-link a:hover { text-decoration: underline; }
.demo-readmore-btn {
    background: none;
    border: none;
    color: var(--nb-accent);
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
}
.demo-readmore-btn:hover { text-decoration: underline; }
.demo-reviewer-only { display: none; }
.demo-modal-contact {
    flex-shrink: 0;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 16px;
}
.demo-modal-contact-lab {
    flex-shrink: 0;
    order: 2;
    margin-left: auto;
}
.demo-noahs-ark-logo {
    height: 64px;
    opacity: 0.6;
    animation: _gp1 2s ease-in-out infinite;
}
.demo-noahs-ark-logo:hover {
    opacity: 1;
    animation: none;
    filter: drop-shadow(0 0 10px rgba(253,255,141,0.9)) drop-shadow(0 0 28px rgba(253,255,141,0.5));
}
@keyframes _gp1 {
    0%, 100% { filter: drop-shadow(0 0 2px rgba(253,255,141,0.25)); }
    50% { filter: drop-shadow(0 0 16px rgba(253,255,141,1)) drop-shadow(0 0 34px rgba(253,255,141,0.8)); }
}
.demo-modal-contact-text { order: 1; }
.demo-modal-copyright {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.45);
    margin: 0 0 4px;
}
.demo-modal-copyright a {
    color: var(--highlight);
    text-decoration: none;
}
.demo-modal-copyright a:hover {
    text-decoration: underline;
}
.demo-modal-email {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.45);
    margin: 0;
}
.demo-modal-email a { color: var(--nb-accent); text-decoration: none; }
.demo-modal-email a:hover { text-decoration: underline; }

/* ── Full article modal ── */
.demo-modal-article {
    display: block;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 36px 42px 32px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.15) transparent;
    background: rgba(240, 238, 234, 0.85);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    color: #2c2c2c;
    border: 1px solid rgba(255,255,255,0.35);
    box-shadow: 0 20px 60px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.4);
}
.demo-article-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.3;
    margin: 0 0 0.3rem;
}
.demo-article-rule {
    width: 100%;
    height: 1px;
    background: rgba(0,0,0,0.15);
    margin: 0.8rem 0 1.4rem;
}
.demo-article-body {
    font-size: 0.9rem;
    line-height: 1.8;
    color: #3a3a3a;
}
.demo-article-body p {
    margin: 0 0 1.1rem;
    text-align: justify;
    -webkit-hyphens: auto;
    hyphens: auto;
}
.demo-article-body strong { color: #1a1a1a; }
.demo-article-body em { color: #1a1a1a; font-style: italic; }
.demo-article-section {
    display: flow-root;
    margin-bottom: 0.8rem;
}
.demo-article-fig {
    float: right;
    clear: right;
    max-width: min(55%, 420px);
    margin: 0.2rem 0 1rem 1.8rem;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.1);
}
.demo-article-fig-sm { max-width: min(48%, 360px); }
.demo-modal-article .demo-modal-close { color: rgba(0,0,0,0.3); }
.demo-modal-article .demo-modal-close:hover { color: #1a1a1a; }
.demo-article-title a {
    color: #1a56db;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}
.demo-article-title a:hover { color: #133fa8; text-decoration-thickness: 2px; }
@media (max-width: 600px) {
    .demo-article-fig { float: none; max-width: 100%; margin: 0.8rem 0; }
}

.demo-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin: 0 0 2px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    font-family: var(--font-ui);
}
.demo-card:hover {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.06);
}
.demo-card.active {
    background: rgba(253,255,141,0.08);
    border-color: rgba(253,255,141,0.2);
}

.demo-card-thumb {
    width: 56px;
    height: 42px;
    border-radius: 4px;
    background: #000;
    flex-shrink: 0;
    overflow: hidden;
}
.demo-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.85;
}

.demo-card-info { min-width: 0; }
.demo-card-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.demo-card-artist {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Main area ── */
.demo-main {
    display: flex;
    flex-direction: column;
    position: relative;
}

.demo-video-strip {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0 16px;
    background: transparent;
}
:root {
    --video-max-h: 50dvh;
    --main-w: calc(100vw - var(--sidebar-w, 340px) - 6px);
}
.demo-embed-slot {
    position: fixed;
    top: 0;
    left: calc(var(--sidebar-w, 340px) + 6px);
    right: 0;
    margin: 0 auto;
    width: calc(var(--video-max-h) * 16 / 9);
    max-width: var(--main-w);
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
    border-radius: 8px;
    z-index: 2;
    box-shadow: -12px 0 32px rgba(0,0,0,0.7), 12px 0 32px rgba(0,0,0,0.7), 0 4px 24px rgba(0,0,0,0.5);
}
.demo-embed-slot iframe,
.demo-embed-slot > div {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    border: 0;
    display: block;
}
.demo-embed-slot iframe { pointer-events: auto; }
.demo-now-playing {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    z-index: 1;
    padding: 12px 16px;
}
.demo-now-title {
    font-family: var(--font-ui);
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.demo-now-artist {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
    transition: opacity 0.3s ease 0.06s, transform 0.3s ease 0.06s;
}

.demo-player-area {
    display: flex;
    flex-direction: column;
    flex: 1;
}
.demo-player-area > #player {
    display: flex;
    flex-direction: column;
}

/* Video strip entrance */
.demo-video-strip.video-entering {
    animation: videoStripEnter 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes videoStripEnter {
    from { opacity: 0; }
    to { opacity: 1; }
}

.demo-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-ui);
    color: rgba(255,255,255,0.25);
}
.demo-welcome {
    text-align: center;
}
.demo-welcome-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: rgba(255,255,255,0.7);
    margin-bottom: 32px;
}
.demo-welcome-tutorial {
    font-family: var(--font-ui);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--highlight);
    background: none;
    border: 2px solid rgba(253,255,141,0.4);
    border-radius: 12px;
    padding: 16px 48px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.demo-welcome-tutorial:hover {
    border-color: var(--highlight);
    background: rgba(253,255,141,0.1);
}

.demo-page .notation-panel {
    background: var(--demo-panel-bg, #1a1a1e);
}

.demo-annotation {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
    padding: 4px 10px;
    pointer-events: none;
    white-space: nowrap;
}
.demo-video-strip .demo-annotation {
    align-self: center;
    margin-left: auto;
    padding-right: 16px;
}

/* ── Mini video (floating corner) ── */
.demo-embed-spacer { width: min(calc(var(--video-max-h) * 16 / 9), 100%); aspect-ratio: 16 / 9; }
.demo-video-strip.video-mini .demo-embed-slot {
    top: 12px !important;
    left: auto !important;
    right: 12px;
    width: clamp(140px, 25vw, 280px) !important;
    height: auto !important;
    max-height: none;
    max-width: none;
    z-index: 50;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.08);
    cursor: pointer;
}
.demo-video-strip.video-mini .demo-annotation { display: none; }
.demo-embed-slot.flipping { will-change: transform; }

/* ── Tutorial scrim (coach-mark overlay) ── */
.tut-scrim {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0,0,0,0.55);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s ease;
}
.tut-scrim.active {
    opacity: 1;
}

/* ── Tutorial hint ── */
.tut-hint {
    position: fixed;
    left: calc(var(--sidebar-w, 340px) + 6px);
    right: 0;
    bottom: 80px;
    z-index: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    font-family: var(--font-ui);
    text-align: center;
    gap: 0;
    animation: tut-hint-enter 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes tut-hint-enter {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.tut-hint-box {
    position: relative;
    background: var(--nb-popover-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--nb-popover-border);
    border-radius: var(--nb-radius-md);
    padding: 18px 28px 14px;
    max-width: 520px;
    box-shadow: var(--nb-popover-shadow);
    text-align: left;
}
.tut-hint-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.35);
    font-size: 1.1rem;
    line-height: 1;
    padding: 2px 6px;
    cursor: pointer;
    pointer-events: auto;
}
.tut-hint-close:hover { color: rgba(255,255,255,0.7); }
.tut-hint-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--nb-accent);
    line-height: 1.2;
    margin-bottom: 6px;
}
.tut-hint-sub {
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--nb-text-secondary);
    line-height: 1.5;
    text-align: justify;
    hyphens: auto;
}
.tut-hint-step {
    display: inline-block;
    margin-top: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(253,255,141,0.5);
}
.tut-bpm-preview {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 4px;
    background: rgba(253,255,141,0.55);
    color: #111;
    font-weight: 700;
    font-size: 0.95em;
    letter-spacing: 0.02em;
    vertical-align: baseline;
}
.tut-hint-key {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--nb-accent);
}

/* Slider-end echo chips: mirror the mixer's Orig (red) / Synth (yellow) labels
   so the tutorial copy maps onto the actual control. Sized to sit inline with
   the running text, the chip is the word's prefix and the rest follows plain
   (e.g. [ORIG]inal, [SYNTH]esized). */
.tut-chip {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 700;
    font-size: 0.72em;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: baseline;
    line-height: 1;
}
.tut-chip-orig  { background: #e8191a; color: #fff; }
.tut-chip-synth { background: var(--nb-accent, #fdff8d); color: #111; }

/* ── Tutorial ring (pulsing spotlight) ── */
@keyframes tut-ring-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(253,255,141,0.7), 0 0 20px 4px rgba(253,255,141,0.4); }
    50%  { box-shadow: 0 0 0 14px rgba(253,255,141,0), 0 0 40px 8px rgba(253,255,141,0.2); }
    100% { box-shadow: 0 0 0 0 rgba(253,255,141,0.7), 0 0 20px 4px rgba(253,255,141,0.4); }
}
.tut-ring {
    position: fixed;
    z-index: 9000;
    border: 3px solid rgba(253,255,141,0.9);
    border-radius: 10px;
    pointer-events: none;
    animation: tut-ring-pulse 1.5s ease infinite;
    background: transparent;
}
/* Arrow from ring toward hint box */
.tut-ring::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -18px;
    transform: translateX(-50%);
    width: 2px;
    height: 16px;
    background: linear-gradient(to bottom, rgba(253,255,141,0.6), rgba(253,255,141,0));
    pointer-events: none;
}
/* When ring is in lower half, point arrow upward instead */
.tut-ring.arrow-up::after {
    bottom: auto;
    top: -18px;
    background: linear-gradient(to top, rgba(253,255,141,0.6), rgba(253,255,141,0));
}

/* Pull handle: left-edge drawer tab (mobile only) */
.demo-pull-handle { display: none; }
@media (max-width: 768px) {
    .demo-pull-handle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        z-index: 61;
        width: 20px;
        height: 56px;
        background: rgba(255,255,255,0.08);
        border: 1px solid rgba(255,255,255,0.12);
        border-left: none;
        border-radius: 0 10px 10px 0;
        cursor: pointer;
        transition: background 0.15s ease, opacity 0.25s ease;
        -webkit-tap-highlight-color: transparent;
    }
    .demo-pull-handle:active { background: rgba(255,255,255,0.25); }
    .demo-pull-handle::after {
        content: '';
        display: block;
        width: 4px;
        height: 16px;
        border-left: 2px solid rgba(255,255,255,0.35);
        border-right: 2px solid rgba(255,255,255,0.35);
    }
    .demo-pull-handle.hint {
        animation: _pullHint 1.8s ease 0s 3;
    }
    .demo-layout.sidebar-open .demo-pull-handle {
        opacity: 0;
        pointer-events: none;
    }
    @keyframes _pullHint {
        0%, 100% { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.12); }
        50% { background: rgba(253,255,141,0.15); border-color: rgba(253,255,141,0.25); }
    }
}

textarea.demo-hidden { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ── Mobile: overlay drawer ── */
@media (max-width: 768px) {
    :root { --mobile-sidebar-w: 85vw; }

    .demo-layout {
        display: block !important;
        min-height: 100dvh;
    }
    .demo-resizer { display: none; }

    .demo-picker {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: var(--mobile-sidebar-w);
        height: 100dvh;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        overflow: hidden;
    }
    .demo-layout.sidebar-open .demo-picker {
        transform: translateX(0);
    }

    .demo-scrim {
        position: fixed;
        inset: 0;
        z-index: 199;
        background: rgba(0,0,0,0.5);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        -webkit-tap-highlight-color: transparent;
    }
    .demo-scrim.active {
        opacity: 1;
        pointer-events: auto;
    }

    .demo-main {
        width: 100%;
    }

    .demo-video-strip { padding: 0; }
    :root { --main-w: 100vw; }
    .demo-embed-slot { left: 0; }

    /* Tutorial mobile */
    .tut-hint { left: 0; bottom: 60px; }
    .tut-hint-box { padding: 10px 16px; max-width: 90vw; }
    .tut-hint-title { font-size: 1.3rem; }
    .tut-hint-sub { font-size: 0.9rem; line-height: 1.4; }
    .tut-ring::after { display: none; }

    /* Modal mobile */
    .demo-modal {
        width: 95%;
        max-height: 85dvh;
        padding: 24px 20px 20px;
    }
    .demo-modal-scroll {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-y;
    }
}

/* ── Very small phones (≤480px) ── */
@media (max-width: 480px) {
    .demo-page .notation-bar {
        --nb-hero-size: 40px;
        --nb-hero-icon: 20px;
        --nb-utility-size: 38px;
        --nb-utility-icon: 22px;
        padding: 10px 6px 3px;
    }
    .demo-page .nb-controls-row { gap: 4px; }
    .demo-page .bar-right { gap: 2px; }

    .tut-hint-title { font-size: 1.1rem; }
    .tut-hint-sub { font-size: 0.8rem; line-height: 1.35; }
    .tut-hint-box { padding: 8px 12px; }
}

/* ─── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .demo-noahs-ark-logo { animation: none; }
    .tut-ring { animation: none; box-shadow: 0 0 0 0 rgba(253,255,141,0.7), 0 0 20px 4px rgba(253,255,141,0.4); }
    .demo-pull-handle.hint { animation: none; }
    .demo-picker,
    .demo-scrim { transition: none; }
    .demo-card { transition: none; }
    .demo-how-btn { transition: none; }
    .tut-hint { animation: none; }
}

/* ── Sync calibration popover (vertical fader) ──────────────────────────────── */
/* Portaled to <body> and fixed-positioned (bottom/right set in JS to the Sync
   button) so the floating video layer can't occlude or clip it. Like the zoom
   popover in spirit, but bigger and above everything. */
.cal-popover {
    display: none;
    position: fixed;
    width: 280px;
    max-width: calc(100vw - 24px);
    flex-direction: column;
    padding: 16px 18px 14px;
    background: var(--nb-popover-bg);
    border: 1px solid var(--nb-popover-border);
    border-radius: var(--nb-radius-md);
    box-shadow: var(--nb-popover-shadow);
    font-family: var(--nb-font-family);
    color: var(--nb-text-secondary);
    text-align: left;
    z-index: 10000;
}
.cal-popover.open { display: flex; }
.cal-pop-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--nb-text-primary);
    margin-bottom: 4px;
}
.cal-pop-hint {
    font-size: 0.76rem;
    color: var(--nb-text-tertiary);
    line-height: 1.45;
    margin-bottom: 10px;
}
.cal-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    margin: 2px 0 16px;
}
.cal-axis {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
/* Vertical range: up = max (Earlier). writing-mode handles modern browsers;
   the orient attribute covers older Firefox. */
.cal-slider {
    writing-mode: vertical-lr;
    direction: rtl;
    width: 26px;            /* wide hit area so it's grabbable on touch (was 8px) */
    height: 150px;
    accent-color: var(--nb-accent);
    cursor: pointer;
    touch-action: none;     /* dragging the fader must not scroll the sheet */
}
.cal-end {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.25;
    font-family: var(--nb-font-family);
    padding: 8px 16px;       /* comfortable tap target for fine nudging */
    border-radius: var(--nb-radius-sm);
    transition: background 0.15s;
}
.cal-end:hover { background: var(--nb-surface-hover); }
.cal-end:active { background: var(--nb-surface-active); }
.cal-end strong { font-size: 0.8rem; color: var(--nb-text-secondary); font-weight: 600; }
.cal-end-note { font-size: 0.67rem; color: var(--nb-text-tertiary); }
.cal-end-arrow { color: var(--nb-accent); font-size: 0.7rem; line-height: 1; }
.cal-readout {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 92px;
}
.cal-val {
    font-size: 2.1rem;
    font-weight: 600;
    color: var(--nb-accent);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.cal-readout-sub {
    font-size: 0.72rem;
    color: var(--nb-text-tertiary);
    margin-top: 5px;
}
.cal-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}
.cal-reset, .cal-save {
    font-family: var(--nb-font-family);
    border-radius: var(--nb-radius-sm);
    padding: 9px 18px;
    font-size: 0.85rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, opacity 0.15s;
}
.cal-reset {
    background: var(--nb-surface);
    border-color: var(--nb-popover-border);
    color: var(--nb-text-secondary);
}
.cal-reset:hover { background: var(--nb-surface-hover); color: var(--nb-text-primary); }
.cal-save {
    background: var(--nb-accent);
    color: #111;
    font-weight: 700;
}
.cal-save:hover { opacity: 0.88; }
