    .timer-page {
        max-width: 480px;
        margin: 0 auto;
        padding: 5rem 1rem 2rem;
        color: #eee;
        font-family: system-ui, -apple-system, sans-serif;
        min-height: 100vh;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 1rem;
    }

    /*
     * pwa-update-toast: fixed pill at the bottom of the viewport
     * notifying the user a newer build is precached and asking them
     * to reload. Sits above the safe-area inset in standalone mode.
     * Blue (#2980b9, the canonical action-button colour) so the
     * call-to-action is impossible to miss; whole pill is no-wrap
     * so it stays compact regardless of viewport width.
     */
    .pwa-update-toast {
        position: fixed;
        left: 50%;
        bottom: calc(1rem + env(safe-area-inset-bottom));
        transform: translateX(-50%);
        background: #2980b9;
        color: #fff;
        padding: 0.55rem 0.65rem 0.55rem 1.1rem;
        border-radius: 999px;
        font: 600 14px/1.2 system-ui, -apple-system, sans-serif;
        box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5),
                    0 0 0 1px rgba(255, 255, 255, 0.08) inset;
        display: flex;
        gap: 0.6rem;
        align-items: center;
        white-space: nowrap;
        z-index: 9999;
        max-width: calc(100vw - 1rem);
        animation: pwa-update-toast-in 0.25s ease-out;
    }
    @keyframes pwa-update-toast-in {
        from { opacity: 0; transform: translate(-50%, 1rem); }
        to   { opacity: 1; transform: translate(-50%, 0); }
    }
    .pwa-update-toast__msg {
        letter-spacing: 0.01em;
    }
    .pwa-update-toast__reload {
        background: #fff;
        color: #2980b9;
        border: 0;
        padding: 0.35rem 0.85rem;
        border-radius: 999px;
        font: 700 13px system-ui, -apple-system, sans-serif;
        cursor: pointer;
        letter-spacing: 0.02em;
    }
    .pwa-update-toast__reload:hover {
        background: #eaf3fa;
    }
    .pwa-update-toast__dismiss {
        background: transparent;
        color: rgba(255, 255, 255, 0.85);
        border: 0;
        padding: 0 0.35rem;
        font: 600 18px system-ui;
        cursor: pointer;
        line-height: 1;
    }
    .pwa-update-toast__dismiss:hover {
        color: #fff;
    }

    /*
     * pwa-gesture-guards: disable browser gestures that interrupt a
     * running timer session.
     *   - overscroll-behavior: none  → no pull-to-refresh on swipe down,
     *                                  no rubber-band scroll-chain.
     *   - touch-action: manipulation → suppress the 300ms double-tap-
     *                                  zoom delay AND prevent the
     *                                  double-tap-zoom gesture itself.
     * Applied to html + body so they hold even if a child scroll
     * container is added later.
     */
    html, body {
        overscroll-behavior: none;
        touch-action: manipulation;
    }

    /*
     * pwa-safe-area: when launched as a standalone PWA with the
     * black-translucent status bar style, the OS status bar overlays
     * the page. Push the timer content down by the safe-area inset so
     * the clock isn't hidden under the notch / status bar. Only
     * applied in standalone mode; in-browser the regular padding
     * (5rem top) already clears the browser chrome.
     */
    @media (display-mode: standalone) {
        .timer-page {
            padding-top: max(5rem, calc(1rem + env(safe-area-inset-top)));
            padding-bottom: max(2rem, calc(2rem + env(safe-area-inset-bottom)));
        }
    }
    body.pwa-standalone .timer-page {
        padding-top: max(5rem, calc(1rem + env(safe-area-inset-top)));
        padding-bottom: max(2rem, calc(2rem + env(safe-area-inset-bottom)));
    }

    /*
     * pwa-standalone-chrome: when launched as an installed PWA, hide
     * the site-wide nav and footer so the timer feels like a focused
     * standalone app. The .brand logo link in <header> is preserved
     * as the single way back to the website — tapping it leaves the
     * /timer/ scope, so iOS/Android open it in the system browser.
     *
     * Matches modern Chrome/Edge/Android-Chrome/iOS-Safari 13+. For
     * legacy iOS (navigator.standalone === true) the body.pwa-standalone
     * fallback class is added by pwa.js.
     */
    @media (display-mode: standalone) {
        header nav,
        .mobile-menu,
        .mobile-menu-overlay,
        footer,
        .footer-banner { display: none !important; }
    }

    body.pwa-standalone header nav,
    body.pwa-standalone .mobile-menu,
    body.pwa-standalone .mobile-menu-overlay,
    body.pwa-standalone footer,
    body.pwa-standalone .footer-banner { display: none !important; }

    .clock-col {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .clock-wrap {
        position: relative;
        width: 340px;
        max-width: 100%;
        aspect-ratio: 1 / 1;
        margin: 1rem auto 0.5rem;
    }

    .clock-wrap > svg {
        width: 100%;
        height: 100%;
        transform: rotate(-90deg);
    }

    .ring-bg {
        fill: none;
        stroke: #222;
        stroke-width: 22;
    }

    .ring-fg {
        fill: none;
        stroke: #fff;
        stroke-width: 22;
        stroke-linecap: butt;
        transition: stroke 0.3s ease;
    }
    /* arch-6: snap class disables the 0.25s lerp for instant state
       changes (resetClock, loadTimer, deleteTimer). The view removes
       the class on the next animation frame so subsequent ticks
       animate normally. */
    .ring-fg.no-anim { transition: none; }

    .cue-mark-ring {
        stroke: #000;
        stroke-width: 1;
        fill: none;
        stroke-linecap: butt;
    }
    .cue-mark-ring.start {
        stroke-width: 4;
    }
    .cue-mark-ring.tick {
        stroke: #000;
        stroke-width: 0.5;
        opacity: 0.1;
    }

    .clock-time {
        position: absolute;
        inset: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
    }

    .clock-time .mmss {
        font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
        letter-spacing: -0.25rem;
        font-size: 4.5rem;
        font-weight: 600;
        line-height: 1;
        margin: 1rem 0 0 0;
        cursor: pointer;
        user-select: none;
    }

    .clock-time .label {
        font-size: 0.85rem;
        color: #888;
        text-transform: uppercase;
        letter-spacing: 0.15em;
        min-height: 1em;
    }

    .clock-controls {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 0.15rem;
        margin: 0;
    }

    .ctrl-btn {
        background: #1a1a1a;
        color: #fff;
        border: 1px solid #333;
        border-radius: 999px;
        padding: 0.7rem 1.6rem;
        font-size: 1rem;
        font-weight: 700;
        letter-spacing: 0.1em;
        cursor: pointer;
        text-transform: uppercase;
        min-width: 120px;
    }

    .ctrl-btn.primary {
        background: #fff;
        color: #000;
        width: 52px;
        height: 52px;
        min-width: 0;
        padding: 0;
        border: 0;
        border-radius: 50%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    }

    .ctrl-btn.primary svg {
        width: 22px;
        height: 22px;
        fill: #000;
        pointer-events: none;
    }

    .ctrl-btn.primary.running {
        background: #f1c40f;
    }

    .ctrl-btn:active {
        filter: brightness(0.85);
    }

    .icon-btn {
        background: transparent;
        color: #fff;
        border: 0;
        width: 48px;
        height: 48px;
        font-size: 2rem;
        line-height: 1;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }

    .icon-btn:active {
        filter: brightness(0.85);
    }

    .timers-section h2 {
        font-size: 0.9rem;
        text-transform: uppercase;
        letter-spacing: 0.15em;
        color: #888;
        margin: 1.5rem 0 0.5rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .add-btn {
        background: #2980b9;
        color: #fff;
        border: none;
        border-radius: 3px;
        padding: 0.4rem 0.9rem;
        font-size: 0.85rem;
        font-weight: 700;
        cursor: pointer;
    }

    .settings-btn {
        background: transparent;
        color: #ddd;
        border: 1px solid #333;
        border-radius: 3px;
        padding: 0.25rem 0.55rem;
        font-size: 1.1rem;
        line-height: 1;
        cursor: pointer;
    }
    .settings-btn[aria-expanded="true"] {
        background: #1a1a1a;
        color: #fff;
    }

    .settings-row {
        display: flex;
        flex-direction: column;
        padding: 0.25rem 0.75rem;
        margin: 0 0 0.75rem;
        background: #f5f5f5;
        color: #111;
        border: 1px solid #fff;
        border-radius: 3px;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    }
    .settings-row[hidden] {
        display: none;
    }
    .settings-row .setting {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.7rem 0.25rem;
        cursor: pointer;
        border-bottom: 1px solid #e0e0e0;
    }
    .settings-row .setting:last-child {
        border-bottom: 0;
    }
    .settings-row .setting:hover {
        background: #ececec;
    }
    .settings-row .s-name {
        font-weight: 700;
        font-size: 0.9rem;
        min-width: 3.5em;
        color: #111;
    }
    .settings-row .s-desc {
        flex: 1;
        font-size: 0.78rem;
        color: #555;
        line-height: 1.3;
    }
    /* Switch colours adjusted for the light panel. */
    .settings-row .m-switch {
        color: #555;
    }
    .settings-row .m-switch .m-side {
        color: #999;
    }
    .settings-row .m-switch .m-side.on {
        color: #111;
    }
    .settings-row .m-switch .m-track {
        background: #d4d4d4;
        border-color: #c0c0c0;
        border-radius: 5rem;
    }
    .settings-row .m-switch.checked .m-track {
        background: #111;
        border-color: #111;
    }

    .header-controls {
        display: inline-flex;
        gap: 0.4rem;
        align-items: center;
    }

    .chime-toggle {
        background: #1a1a1a;
        color: #ddd;
        border: 1px solid #333;
        border-radius: 3px;
        padding: 0.4rem 0.7rem;
        font-size: 0.8rem;
        font-weight: 600;
        cursor: pointer;
        text-transform: none;
        letter-spacing: 0;
    }

    .chime-toggle.on {
        border-color: #f1c40f;
        color: #f1c40f;
    }

    /* Material-style toggle switch (used for Tick and Chime). */
    .m-switch {
        display: inline-flex;
        align-items: center;
        gap: 0.45rem;
        font-size: 0.78rem;
        font-weight: 600;
        color: #888;
        user-select: none;
    }
    .m-switch .m-name {
        color: #ddd;
        margin-right: 0.15rem;
        letter-spacing: 0.04em;
    }
    .m-switch .m-side {
        color: #666;
        text-transform: lowercase;
        min-width: 1.8em;
        text-align: center;
    }
    .m-switch .m-side.on {
        color: #fff;
    }
    .m-switch .m-track {
        position: relative;
        width: 38px;
        height: 20px;
        background: #2a2a2a;
        border: 1px solid #333;
        border-radius: 3px;
        cursor: pointer;
        padding: 0;
        transition: background 200ms ease, border-color 200ms ease;
        flex-shrink: 0;
    }
    .m-switch .m-thumb {
        position: absolute;
        top: 1px;
        left: 1px;
        width: 16px;
        height: 16px;
        background: #fff;
        border-radius: 50%;
        transition: transform 220ms cubic-bezier(.4,.0,.2,1), background 200ms ease;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    }
    .m-switch.checked .m-track {
        background: #f1c40f;
        border-color: #f1c40f;
    }
    .m-switch.checked .m-thumb {
        transform: translateX(18px);
        background: #fff;
    }

    .timer-list {
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        overflow: visible;
    }

    .timer-row {
        background: #1a1a1a;
        border: 1px solid #2a2a2a;
        border-radius: 3px;
        padding: 0.7rem 0.9rem;
        display: flex;
        align-items: center;
        gap: 0.6rem;
        cursor: pointer;
        position: relative;
    }

    .timer-row.active {
        border-color: #f1c40f;
        background: #20200f;
    }

    .timer-row .info {
        flex: 1;
        min-width: 0;
    }

    .timer-row .name {
        font-size: 1rem;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .timer-row .meta {
        font-size: 0.8rem;
        color: #888;
        margin-top: 0.15rem;
    }

    .timer-row .duration {
        font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
        font-size: 1.1rem;
        color: #ddd;
        margin-right: 0.3rem;
    }

    .timer-row .edit-link {
        color: #aaa;
        font-size: 0.85rem;
        text-decoration: underline;
        text-underline-offset: 3px;
        cursor: pointer;
        padding: 0.2rem 0.3rem;
    }
    .timer-row .edit-link:hover {
        color: #fff;
    }

    .timer-row button.play {
        background: #fff;
        border: 1px solid #fff;
        color: #000;
        border-radius: 50%;
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
        cursor: pointer;
        padding: 0;
    }

    /* Delete: outside the row, only visible when row is active. */
    .timer-row button.del {
        position: absolute;
        top: 50%;
        right: -42px;
        transform: translateY(-50%);
        background: transparent;
        border: 0;
        color: #fff;
        width: 32px;
        height: 32px;
        padding: 0;
        cursor: pointer;
        display: none;
        line-height: 1;
        align-items: center;
        justify-content: center;
    }
    .timer-row.active button.del {
        display: inline-flex;
    }
    .timer-row button.del:hover {
        color: #e74c3c;
    }
    .timer-row button.del .icon-trash {
        width: 20px;
        height: 20px;
        display: block;
    }

    /* Make sure the absolutely positioned trash icon isn't clipped. */
    .timers-section {
        max-width: 380px;
        overflow: visible;
    }

    /* Mobile: hide the trash icon entirely (its negative-right positioning
       was pushing the document width beyond the viewport, causing horizontal
       overflow). Deletion is still available from the edit modal. */
    @media (max-width: 899px) {
        .timer-row button.del,
        .timer-row.active button.del {
            display: none !important;
        }
        .timers-section,
        .timer-list {
            overflow: hidden;
        }
    }

    .help-panel {
        position: relative;
        margin: 1rem 0 0;
        padding: 0.9rem 2.2rem 0.9rem 1rem;
        background: #15161a;
        border: 1px dashed #333;
        border-radius: 3px;
        color: #bbb;
        font-size: 0.82rem;
        line-height: 1.45;
    }
    .help-panel[hidden] { display: none; }
    .help-panel p {
        margin: 0 0 0.5rem;
    }
    .help-panel p:last-child { margin-bottom: 0; }
    .help-panel strong { color: #fff; }
    .help-panel em {
        font-style: normal;
        font-weight: 600;
        color: #f1c40f;
    }
    .help-panel .help-close {
        position: absolute;
        top: 4px;
        right: 6px;
        background: transparent;
        border: 0;
        color: #888;
        font-size: 1.4rem;
        line-height: 1;
        cursor: pointer;
        padding: 0.2rem 0.4rem;
    }
    .help-panel .help-close:hover { color: #fff; }

    /* ---------- Landscape phone layout ---------- */
    .landscape {
        display: none;
    }

    @media (orientation: landscape) and (hover: none) and (pointer: coarse) {
        body > header,
        body > footer {
            display: none !important;
        }
        .timer-page > .clock-wrap,
        .timer-page > .clock-controls,
        .timer-page > .timers-section {
            display: none;
        }
        .timer-page {
            padding: 0;
            max-width: none;
        }
        .landscape {
            display: grid;
        }
        .ig-topbar {
            display: none;
        }
    }

    .landscape {
        position: fixed;
        inset: 0;
        background: #000;
        color: #eee;
        font-family: system-ui, -apple-system, sans-serif;
        overflow: hidden;
        box-sizing: border-box;
        grid-template-rows: 1fr auto;
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
        padding-bottom: env(safe-area-inset-bottom);
    }
    .landscape * { box-sizing: border-box; }

    .ls-stage {
        min-height: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 0.5rem 1rem;
        overflow: hidden;
    }

    .ls-time {
        font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
        /* Scale with available screen estate, but never exceed ~80% of the
           viewport width (MM:SS in monospace is roughly 2.7em wide, so
           80vw / 2.7 ≈ 29vw — use 28vw to keep a small safety margin). */
        font-size: clamp(5rem, min(60vh, 28vw), 24rem);
        font-weight: 600;
        line-height: 0.9;
        letter-spacing: -0.06em;
        color: #fff;
        cursor: pointer;
        user-select: none;
    }

    .ls-meta {
        margin-top: 0.4rem;
        font-size: 1rem;
        color: #aaa;
        display: flex;
        align-items: center;
        gap: 1.2rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .ls-label {
        font-weight: 600;
        color: #ddd;
    }

    .ls-link {
        color: #f1c40f;
        cursor: pointer;
        text-decoration: underline;
        text-underline-offset: 3px;
        font-weight: 600;
        user-select: none;
    }
    .ls-link:active { opacity: 0.7; }

    .ls-bottom {
        display: grid;
        grid-template-columns: 44px 1fr 44px;
        align-items: center;
        gap: 12px;
        padding: 8px 12px 18px;
        background: #000;
        border-top: 1px solid #1a1a1a;
        width: 100%;
    }

    .ls-icon-btn {
        background: #1a1a1a;
        border: 1px solid #333;
        color: #fff;
        font-size: 1.2rem;
        line-height: 1;
        width: 44px;
        height: 44px;
        border-radius: 3px;
        cursor: pointer;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .ls-icon-btn:active { filter: brightness(0.85); }

    .ls-progress {
        position: relative;
        height: 28px;
        min-width: 0;
        width: 100%;
        overflow: hidden;
    }
    .ls-progress svg {
        display: block;
        width: 100%;
        height: 100%;
    }
    .ls-bar-bg { fill: #222; }
    .ls-bar-fg {
        fill: #fff;
        transition: fill 0.3s ease;
    }
    .ls-bar-fg.no-anim { transition: none; }
    .ls-progress .cue-mark {
        stroke: #fff;
        stroke-width: 2;
        vector-effect: non-scaling-stroke;
    }
    .ls-progress .cue-mark.end { stroke-width: 4; }
    .ls-progress .cue-mark.tick {
        stroke: #fff;
        stroke-width: 0.5;
        opacity: 0.35;
        vector-effect: non-scaling-stroke;
    }

    .ls-panel {
        /* Anchor directly to the viewport — using `absolute` inside
           `.landscape` (which carries safe-area padding) shrank the panel
           and clipped its scrollable body on iPad. */
        position: fixed;
        top: 0;
        right: 0;
        width: min(360px, 88vw);
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        background: #0c0c0c;
        border-left: 1px solid #222;
        transform: translateX(105%);
        transition: transform 0.22s ease;
        z-index: 30;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    .ls-panel.open {
        transform: translateX(0);
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
    }
    .ls-panel-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.7rem 0.8rem;
        border-bottom: 1px solid #1a1a1a;
        gap: 0.4rem;
    }
    .ls-panel-header .header-controls {
        display: inline-flex;
        gap: 0.3rem;
    }
    .ls-panel-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0.6rem 0.8rem max(1rem, env(safe-area-inset-bottom));
    }
    /* Tighten heading inside the slide-over panel (no top spacer). */
    .ls-panel-body.timers-section h2 {
        margin-top: 0;
    }
    .ls-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 20;
        display: none;
    }
    .ls-backdrop.open { display: block; }

    .modal-back {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.75);
        display: none;
        align-items: center;
        justify-content: center;
        z-index: 100;
        padding: 1rem;
    }

    .modal-back.open {
        display: flex;
    }

    .modal {
        background: #fafafa;
        border: 1px solid #d0d0d0;
        border-radius: 3px;
        padding: 1.2rem;
        width: 100%;
        max-width: 420px;
        color: #1a1a1a;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    }

    .modal h3 {
        margin: 0 0 1rem;
        font-size: 1.1rem;
        color: #111;
    }

    .form-row {
        display: flex;
        flex-direction: column;
        gap: 0.3rem;
        margin-bottom: 0.9rem;
    }

    .form-row label {
        font-size: 0.8rem;
        color: #666;
        text-transform: uppercase;
        letter-spacing: 0.1em;
    }

    .form-row input[type="text"],
    .form-row input[type="number"] {
        background: #fff;
        border: 1px solid #ccc;
        color: #111;
        border-radius: 3px;
        padding: 0.6rem 0.7rem;
        font-size: 1rem;
        font-family: inherit;
    }

    .chime-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }

    .chime-chip {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        background: #fff;
        border: 1px solid #ccc;
        border-radius: 3px;
        padding: 0.5rem 0.6rem;
        font-size: 0.9rem;
        color: #222;
        cursor: pointer;
        user-select: none;
    }

    .chime-chip.on {
        border-color: #b8860b;
        color: #b8860b;
        background: #fff8e1;
    }

    .chime-chip input {
        accent-color: #b8860b;
    }

    .ten-mode-row {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.6rem;
        margin-top: 0.5rem;
        padding: 0.5rem 0.6rem;
        background: #fff;
        border: 1px solid #ccc;
        border-radius: 3px;
        font-size: 0.85rem;
        color: #333;
    }

    .ten-mode-row label {
        display: inline-flex;
        align-items: center;
        gap: 0.3rem;
        cursor: pointer;
    }

    .ten-mode-row input {
        accent-color: #b8860b;
    }

    .custom-cues {
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
    }

    .custom-cue-row {
        display: flex;
        gap: 0.4rem;
        align-items: center;
    }

    .custom-cue-row input {
        flex: 1;
    }

    .custom-cue-row button {
        background: transparent;
        border: 1px solid #ccc;
        color: #c0392b;
        border-radius: 3px;
        padding: 0.4rem 0.7rem;
        cursor: pointer;
    }

    .add-cue-btn {
        background: transparent;
        border: 1px dashed #aaa;
        color: #555;
        border-radius: 3px;
        padding: 0.5rem;
        cursor: pointer;
        font-size: 0.85rem;
        margin-top: 0.3rem;
    }

    .modal-actions {
        display: flex;
        gap: 0.6rem;
        margin-top: 1rem;
    }

    .modal-actions button {
        flex: 1;
        padding: 0.8rem;
        border-radius: 3px;
        border: none;
        font-weight: 700;
        font-size: 1rem;
        cursor: pointer;
    }

    .btn-cancel {
        background: #e5e5e5;
        color: #222;
    }

    .btn-save {
        background: #111;
        color: #fff;
    }

    .btn-delete {
        background: #e74c3c;
        color: #fff;
        flex: 0 0 auto !important;
        margin-right: auto;
    }
    .btn-delete[hidden] { display: none !important; }

    /* Join (tether) dialog — native <dialog> */
    .join-dialog {
        border: 1px solid #d0d0d0;
        border-radius: 3px;
        padding: 0;
        background: #fafafa;
        color: #1a1a1a;
        max-width: 360px;
        width: 90%;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    }
    .join-dialog::backdrop {
        background: rgba(0, 0, 0, 0.75);
    }
    .join-dialog form {
        padding: 1.2rem;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 0.8rem;
    }
    .join-dialog h3 {
        margin: 0;
        font-size: 1.1rem;
        color: #111;
    }
    .join-desc {
        margin: 0;
        font-size: 0.9rem;
        color: #555;
        line-height: 1.4;
    }
    .join-dialog input {
        background: #fff;
        border: 1px solid #ccc;
        color: #111;
        border-radius: 3px;
        padding: 0.7rem 0.7rem;
        font-size: 1.4rem;
        font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
        letter-spacing: 0.3em;
        text-align: center;
    }
    .join-dialog .join-error {
        font-size: 0.85rem;
        color: #c0392b;
        min-height: 1.1em;
    }
    .join-actions {
        display: flex;
        gap: 0.6rem;
    }
    .join-actions button {
        flex: 1;
        padding: 0.7rem;
        border-radius: 3px;
        border: none;
        font-weight: 700;
        font-size: 1rem;
        cursor: pointer;
        font-family: inherit;
    }

    html,
    body {
        background: #000;
        color: #eee;
        font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    }

    @media (orientation: landscape) and (hover: none) and (pointer: coarse) {
        html, body {
            overflow: hidden;
            width: 100vw;
            max-width: 100vw;
            margin: 0;
            padding: 0;
        }
    }

    /* Force the shared v3 header to be visible on the black timer page. */
    body > header {
        background: rgba(0, 0, 0, 0.85) !important;
        color: #fff !important;
        backdrop-filter: blur(8px);
    }
    body > header .logo {
        background: transparent !important;
    }

    /* ---------- Desktop layout (two flex columns: clock | timers, vertically centred) ---------- */
    @media (min-width: 900px) {
        .timer-page {
            flex-direction: row;
            align-items: center;
            justify-content: center;
            gap: 4rem;
            max-width: 1100px;
            padding: 5rem 2rem 2rem;
            min-height: 100vh;
        }

        .clock-col {
            flex: 1 1 0;
            min-width: 0;
            max-width: 600px;
        }

        .clock-wrap {
            width: 500px;
            max-width: 100%;
        }

        .timers-section {
            flex: auto;
            margin: 0;
            align-self: center;
        }

        .timers-section h2 {
            margin-top: 0;
        }

        .clock-time .mmss {
            font-size: 7rem;
        }
    }

    /* ---------- Sync (Ably) UI ---------- */
    .sync-setting {
        position: relative;
    }
    .sync-actions {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.4rem;
        flex-shrink: 0;
        min-width: 88px;
        align-items: stretch;
    }
    .sync-actions .add-btn {
        width: 100%;
        font-family: inherit;
    }
    .sync-actions .add-btn:hover { filter: brightness(0.9); }

    /* Tether-pending yellow banner */
    .sync-banner-x {
        background: transparent;
        border: 0;
        color: #111;
        font-size: 1.4rem;
        line-height: 1;
        cursor: pointer;
        padding: 0.2rem 0.5rem;
        margin-left: 0.2rem;
    }
    .sync-banner-x:hover { color: #c0392b; }
    .sync-actions .add-btn:hover { filter: brightness(0.9); }

    .sync-banner {
        display: flex;
        align-items: center;
        gap: 0.8rem;
        margin-top: 0.75rem;
        padding: 0.7rem 0.9rem;
        background: #f1c40f;
        color: #111;
        border-radius: 3px;
        font-size: 0.9rem;
    }
    .sync-banner[hidden] { display: none; }
    .sync-banner.slave {
        background: #2e86de;
        color: #fff;
    }
    .sync-banner-label { font-weight: 700; }
    .sync-banner-code {
        font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
        font-size: 1.4rem;
        letter-spacing: 0.2em;
        font-weight: 700;
        margin-left: 0.4rem;
    }
    .sync-banner-btn {
        margin-left: auto;
        background: #111;
        color: #fff;
        border: 0;
        border-radius: 3px;
        padding: 0.45rem 0.8rem;
        font-weight: 600;
        cursor: pointer;
        font-family: inherit;
    }
    .sync-banner.slave .sync-banner-btn { background: #fff; color: #111; }

    .sync-banner-resync {
        margin-left: auto;
        background: transparent;
        color: inherit;
        border: 1px solid currentColor;
        border-radius: 3px;
        padding: 0.45rem 0.8rem;
        font-weight: 600;
        cursor: pointer;
        font-family: inherit;
    }
    .sync-banner-resync + .sync-banner-btn { margin-left: 0.5rem; }

    /* Slave-mode lockdown: hide non-clock UI, leave the clock visible */
    body.slave-mode > header,
    body.slave-mode > footer,
    body.slave-mode .timers-section,
    body.slave-mode .clock-time .ctrl-btn.primary,
    body.slave-mode .clock-time .icon-btn {
        display: none !important;
    }
    /* With chrome hidden, let the clock centre in the actual viewport
       instead of inside a 100vh block offset by the page header. */
    body.slave-mode .timer-page {
        min-height: 100dvh;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    body.slave-mode .clock-col .clock-label {
        opacity: 0.7;
    }
    /* Inline DETACH button replaces PLAY/RESET in slave mode */
    .ctrl-btn.slave-detach-inline {
        display: none;
        background: #2e86de;
        color: #fff;
    }
    body.slave-mode .ctrl-btn.slave-detach-inline { display: inline-flex; }
    .ctrl-btn.slave-detach-inline:hover { filter: brightness(1.05); }

    /* Landscape slave-mode: keep the progress bar visible, hide play/menu icons + non-detach meta links */
    body.slave-mode .ls-bottom .ls-icon-btn { display: none !important; }
    /* With the play + menu buttons hidden, collapse the grid so the
       progress bar spans the full width of the bottom bar. */
    body.slave-mode .ls-bottom { grid-template-columns: 1fr; }
    body.slave-mode .ls-meta .ls-link:not(.ls-detach-link) { display: none !important; }
    .ls-link.ls-detach-link { display: none; color: #2e86de; }
    body.slave-mode .ls-link.ls-detach-link { display: inline; }
