/* ===== Firri Start — start page =====
   Tokens, backdrop, buttons and a11y live in base.css. */

body {
    display: flex;
    padding: clamp(1rem, 4vw, 3rem);
    /* leave room for the fixed APOD dock at the bottom */
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
}

/* ===== Layout ===== */
.ui {
    width: 100%;
    display: flex;
    transition: opacity 0.55s ease, visibility 0.55s;
}

main {
    width: 100%;
    max-width: 700px;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(1.4rem, 3.6vh, 2.5rem);
    animation: rise 0.8s var(--ease) both;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* "View picture" mode: hide the interface, let the photograph breathe */
body.view .ui { opacity: 0; visibility: hidden; pointer-events: none; }
body.view .scrim { opacity: 0.22; }

/* ===== Clock ===== */
.hero { text-align: center; display: flex; flex-direction: column; align-items: center; }

.greeting {
    margin: 0 0 0.35rem;
    font-size: clamp(0.85rem, 2.2vw, 1rem);
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--txt-muted);
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.55);
}
.greeting:empty { display: none; }

.clock {
    padding: 0 0.4em;
    border: 0;
    border-radius: var(--radius);
    background: none;
    color: var(--txt);
    cursor: pointer;
    line-height: 1;
    text-shadow: 0 6px 36px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.35);
    transition: transform var(--ease);
}
.clock:active { transform: scale(0.985); }

#clock {
    position: relative;
    display: inline-block;
    font-variant-numeric: tabular-nums;
}
.clock-hm {
    font-size: clamp(4rem, 15vw, 7.5rem);
    font-weight: 600;
    letter-spacing: -0.045em;
}
/* Seconds (and AM/PM) hang to the right so HH:MM stays optically centred. */
.clock-aside {
    position: absolute;
    left: 100%;
    bottom: 0.2em;
    display: flex;
    align-items: baseline;
    gap: 0.35em;
    margin-left: 0.18em;
    white-space: nowrap;
    font-size: clamp(1.2rem, 4vw, 2rem);
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--txt-muted);
}
.clock-period { font-size: 0.62em; letter-spacing: 0.05em; }
.clock-period:empty { display: none; }

.date {
    margin: 0.7rem 0 0;
    font-size: clamp(1rem, 2.6vw, 1.2rem);
    font-weight: 500;
    color: var(--txt-muted);
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.55);
}

/* ===== Daily quote ===== */
.quote {
    margin: 0;
    max-width: 34rem;
    text-align: center;
    animation: rise 0.8s 0.15s var(--ease) both;
}
.quote-text {
    margin: 0;
    font-size: clamp(0.98rem, 2.4vw, 1.15rem);
    font-style: italic;
    line-height: 1.6;
    color: var(--txt);
    text-wrap: balance;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.65), 0 1px 2px rgba(0, 0, 0, 0.4);
}
.quote-text::before { content: "\201C"; }
.quote-text::after  { content: "\201D"; }
.quote-author {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.84rem;
    font-style: normal;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--txt-muted);
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}
.quote-author:empty { display: none; }
.quote-author:not(:empty)::before { content: "— "; }

/* ===== Search ===== */
.search {
    position: relative;
    z-index: 20;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 6px;
    background: var(--glass);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: border-color var(--ease), background var(--ease), box-shadow var(--ease);
}
.search:focus-within {
    border-color: color-mix(in srgb, var(--accent) 70%, white 10%);
    background: var(--glass-strong);
    box-shadow: var(--shadow), 0 0 0 4px color-mix(in srgb, var(--accent) 28%, transparent);
}

/* ===== Engine picker ===== */
/* (the keyboard-shortcut hint is hidden on touch screens, where there is no keyboard) */
@media (hover: none) { .engine-hint { display: none; } }
.engine { position: relative; flex: none; }

.engine-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    height: 44px;
    padding: 0 0.75rem 0 0.8rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background var(--ease);
}
.engine-btn:hover,
.engine-btn[aria-expanded="true"] { background: rgba(255, 255, 255, 0.1); }
/* While a "!bang" is typed the chip previews the engine that will be used. */
.engine.peek .engine-btn { background: color-mix(in srgb, var(--accent) 26%, transparent); }

.engine-icon {
    width: 20px;
    height: 20px;
    flex: none;
    border-radius: 6px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16);
}
.engine-chevron { flex: none; opacity: 0.7; transition: transform var(--ease); }
.engine-btn[aria-expanded="true"] .engine-chevron { transform: rotate(180deg); }

.engine-pop {
    position: absolute;
    top: calc(100% + 14px);
    left: -6px;
    z-index: 30;
    width: min(88vw, 300px);
    padding: 6px;
    border-radius: 20px;
    border: 1px solid var(--line-strong);
    /* Near-opaque on purpose: this sits inside the search pill, which already has a
       backdrop-filter, and a nested one can't blur what is behind its parent. */
    background: rgba(13, 16, 30, 0.97);
    box-shadow: var(--shadow);
    transform-origin: top left;
    animation: pop 0.2s var(--ease) both;
}
.engine-pop[hidden] { display: none; }
/* JS flips the picker above the search bar when there is more room there. */
.engine-pop[data-side="up"] { top: auto; bottom: calc(100% + 14px); transform-origin: bottom left; }

.engine-menu {
    margin: 0;
    padding: 0;
    list-style: none;
    outline: none;
    max-height: 80vh;          /* JS narrows this further when space is tight */
    overflow-y: auto;
    scrollbar-width: thin;
}
.engine-opt {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0.6rem;
    border-radius: 14px;
    font-size: 0.93rem;
    cursor: pointer;
    transition: background 0.12s;
}
.engine-opt .engine-icon { width: 24px; height: 24px; border-radius: 7px; }
.engine-opt.active { background: rgba(255, 255, 255, 0.12); }
.engine-menu:focus-visible .engine-opt.active { box-shadow: inset 0 0 0 2px var(--accent-hover); }
.engine-opt-name { flex: 1; min-width: 0; }
.engine-bang {
    padding: 0.18rem 0.42rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: 600 0.72rem/1.1 var(--font);
    color: var(--txt-faint);
}
.engine-check { flex: none; width: 16px; height: 16px; color: var(--accent-hover); opacity: 0; }
.engine-opt[aria-selected="true"] .engine-check { opacity: 1; }

.engine-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
    margin-top: 0.35rem;
    padding: 0.65rem 0.75rem;
    border-top: 1px solid var(--line);
    border-radius: 0 0 12px 12px;
    cursor: pointer;
}
.engine-switch:hover { background: rgba(255, 255, 255, 0.05); }
.engine-switch-text { display: grid; gap: 0.15rem; min-width: 0; }
.engine-switch-text strong { font-size: 0.9rem; font-weight: 600; }
.engine-switch-text small { font-size: 0.74rem; line-height: 1.35; color: var(--txt-faint); }

/* The checkbox itself is the switch: native semantics and focus, custom look.
   (Scoped under .engine-switch so it beats the generic ".search input" rule.) */
.engine-switch .switch-input {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    flex: none;
    width: 40px;
    min-width: 40px;
    height: 24px;
    margin: 0;
    padding: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    cursor: pointer;
    transition: background var(--ease);
}
.engine-switch .switch-input::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    transition: transform var(--ease);
}
.engine-switch .switch-input:checked { background: linear-gradient(135deg, var(--accent-strong), var(--accent)); }
.engine-switch .switch-input:checked::after { transform: translateX(16px); }

.engine-hint {
    display: grid;
    gap: 0.3rem;
    margin-top: 0.1rem;
    padding: 0.55rem 0.75rem 0.4rem;
    border-top: 1px solid var(--line);
    font-size: 0.74rem;
    color: var(--txt-faint);
}
.engine-hint kbd {
    padding: 0.05rem 0.34rem;
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 5px;
    font: 600 0.7rem/1.3 var(--font);
    color: var(--txt-muted);
}

.search input {
    flex: 1;
    min-width: 0;
    height: 44px;
    border: 0;
    background: transparent;
    font-size: 1.05rem;
    padding: 0 0.6rem;
    outline: none;
}
.search input::placeholder { color: var(--txt-faint); }
/* color-scheme: dark already draws the native clear button light — don't invert it */
.search input::-webkit-search-cancel-button { opacity: 0.7; cursor: pointer; }

.kbd {
    flex: none;
    min-width: 1.6rem;
    padding: 0.18rem 0.5rem;
    margin-right: 0.35rem;
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 7px;
    font: 600 0.78rem/1.2 var(--font);
    text-align: center;
    color: var(--txt-faint);
    transition: opacity var(--ease);
}
.search:focus-within .kbd { opacity: 0; }
@media (hover: none), (max-width: 520px) { .kbd { display: none; } }

.search-go {
    flex: none;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-strong), var(--accent));
    color: var(--on-accent);
    box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 85%, transparent);
    transition: transform var(--ease), box-shadow var(--ease), filter var(--ease);
}
.search-go:hover { transform: scale(1.06); filter: brightness(1.08); }
.search-go:active { transform: scale(0.94); }

/* ===== Live suggestions ===== */
.suggest {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 10px);
    z-index: 25;
    margin: 0;
    padding: 6px;
    list-style: none;
    overflow-y: auto;
    scrollbar-width: thin;
    border-radius: 22px;
    border: 1px solid var(--line-strong);
    /* near-opaque for the same reason as the engine picker (nested backdrop-filter) */
    background: rgba(13, 16, 30, 0.97);
    box-shadow: var(--shadow);
    transform-origin: top center;
    animation: pop 0.16s var(--ease) both;
}
.suggest[hidden] { display: none; }
.suggest[data-side="up"] { top: auto; bottom: calc(100% + 10px); transform-origin: bottom center; }

.suggest-opt {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.55rem 0.9rem;
    border-radius: 16px;
    font-size: 0.98rem;
    cursor: pointer;
}
.suggest-opt svg { flex: none; width: 16px; height: 16px; opacity: 0.5; }
.suggest-opt.active { background: rgba(255, 255, 255, 0.12); }
.suggest-opt.active svg { opacity: 0.9; }
.suggest-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--txt-muted);
}
/* what you typed stays quiet; the completion is emphasised */
.suggest-text b { color: var(--txt); font-weight: 600; }

/* ===== Bookmarks ===== */
.bookmarks { width: 100%; }

.bookmark-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;   /* a short last row stays centred instead of orphaned */
    gap: 0.8rem;
}
.bookmark-grid > li { position: relative; display: flex; width: 88px; }

.bookmark-link {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 0.5rem 0.85rem;
    border-radius: var(--radius);
    background: var(--glass);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    border: 1px solid var(--line);
    color: var(--txt);
    text-decoration: none;
    text-align: center;
    min-width: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: transform var(--ease), background var(--ease), border-color var(--ease), box-shadow var(--ease);
}
.bookmark-link:hover {
    transform: translateY(-4px);
    background: var(--glass-hover);
    border-color: var(--line-strong);
    box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.bookmark-link:active { transform: translateY(-1px) scale(0.98); }

.bookmark-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06));
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    overflow: hidden;
}
.bookmark-icon img { width: 26px; height: 26px; object-fit: contain; border-radius: 4px; }
.bookmark-icon.is-text { font-size: 0.95rem; letter-spacing: 0.01em; }

.bookmark-name {
    font-size: 0.82rem;
    font-weight: 500;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--txt-muted);
}
.bookmark-link:hover .bookmark-name { color: var(--txt); }

.bookmark-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: rgba(8, 10, 20, 0.7);
    color: var(--txt);
    font-size: 0.95rem;
    line-height: 1;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity var(--ease), transform var(--ease), background var(--ease);
}
.bookmark-grid > li:hover .bookmark-remove,
.bookmark-grid > li:focus-within .bookmark-remove { opacity: 1; transform: scale(1); }
.bookmark-remove:hover { background: #e5484d; border-color: transparent; }
/* No hover on touch screens → keep the control reachable */
@media (hover: none) { .bookmark-remove { opacity: 0.9; transform: scale(1); } }

/* Add-bookmark tile */
.bookmark-link.add {
    border: 1.5px dashed rgba(255, 255, 255, 0.32);
    background: rgba(255, 255, 255, 0.035);
    box-shadow: none;
    font: inherit;
    cursor: pointer;
}
.bookmark-link.add .bookmark-icon {
    background: transparent;
    font-size: 1.8rem;
    font-weight: 300;
    color: var(--txt-muted);
}
.bookmark-link.add:hover { border-color: var(--accent-hover); }

/* ===== Meta (IP & location) ===== */
.meta {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 100%;
    padding: 0.4rem 0.85rem;
    border: 1px solid transparent;
    border-radius: 999px;
    background: rgba(8, 10, 20, 0.28);
    font-size: 0.82rem;
    color: var(--txt-muted);
    transition: background var(--ease), border-color var(--ease), color var(--ease);
}
.meta:hover { background: var(--glass); border-color: var(--line); color: var(--txt); }
.meta svg { flex: none; opacity: 0.85; }
#ip { font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Dialog ===== */
.dialog {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--glass-strong);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    color: var(--txt);
    padding: 0;
    width: min(92vw, 400px);
    box-shadow: var(--shadow);
}
.dialog[open] { animation: pop 0.3s var(--ease) both; }
.dialog::backdrop { background: rgba(4, 6, 14, 0.6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }

@keyframes pop {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: none; }
}

.dialog-form { display: flex; flex-direction: column; gap: 0.5rem; padding: 1.6rem; }
.dialog-form h2 { margin: 0 0 0.6rem; font-size: 1.2rem; letter-spacing: -0.01em; }
.dialog-form label { font-size: 0.82rem; font-weight: 500; color: var(--txt-muted); margin-top: 0.4rem; }
.dialog-form input {
    padding: 0.72rem 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.07);
    outline: none;
    transition: border-color var(--ease), box-shadow var(--ease);
}
.dialog-form input:focus {
    border-color: var(--accent-hover);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}
.dialog-form input::placeholder { color: var(--txt-faint); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.3rem; }

/* ===== APOD: dock, info panel, caption ===== */
.apod {
    position: fixed;
    right: max(clamp(0.9rem, 3vw, 1.75rem), env(safe-area-inset-right, 0px));
    bottom: max(clamp(0.9rem, 3vw, 1.75rem), env(safe-area-inset-bottom, 0px));
    z-index: 5;
}
/* A class selector would otherwise override the `hidden` attribute. */
.apod[hidden] { display: none; }

.apod-dock {
    display: flex;
    gap: 2px;
    padding: 4px;
    border-radius: 999px;
    background: var(--glass);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}
.dock-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    height: 38px;
    padding: 0 0.95rem 0 0.8rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--txt-muted);
    font-size: 0.85rem;
    font-weight: 600;
    transition: background var(--ease), color var(--ease), transform var(--ease);
}
.dock-btn:hover { background: rgba(255, 255, 255, 0.12); color: var(--txt); }
.dock-btn:active { transform: scale(0.96); }
.dock-btn[aria-pressed="true"],
.dock-btn[aria-expanded="true"] { background: rgba(255, 255, 255, 0.18); color: var(--txt); }
.dock-btn svg { flex: none; }

/* The panel floats above the dock (out of flow) so the closed, invisible panel
   can never sit on top of — and swallow clicks meant for — the page beneath. */
.apod-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.7rem);
    width: min(92vw, 400px);
    max-height: min(68vh, 520px);
    display: flex;
    flex-direction: column;
    padding: 1.3rem 1.4rem 1.2rem;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--glass-strong);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.98);
    transform-origin: bottom right;
    transition: opacity var(--ease), transform var(--ease), visibility 0s linear 0.28s;
}
.apod.open .apod-panel {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
}

.apod-kicker {
    margin: 0 0 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-hover);
}
.apod-title { margin: 0; font-size: 1.3rem; font-weight: 700; line-height: 1.25; letter-spacing: -0.015em; text-wrap: balance; }
.apod-meta {
    margin: 0.45rem 0 0.9rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    font-size: 0.8rem;
    color: var(--txt-faint);
}
.apod-meta [id="apodCredit"]:empty { display: none; }

.apod-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.6rem;
    margin-right: -0.4rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
    border-radius: 6px;
    /* soft fade where the text continues; the padding keeps the last line clear of it */
    padding-bottom: 1.4rem;
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 1.4rem), transparent);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 1.4rem), transparent);
}
.apod-scroll::-webkit-scrollbar { width: 6px; }
.apod-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.25); border-radius: 3px; }
.apod-explanation { margin: 0; font-size: 0.92rem; line-height: 1.7; color: var(--txt-muted); }

.apod-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 0.6rem; }
.apod-actions a { padding: 0.55rem 1rem; font-size: 0.85rem; }
.apod-actions a[hidden] { display: none; }

.apod-caption {
    position: fixed;
    left: max(clamp(1rem, 3vw, 2rem), env(safe-area-inset-left, 0px));
    bottom: max(clamp(1rem, 3vw, 1.9rem), env(safe-area-inset-bottom, 0px));
    z-index: 4;
    max-width: min(46ch, calc(100vw - 20rem));
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.82rem;
    color: var(--txt-muted);
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.85), 0 1px 3px rgba(0, 0, 0, 0.6);
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    transition: opacity 0.5s ease 0.1s, transform 0.5s ease 0.1s;
}
.apod-caption strong { font-size: 1.02rem; font-weight: 700; color: var(--txt); }
.apod-caption span:empty { display: none; }
body.view .apod-caption { opacity: 1; transform: none; }

/* ===== Toast ===== */
.toast {
    position: fixed;
    top: max(1.25rem, env(safe-area-inset-top, 0px));
    left: 50%;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    max-width: min(92vw, 30rem);
    padding: 0.7rem 1.2rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--glass-strong);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    box-shadow: var(--shadow-sm);
    font-size: 0.88rem;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -0.75rem);
    transition: opacity var(--ease), transform var(--ease), visibility 0s linear 0.28s;
}
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition-delay: 0s; }
.toast-action {
    padding: 0.2rem 0.65rem;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: var(--txt);
    font-size: 0.82rem;
    font-weight: 700;
}
.toast-action:hover { background: rgba(255, 255, 255, 0.24); }

.noscript { position: fixed; inset: auto 0 1rem; text-align: center; color: var(--txt-muted); }

/* ===== Small screens ===== */
@media (max-width: 640px) {
    .dock-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .dock-btn { width: 42px; height: 42px; padding: 0; justify-content: center; }
    .apod-caption { right: 1rem; bottom: calc(4.6rem + env(safe-area-inset-bottom, 0px)); max-width: none; }
    .bookmark-grid > li { width: calc((100% - 1.6rem) / 3); }
    .engine-name { display: none; }
    .engine-btn { padding: 0 0.6rem 0 0.75rem; gap: 0.4rem; }
    .engine-pop { left: -2px; }
}
