/* =========================================================================
   core.css — layout and structure only (no colours)
   ========================================================================= */

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

html, body { margin: 0; padding: 0; }

body {
    font-family: 'Cormorant Garamond', 'Iowan Old Style', 'Palatino Linotype',
                 Georgia, 'Times New Roman', serif;
    font-size: 18px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 200px;
}

/* ---------- sticky header -------------------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-divider);
    z-index: 50;
}

.main-nav { display: flex; gap: 1.25rem; }

.main-nav a {
    text-decoration: none;
    color: inherit;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
    display: inline-flex;
    align-items: center;
}

.main-nav a[aria-current="page"] { border-bottom-color: var(--color-accent); }

.nav-home {
    padding: 0.2rem !important;
}

.nav-home svg {
    width: 34px;
    height: 34px;
    color: inherit;
}

.nav-home[aria-current="page"] svg { color: var(--color-accent); }

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

#lang-select {
    font-family: inherit;
    font-size: 0.95rem;
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: 1px solid var(--color-divider);
    border-radius: 4px;
    color: inherit;
    cursor: pointer;
}

#theme-toggle {
    width: 36px;
    height: 36px;
    border: 1px solid var(--color-divider);
    background: transparent;
    color: var(--color-accent);
    cursor: pointer;
    border-radius: 6px;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#theme-toggle svg { width: 24px; height: 24px; }

.help-toggle {
    width: 36px;
    height: 36px;
    border: 1px solid var(--color-divider);
    background: transparent;
    color: var(--color-accent);
    cursor: pointer;
    border-radius: 6px;
    padding: 0;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.help-toggle:hover { border-color: var(--color-accent); }

.help-panel {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
}

.help-panel[hidden] { display: none; }

.help-panel__inner {
    background: var(--color-bg);
    color: var(--color-text);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    max-width: 640px;
    width: 100%;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    padding: 1rem 1.25rem 1.5rem;
}

.help-panel__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--color-bg);
    padding: 0.5rem 0;
    margin: -0.5rem 0 0.5rem;
    border-bottom: 1px solid var(--color-divider);
    z-index: 1;
}

.help-panel__header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.help-panel__close {
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: 1px solid var(--color-divider);
    border-radius: 999px;
    cursor: pointer;
    color: var(--color-text-muted);
    font-size: 1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.help-panel__close:hover { border-color: var(--color-accent); color: var(--color-accent); }

.help-section {
    margin-top: 1.2rem;
}

.help-section h3 {
    margin: 0 0 0.4rem;
    font-size: 0.95rem;
    color: var(--color-accent);
}

.help-section p {
    margin: 0.3rem 0;
    font-size: 0.95rem;
    line-height: 1.55;
}

.help-keys {
    margin: 0.4rem 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.35rem 0.7rem;
    font-size: 0.9rem;
    align-items: center;
}

.help-keys dt {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.8rem;
    background: var(--color-row-hover);
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    border: 1px solid var(--color-divider);
    text-align: center;
    min-width: 1.6rem;
}

.help-keys dd {
    margin: 0;
    color: var(--color-text-muted);
}

/* ---------- author photo in About view ------------------------------ */

.author-photo {
    display: flex;
    justify-content: center;
    margin: 0 0 1.5rem;
}

.author-photo img {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--color-divider);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@media (max-width: 500px) {
    .author-photo img { width: 130px; height: 130px; }
}

.text-view__body {
    white-space: pre-wrap;
}

/* ---------- category filter strip ------------------------------------ */

/* ---------- Aum badge in the header --------------------------------- */
.nav-aum {
    display: inline-flex;
    align-items: center;
}
.nav-aum svg { display: block; }

/* ---------- floating filter funnel (draggable) ---------------------- */
.filter-fab {
    position: fixed;
    /* default resting spot: top-right, just under the gear / help buttons */
    right: 16px;
    top: 64px;
    z-index: 40;
    touch-action: none;   /* let pointer events drive dragging on touch */
}
.filter-fab[hidden] { display: none; }

.filter-fab__btn {
    position: relative;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 1px solid var(--color-divider);
    background: var(--color-bg);
    color: var(--color-text);
    cursor: grab;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
    -webkit-user-select: none;
    user-select: none;
}
.filter-fab__btn:active { cursor: grabbing; }
.filter-fab__btn svg { width: 24px; height: 24px; }
.filter-fab.has-active .filter-fab__btn {
    background: var(--color-accent);
    color: var(--color-bg);
    border-color: var(--color-accent);
}

.filter-fab__count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--color-accent);
    color: var(--color-bg);
    border: 2px solid var(--color-bg);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.filter-fab__count[hidden] { display: none; }

.filter-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: max-content;
    max-width: min(90vw, 22rem);
    padding: 0.8rem;
    background: var(--color-bg);
    border: 1px solid var(--color-divider);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}
.filter-panel[hidden] { display: none; }

.filter-panel__group + .filter-panel__group { margin-top: 0.75rem; }
.filter-panel__label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    margin-bottom: 0.4rem;
}
.filter-panel__row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 0.55rem;
}
.filter-panel__row[hidden] { display: none; }
.filter-panel__foot {
    margin-top: 0.75rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--color-divider);
    text-align: right;
}
.category-clear-text {
    font: inherit;
    font-size: 0.85rem;
    background: transparent;
    border: 1px solid var(--color-divider);
    border-radius: 999px;
    padding: 0.3rem 0.8rem;
    color: var(--color-text);
    cursor: pointer;
}
.category-clear-text:hover { border-color: var(--color-accent); color: var(--color-accent); }
.category-clear-text[hidden] { display: none; }

.category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-start;
}

.category-chip {
    font: inherit;
    font-size: 0.85rem;
    line-height: 1.2;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--color-divider);
    border-radius: 999px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.category-chip:hover { border-color: var(--color-accent); }

.category-chip.is-active {
    background: var(--color-accent);
    color: var(--color-bg);
    border-color: var(--color-accent);
}

.category-chip__count {
    font-size: 0.72rem;
    opacity: 0.7;
    font-variant-numeric: tabular-nums;
}

.category-chip.is-active .category-chip__count { opacity: 0.9; }

/* favourites chip — heart icon inline before the label */
.category-chip--fav .category-chip__heart {
    display: inline-flex;
    align-items: center;
}
.category-chip--fav .category-chip__heart svg {
    width: 14px;
    height: 14px;
    color: var(--color-accent);
}
.category-chip--fav.is-active .category-chip__heart svg {
    color: var(--color-bg);
}

/* share-favourites button — matches the clear button footprint */
.fav-share {
    background: transparent;
    border: 1px solid var(--color-divider);
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: 999px;
    padding: 0.25rem 0.45rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.fav-share:hover { border-color: var(--color-accent); color: var(--color-accent); }
.fav-share[hidden] { display: none; }
.fav-share svg { width: 16px; height: 16px; }

.category-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: center;
}

.category-match {
    font: inherit;
    font-size: 0.78rem;
    line-height: 1.2;
    padding: 0.25rem 0.7rem;
    border: 1px solid var(--color-divider);
    border-radius: 999px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    min-width: 3.5rem;
    text-align: center;
    transition: opacity 0.15s, border-color 0.15s, background-color 0.15s;
}

.category-match:hover { border-color: var(--color-accent); }

.category-match.is-dim { opacity: 0.45; }

.category-match[data-mode="all"] {
    background: var(--color-accent);
    color: var(--color-bg);
    border-color: var(--color-accent);
}

.difficulty-chips {
    display: inline-flex;
    gap: 0.3rem;
}

.difficulty-chip {
    font: inherit;
    font-size: 0.85rem;
    line-height: 1;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--color-divider);
    border-radius: 999px;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    letter-spacing: 0.05em;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.difficulty-chip:hover { border-color: var(--color-accent); }

.difficulty-chip.is-active {
    background: var(--color-accent);
    color: var(--color-bg);
    border-color: var(--color-accent);
}

.category-clear {
    font: inherit;
    font-size: 1rem;
    line-height: 1;
    width: 1.6rem;
    height: 1.6rem;
    background: transparent;
    border: 1px solid var(--color-divider);
    border-radius: 999px;
    color: var(--color-text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.category-clear:hover {
    color: var(--color-accent);
    border-color: var(--color-accent);
}

/* ---------- main view ------------------------------------------------- */

main { flex: 1; width: 100%; }
.view { width: 100%; }
.view[hidden] { display: none; }

.page-shell {
    max-width: 620px;
    margin: 0 auto;
    padding: 0 0.25rem;
}

/* ---------- gate frame (grid-overlay, gate on top, songs behind) ----- */

.gate-frame {
    display: grid;
    position: relative;
}

.gate-frame > * {
    grid-row: 1;
    grid-column: 1;
}

.gate-bg {
    position: sticky;
    top: 8px;
    width: 100%;
    aspect-ratio: 680 / 1148;   /* placeholder before first JS render (1200-52) */
    align-self: start;
    pointer-events: none;
    z-index: 3;                 /* in front of songs */
    color: var(--color-accent);
}

.gate-bg svg {
    width: 100%;
    height: 100%;
    display: block;
}

.songs-area {
    position: relative;
    z-index: 1;                 /* behind gate (gets masked) */
    /* Songs start higher now that the Aum moved to the header and the arch
       is shorter — reclaims a big chunk of vertical space on mobile. */
    padding: 22% 13% 0;
}

@media (max-width: 700px) {
    .songs-area { padding: 24% 12% 0; }
    .gate-bg { top: 6px; }
}

/* mobile portrait: top pagination hidden */
@media (max-width: 500px) {
    #pagination-top { display: none; }
}

/* ---------- song list ------------------------------------------------- */

.song-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    font-size: var(--song-font-size, 1rem);
}

.song-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid var(--color-divider);
    cursor: pointer;
    transition: background-color 120ms;
}

.song-item:hover,
.song-item:focus-within { background: var(--color-row-hover); }

.song-item.is-playing {
    background: color-mix(in srgb, var(--color-accent) 12%, transparent);
    font-weight: 500;
}

.song-item.is-error {
    opacity: 0.4;
    text-decoration: line-through;
    cursor: not-allowed;
}

.song-item__order {
    font-variant-numeric: tabular-nums;
    min-width: 2em;
    text-align: right;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.song-item__name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-transform: capitalize;
}

#now-playing-title { text-transform: capitalize; }

.song-item__lyrics-btn {
    background: none;
    border: 1px solid transparent;
    color: inherit;
    cursor: pointer;
    padding: 0.2rem 0.3rem;
    font: inherit;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.song-item__lyrics-btn:hover { border-color: var(--color-divider); }
.song-item__lyrics-btn svg { width: 18px; height: 18px; color: var(--color-text-muted); }
.song-item__lyrics-btn.is-active svg { color: var(--color-accent); }

/* Per-song options (⋮): share + download this song. Replaces the old
   standalone share button, so every row carries the same three controls. */
.song-item__menu {
    position: relative;
    flex-shrink: 0;
}

.song-item__menu-btn {
    background: none;
    border: 1px solid transparent;
    color: inherit;
    cursor: pointer;
    padding: 0.2rem 0.3rem;
    font: inherit;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.song-item__menu-btn:hover { border-color: var(--color-divider); }
.song-item__menu-btn svg { width: 18px; height: 18px; color: var(--color-text-muted); }
.song-item__menu-btn[aria-expanded="true"] svg { color: var(--color-accent); }

.song-item__menu-pop {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 20;
    min-width: 12.5rem;
    padding: 0.25rem;
    background: var(--color-bg);
    border: 1px solid var(--color-divider);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
}
/* Flipped upwards when the row sits near the bottom of the viewport. */
.song-item__menu-pop.is-above {
    top: auto;
    bottom: calc(100% + 4px);
}
.song-item__menu-pop[hidden] { display: none; }

.song-item__menu-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.6rem 0.7rem;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--color-text);
    font: inherit;
    font-size: 0.95rem;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.song-item__menu-item:hover,
.song-item__menu-item:focus-visible {
    background: var(--color-row-hover, rgba(127, 127, 127, 0.12));
}
.song-item__menu-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--color-text-muted);
}

.song-item__fav-btn {
    background: none;
    border: 1px solid transparent;
    color: inherit;
    cursor: pointer;
    padding: 0.2rem 0.3rem;
    font: inherit;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.song-item__fav-btn:hover { border-color: var(--color-divider); }
.song-item__fav-btn svg { width: 18px; height: 18px; color: var(--color-text-muted); }
.song-item__fav-btn.is-active svg { color: var(--color-accent); }

.song-lyrics {
    padding: 0.5rem 0.75rem 0.75rem 3rem;
    border-bottom: 1px solid var(--color-divider);
    white-space: pre-wrap;
    font-size: 0.95em;
    line-height: 1.7;
    color: var(--color-text-muted);
}

.song-lyrics[hidden] { display: none; }

/* ---------- pagination ----------------------------------------------- */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin: 0.75rem 0;
    padding: 0 0.25rem;
    flex-wrap: nowrap;
    position: relative;
    z-index: 5;
}

.pagination button {
    font: inherit;
    background: var(--color-bg);
    border: 1px solid var(--color-divider);
    color: inherit;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    font-size: 0.95rem;
}

.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }

.pagination__info {
    margin: 0 0.4rem;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    white-space: nowrap;
}

@media (max-width: 500px) {
    .pagination { gap: 0.25rem; font-size: 0.9rem; }
    .pagination button { padding: 0.3rem 0.45rem; }
    .pagination__info { margin: 0 0.25rem; font-size: 0.85rem; }
    .pagination .pagination__label { display: none; }
}

.notes-download {
    display: block;
    text-align: center;
    margin: 1.5rem auto;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    position: relative;
    z-index: 5;
}

/* ---------- about / privacy view ------------------------------------- */

.text-view {
    max-width: 720px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    white-space: pre-wrap;
}

/* ---------- player bar ----------------------------------------------- */

.player-bar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: var(--color-bar-bg);
    border-top: 1px solid var(--color-divider);
    padding: 0.5rem 0.6rem 0.7rem;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.player-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
    gap: 0.75rem;
}

#now-playing-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.player-info-right {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

#now-playing-time {
    font-variant-numeric: tabular-nums;
    color: var(--color-text-muted);
}

/* small mute button next to the time */
.btn-mute-mini {
    background: transparent;
    border: 1px solid transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-mute-mini:hover { border-color: var(--color-divider); }
.btn-mute-mini.is-active { color: var(--color-accent); border-color: var(--color-accent); }
.btn-mute-mini svg { width: 18px; height: 18px; }

#progress-slider {
    width: 100%;
    margin: 0;
    accent-color: var(--color-accent);
}

.player-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.55rem;
    margin-top: 0.4rem;
    flex-wrap: nowrap;          /* always single row */
}

.player-controls button {
    background: transparent;
    border: 1px solid var(--color-divider);
    color: inherit;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    width:  var(--btn-round-size);
    height: var(--btn-round-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.player-controls button:hover { border-color: var(--color-accent); }
.player-controls button.is-active { color: var(--color-accent); border-color: var(--color-accent); }

.player-controls button.btn-play {
    width:  var(--btn-play-size);
    height: var(--btn-play-size);
    border: 2px solid var(--color-accent);
}

.player-controls svg {
    width:  var(--btn-icon-size);
    height: var(--btn-icon-size);
}

.player-controls button.btn-play svg {
    width:  var(--btn-play-icon-size);
    height: var(--btn-play-icon-size);
}

/* ---------- footer --------------------------------------------------- */

.site-footer {
    text-align: center;
    padding: 1rem 0.5rem;
    margin-top: 2rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    border-top: 1px solid var(--color-divider);
    position: relative;
    z-index: 5;
}

.site-footer a {
    color: inherit;
    margin: 0 0.6rem;
    text-decoration: underline;
    padding-bottom: 2px;
    border-bottom: 2px solid transparent;
}

.site-footer a[aria-current="page"] {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
    text-decoration: none;
}

#copyright { display: block; margin-top: 0.4rem; }

#app-version {
    display: block;
    margin-top: 0.25rem;
    opacity: 0.6;
    font-size: 0.78rem;
}

.site-footer__webmaster {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    opacity: 0.75;
}

.site-footer__webmaster a { margin: 0 0 0 0.25rem; }

/* ---------- footer bulk downloads ------------------------------------ */

.site-footer__downloads {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* Full-contrast border and text (no dimming): a large part of the audience
   has declining vision, so these read as proper buttons, not hints. */
.footer-download {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    padding: 0.45rem 0.8rem;
    border: 1px solid var(--color-divider);
    border-radius: 999px;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.85rem;
    cursor: pointer;
}
.footer-download:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}
.footer-download svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}
.footer-download[aria-disabled="true"] {
    opacity: 0.45;
    cursor: not-allowed;
}
.footer-download[aria-disabled="true"]:hover {
    border-color: var(--color-divider);
    color: var(--color-text);
}

/* ---------- options panel ------------------------------------------- */

.theme-panel {
    position: fixed;
    top: 56px;
    right: 0.75rem;
    background: var(--color-bar-bg);
    backdrop-filter: blur(8px);
    border: 1px solid var(--color-divider);
    border-radius: 8px;
    padding: 1rem;
    z-index: 200;
    box-shadow: 0 4px 24px rgba(0,0,0,0.12);
    min-width: 240px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

.theme-panel[hidden] { display: none; }

.theme-panel h2 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 500;
}

.theme-panel h3 {
    margin: 0.85rem 0 0.4rem;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.color-palette {
    display: grid;
    grid-template-columns: repeat(5, 32px);
    gap: 8px;
    margin-bottom: 0.5rem;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
}

.color-swatch.is-selected { border-color: var(--color-text-primary); }

.segmented {
    display: flex;
    gap: 0;
    border: 1px solid var(--color-divider);
    border-radius: 4px;
    overflow: hidden;
}

.segmented button {
    flex: 1;
    background: transparent;
    border: 0;
    padding: 0.4rem 0.5rem;
    color: inherit;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    border-right: 1px solid var(--color-divider);
}

.segmented button:last-child { border-right: 0; }

.segmented button.is-selected {
    background: var(--color-accent);
    color: var(--color-bg);
}

.shortcuts-list {
    margin: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.4rem 0.75rem;
    font-size: 0.85rem;
    align-items: center;
}

.shortcuts-list dt {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.8rem;
    background: var(--color-row-hover);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--color-divider);
    text-align: center;
    min-width: 1.5rem;
}

.shortcuts-list dd {
    margin: 0;
    color: var(--color-text-muted);
}

#theme-close {
    width: 100%;
    padding: 0.45rem;
    margin-top: 0.85rem;
    border: 1px solid var(--color-divider);
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 0.9rem;
    border-radius: 4px;
    cursor: pointer;
}

/* ---------- toast --------------------------------------------------- */

.toast {
    position: fixed;
    bottom: 200px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-toast-bg);
    color: var(--color-toast-text);
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    z-index: 300;
    font-size: 0.9rem;
}

.toast[hidden] { display: none; }

/* ---------- mask SVG fill --------------------------------------------- */
/* the gate's outside-mask fills with bg colour so songs behind it disappear */

.gate-bg svg .gate-mask-outside { fill: var(--color-bg); }

/* ---------- mobile ---------------------------------------------------- */

@media (max-width: 500px) {
    body { font-size: 16px; }
    .site-header { padding: 0.5rem 0.5rem; flex-wrap: wrap; }
    .main-nav { gap: 0.7rem; flex-wrap: wrap; align-items: center; }
    .filter-menus { gap: 0.4rem; }
    .filter-menu__btn { font-size: 0.85rem; padding: 0.28rem 0.6rem; }
    /* popups can be wide on phones; anchor to the left edge of the nav */
    .filter-menu__pop { max-width: 90vw; }
    .theme-panel { right: 0.5rem; left: 0.5rem; min-width: auto; }
    .color-palette { grid-template-columns: repeat(5, 36px); }
    .color-swatch { width: 36px; height: 36px; }
    .player-bar { padding: 0.4rem 0.4rem 0.6rem; }
    .player-controls { gap: 0.4rem; }
}

/* ---------- offline audio controls (footer) ------------------------- */
.site-footer__offline {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.site-footer__offline[hidden] { display: none; }
.site-footer__offline[hidden] { display: none; }
#offline-save[hidden], #offline-clear[hidden] { display: none; }
.offline-status {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}
#offline-save:disabled { opacity: 0.7; cursor: default; }

/* Prominent state: solid blue "save" so people notice it. */
#offline-save {
    background: #1f6feb;
    border-color: #1f6feb;
    color: #fff;
    font-weight: 600;
}
#offline-save:hover { background: #195bc4; border-color: #195bc4; }
/* Saved state: green, so it's clear the songs are stored offline. */
#offline-save.is-saved {
    background: #1f9d55;
    border-color: #1f9d55;
    color: #fff;
}
#offline-save.is-saved:hover { background: #198048; border-color: #198048; }
