/* =========================================================================
   Global Service — home page
   Self-contained: index.html no longer loads the shared style.css.
   Zones: .zone-day (hero) and .zone-night (explore + footer + dialogs).
   html[data-scheme] = sky (day → night while scrolling) | light | dark.
   ========================================================================= */

/* ---------- Tokens ---------- */
:root {
    --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-digit: 'Orbitron', ui-monospace, 'SF Mono', Menlo, monospace;

    --brand-red: #E92047;
    --brand-navy: #00246C;
    --brand-blue: #1C4E9D;
    --brand-sky: #4da6ff;
    --brand-slate: #65728A;
    --brand-ice: #D0E7F7;
    --sun: #FFC83D;

    --day-top: #f7faff;
    --day-mid: #e8f1fb;
    --day-low: #d6e7f6;
    --night: #08111f;
    --night-deep: #050b16;

    --r-xs: 6px;
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 28px;

    --ease: cubic-bezier(.2, .8, .2, 1);
    --ease-in-out: cubic-bezier(.65, 0, .35, 1);
    --spring: cubic-bezier(.34, 1.56, .64, 1);

    --gutter: 16px;
    --max: 1180px;
}

.zone-day,
html[data-scheme="light"] .zone-night {
    color-scheme: light;
    --bg: var(--day-top);
    --ink: #0d1f3c;
    --ink-2: #3a4b67;
    --ink-3: #5f6f88;
    --ink-4: #98a5b8;
    --line: rgba(13, 31, 60, .1);
    --accent: var(--brand-blue);
    --accent-strong: var(--brand-navy);
    --accent-ink: #fff;
    --accent-soft: rgba(28, 78, 157, .08);
    --accent-line: rgba(28, 78, 157, .24);
    --red: #d3173d;
    --red-soft: rgba(233, 32, 71, .1);
    --card: rgba(255, 255, 255, .82);
    --card-solid: #fff;
    --card-border: rgba(13, 31, 60, .08);
    --card-border-hover: rgba(28, 78, 157, .2);
    --card-shadow: 0 1px 1px rgba(13, 31, 60, .04), 0 10px 30px -14px rgba(13, 31, 60, .16);
    --pop-shadow: 0 2px 6px rgba(13, 31, 60, .06), 0 24px 60px -18px rgba(13, 31, 60, .32);
    --field: #fff;
    --field-border: rgba(13, 31, 60, .12);
    --hover: rgba(28, 78, 157, .06);
    --press: rgba(28, 78, 157, .12);
    --focus: #2563eb;
    --glow: 0 0 0 transparent;
    --tile: #eef3fa;
    --cloud: #a7b8cf;
    --good: #0f7a55;
    --skeleton: rgba(13, 31, 60, .07);
}

.zone-night,
html[data-scheme="dark"] .zone-day {
    color-scheme: dark;
    --bg: var(--night);
    --ink: #e9effa;
    --ink-2: #b4c1d6;
    --ink-3: #8394ae;
    --ink-4: #56657e;
    --line: rgba(255, 255, 255, .08);
    --accent: var(--brand-sky);
    --accent-strong: #8cc6ff;
    --accent-ink: #04101f;
    --accent-soft: rgba(77, 166, 255, .12);
    --accent-line: rgba(77, 166, 255, .34);
    --red: #ff6b85;
    --red-soft: rgba(255, 107, 133, .13);
    --card: rgba(255, 255, 255, .04);
    --card-solid: #0e1a2d;
    --card-border: rgba(255, 255, 255, .08);
    --card-border-hover: rgba(77, 166, 255, .26);
    --card-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 24px 48px -28px rgba(0, 0, 0, .7);
    --pop-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 30px 80px -20px rgba(0, 0, 0, .8);
    --field: rgba(255, 255, 255, .06);
    --field-border: rgba(255, 255, 255, .12);
    --hover: rgba(255, 255, 255, .06);
    --press: rgba(255, 255, 255, .1);
    --focus: #7cc0ff;
    --glow: 0 0 14px rgba(77, 166, 255, .55);
    --tile: rgba(255, 255, 255, .045);
    --cloud: #c9d5e6;
    --good: #4ade80;
    --skeleton: rgba(255, 255, 255, .07);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    background: var(--night);
}
html[data-scheme="light"] { background: var(--day-top); }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink, #0d1f3c);
    background: var(--night);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}
html[data-scheme="light"] body { background: var(--day-top); }

img, svg { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
a { color: inherit; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
    border-radius: 6px;
}

::selection { background: rgba(77, 166, 255, .3); }

.sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
}

.skip {
    position: fixed;
    top: 12px; left: 12px;
    z-index: 200;
    padding: 10px 16px;
    border-radius: var(--r-sm);
    background: var(--brand-navy);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    transform: translateY(-160%);
    transition: transform .2s var(--ease);
}
.skip:focus-visible { transform: none; }

kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 6px;
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    background: var(--tile);
    color: var(--ink-3);
    font: 600 11px/1 var(--font);
    letter-spacing: .02em;
}

.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    border-radius: var(--r-sm);
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .12s var(--ease), box-shadow .2s var(--ease);
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); }
.btn-soft { background: var(--accent-soft); color: var(--accent); }
.btn-soft:hover:not(:disabled) { background: var(--press); }
.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    color: var(--ink-3);
    transition: background-color .2s var(--ease), color .2s var(--ease), transform .12s var(--ease);
}
.icon-btn:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.icon-btn:active:not(:disabled) { transform: scale(.92); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.icon-btn svg { width: 18px; height: 18px; }

.link-btn {
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    transition: color .2s var(--ease);
}
.link-btn:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; }

/* Segmented control */
.seg {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    border-radius: 11px;
    background: var(--tile);
    border: 1px solid var(--line);
}
.seg button {
    display: inline-grid;
    place-items: center;
    min-width: 34px;
    height: 28px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--ink-3);
    transition: background-color .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease);
}
.seg button:hover { color: var(--ink); }
.seg button[aria-checked="true"] {
    background: var(--card-solid);
    color: var(--ink);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .1), 0 0 0 1px var(--line);
}
.seg-icons button { padding: 0; width: 32px; min-width: 0; }
.seg-icons svg { width: 16px; height: 16px; }

/* =========================================================================
   HERO (day)
   ========================================================================= */
.hero {
    position: relative;
    isolation: isolate;
    padding: 14px var(--gutter) clamp(40px, 6vw, 64px);
    background:
        radial-gradient(900px 520px at 88% -8%, rgba(255, 214, 170, .5), transparent 62%),
        radial-gradient(700px 420px at 6% 8%, rgba(255, 255, 255, .9), transparent 60%),
        linear-gradient(180deg, var(--day-top) 0%, var(--day-mid) 58%, var(--day-low) 100%);
    color: var(--ink);
}
html[data-scheme="dark"] .hero {
    background:
        radial-gradient(800px 480px at 86% -10%, rgba(140, 170, 255, .16), transparent 60%),
        radial-gradient(600px 400px at 8% 0%, rgba(77, 166, 255, .08), transparent 60%),
        linear-gradient(180deg, #0c1830 0%, #0a1426 60%, var(--night) 100%);
}

.topbar {
    max-width: var(--max);
    margin: 0 auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 6px 0 12px;
    border-radius: 11px;
    background: var(--tile);
    border: 1px solid var(--line);
    color: var(--ink-3);
    font-size: 13px;
    font-weight: 500;
    transition: color .2s var(--ease), border-color .2s var(--ease), background-color .2s var(--ease);
}
.pill-btn:hover { color: var(--ink); border-color: var(--accent-line); }
.pill-btn svg { width: 15px; height: 15px; }
.pill-btn kbd { height: 24px; }

.hero-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: clamp(10px, 1.4vw, 16px);
    margin-top: clamp(20px, 5vw, 44px);
}
.brand-logo {
    width: auto;
    height: clamp(40px, 5vw, 56px);
    filter: drop-shadow(0 6px 14px rgba(0, 36, 108, .18));
    transition: transform .5s var(--spring);
}
.brand:hover .brand-logo { transform: rotate(-6deg) scale(1.05); }
.brand-name {
    font-size: clamp(32px, 5vw, 56px);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -.03em;
    color: var(--brand-navy);
}
html[data-scheme="dark"] .brand-name { color: var(--ink); }

.tagline {
    margin-top: 12px;
    min-height: 1.7em;
    font-size: clamp(16px, 1.9vw, 19px);
    color: var(--ink-2);
    display: flex;
    align-items: center;
    justify-content: center;
}
.caret {
    display: inline-block;
    width: 2px;
    height: 1.15em;
    margin-left: 3px;
    border-radius: 1px;
    background: var(--brand-red);
    animation: caret 1.05s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

/* ---------- Search ---------- */
.search {
    position: relative;
    width: min(580px, 100%);
    margin-top: clamp(22px, 3vw, 32px);
    z-index: 20;
}
.search::before {
    content: '';
    position: absolute;
    inset: -3px;
    z-index: -1;
    border-radius: 999px;
    background: conic-gradient(from var(--spin, 0deg), var(--brand-navy), var(--brand-sky), var(--brand-red), var(--brand-blue), var(--brand-navy));
    filter: blur(14px);
    opacity: 0;
    transition: opacity .45s var(--ease);
    animation: spin 8s linear infinite;
    animation-play-state: paused;
}
.search:focus-within::before { opacity: .55; animation-play-state: running; }
@property --spin { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes spin { to { --spin: 360deg; } }

.search-field {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 54px;
    padding: 0 7px 0 18px;
    border-radius: 999px;
    background: var(--field);
    border: 1px solid var(--field-border);
    box-shadow: 0 1px 2px rgba(13, 31, 60, .05), 0 12px 32px -16px rgba(13, 31, 60, .28);
    transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.search:focus-within .search-field { border-color: var(--accent-line); }
.search-field > svg { width: 19px; height: 19px; color: var(--ink-3); flex: none; }
.search-input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    background: transparent;
    font-size: 16px;
    color: var(--ink);
    outline: none;
}
.search-input::placeholder { color: var(--ink-3); opacity: 1; }
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search-kbd { flex: none; }
.search-go {
    flex: none;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--brand-navy);
    color: #fff;
    transition: transform .15s var(--ease), background-color .2s var(--ease);
}
html[data-scheme="dark"] .search-go { background: var(--accent); color: var(--accent-ink); }
.search-go:hover { background: var(--brand-blue); }
.search-go:active { transform: scale(.92); }
.search-go svg { width: 18px; height: 18px; }

.search.shake .search-field { animation: shake .42s var(--ease); }
@keyframes shake {
    15%, 55% { transform: translateX(-7px); }
    35%, 75% { transform: translateX(6px); }
    90% { transform: translateX(-2px); }
}

.pop {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    padding: 6px;
    border-radius: 18px;
    background: var(--card-solid);
    border: 1px solid var(--card-border);
    box-shadow: var(--pop-shadow);
    text-align: left;
    max-height: min(420px, 60vh);
    overflow: auto;
    overscroll-behavior: contain;
    animation: pop-in .18s var(--ease);
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } }

/* ---------- Option rows (search + palette) ---------- */
.opt-group {
    padding: 10px 12px 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.opt {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 6px 8px 6px 10px;
    border-radius: 12px;
    color: var(--ink);
    text-decoration: none;
    cursor: pointer;
    scroll-margin: 6px;
}
.opt[aria-selected="true"] { background: var(--accent-soft); }
.opt-ico {
    flex: none;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--tile);
    border: 1px solid var(--line);
    color: var(--accent);
}
.opt-ico svg { width: 16px; height: 16px; }
.opt[aria-selected="true"] .opt-ico { border-color: var(--accent-line); }
.opt-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.opt-title {
    font-size: 14.5px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.opt-title mark { background: none; color: var(--accent); font-weight: 700; }
.opt-sub { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt-tag {
    flex: none;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--brand-red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
}
.opt-star { flex: none; }
.opt-star[aria-pressed="true"] { color: var(--sun); }
.opt-star[aria-pressed="true"] svg { fill: currentColor; }
.opt-enter { flex: none; color: var(--ink-4); opacity: 0; }
.opt[aria-selected="true"] .opt-enter { opacity: 1; }
.opt-enter svg { width: 16px; height: 16px; }
.opt-empty { padding: 22px 12px; text-align: center; color: var(--ink-3); font-size: 14px; }

/* ---------- Section buttons (images kept as designed) ---------- */
.sections {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 200px));
    justify-content: center;
    gap: clamp(12px, 2vw, 22px);
    width: 100%;
    margin-top: clamp(28px, 4vw, 40px);
}
.sec {
    position: relative;
    display: block;
    border-radius: 6%;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(13, 31, 60, .1), 0 6px 16px -8px rgba(13, 31, 60, .28);
    transition: transform .35s var(--ease), box-shadow .35s var(--ease);
    will-change: transform;
}
.sec picture, .sec img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    border-radius: inherit;
}
.sec::after {
    /* sheen on hover */
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .35) 48%, transparent 62%);
    background-size: 250% 100%;
    background-position: 120% 0;
    opacity: 0;
    transition: opacity .3s var(--ease), background-position .8s var(--ease);
    pointer-events: none;
}
.sec:hover {
    transform: translateY(-5px);
    box-shadow: 0 2px 4px rgba(13, 31, 60, .08), 0 22px 36px -16px rgba(0, 36, 108, .45);
}
.sec:hover::after { opacity: 1; background-position: -40% 0; }
.sec:active { transform: translateY(-1px) scale(.97); transition-duration: .12s; }
.sec:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: 6%; }
html[data-scheme="dark"] .sec { box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 10px 24px -12px rgba(0, 0, 0, .7); }
html[data-scheme="dark"] .sec:hover { box-shadow: 0 0 0 1px rgba(77, 166, 255, .3), 0 24px 40px -18px rgba(0, 0, 0, .8); }

.sec-badges {
    position: absolute;
    right: 7%;
    bottom: 6%;
    display: flex;
    gap: 4px;
    pointer-events: none;
}
.sec-badge {
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .82);
    border: 1px solid rgba(0, 36, 108, .12);
    color: var(--brand-navy);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    backdrop-filter: blur(4px);
}
.sec-badge.new { background: var(--brand-red); border-color: transparent; color: #fff; letter-spacing: .06em; font-weight: 700; }
.sec-key {
    position: absolute;
    left: 7%;
    bottom: 6%;
    min-width: 22px;
    height: 22px;
    background: rgba(255, 255, 255, .82);
    border-color: rgba(0, 36, 108, .14);
    color: var(--brand-navy);
    opacity: 0;
    transform: translateY(3px);
    transition: opacity .2s var(--ease), transform .2s var(--ease);
    pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
    .sec:hover .sec-key, .sec:focus-visible .sec-key { opacity: 1; transform: none; }
}

/* ---------- Quick access (recent + favourites) ---------- */
.quick { width: min(880px, 100%); margin-top: clamp(26px, 3.4vw, 36px); }
.quick-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 10px;
}
.quick-head h2 {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.chips {
    display: flex;
    gap: 8px;
    justify-content: safe center;
    overflow-x: auto;
    padding: 2px 2px 6px;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
    flex: none;
    display: inline-flex;
    align-items: center;
    height: 38px;
    border-radius: 999px;
    background: var(--card);
    border: 1px solid var(--card-border);
    box-shadow: 0 1px 2px rgba(13, 31, 60, .04);
    transition: border-color .2s var(--ease), transform .15s var(--ease);
}
.chip:hover { border-color: var(--accent-line); }
.chip a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 100%;
    padding: 0 6px 0 14px;
    border-radius: 999px 0 0 999px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ink);
    text-decoration: none;
    white-space: nowrap;
}
.chip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.chip .icon-btn { width: 30px; height: 30px; margin-right: 4px; border-radius: 50%; }
.chip .icon-btn svg { width: 15px; height: 15px; }
.chip .icon-btn[aria-pressed="true"] { color: var(--sun); }
.chip .icon-btn[aria-pressed="true"] svg { fill: currentColor; }

/* ---------- Now card (clock) ---------- */
.now {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 6px 22px;
    width: min(560px, 100%);
    margin-top: clamp(28px, 4vw, 40px);
    padding: 20px 24px 16px;
    border-radius: var(--r-lg);
    background: var(--card);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    text-align: left;
}
.now-time {
    display: flex;
    align-items: baseline;
    font-size: clamp(44px, 6vw, 58px);
    font-weight: 300;
    line-height: 1;
    letter-spacing: -.03em;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.now-s {
    margin-left: 4px;
    font-size: .38em;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--ink-4);
    min-width: 2ch;
}
.now-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.now-greet {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--brand-red);
}
html[data-scheme="dark"] .now-greet { color: var(--red); }
.now-date { font-size: 16px; font-weight: 600; color: var(--ink); }
.now-lunar { font-size: 13.5px; color: var(--ink-3); }
.now-loc {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    font-size: 13.5px;
    color: var(--ink-2);
}
.now-loc svg { width: 15px; height: 15px; color: var(--brand-red); flex: none; }
.now-loc .link-btn { margin-left: auto; }
.loc-tag {
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--tile);
    color: var(--ink-3);
    font-size: 11px;
    font-weight: 600;
}

/* =========================================================================
   DUSK — the sky darkens as you scroll from the hero into "Explore"
   ========================================================================= */
.dusk {
    height: clamp(140px, 20vw, 260px);
    margin-bottom: -1px;
    background: linear-gradient(180deg,
        var(--day-low) 0%,
        #ecdcd0 16%,
        #e7c3b1 30%,
        #c99aa6 44%,
        #7d6f9c 60%,
        #34406e 78%,
        #141f3a 90%,
        var(--night) 100%);
}
html[data-scheme="light"] .dusk { height: 32px; background: linear-gradient(180deg, var(--day-low), var(--day-top)); }
html[data-scheme="dark"] .dusk { height: 24px; background: var(--night); }

/* =========================================================================
   EXPLORE (night)
   ========================================================================= */
.main {
    position: relative;
    isolation: isolate;
    padding: 8px var(--gutter) clamp(64px, 8vw, 104px);
    background: var(--bg);
    color: var(--ink);
}
.main::before {
    /* star field, fades in from the top */
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        radial-gradient(1.2px 1.2px at 6% 12%, rgba(255, 255, 255, .85), transparent 70%),
        radial-gradient(1px 1px at 18% 64%, rgba(255, 255, 255, .6), transparent 70%),
        radial-gradient(1.4px 1.4px at 27% 30%, rgba(200, 225, 255, .9), transparent 70%),
        radial-gradient(1px 1px at 39% 82%, rgba(255, 255, 255, .55), transparent 70%),
        radial-gradient(1px 1px at 46% 8%, rgba(255, 255, 255, .7), transparent 70%),
        radial-gradient(1.6px 1.6px at 58% 44%, rgba(255, 240, 220, .85), transparent 70%),
        radial-gradient(1px 1px at 66% 72%, rgba(255, 255, 255, .5), transparent 70%),
        radial-gradient(1.2px 1.2px at 74% 20%, rgba(255, 255, 255, .8), transparent 70%),
        radial-gradient(1px 1px at 83% 56%, rgba(200, 225, 255, .65), transparent 70%),
        radial-gradient(1.3px 1.3px at 92% 90%, rgba(255, 255, 255, .7), transparent 70%),
        radial-gradient(1px 1px at 96% 34%, rgba(255, 255, 255, .55), transparent 70%);
    background-size: 520px 520px;
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 280px);
    mask-image: linear-gradient(180deg, transparent 0, #000 280px);
    animation: twinkle 7s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .55; } to { opacity: 1; } }
html[data-scheme="light"] .main::before { display: none; }

.main-inner { max-width: var(--max); margin: 0 auto; }

.section-head { text-align: center; margin: 8px auto clamp(28px, 4vw, 44px); max-width: 640px; }
.eyebrow {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--accent);
}
.section-head h2 {
    margin-top: 8px;
    font-size: clamp(28px, 3.6vw, 42px);
    font-weight: 700;
    letter-spacing: -.025em;
    line-height: 1.1;
}
.section-head .sub { margin-top: 10px; color: var(--ink-3); font-size: 16px; }

/* ---------- Bento grid ---------- */
.bento {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-areas:
        "cal  cal  wea  moon"
        "cal  cal  wea  sun"
        "otd  otd  cd   cd"
        "gmk  gmk  ttt  ttt"
        "gmk  gmk  word word";
    align-items: stretch;
}
.w-cal  { grid-area: cal; }
.w-wea  { grid-area: wea; }
.w-moon { grid-area: moon; }
.w-sun  { grid-area: sun; }
.w-otd  { grid-area: otd; }
.w-cd   { grid-area: cd; }
.w-gmk  { grid-area: gmk; }
.w-ttt  { grid-area: ttt; }
.w-word { grid-area: word; }

@media (max-width: 1099px) {
    .bento {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
            "cal  cal"
            "wea  moon"
            "wea  sun"
            "cd   cd"
            "otd  otd"
            "word word"
            "ttt  ttt"
            "gmk  gmk";
    }
}
@media (max-width: 679px) {
    .bento {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "cal" "wea" "moon" "sun" "cd" "otd" "word" "ttt" "gmk";
        gap: 14px;
    }
}

/* ---------- Widget card ---------- */
.w {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 20px;
    border-radius: var(--r-lg);
    background: var(--card);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    transition: border-color .3s var(--ease);
}
.w:hover { border-color: var(--card-border-hover); }
.w-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    margin-bottom: 14px;
}
.w-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.w-title svg { width: 16px; height: 16px; color: var(--accent); }
.w-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.w-foot {
    margin-top: auto;
    padding-top: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--ink-3);
}
.w-foot a { color: var(--accent); text-decoration: none; font-weight: 600; }
.w-foot a:hover { text-decoration: underline; text-underline-offset: 3px; }

.stat-rows { display: grid; gap: 0; }
.stat-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-top: 1px solid var(--line);
    font-size: 14px;
}
.stat-row:first-child { border-top: 0; }
.stat-row dt, .stat-row .k { color: var(--ink-3); }
.stat-row dd, .stat-row .v { margin: 0; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; text-align: right; }

/* Reveal on scroll */
.js .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity .8s var(--ease), transform .8s var(--ease), border-color .3s var(--ease);
    transition-delay: var(--d, 0ms);
}
.js .reveal.in { opacity: 1; transform: none; }

/* Skeleton */
.sk {
    display: block;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--skeleton) 0%, rgba(255, 255, 255, .12) 50%, var(--skeleton) 100%);
    background-size: 200% 100%;
    animation: sk 1.4s ease-in-out infinite;
}
@keyframes sk { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- Calendar ---------- */
.cal-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.cal-month { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.cal-lunar-year { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.cal-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-template-rows: auto repeat(6, minmax(46px, 66px));
    align-content: center;
    gap: 4px;
}
.cal-dow {
    padding: 4px 0 8px;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.cal-dow.sun { color: var(--red); }
.cal-day {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    min-height: 46px;
    border-radius: 12px;
    color: var(--ink);
    transition: background-color .15s var(--ease), box-shadow .15s var(--ease);
}
.cal-day:hover { background: var(--hover); }
.cal-day .sol { font-size: 15px; font-weight: 500; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cal-day .lun { font-size: 10px; line-height: 1.1; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.cal-day .lun.m1 { color: var(--accent); font-weight: 600; }
.cal-day .lun.m15 { color: var(--sun); font-weight: 600; }
.cal-day.sat .sol { color: var(--ink-2); }
.cal-day.sun .sol { color: var(--red); }
.cal-day.out { opacity: .32; }
.cal-day.hol::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 7px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--brand-red);
}
.cal-day.hol.lunar-hol::after { background: var(--sun); }
.cal-day[aria-selected="true"] { box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal-day.today { background: var(--accent); box-shadow: var(--glow); }
.cal-day.today .sol, .cal-day.today .lun { color: var(--accent-ink); }
.cal-day.today .sol { font-weight: 700; }
.cal-day.today[aria-selected="true"] { box-shadow: var(--glow), inset 0 0 0 2px var(--accent-ink); }

.cal-detail {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: var(--r-md);
    background: var(--tile);
    border: 1px solid var(--line);
    display: grid;
    gap: 3px;
    min-height: 74px;
}
.cal-detail .d1 { font-weight: 600; font-size: 15px; }
.cal-detail .d2 { font-size: 13.5px; color: var(--ink-3); }
.cal-detail .hols { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.hol-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--red-soft);
    color: var(--red);
    font-size: 12px;
    font-weight: 600;
}
.hol-pill.lunar { background: rgba(255, 200, 61, .14); color: #c48a00; }
.zone-night .hol-pill.lunar { color: var(--sun); }
html[data-scheme="light"] .zone-night .hol-pill.lunar { color: #a26f00; }

/* ---------- Weather ---------- */
.w-wea { overflow: hidden; }
.wea-stage { position: relative; flex: 1; display: grid; grid-template-rows: 1fr; touch-action: pan-y; }
.wea-slide {
    grid-area: 1 / 1;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateX(18px);
    transition: opacity .5s var(--ease), transform .5s var(--ease), visibility 0s .5s;
}
.wea-slide.is-active { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.wea-slide.is-leaving { transform: translateX(-18px); }
.wea-city { font-size: 20px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.wea-meta { display: flex; align-items: center; gap: 8px; margin-top: 2px; font-size: 13px; color: var(--ink-3); }
.wea-here {
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
}
.wea-main { flex: 1; display: flex; align-items: center; gap: 8px; min-height: 120px; margin: 14px 0 8px; }
.wea-icon { width: 108px; height: 108px; flex: none; margin-left: -8px; }
.wea-temp { font-size: 60px; font-weight: 300; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.wea-temp sup { font-size: .42em; font-weight: 400; vertical-align: top; position: relative; top: .3em; margin-left: 2px; color: var(--ink-3); }
.wea-desc { font-size: 15px; color: var(--ink-2); margin-bottom: 14px; }
.wea-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: auto; }
.wea-stat { padding: 10px; border-radius: 12px; background: var(--tile); border: 1px solid var(--line); }
.wea-stat .k { display: block; font-size: 11px; color: var(--ink-3); }
.wea-stat .v { display: block; margin-top: 2px; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wea-stat .v small { font-size: 11px; font-weight: 500; color: var(--ink-3); margin-left: 2px; }
.wea-err { margin: auto 0; padding: 24px 0; text-align: center; color: var(--ink-3); font-size: 14px; display: grid; gap: 12px; justify-items: center; }
.wea-nav { display: flex; align-items: center; gap: 6px; margin-top: 16px; }
.dots { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1; justify-content: center; }
.dot {
    position: relative;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--ink-4);
    opacity: .55;
    overflow: hidden;
    transition: width .35s var(--ease), opacity .2s var(--ease), background-color .2s var(--ease);
}
.dot::before { content: ''; position: absolute; inset: -8px -3px; } /* bigger hit area */
.dot:hover { opacity: 1; }
.dot[aria-current="true"] { width: 22px; opacity: 1; background: var(--accent-line); }
.dot[aria-current="true"] i {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--accent);
    transform-origin: left;
    transform: scaleX(0);
}
.dot[aria-current="true"] i.run { animation: dot-fill var(--dur, 8s) linear forwards; }
.paused .dot[aria-current="true"] i.run { animation-play-state: paused; }
@keyframes dot-fill { to { transform: scaleX(1); } }

/* ---------- Moon ---------- */
.moon-wrap { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.moon-svg { width: 84px; height: 84px; flex: none; filter: drop-shadow(0 0 18px rgba(220, 230, 255, .22)); }
html[data-scheme="light"] .moon-svg, .zone-day .moon-svg { filter: drop-shadow(0 4px 10px rgba(13, 31, 60, .18)); }
.moon-name { font-size: 17px; font-weight: 700; line-height: 1.25; }
.moon-illum { font-size: 13px; color: var(--ink-3); margin-top: 2px; }

/* ---------- Sun ---------- */
.sun-arc { width: 100%; height: auto; margin: 2px 0 6px; overflow: visible; }
.sun-arc .track { fill: none; stroke: var(--ink-4); stroke-width: 1.5; stroke-dasharray: 3 5; }
.sun-arc .done { fill: none; stroke: url(#sunGrad); stroke-width: 2.5; stroke-linecap: round; }
.sun-arc .horizon { stroke: var(--line); stroke-width: 1.5; }
.sun-arc .ball { fill: var(--sun); }
.sun-arc .halo { fill: var(--sun); opacity: .22; }
.sun-arc text { fill: var(--ink-3); font: 600 11px var(--font); font-variant-numeric: tabular-nums; }
.sun-status { font-size: 14px; color: var(--ink-2); margin-bottom: 8px; text-align: center; }
.sun-status b { color: var(--ink); font-weight: 600; }

/* ---------- On this day ---------- */
.otd-list { display: grid; gap: 4px; }
.otd-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 10px;
    margin: 0 -10px;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: background-color .2s var(--ease);
}
a.otd-item:hover { background: var(--hover); }
.otd-year {
    min-width: 54px;
    padding: 4px 8px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.otd-text {
    font-size: 14px;
    line-height: 1.45;
    color: var(--ink-2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.otd-thumb {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--tile);
    border: 1px solid var(--line);
}
.otd-thumb.none { visibility: hidden; }
.otd-sk { display: grid; grid-template-columns: 54px 1fr 48px; gap: 14px; align-items: center; padding: 10px 0; }
.otd-sk .sk:nth-child(1) { height: 26px; }
.otd-sk .sk:nth-child(3) { height: 48px; border-radius: 10px; }

/* ---------- Countdown (flip digits kept) ---------- */
.cd-board { display: grid; }
.cd-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px dashed var(--line);
    animation: cd-in .5s var(--ease) both;
    animation-delay: calc(var(--i, 0) * 60ms);
}
.cd-row:first-child { border-top: 0; }
@keyframes cd-in { from { opacity: 0; transform: translateY(6px); } }
.cd-name { flex: 1; min-width: 0; font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cd-date { display: block; font-size: 12px; color: var(--ink-3); font-weight: 400; }
.cd-digits { display: flex; gap: 3px; perspective: 200px; }
.digit {
    display: grid;
    place-items: center;
    width: 26px;
    height: 34px;
    border-radius: 6px;
    background: var(--tile);
    border: 1px solid var(--accent-line);
    color: var(--ink);
    font: 700 17px/1 var(--font-digit);
    text-shadow: var(--glow);
    position: relative;
    isolation: isolate;
}
.digit::after {
    content: '';
    position: absolute;
    z-index: -1;
    left: 0; right: 0; top: 50%;
    height: 1px;
    background: var(--line);
}
.digit.flipping { animation: digit-flip .7s var(--ease-in-out); }
@keyframes digit-flip {
    0%   { transform: rotateX(0); background: var(--accent); color: var(--accent-ink); }
    49%  { transform: rotateX(-90deg); }
    50%  { transform: rotateX(90deg); }
    100% { transform: rotateX(0); }
}
.cd-label { width: 34px; font-size: 12px; color: var(--accent); }
.cd-row.today .cd-name { color: var(--accent); font-weight: 700; }
.cd-progress { flex: 1; }

/* ---------- Word of the day ---------- */
.word-top { display: flex; align-items: flex-start; gap: 12px; }
.word-main { flex: 1; min-width: 0; }
.word-text { font-size: clamp(26px, 3vw, 32px); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere; }
.word-ipa { margin-top: 4px; font-size: 14px; color: var(--ink-3); }
.word-pos {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
    font-style: normal;
}
.word-def { margin-top: 14px; font-size: 15px; color: var(--ink); }
.word-vi { margin-top: 4px; font-size: 14.5px; color: var(--ink-2); }
.word-vi b { color: var(--red); font-weight: 600; }
.word-ex {
    margin: 14px 0 0;
    padding: 12px 14px;
    border-left: 3px solid var(--accent);
    border-radius: 0 12px 12px 0;
    background: var(--tile);
    font-size: 14px;
    font-style: italic;
    color: var(--ink-2);
}
.word-ex mark { background: none; color: var(--accent); font-weight: 600; font-style: normal; }

/* ---------- Games ---------- */
.score {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}
.score div {
    padding: 8px 10px;
    border-radius: 12px;
    background: var(--tile);
    border: 1px solid var(--line);
    text-align: center;
    transition: border-color .2s var(--ease), background-color .2s var(--ease);
}
.score div.turn { border-color: var(--accent-line); background: var(--accent-soft); }
.score .k { display: block; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.score .v { display: block; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.game-status {
    min-height: 24px;
    margin-top: 12px;
    text-align: center;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--ink-2);
}
.game-status.win { color: var(--accent); font-weight: 700; }
.game-btns { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.w-gmk .game-btns, .w-ttt .game-btns { margin-bottom: auto; }
.ttt-wrap { margin-top: auto; }

.ttt-wrap { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; }
.ttt-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: min(100%, 264px);
}
.ttt-cell {
    position: relative;
    aspect-ratio: 1;
    border-radius: 14px;
    background: var(--tile);
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
    transition: background-color .2s var(--ease), border-color .2s var(--ease), transform .12s var(--ease);
}
.ttt-cell[aria-disabled="false"]:hover { background: var(--accent-soft); border-color: var(--accent-line); }
.ttt-cell[aria-disabled="true"] { cursor: default; }
.ttt-cell svg { width: 52%; height: 52%; overflow: visible; }
.ttt-cell .mx path { stroke: var(--accent); stroke-width: 10; stroke-linecap: round; fill: none; stroke-dasharray: 68; stroke-dashoffset: 68; animation: draw .32s var(--ease) forwards; }
.ttt-cell .mx path + path { animation-delay: .12s; }
.ttt-cell .mo circle { stroke: var(--red); stroke-width: 10; fill: none; stroke-dasharray: 170; stroke-dashoffset: 170; animation: draw .45s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.ttt-cell.win { background: var(--accent-soft); border-color: var(--accent); box-shadow: var(--glow); }
.ttt-cell.win .mo circle { stroke: var(--red); }

.gm-board {
    --n: 15;
    position: relative;
    width: 100%;
    max-width: 560px;
    margin: auto auto 0;
    aspect-ratio: 1;
    border-radius: 14px;
    background:
        radial-gradient(120% 120% at 30% 20%, rgba(255, 255, 255, .06), transparent 60%),
        var(--tile);
    border: 1px solid var(--line);
    --line-c: var(--ink-4);
}
html[data-scheme="light"] .gm-board, .zone-day .gm-board { --line-c: rgba(13, 31, 60, .22); }
.gm-lines {
    position: absolute;
    inset: calc(100% / (var(--n) * 2));
    border: 1px solid var(--line-c);
    background-image:
        linear-gradient(to right, var(--line-c) 1px, transparent 1px),
        linear-gradient(to bottom, var(--line-c) 1px, transparent 1px);
    background-size: calc(100% / (var(--n) - 1)) calc(100% / (var(--n) - 1));
    background-position: -.5px -.5px;
    opacity: .7;
    pointer-events: none;
}
.gm-star {
    position: absolute;
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    border-radius: 50%;
    background: var(--line-c);
    pointer-events: none;
}
.gm-grid {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(var(--n), 1fr);
    grid-template-rows: repeat(var(--n), 1fr);
}
.gm-cell { position: relative; border-radius: 50%; }
.gm-cell::before {
    content: '';
    position: absolute;
    inset: 9%;
    border-radius: 50%;
    transform: scale(0);
    transition: transform .22s var(--spring), opacity .15s;
}
@media (hover: hover) and (pointer: fine) {
    .gm-board:not(.locked) .gm-cell:not([data-v]):hover::before {
        transform: scale(1);
        opacity: .35;
        background: var(--ghost, #111);
    }
}
.gm-cell[data-v]::before { transform: scale(1); opacity: 1; }
.gm-cell[data-v="X"]::before {
    background: radial-gradient(circle at 34% 30%, #5b6475 0%, #1a1f29 45%, #05070b 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, .45);
}
.gm-cell[data-v="O"]::before {
    background: radial-gradient(circle at 34% 30%, #ffffff 0%, #eef1f6 45%, #b9c1cf 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, .35);
}
.gm-cell.last::after {
    content: '';
    position: absolute;
    left: 50%; top: 50%;
    width: 22%; height: 22%;
    margin: -11% 0 0 -11%;
    border-radius: 50%;
    background: var(--brand-red);
}
.gm-cell.win::before { box-shadow: 0 0 0 2px var(--accent), 0 0 14px 2px var(--accent); }
.gm-cell:focus-visible { outline-offset: -2px; border-radius: 50%; }
.stone {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    vertical-align: -1px;
    margin-right: 6px;
}
.stone.x { background: radial-gradient(circle at 34% 30%, #5b6475, #05070b); }
.stone.o { background: radial-gradient(circle at 34% 30%, #fff, #b9c1cf); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }

/* =========================================================================
   FOOTER
   ========================================================================= */
.foot {
    position: relative;
    padding: clamp(48px, 6vw, 72px) var(--gutter) calc(28px + env(safe-area-inset-bottom));
    background: var(--night-deep);
    border-top: 1px solid var(--line);
    color: var(--ink-2);
    font-size: 14px;
}
html[data-scheme="light"] .foot { background: #eaf1f9; }
.foot-inner {
    max-width: var(--max);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 40px;
}
.foot-brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; color: var(--ink); }
.foot-brand img { height: 32px; width: auto; }
.foot-about { margin-top: 12px; max-width: 360px; color: var(--ink-3); }
.foot-coffee { display: inline-block; margin-top: 18px; border-radius: 10px; transition: transform .2s var(--ease); }
.foot-coffee:hover { transform: translateY(-2px); }
.foot-coffee img { width: 150px; height: auto; border-radius: 10px; }
.foot h3 {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 14px;
}
.foot-links { display: grid; gap: 8px; }
.foot-links a, .foot-links button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-2);
    text-decoration: none;
    text-align: left;
    transition: color .2s var(--ease);
}
.foot-links a:hover, .foot-links button:hover { color: var(--accent); }
.foot-links kbd { height: 20px; min-width: 20px; font-size: 10px; }
.foot-bottom {
    max-width: var(--max);
    margin: 40px auto 0;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    justify-content: space-between;
    color: var(--ink-3);
    font-size: 13px;
}
@media (max-width: 779px) {
    .foot-inner { grid-template-columns: 1fr 1fr; gap: 32px; }
    .foot-col-brand { grid-column: 1 / -1; }
}

/* =========================================================================
   FLOATING ACTIONS
   ========================================================================= */
.fabs {
    position: fixed;
    right: calc(16px + env(safe-area-inset-right));
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}
.fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    height: 52px;
    min-width: 52px;
    padding: 0 15px;
    border-radius: 999px;
    background: var(--brand-navy);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .14);
    box-shadow: 0 10px 28px -10px rgba(0, 20, 60, .6), 0 2px 6px rgba(0, 0, 0, .18);
    text-decoration: none;
    transition: transform .25s var(--ease), background-color .2s var(--ease), opacity .25s var(--ease), gap .3s var(--ease);
}
.fab:hover { background: var(--brand-blue); transform: translateY(-2px); }
.fab:active { transform: scale(.95); }
.fab svg { width: 21px; height: 21px; flex: none; }
.fab-label {
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
    transition: max-width .35s var(--ease);
}
@media (hover: hover) {
    .fab-main:hover, .fab-main:focus-visible { gap: 8px; }
    .fab-main:hover .fab-label, .fab-main:focus-visible .fab-label { max-width: 160px; }
}
.fab-sm { height: 44px; min-width: 44px; padding: 0; width: 44px; }
.fab-sm svg { width: 19px; height: 19px; }
.fab-coffee { background: #FFDD00; color: #1d1d1f; border-color: rgba(0, 0, 0, .08); }
.fab-coffee:hover { background: #ffe433; }
.fab-top { background: var(--card-solid, #0e1a2d); color: var(--ink, #e9effa); border-color: var(--line, rgba(255, 255, 255, .1)); }
.fab-top:hover { background: var(--card-solid); color: var(--accent); }
.fab-top.is-hidden { opacity: 0; transform: translateY(10px) scale(.9); pointer-events: none; }
.fabs { transition: transform .35s var(--ease), opacity .35s var(--ease); }
.fabs.away { transform: translateY(calc(100% + 24px)); opacity: 0; pointer-events: none; }
@media (max-width: 560px) {
    .fab-coffee { display: none; }
}
@media (max-width: 520px) {
    .fab { height: 48px; min-width: 48px; padding: 0 13px; }
    .fab-sm { height: 42px; width: 42px; min-width: 42px; padding: 0; }
}

/* =========================================================================
   DIALOGS
   ========================================================================= */
.dlg {
    width: min(520px, calc(100vw - 24px));
    max-height: calc(100dvh - 48px);
    padding: 0;
    border: 1px solid var(--card-border);
    border-radius: var(--r-xl);
    background: var(--card-solid);
    color: var(--ink);
    box-shadow: var(--pop-shadow);
    overflow: auto;
}
.dlg::backdrop {
    background: rgba(4, 10, 22, .55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.dlg[open] { animation: dlg-in .28s var(--ease); }
.dlg[open]::backdrop { animation: fade-in .28s var(--ease); }
.dlg.closing { animation: dlg-out .18s var(--ease) forwards; }
.dlg.closing::backdrop { animation: fade-out .18s var(--ease) forwards; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes dlg-out { to { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }

.dlg-head { display: flex; align-items: flex-start; gap: 12px; padding: 22px 22px 0; }
.dlg-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.dlg-head p { margin-top: 4px; font-size: 14px; color: var(--ink-3); }
.dlg-head .icon-btn { margin-left: auto; margin-top: -4px; margin-right: -6px; }
.dlg-body { padding: 18px 22px 22px; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field textarea {
    width: 100%;
    padding: 11px 14px;
    border-radius: 12px;
    border: 1px solid var(--field-border);
    background: var(--field);
    color: var(--ink);
    font-size: 15px;
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field input::placeholder, .field textarea::placeholder { color: var(--ink-4); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field [aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.field textarea { min-height: 140px; max-height: 320px; resize: vertical; line-height: 1.5; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; gap: 0; } }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-err { margin: -2px 0 12px; font-size: 13.5px; color: var(--red); min-height: 0; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-right-color: transparent;
    animation: rot .7s linear infinite;
}
@keyframes rot { to { transform: rotate(360deg); } }

.sent { padding: 40px 24px 32px; text-align: center; display: grid; justify-items: center; gap: 10px; }
.sent svg { width: 72px; height: 72px; }
.sent circle { fill: none; stroke: var(--good); stroke-width: 3; stroke-dasharray: 160; stroke-dashoffset: 160; animation: draw .6s var(--ease) forwards; }
.sent path { fill: none; stroke: var(--good); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .4s .45s var(--ease) forwards; }
.sent h2 { font-size: 20px; }
.sent p { color: var(--ink-3); margin-bottom: 8px; }

/* Command palette */
.palette { width: min(640px, calc(100vw - 24px)); margin-top: min(14vh, 120px); border-radius: 22px; overflow: hidden; display: none; }
.palette[open] { display: flex; flex-direction: column; }
.pal-field { display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 60px; border-bottom: 1px solid var(--line); flex: none; }
.pal-field > svg { width: 20px; height: 20px; color: var(--ink-3); flex: none; }
.pal-field input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; font-size: 17px; color: var(--ink); }
.pal-field input::placeholder { color: var(--ink-4); }
.pal-list { overflow: auto; overscroll-behavior: contain; padding: 6px; max-height: min(440px, 58vh); }
.pal-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    padding: 10px 16px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--ink-3);
    flex: none;
}
.pal-foot span { display: inline-flex; align-items: center; gap: 6px; }
.pal-foot kbd { height: 20px; min-width: 20px; font-size: 10px; }

/* Shortcuts */
.keys-list { display: grid; gap: 0; }
.keys-list div { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.keys-list div:first-child { border-top: 0; }
.keys-list span:last-child { display: inline-flex; gap: 4px; }

/* Toasts */
.toasts {
    position: fixed;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 300;
    display: grid;
    gap: 8px;
    justify-items: center;
    pointer-events: none;
    width: max-content;
    max-width: calc(100vw - 32px);
}
.toast {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 14px;
    background: #0e1a2d;
    color: #e9effa;
    border: 1px solid rgba(255, 255, 255, .1);
    box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .55);
    font-size: 14px;
    font-weight: 500;
    animation: toast-in .35s var(--spring);
}
.toast svg { width: 18px; height: 18px; flex: none; }
.toast.ok svg { color: #4ade80; }
.toast.err svg { color: #ff6b85; }
.toast.out { animation: toast-out .25s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 760px) {
    .sections { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 440px; }
    .pill-btn .pill-label, .pill-btn kbd { display: none; }
    .pill-btn { padding: 0; width: 36px; justify-content: center; }
    .search-kbd { display: none; }
}
@media (max-width: 560px) {
    .now { grid-template-columns: 1fr; text-align: center; padding: 20px 18px 14px; }
    .now-time { justify-content: center; }
    .now-loc { justify-content: center; }
    .now-loc .link-btn { margin-left: 0; }
    .w { padding: 16px; border-radius: 18px; }
    .cal-day { min-height: 46px; border-radius: 10px; }
    .cal-day .sol { font-size: 14px; }
    .wea-temp { font-size: 46px; }
    .wea-icon { width: 80px; height: 80px; }
    .digit { width: 23px; height: 31px; font-size: 15px; }
}
@media (hover: none) {
    .search-kbd { display: none; }
}

/* =========================================================================
   MOTION PREFERENCES
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        transition-delay: 0s !important;
    }
    .caret { animation: none; }
    .js .reveal { opacity: 1; transform: none; }
    .main::before { animation: none; }
}

/* Icon sprite usage: <svg class="i"><use href="#i-name"/></svg> */
.i {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Moon drawing */
.moon-dark { fill: #172235; }
.moon-rim { stroke: rgba(255, 255, 255, .14); stroke-width: 1; }
html[data-scheme="light"] .moon-dark { fill: #d5deea; }
html[data-scheme="light"] .moon-rim { stroke: rgba(13, 31, 60, .12); }

/* Weather icons */
.wi-sun circle { fill: var(--sun); }
.wi-rays line { stroke: var(--sun); stroke-width: 3; stroke-linecap: round; }
.wi-moon { fill: #e9eef9; }
html[data-scheme="light"] .wi-moon { fill: #f2c94c; }
.wi-cloud { fill: var(--cloud); }
.wi-cloud-back { opacity: .55; }
.wi-rain line { stroke: var(--brand-sky); stroke-width: 3; stroke-linecap: round; }
.wi-snow circle { fill: #fff; stroke: var(--cloud); stroke-width: 1; }
.wi-bolt { fill: var(--sun); }
.wi-mist line { stroke: var(--cloud); stroke-width: 3.5; stroke-linecap: round; }
.wea-icon { overflow: visible; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .18)); }
