/* Shared planner styles for the homepage and every pair page. Pair pages load assets/pair.css after this file. */
        :root {
            --bg: #060913;
            --card: #0d1424;
            --line: rgba(255, 255, 255, 0.08);
            --text: #f8fafc;
            --muted: #94a3b8;
            --cyan: #00f0ff;
            --work: #059669;
            --shoulder: #d97706;
            --night: #991b1b;
            --work-ink: #fff;
            --shoulder-ink: #fff;
            --night-ink: #fff;
            --night-stripe: rgba(0,0,0,0.16);
            --hour-edge: rgba(0,0,0,0.18);
            --track: #04060b;
            --weekend-wash: rgba(255, 255, 255, 0.2);
            --weekend-dot: rgba(255, 255, 255, 0.95);
            --weekend-mark: 3px;
        }
        html.light {
            --bg: #f1f5f9;
            --card: #ffffff;
            --line: rgba(15, 23, 42, 0.1);
            --text: #0f172a;
            --muted: #64748b;
            --cyan: #0284c7;
            --track: #e2e8f0;
            /* Light-mode hour palette: lighter fills, dark labels (AA: 6.4 / 5.6 / 6.7:1, 5.4:1 on night stripes). */
            --work: #6ee7b7;
            --shoulder: #fdba74;
            --night: #fca5a5;
            --work-ink: #064e3b;
            --shoulder-ink: #7c2d12;
            --night-ink: #651313;
            --night-stripe: rgba(127,29,29,0.14);
            --hour-edge: rgba(15,23,42,0.12);
            --shoulder-text: #9a3412;
            --night-text: #b91c1c;
            /* Heavier stitch on the pastel hour fills: 5px near-black dots and a stronger wash. */
            --weekend-wash: rgba(15, 23, 42, 0.28);
            --weekend-dot: #020617;
            --weekend-mark: 5px;
        }
        :root { color-scheme: dark; }
        html.light { color-scheme: light; }
        * { box-sizing: border-box; margin: 0; padding: 0; }
        body {
            font-family: Outfit, system-ui, sans-serif;
            background: var(--bg);
            color: var(--text);
            min-height: 100vh;
        }
        header {
            display: flex;
            justify-content: space-between;
            gap: 16px;
            flex-wrap: wrap;
            align-items: center;
            padding: 22px 28px;
            border-bottom: 1px solid var(--line);
            position: sticky;
            top: 0;
            z-index: 20;
            background: color-mix(in srgb, var(--bg) 88%, transparent);
            backdrop-filter: blur(12px);
        }
        h1 { font-size: 1.7rem; letter-spacing: 0.06em; font-weight: 800; }
        .title-row { display: flex; align-items: center; gap: 12px; }
        .dot {
            width: 10px; height: 10px; border-radius: 50%;
            background: #10b981; box-shadow: 0 0 8px #10b981;
        }
        .badge {
            border: 1px solid color-mix(in srgb, var(--cyan) 45%, transparent);
            color: var(--cyan);
            border-radius: 999px;
            padding: 4px 10px;
            font-size: 0.72rem;
            font-weight: 700;
            letter-spacing: 0.08em;
        }
        .subtitle { color: var(--muted); margin-top: 6px; font-size: 0.92rem; }
        /* The visible page heading keeps the subtitle's size and colour. The keyword sits on its own short line. */
        h1.subtitle { font-weight: 400; letter-spacing: normal; line-height: 1.45; }
        .subtitle-lead { display: block; }
        .controls { display: flex; gap: 10px; flex-wrap: wrap; }
        button, input, select { font-family: inherit; }
        .btn {
            background: #1e293b;
            color: var(--text);
            border: 1px solid var(--line);
            border-radius: 12px;
            padding: 10px 16px;
            font-weight: 600;
            cursor: pointer;
        }
        html.light .btn { background: #fff; }
        html.light .btn.primary { background: #0284c7; color: #fff; }
        .btn.primary { background: #0284c7; color: #fff; border: none; }
        main { max-width: 1400px; margin: 0 auto; padding: 22px 28px 64px; }
        .hint-row {
            display: flex; justify-content: space-between; color: var(--muted);
            font-size: 1.05rem; margin-bottom: 14px;
        }
        .corner { font-size: 1.05rem; }
        .stack { position: relative; display: flex; flex-direction: column; gap: 16px; cursor: grab; user-select: none; touch-action: pan-y; }
        .stack.dragging { cursor: grabbing; }
        .playhead {
            position: absolute; top: -8px; bottom: -8px; left: 50%; width: 2px;
            background: var(--cyan); box-shadow: 0 0 10px var(--cyan);
            transform: translateX(-1px); pointer-events: none; z-index: 5;
        }
        .playhead i {
            position: absolute; left: 50%; width: 22px; height: 11px;
            border: 2px solid var(--cyan); transform: translateX(-50%);
            background: var(--bg);
        }
        .playhead i.top {
            top: -11px;
            border-bottom: none;
            border-radius: 11px 11px 0 0;
            background: var(--bg);
            border-color: var(--cyan);
            animation: cap-pulse 1.8s ease-in-out infinite;
        }
        .playhead i.top::after {
            content: "";
            position: absolute;
            left: 3px;
            right: 3px;
            top: 3px;
            bottom: 0;
            background: var(--cyan);
            border-radius: 8px 8px 0 0;
            animation: cap-pulse 1.8s ease-in-out infinite;
        }
        @keyframes cap-pulse {
            0%, 100% { box-shadow: 0 0 4px var(--cyan); }
            50% { box-shadow: 0 0 14px var(--cyan), 0 0 22px rgba(0, 240, 255, 0.75); }
        }
        .sync-dot {
            width: 9px;
            height: 9px;
            border-radius: 50%;
            background: #10b981;
            box-shadow: 0 0 8px #10b981;
            animation: dot-pulse 1.8s ease-in-out infinite;
        }
        @keyframes dot-pulse {
            0%, 100% { transform: scale(1); opacity: 0.75; box-shadow: 0 0 4px #10b981; }
            50% { transform: scale(1.25); opacity: 1; box-shadow: 0 0 12px #10b981; }
        }
        .sync-label { display: flex; align-items: center; gap: 8px; font-size: 1.12rem; }
        .now-clock { font-size: 1.2rem; }
        .playhead i.bot { bottom: -11px; border-top: none; border-radius: 0 0 11px 11px; }
        .card {
            background: var(--card);
            border: 1px solid var(--line);
            border-radius: 16px;
            padding: 18px 20px 16px;
            position: relative;
        }
        .card-head { display: flex; align-items: flex-start; margin-bottom: 14px; }
        .city-line { display: flex; align-items: center; gap: 10px; }
        .card h3 { letter-spacing: 0.04em; font-size: 1.05rem; }
        .card p { color: var(--muted); font-size: 0.8rem; }
        .remove {
            background: #1e293b;
            color: var(--text);
            border: 1px solid var(--line);
            border-radius: 12px;
            padding: 8px 14px;
            font-size: 0.85rem;
            font-weight: 600;
            cursor: pointer;
            position: relative;
            z-index: 8;
        }
        html.light .remove { background: #fff; }
        /* Day/week jumps hug the playhead: a 28px gutter is left open for the line (pairs sit 14px either side of centre). */
        .jump-row { display: grid; grid-template-columns: 1fr 28px 1fr; gap: 0; margin: -4px 0 12px; }
        /* Each pair is one joined pill: no gap, borders overlap into a single divider, outer corners rounded only. */
        .jump-row > div { display: flex; gap: 0; }
        .jump-row .jump { border-radius: 0; }
        .jump-row .jump + .jump { margin-inline-start: -1px; }
        .jump-row .jump:first-child { border-start-start-radius: 10px; border-end-start-radius: 10px; }
        .jump-row .jump:last-child { border-start-end-radius: 10px; border-end-end-radius: 10px; }
        .jump-row > div:first-child { grid-column: 1; justify-self: end; }
        .jump-row > div:last-child { grid-column: 3; justify-self: start; }
        .jump {
            background: #1e293b; color: var(--text); border: 1px solid var(--line);
            border-radius: 10px; padding: 6px 12px; font-size: 0.8rem; font-weight: 600;
            cursor: pointer; position: relative; z-index: 8; font-family: inherit;
        }
        .jump:hover { border-color: var(--cyan); z-index: 9; }
        .jump:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; z-index: 10; }
        html.light .jump { background: #fff; }
        .now-clock {
            color: var(--text);
            font-weight: 700;
            margin-left: 4px;
            font-size: 1.2rem;
            font-variant-numeric: tabular-nums;
        }
        .flag {
            position: absolute; top: 16px; left: calc(50% + 14px); z-index: 6;
            display: flex; gap: 8px; align-items: center;
            background: #090d16; color: #fff;
            border: 1px solid color-mix(in srgb, var(--cyan) 45%, transparent);
            border-radius: 10px; padding: 6px 10px; pointer-events: none;
        }
        html.light .flag { background: #fff; color: var(--text); }
        .flag b { font-size: 0.95rem; }
        .flag span { color: var(--cyan); font-size: 0.75rem; font-weight: 700; }
        .flag em { font-style: normal; color: var(--muted); font-size: 0.75rem; background: rgba(255,255,255,0.06); padding: 2px 6px; border-radius: 4px; }
        /* Transparent border is always reserved so the pill doesn't change the badge width at midnight. */
        .flag .date { border: 1.5px solid transparent; border-radius: 999px; padding: 0 6px; line-height: 1.35; white-space: nowrap; }
        .flag[data-weekend] .date { border-color: currentColor; }
        /* Light date text: #0284c7 on the white badge is 4.1:1. #0277b3 is 4.9:1 (AA). Dark mode keeps --cyan. */
        html.light .flag .date { color: #0277b3; }
        @keyframes day-roll {
            0% { box-shadow: 0 0 0 0 transparent; }
            30% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan) 55%, transparent), 6px 0 22px 2px color-mix(in srgb, var(--cyan) 55%, transparent); border-color: var(--cyan); }
            100% { box-shadow: 0 0 0 0 transparent; }
        }
        @keyframes day-roll-text { 30% { text-shadow: 0 0 10px var(--cyan); } }
        @keyframes day-roll-static {
            0%, 99.9% { outline: 2px solid var(--cyan); outline-offset: 2px; }
            100% { outline: none; }
        }
        .flag.rolled { animation: day-roll 900ms ease-out; }
        .flag.rolled .date { animation: day-roll-text 900ms ease-out; }
        @media (prefers-reduced-motion: reduce) {
            .flag.rolled { animation: day-roll-static 1200ms linear; }
            .flag.rolled .date { animation: none; }
        }
        .track {
            position: relative; height: 54px; overflow: hidden; border-radius: 10px;
            background: var(--track); border: 1px solid var(--line); touch-action: pan-y;
        }
        .strip { position: absolute; top: 0; left: 0; height: 100%; display: flex; will-change: transform; }
        .hour {
            width: 100px; height: 100%; flex: none;
            display: flex; align-items: center; justify-content: center;
            font-weight: 700; font-size: 0.85rem; color: #fff;
            border-right: 1px solid var(--hour-edge);
        }
        .hour.work { background: var(--work); color: var(--work-ink); }
        .hour.shoulder { background: var(--shoulder); color: var(--shoulder-ink); }
        .hour.night {
            background: var(--night); color: var(--night-ink);
            background-image: repeating-linear-gradient(45deg, var(--night-stripe) 0 10px, transparent 10px 20px);
        }
        /* Weekend hours keep work/early/night colours. One attribute on the strip selects them;
           the cells themselves are not rewritten while the bar moves. Dots and wash are
           background layers, so they rasterize once inside the transformed strip. A dotted
           border plus a 999px inset shadow is a paint record on every hour. Forced colors
           drops background images, so the CanvasText border stays. */
        .strip[data-weekend="fri"] .hour:nth-child(n + 49),
        .strip[data-weekend="sat"] .hour:nth-child(n + 25),
        .strip[data-weekend="sun"] .hour:nth-child(-n + 48),
        .strip[data-weekend="mon"] .hour:nth-child(-n + 24) {
            border-top: 0;
            box-shadow: none;
            background-image:
                radial-gradient(circle, var(--weekend-dot) calc(var(--weekend-mark) / 2), transparent calc(var(--weekend-mark) / 2 + 0.5px)),
                linear-gradient(var(--weekend-wash), var(--weekend-wash));
            background-size: calc(var(--weekend-mark) * 2) var(--weekend-mark), auto;
            background-repeat: repeat-x, no-repeat;
            background-position: left top, 0 0;
        }
        .strip[data-weekend="fri"] .hour.night:nth-child(n + 49),
        .strip[data-weekend="sat"] .hour.night:nth-child(n + 25),
        .strip[data-weekend="sun"] .hour.night:nth-child(-n + 48),
        .strip[data-weekend="mon"] .hour.night:nth-child(-n + 24) {
            background-image:
                radial-gradient(circle, var(--weekend-dot) calc(var(--weekend-mark) / 2), transparent calc(var(--weekend-mark) / 2 + 0.5px)),
                linear-gradient(var(--weekend-wash), var(--weekend-wash)),
                repeating-linear-gradient(45deg, var(--night-stripe) 0 10px, transparent 10px 20px);
            background-size: calc(var(--weekend-mark) * 2) var(--weekend-mark), auto, auto;
            background-repeat: repeat-x, no-repeat, repeat;
            background-position: left top, 0 0, 0 0;
        }
        .sw.work { background: var(--work); }
        .sw.shoulder { background: var(--shoulder); }
        .sw.night { background: var(--night); }
        /* border-style: dotted does not paint on a small swatch. The weekend line sits on any
           hour colour, so the chip is only the dots, with a transparent fill. */
        .sw.weekend {
            width: 28px;
            background-color: transparent;
            background-image: repeating-linear-gradient(to right, var(--weekend-dot) 0 3px, transparent 3px 7px);
            background-size: auto var(--weekend-mark);
            background-repeat: repeat-x;
            background-position: left center;
        }
        @media (forced-colors: active) {
            .strip[data-weekend="fri"] .hour:nth-child(n + 49),
            .strip[data-weekend="sat"] .hour:nth-child(n + 25),
            .strip[data-weekend="sun"] .hour:nth-child(-n + 48),
            .strip[data-weekend="mon"] .hour:nth-child(-n + 24),
            .strip[data-weekend="fri"] .hour.night:nth-child(n + 49),
            .strip[data-weekend="sat"] .hour.night:nth-child(n + 25),
            .strip[data-weekend="sun"] .hour.night:nth-child(-n + 48),
            .strip[data-weekend="mon"] .hour.night:nth-child(-n + 24) {
                box-shadow: none;
                background-image: none;
                border-top: 3px dotted CanvasText;
            }
            .sw.weekend {
                background: Canvas;
                border: 1px solid CanvasText;
                border-top: 3px dotted CanvasText;
            }
        }
        html.light .sw.night { background-image: repeating-linear-gradient(45deg, var(--night-stripe) 0 3px, transparent 3px 6px); }
        html.light .sw:not(.weekend) { box-shadow: inset 0 0 0 1px rgba(15,23,42,0.18); }
        .add {
            margin: 36px auto 0;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            background: #0284c7;
            color: #fff;
            border: none;
            border-radius: 14px;
            padding: 14px 28px;
            font-size: 1rem;
            font-weight: 700;
            cursor: pointer;
            box-shadow: 0 8px 24px rgba(2, 132, 199, 0.35);
        }
        .add:hover { background: #0369a1; }
        footer {
            display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
            margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line);
            color: var(--muted); font-size: 1.05rem;
        }
        /* Homepage "Popular conversions": one quiet line of links to the pair pages (list filled by scripts/build-pairs.mjs). */
        .popular { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-top: 18px; color: var(--muted); font-size: 0.85rem; }
        .popular h2 { font-size: inherit; font-weight: 600; }
        .popular ul { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; }
        .popular a { color: inherit; text-underline-offset: 3px; }
        .popular a:hover { color: var(--text); }
        .popular a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 3px; }
        .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; margin-right: 6px; }
        .modal {
            position: fixed; inset: 0; background: rgba(6,9,19,0.78);
            display: none; align-items: center; justify-content: center; z-index: 30;
        }
        .modal.open { display: flex; }
        .sheet {
            width: min(460px, calc(100% - 32px));
            background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px;
        }
        .sheet input {
            width: 100%; margin-top: 8px; background: var(--bg); color: var(--text);
            border: 1px solid var(--line); border-radius: 10px; padding: 12px;
        }
        .hits { margin-top: 10px; max-height: 220px; overflow: auto; }
        .hits button {
            width: 100%; text-align: left; background: none; color: var(--text);
            border: none; border-radius: 8px; padding: 8px 10px; cursor: pointer;
        }
        .hits button:hover { background: rgba(0,240,255,0.08); }
        .toast {
            position: fixed; right: 20px; bottom: 20px; background: #0f172a; color: #fff;
            border: 1px solid color-mix(in srgb, var(--cyan) 40%, transparent);
            border-radius: 12px; padding: 12px 16px; opacity: 0; transform: translateY(8px);
            transition: opacity 0.2s ease, transform 0.2s ease; pointer-events: none; z-index: 100;
            max-width: calc(100vw - 16px); box-sizing: border-box;
        }
        .toast.show { opacity: 1; transform: none; }
        /* Anchored toast: a small popover just below (or, near the bottom edge, above) the button that triggered it. */
        .toast.anchored {
            right: auto; bottom: auto; padding: 8px 12px; font-size: 0.85rem; border-radius: 10px;
            white-space: nowrap; transform: translateY(-4px); box-shadow: 0 6px 20px rgba(0,0,0,0.35);
        }
        .toast.anchored.above { transform: translateY(4px); }
        .toast.anchored.show { transform: none; }
        .toast.anchored::before {
            content: ""; position: absolute; top: -6px; left: var(--arrow-x, 50%); width: 10px; height: 10px;
            background: inherit; border: inherit; border-width: 1px 0 0 1px; border-radius: 2px 0 0 0;
            transform: translateX(-50%) rotate(45deg);
        }
        .toast.anchored.above::before { top: auto; bottom: -6px; border-width: 0 1px 1px 0; border-radius: 0 0 2px 0; }
        .cdn-note { color: #f59e0b; font-size: 0.8rem; margin-top: 6px; }
        .logo { line-height: 0; margin-left: -6px; }
        .logo img { height: 88px; width: auto; max-width: 100%; display: block; }
        .logo-light { display: none !important; }
        html.light .logo-light { display: block !important; }
        html.light .logo-dark { display: none !important; }
        .btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
        .btn svg { width: 16px; height: 16px; flex: none; }
        .lbl-short { display: none; }
        /* Theme switcher (System / Light / Dark), same pattern as ElNinoTrack: icon button + small radio menu. Quiet style. */
        .theme-switch { position: relative; display: flex; }
        .theme-switch__btn svg { width: 18px; height: 18px; }
        .theme-switch__icon--dark { display: none; }
        html.dark .theme-switch__icon--light { display: none; }
        html.dark .theme-switch__icon--dark { display: block; }
        .theme-switch__menu {
            position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 220px;
            display: grid; gap: 2px; padding: 6px;
            background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 12px;
            box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
        }
        .theme-switch__menu[hidden] { display: none; }
        .theme-switch__option {
            display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; align-items: center;
            width: 100%; min-height: 44px; padding: 6px 10px; border: 0; border-radius: 8px;
            background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
        }
        .theme-switch__option:hover { background: color-mix(in srgb, var(--cyan) 10%, transparent); }
        .theme-switch__option:focus-visible { outline: 3px solid var(--text); outline-offset: 1px; }
        .theme-switch__option[aria-checked="true"] { background: color-mix(in srgb, var(--cyan) 14%, transparent); }
        .theme-switch__check { width: 16px; height: 16px; visibility: hidden; color: var(--cyan); }
        .theme-switch__option[aria-checked="true"] .theme-switch__check { visibility: visible; }
        .theme-switch__name { display: block; font-size: 0.92rem; font-weight: 600; line-height: 1.2; }
        .theme-switch__hint { display: block; font-size: 0.75rem; color: var(--muted); line-height: 1.3; }
        /* "Hot" actions: Share link + Add to Calendar. Vivid cyan like the playhead, dark label for contrast (AA in both themes). */
        .btn.hot, html.light .btn.hot {
            background: linear-gradient(135deg, #67e8f9 0%, #22d3ee 55%, #00f0ff 100%);
            color: #04222b; border: 1px solid #0891b2;
            box-shadow: 0 0 0 1px rgba(0, 240, 255, 0.25), 0 4px 18px rgba(0, 240, 255, 0.32);
            font-weight: 700;
            transition: box-shadow 0.2s ease, transform 0.2s ease, filter 0.2s ease;
        }
        html.light .btn.hot { box-shadow: 0 4px 14px rgba(8, 145, 178, 0.35); }
        .btn.hot:hover { filter: brightness(1.06); box-shadow: 0 0 0 1px rgba(0, 240, 255, 0.45), 0 6px 24px rgba(0, 240, 255, 0.5); transform: translateY(-1px); }
        .btn.hot svg { stroke-width: 2.4; }
        .btn:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
        .btn.hot:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
        @keyframes hot-pulse {
            0% { box-shadow: 0 0 0 0 rgba(0, 240, 255, 0.7), 0 4px 18px rgba(0, 240, 255, 0.32); }
            70% { box-shadow: 0 0 0 12px rgba(0, 240, 255, 0), 0 4px 18px rgba(0, 240, 255, 0.32); }
            100% { box-shadow: 0 0 0 0 rgba(0, 240, 255, 0), 0 4px 18px rgba(0, 240, 255, 0.32); }
        }
        .controls.hot-pulse .btn.hot { animation: hot-pulse 1.6s ease-out 0.6s 3; }
        .controls.hot-pulse #share { animation-delay: 0.85s; }
        .controls.hot-pulse #copy { animation-delay: 1.1s; }
        @media (prefers-reduced-motion: reduce) {
            .controls.hot-pulse .btn.hot { animation: none; }
            .btn.hot:hover { transform: none; }
        }
        /* Add to Calendar dialog */
        .cal-dialog {
            width: min(500px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); margin: auto;
            background: var(--card); color: var(--text); border: 1px solid var(--line);
            border-radius: 18px; padding: 0; overflow: auto;
            box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
        }
        .cal-dialog::backdrop { background: rgba(6, 9, 19, 0.72); }
        html.light .cal-dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
        .cal-form { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 16px; }
        .cal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
        .cal-head h2 { font-size: 1.2rem; font-weight: 700; }
        .cal-x {
            background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 10px;
            width: 36px; height: 36px; font-size: 1.3rem; line-height: 1; cursor: pointer; font-family: inherit;
        }
        .cal-x:hover { color: var(--text); border-color: var(--cyan); }
        .cal-k { color: var(--muted); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
        .cal-start { font-size: 1.35rem; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
        .cal-start small { display: block; color: var(--muted); font-size: 0.82rem; font-weight: 500; margin-top: 2px; }
        .cal-dur { border: none; }
        .cal-dur legend { margin-bottom: 8px; }
        .dur-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
        .dur-btn {
            background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
            padding: 9px 4px; font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; white-space: nowrap;
        }
        .dur-btn:hover { border-color: var(--cyan); }
        .dur-btn[aria-pressed="true"] { background: #0284c7; border-color: #0284c7; color: #fff; }
        .dur-custom { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 0.85rem; }
        .dur-custom input {
            width: 84px; background: var(--bg); color: var(--text); border: 1px solid var(--line);
            border-radius: 8px; padding: 7px 9px; font: inherit; font-size: 0.9rem;
        }
        .dur-custom input:focus-visible, .dur-btn:focus-visible, .cal-x:focus-visible, .cal-actions .btn:focus-visible {
            outline: 2px solid var(--cyan); outline-offset: 2px;
        }
        .cal-cities { list-style: none; display: flex; flex-direction: column; gap: 6px; }
        .cal-city {
            display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px;
            background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
        }
        .cal-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
        .cal-city b { font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .wkend-tag {
            flex: none; font-size: 0.72rem; font-weight: 700; line-height: 1.35;
            border: 1.5px solid currentColor; border-radius: 999px; padding: 1px 7px;
        }
        .cal-weekend { margin: 0 0 8px; font-size: 0.85rem; font-weight: 600; }
        .cal-city .span { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 0.95rem; white-space: nowrap; }
        .cal-city .span .end { padding: 1px 6px; border-radius: 6px; }
        .cal-city .note { grid-column: 1 / -1; color: var(--muted); font-size: 0.75rem; }
        .cal-city.shoulder .end { background: var(--shoulder); color: #fff; }
        .cal-city.night .end { background: var(--night); color: #fff; }
        .cal-city.shoulder { border-color: color-mix(in srgb, var(--shoulder) 55%, transparent); }
        .cal-city.night { border-color: color-mix(in srgb, var(--night) 65%, transparent); }
        .cal-city.shoulder .note { color: var(--shoulder); }
        .cal-city.night .note { color: #ef4444; }
        html.light .cal-city.shoulder .end { color: var(--shoulder-ink); }
        html.light .cal-city.night .end { color: var(--night-ink); }
        html.light .cal-city.shoulder { border-color: color-mix(in srgb, var(--shoulder-text) 45%, transparent); }
        html.light .cal-city.night { border-color: color-mix(in srgb, var(--night-text) 45%, transparent); }
        html.light .cal-city.shoulder .note { color: var(--shoulder-text); }
        html.light .cal-city.night .note { color: var(--night-text); }
        .cal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
        .cal-actions .btn, .act-row .btn { text-decoration: none; padding: 12px 14px; }
        .cal-form [hidden] { display: none !important; }
        .act-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
        .act-link {
            width: 100%; min-width: 0; background: var(--bg); color: var(--text); border: 1px solid var(--line);
            border-radius: 10px; padding: 11px 12px; font: inherit; font-size: 0.82rem;
        }
        .act-copy { display: flex; flex-direction: column; gap: 10px; }
        .act-preview {
            background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
            padding: 10px 12px; max-height: 150px; overflow: auto; white-space: pre;
            font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.74rem; line-height: 1.45;
        }
        .act-copy .btn { align-self: stretch; padding: 12px 14px; }
        .act-status { color: var(--muted); font-size: 0.8rem; margin-top: -6px; }
        .act-status:empty { display: none; }
        .act-link:focus-visible, .act-preview:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
        @media (max-width: 600px) {
            .lbl-long { display: none; }
            .lbl-short { display: inline; }
            .controls .btn.icon { padding: 9px 10px; flex: 0 0 auto; }
            .dur-row { grid-template-columns: repeat(3, 1fr); }
            .cal-form { padding: 16px 16px 18px; gap: 14px; }
            .logo img { height: 64px; }
            header { position: static; padding: 16px; gap: 12px; backdrop-filter: none; }
            .controls { flex-wrap: nowrap; gap: 6px; width: 100%; }
            .controls .btn { flex: 1 1 auto; padding: 9px 8px; font-size: 0.8rem; white-space: nowrap; }
            main { padding: 16px 12px 48px; }
            .hint-row { flex-direction: column; gap: 4px; font-size: 0.95rem; }
            .sync-label { font-size: 1rem; }
            .corner { font-size: 0.85rem; }
            .card .remove { display: none; padding: 6px 10px; font-size: 0.78rem; }
            .card.show-remove .remove { display: inline-block; }
            /* Name block stays left of the time badge (which starts 14px right of centre); Remove wraps under the name. */
            .card-head > div { max-width: calc(50% - 6px); }
            .city-line { flex-wrap: wrap; row-gap: 6px; }
            .card h3 { overflow-wrap: anywhere; }
            /* Slightly tighter time badge so it fits inside the card at 360px. */
            /* Time badge: time on top, date + offset underneath, so it stays inside the card in 12H at 360px. */
            .flag { display: grid; grid-template-columns: auto auto; gap: 2px 6px; padding: 5px 8px; white-space: nowrap; justify-items: start; }
            .flag b { grid-column: 1 / -1; grid-row: 1; font-size: 0.95rem; }
            .flag span, .flag em { font-size: 0.7rem; }
            .flag em { padding: 1px 4px; }
            .card-head { margin-bottom: 18px; }
            .card h3 { cursor: pointer; text-decoration: underline dotted color-mix(in srgb, var(--muted) 60%, transparent); text-underline-offset: 4px; }
            .jump { padding: 5px 8px; font-size: 0.72rem; white-space: nowrap; }
        }
        /* Touch screens: 44px targets for the day/week jumps (after the phone rules so the padding wins). */
        @media (pointer: coarse) {
            .jump { min-block-size: 44px; min-inline-size: 44px; padding-inline: 12px; }
        }
        @media (pointer: coarse) and (max-width: 380px) {
            .jump { padding-inline: 10px; }
        }
        /* Homepage explainer + site footer. The planner fills the first screen (main min-height); this sits below the fold. */
        main { min-height: calc(100svh - var(--hdr, 160px)); }
        .explainer { max-width: 980px; margin: 0 auto; padding: 56px 28px 40px; border-top: 1px solid var(--line); line-height: 1.6; }
        .explainer h2 { font-size: 1.6rem; line-height: 1.25; margin-bottom: 10px; }
        .explainer h3 { font-size: 1.08rem; margin-bottom: 6px; }
        .explainer .lead { color: var(--muted); font-size: 1.1rem; max-width: 720px; }
        .explainer a { color: var(--cyan); text-underline-offset: 3px; }
        .explainer a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 3px; }
        .steps { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 26px 0 40px; counter-reset: step; }
        .steps > li { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; counter-increment: step; }
        .steps h3::before {
            content: counter(step); display: inline-grid; place-items: center; width: 26px; height: 26px; margin-right: 10px;
            border-radius: 50%; background: color-mix(in srgb, var(--cyan) 16%, transparent); color: var(--cyan); font-size: 0.85rem;
        }
        .steps p { color: var(--muted); font-size: 0.98rem; }
        .steps p + p { margin-top: 8px; }
        .steps b { color: var(--text); font-weight: 600; }
        .colour-key { list-style: none; display: grid; gap: 6px; margin-top: 8px; color: var(--muted); font-size: 0.98rem; }
        .colour-key .sw { vertical-align: -1px; }
        .faq { display: grid; gap: 10px; margin-top: 14px; }
        .faq details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 18px; }
        .faq summary { cursor: pointer; font-weight: 600; padding: 14px 0; list-style-position: outside; }
        .faq summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }
        .faq details p { color: var(--muted); padding-bottom: 14px; }
        /* Long-form text needs AA: the app's light --muted (#64748b) is 4.3:1 on the page background, so darken it here. */
        html.light .explainer, html.light .site-footer { --muted: #475569; }
        .site-footer {
            border-top: 1px solid var(--line); color: var(--muted); font-size: 0.95rem;
            padding: 22px 28px 28px; display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between; align-items: center;
        }
        .site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
        .site-footer a { color: inherit; text-underline-offset: 3px; }
        .site-footer nav a { color: var(--text); text-decoration: none; font-weight: 600; }
        .site-footer nav a:hover { text-decoration: underline; }
        .site-footer a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 3px; }
        @media (max-width: 700px) {
            .steps { grid-template-columns: 1fr; }
            .explainer { padding: 40px 16px 32px; }
            .explainer h2 { font-size: 1.35rem; }
            .site-footer { padding: 20px 16px 24px; }
        }
