/* Adwaita Sans and Adwaita Mono, SIL OFL 1.1. An installed copy wins via
   local(); the subsets below are only fetched when the system lacks the font.
   Sans is the variable face trimmed to the 400-700 weights the page uses. */
@font-face {
    font-family: "Adwaita Sans";
    src: local("Adwaita Sans"), url("fonts/adwaita-sans-latin.woff2") format("woff2");
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2039, U+203A, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+2665, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Adwaita Sans";
    src: local("Adwaita Sans"), url("fonts/adwaita-sans-latin-ext.woff2") format("woff2");
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0100-02AF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Adwaita Sans";
    src: local("Adwaita Sans"), url("fonts/adwaita-sans-cyrillic.woff2") format("woff2");
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116, U+0460-052F, U+2DE0-2DFF, U+A640-A69F;
}
@font-face {
    font-family: "Adwaita Mono";
    src: local("Adwaita Mono"), url("fonts/adwaita-mono-latin.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2039, U+203A, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+2665, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Adwaita Mono";
    src: local("Adwaita Mono"), url("fonts/adwaita-mono-cyrillic.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116, U+0460-052F, U+2DE0-2DFF, U+A640-A69F;
}
@font-face {
    font-family: "Adwaita Mono";
    src: local("Adwaita Mono Bold"), url("fonts/adwaita-mono-bold-latin.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2039, U+203A, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+2665, U+FEFF, U+FFFD;
}

:root {
    color-scheme: dark;
    --window-bg: #242424;
    --view-bg: #1e1e1e;
    --headerbar-bg: #303030;
    --card-bg: #303030;
    --row-bg: #353535;
    --row-hover: #3b3b3b;
    --fg: #ffffff;
    --fg-secondary: rgba(255, 255, 255, 0.70);
    --fg-tertiary: rgba(255, 255, 255, 0.48);
    --border: rgba(255, 255, 255, 0.09);
    --strong-border: rgba(255, 255, 255, 0.14);
    --accent: #3584e4;
    --accent-hover: #62a0ea;
    --accent-bg: rgba(53, 132, 228, 0.18);
    --accent-soft: rgba(53, 132, 228, 0.12);
    --accent-tag: #99c1f1;
    --accent-tag-hover: #c0ddff;
    --accent-tag-bg-hover: rgba(53, 132, 228, 0.30);
    --success: #33d17a;

    --shadow-window: 0 1px 2px rgba(0, 0, 0, 0.65), 0 18px 50px rgba(0, 0, 0, 0.48);
    --shadow-headerbar: 0 1px rgba(0, 0, 0, 0.25);
    --shadow-card: inset 0 1px rgba(255, 255, 255, 0.025), 0 1px 2px rgba(0, 0, 0, 0.26);
    --shadow-card-tinted: inset 0 1px rgba(255, 255, 255, 0.045), 0 1px 2px rgba(0, 0, 0, 0.28);
    --shadow-cover: 0 2px 8px rgba(0, 0, 0, 0.34);
    --shadow-cover-hover: 0 4px 13px rgba(0, 0, 0, 0.42);
    --shadow-history-cover: 0 1px 4px rgba(0, 0, 0, 0.34);
    --shadow-lightbox: 0 24px 80px rgba(0, 0, 0, 0.72);
    --shadow-lightbox-close: 0 2px 6px rgba(0, 0, 0, 0.35);
    --icon-border: rgba(255, 255, 255, 0.16);
    --icon-shadow: inset 0 1px rgba(255, 255, 255, 0.16), 0 1px 2px rgba(0, 0, 0, 0.35);
    --cover-placeholder: #282828;
    --lightbox-img-bg: #202020;
    --lightbox-backdrop: rgba(0, 0, 0, 0.72);
    --lightbox-close-bg: rgba(36, 36, 36, 0.88);
    --lightbox-close-hover: #424242;
    --eq-top-bg: rgba(255, 255, 255, 0.06);
    --eq-top-border: rgba(255, 255, 255, 0.06);
    --tint-base: rgba(48, 48, 48, 0.96);
    --tint-row-base: rgba(53, 53, 53, 0.94);
    --tint-row-base-hover: rgba(59, 59, 59, 0.96);
    --loved-fg: #ff7b82;
    --loved-bg: rgba(237, 51, 59, 0.16);
    --loved-border: rgba(237, 51, 59, 0.28);

    --font-sans: "Adwaita Sans", "Cantarell", system-ui, sans-serif;
    --font-mono: "Adwaita Mono", "AdwaitaMono Nerd Font", "Adwaita Mono Nerd Font", ui-monospace, monospace;

    --radius-window: 15px;
    --radius-card: 12px;
    --radius-row: 9px;
}

/* The light palette is applied by the system preference unless the visitor
   pinned dark, and by an explicit light choice. Both copies below are
   generated from one source and must stay identical. */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        color-scheme: light;
        --window-bg: #fafafa;
        --view-bg: #ffffff;
        --headerbar-bg: #ebebeb;
        --card-bg: #ffffff;
        --row-bg: #ffffff;
        --row-hover: #f2f2f2;
        --fg: rgba(0, 0, 0, 0.86);
        --fg-secondary: rgba(0, 0, 0, 0.63);
        --fg-tertiary: rgba(0, 0, 0, 0.45);
        --border: rgba(0, 0, 0, 0.08);
        --strong-border: rgba(0, 0, 0, 0.13);
        --accent: #1c71d8;
        --accent-hover: #1a5fb4;
        --accent-bg: rgba(53, 132, 228, 0.13);
        --accent-soft: rgba(53, 132, 228, 0.10);
        --accent-tag: #1a5fb4;
        --accent-tag-hover: #15458c;
        --accent-tag-bg-hover: rgba(53, 132, 228, 0.24);
        --success: #2ec27e;

        --shadow-window: 0 1px 2px rgba(0, 0, 0, 0.10), 0 18px 50px rgba(0, 0, 0, 0.13);
        --shadow-headerbar: 0 1px rgba(0, 0, 0, 0.07);
        --shadow-card: inset 0 1px rgba(255, 255, 255, 0.90), 0 1px 2px rgba(0, 0, 0, 0.07);
        --shadow-card-tinted: inset 0 1px rgba(255, 255, 255, 0.75), 0 1px 2px rgba(0, 0, 0, 0.08);
        --shadow-cover: 0 2px 8px rgba(0, 0, 0, 0.14);
        --shadow-cover-hover: 0 4px 13px rgba(0, 0, 0, 0.19);
        --shadow-history-cover: 0 1px 4px rgba(0, 0, 0, 0.13);
        --shadow-lightbox: 0 24px 80px rgba(0, 0, 0, 0.30);
        --shadow-lightbox-close: 0 2px 6px rgba(0, 0, 0, 0.14);
        --icon-border: rgba(0, 0, 0, 0.12);
        --icon-shadow: inset 0 1px rgba(255, 255, 255, 0.80), 0 1px 2px rgba(0, 0, 0, 0.12);
        --cover-placeholder: #e4e4e4;
        --lightbox-img-bg: #f0f0f0;
        --lightbox-backdrop: rgba(0, 0, 0, 0.45);
        --lightbox-close-bg: rgba(255, 255, 255, 0.92);
        --lightbox-close-hover: #e0e0e0;
        --eq-top-bg: rgba(0, 0, 0, 0.05);
        --eq-top-border: rgba(0, 0, 0, 0.06);
        --tint-base: rgba(255, 255, 255, 0.96);
        --tint-row-base: rgba(255, 255, 255, 0.94);
        --tint-row-base-hover: rgba(248, 248, 248, 0.96);
        --loved-fg: #c01c28;
        --loved-bg: rgba(237, 51, 59, 0.12);
        --loved-border: rgba(237, 51, 59, 0.26);
    }
}

:root[data-theme="light"] {
    color-scheme: light;
    --window-bg: #fafafa;
    --view-bg: #ffffff;
    --headerbar-bg: #ebebeb;
    --card-bg: #ffffff;
    --row-bg: #ffffff;
    --row-hover: #f2f2f2;
    --fg: rgba(0, 0, 0, 0.86);
    --fg-secondary: rgba(0, 0, 0, 0.63);
    --fg-tertiary: rgba(0, 0, 0, 0.45);
    --border: rgba(0, 0, 0, 0.08);
    --strong-border: rgba(0, 0, 0, 0.13);
    --accent: #1c71d8;
    --accent-hover: #1a5fb4;
    --accent-bg: rgba(53, 132, 228, 0.13);
    --accent-soft: rgba(53, 132, 228, 0.10);
    --accent-tag: #1a5fb4;
    --accent-tag-hover: #15458c;
    --accent-tag-bg-hover: rgba(53, 132, 228, 0.24);
    --success: #2ec27e;

    --shadow-window: 0 1px 2px rgba(0, 0, 0, 0.10), 0 18px 50px rgba(0, 0, 0, 0.13);
    --shadow-headerbar: 0 1px rgba(0, 0, 0, 0.07);
    --shadow-card: inset 0 1px rgba(255, 255, 255, 0.90), 0 1px 2px rgba(0, 0, 0, 0.07);
    --shadow-card-tinted: inset 0 1px rgba(255, 255, 255, 0.75), 0 1px 2px rgba(0, 0, 0, 0.08);
    --shadow-cover: 0 2px 8px rgba(0, 0, 0, 0.14);
    --shadow-cover-hover: 0 4px 13px rgba(0, 0, 0, 0.19);
    --shadow-history-cover: 0 1px 4px rgba(0, 0, 0, 0.13);
    --shadow-lightbox: 0 24px 80px rgba(0, 0, 0, 0.30);
    --shadow-lightbox-close: 0 2px 6px rgba(0, 0, 0, 0.14);
    --icon-border: rgba(0, 0, 0, 0.12);
    --icon-shadow: inset 0 1px rgba(255, 255, 255, 0.80), 0 1px 2px rgba(0, 0, 0, 0.12);
    --cover-placeholder: #e4e4e4;
    --lightbox-img-bg: #f0f0f0;
    --lightbox-backdrop: rgba(0, 0, 0, 0.45);
    --lightbox-close-bg: rgba(255, 255, 255, 0.92);
    --lightbox-close-hover: #e0e0e0;
    --eq-top-bg: rgba(0, 0, 0, 0.05);
    --eq-top-border: rgba(0, 0, 0, 0.06);
    --tint-base: rgba(255, 255, 255, 0.96);
    --tint-row-base: rgba(255, 255, 255, 0.94);
    --tint-row-base-hover: rgba(248, 248, 248, 0.96);
    --loved-fg: #c01c28;
    --loved-bg: rgba(237, 51, 59, 0.12);
    --loved-border: rgba(237, 51, 59, 0.26);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    padding: 32px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fg);
    background:
        radial-gradient(900px 500px at 50% -120px, var(--accent-soft), transparent 68%),
        var(--view-bg);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.window {
    width: min(780px, 100%);
    overflow: hidden;
    background: var(--window-bg);
    border: 1px solid var(--strong-border);
    border-radius: var(--radius-window);
    box-shadow: var(--shadow-window);
}

.headerbar {
    min-height: 58px;
    padding: 8px 12px;
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr) 80px;
    align-items: center;
    background: var(--headerbar-bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-headerbar);
}

.header-side {
    display: flex;
    align-items: center;
}

.header-start {
    justify-content: flex-start;
}

.header-end {
    min-height: 34px;
    justify-content: flex-end;
    gap: 6px;
}

.app-icon {
    width: 34px;
    height: 34px;
    display: block;
    object-fit: contain;
    border: 1px solid var(--icon-border);
    border-radius: 9px;
    box-shadow: var(--icon-shadow);
}

.title-stack {
    min-width: 0;
    text-align: center;
}

.title-stack h1 {
    margin: 0;
    font-size: 0.96rem;
    font-weight: 700;
    line-height: 1.18;
}

.title-stack > span {
    display: block;
    margin-top: 2px;
    color: var(--fg-tertiary);
    font-size: 0.69rem;
    line-height: 1.15;
}

.content {
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.group {
    min-width: 0;
}

.group-title {
    min-height: 24px;
    margin: 0 4px 7px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.group-title h2 {
    margin: 0;
    color: var(--fg-secondary);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.2;
}

.group-title > span {
    color: var(--fg-tertiary);
    font-size: 0.7rem;
}

.mono-title h2 {
    color: var(--fg-secondary);
    font-family: var(--font-mono);
}

.mono-title h2::before {
    content: "## ";
    color: var(--accent);
}

.card {
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
}

.music {
    padding: 16px;
    transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

.music.cover-tinted {
    background:
        linear-gradient(115deg,
            rgba(var(--cover-rgb), 0.22),
            rgba(var(--cover-rgb), 0.10) 48%,
            var(--tint-base) 100%),
        var(--card-bg);
    border-color: rgba(var(--cover-rgb), 0.32);
    box-shadow:
        var(--shadow-card-tinted),
        0 6px 24px rgba(var(--cover-rgb), 0.07);
}

.music.cover-tinted .divider {
    background: rgba(var(--cover-rgb), 0.28);
}

.track-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.cover-button {
    width: 114px;
    height: 114px;
    padding: 0;
    flex: 0 0 auto;
    border: 0;
    border-radius: 12px;
    background: transparent;
    cursor: zoom-in;
}

.cover {
    width: 112px;
    height: 112px;
    display: block;
    object-fit: cover;
    opacity: 0;
    background: var(--cover-placeholder);
    border: 1px solid var(--strong-border);
    border-radius: 11px;
    box-shadow: var(--shadow-cover);
    transition: opacity 0.35s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.cover.loaded {
    opacity: 1;
}

.cover-button:hover .cover {
    transform: scale(1.025);
    box-shadow: var(--shadow-cover-hover);
}

.cover-button:active .cover,
.history-cover-button:active .history-cover {
    transform: scale(0.98);
}

.cover-button:focus-visible,
.history-cover-button:focus-visible,
.lightbox-close:focus-visible,
.link-row a:focus-visible,
.t-name:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.track-meta {
    min-width: 0;
    padding-top: 3px;
    text-align: left;
}

.t-name,
.t-artist,
.t-album {
    font-family: var(--font-sans);
}

.track-title-row,
.history-title-row {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 7px;
}

.track-title-row {
    align-items: baseline;
}

.t-name {
    display: inline-block;
    max-width: 100%;
    color: var(--fg);
    font-size: 1.32rem;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
    text-decoration: none;
    transition: color 0.15s ease;
}

.t-name:hover {
    color: var(--accent-hover);
}

.loved-mark {
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--loved-fg);
    background: var(--loved-bg);
    border: 1px solid var(--loved-border);
    border-radius: 999px;
    font-size: 0.72rem;
    line-height: 1;
}

.main-loved {
    position: relative;
    top: -1px;
    min-width: 24px;
    height: 24px;
    font-size: 0.82rem;
}

.loved-mark[hidden] {
    display: none;
}

.t-artist {
    margin-top: 5px;
    color: var(--fg-secondary);
    font-size: 0.96rem;
    overflow-wrap: anywhere;
}

.t-album {
    margin-top: 4px;
    color: var(--fg-tertiary);
    font-size: 0.78rem;
    overflow-wrap: anywhere;
}

.track-meta > div:empty {
    display: none;
}

.divider {
    height: 1px;
    margin: 15px 0 11px;
    background: var(--border);
}

.status-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    color: var(--fg-secondary);
    font-size: 0.8rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--fg-tertiary);
}

.status-dot.now {
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(51, 209, 122, 0.10), 0 0 7px rgba(51, 209, 122, 0.65);
    animation: pulse 2s ease-in-out infinite;
}

.eq {
    display: inline-flex;
    align-items: flex-end;
    gap: 3px;
}

.eq span {
    width: 3px;
    border-radius: 2px;
    background: var(--fg-tertiary);
    transform: scaleY(0.15);
    transform-origin: bottom;
    transition: background-color 0.2s ease;
}

.eq-top {
    width: 34px;
    height: 34px;
    padding: 8px;
    display: inline-flex;
    align-items: flex-end;
    justify-content: center;
    border-radius: 9px;
    background: var(--eq-top-bg);
    border: 1px solid var(--eq-top-border);
}

.eq-top span {
    height: 100%;
}

.eq-top span:nth-child(1) { transform: scaleY(0.28); }
.eq-top span:nth-child(2) { transform: scaleY(0.48); }
.eq-top span:nth-child(3) { transform: scaleY(0.22); }
.eq-top span:nth-child(4) { transform: scaleY(0.38); }

.eq-top.on span {
    background: var(--accent-hover);
    animation: eq-bounce 1s ease-in-out infinite;
}

.eq-top.on span:nth-child(1) { animation-duration: 0.9s; }
.eq-top.on span:nth-child(2) { animation-duration: 0.7s; animation-delay: 0.12s; }
.eq-top.on span:nth-child(3) { animation-duration: 1.1s; animation-delay: 0.28s; }
.eq-top.on span:nth-child(4) { animation-duration: 0.8s; animation-delay: 0.42s; }

.t-tags {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.t-tags:empty {
    display: none;
}

.t-tag {
    padding: 4px 9px;
    color: var(--accent-tag);
    background: var(--accent-bg);
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    line-height: 1.2;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.t-tag:hover {
    color: var(--accent-tag-hover);
    background: var(--accent-tag-bg-hover);
}

.history {
    padding: 6px;
}

.history-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    background: var(--border);
    border-radius: 8px;
}

.history-item {
    min-width: 0;
    min-height: 82px;
    padding: 11px;
    display: flex;
    align-items: center;
    gap: 11px;
    background: var(--row-bg);
    transition: background 0.25s ease, box-shadow 0.25s ease;
}

.history-item.cover-tinted {
    background:
        linear-gradient(105deg,
            rgba(var(--cover-rgb), 0.24),
            rgba(var(--cover-rgb), 0.10) 62%,
            var(--tint-row-base)),
        var(--row-bg);
    box-shadow: inset 3px 0 rgba(var(--cover-rgb), 0.48);
}

.history-item:hover {
    background: var(--row-hover);
}

.history-item.cover-tinted:hover {
    background:
        linear-gradient(105deg,
            rgba(var(--cover-rgb), 0.31),
            rgba(var(--cover-rgb), 0.14) 62%,
            var(--tint-row-base-hover)),
        var(--row-hover);
}

.history-cover-button {
    width: 58px;
    height: 58px;
    padding: 0;
    flex: 0 0 auto;
    border: 0;
    border-radius: 8px;
    background: var(--cover-placeholder);
    cursor: zoom-in;
}

.history-cover {
    width: 58px;
    height: 58px;
    display: block;
    object-fit: cover;
    border: 1px solid var(--strong-border);
    border-radius: 8px;
    box-shadow: var(--shadow-history-cover);
    transition: transform 0.18s ease;
}

.history-cover-button:hover .history-cover {
    transform: scale(1.035);
}

.history-meta {
    min-width: 0;
}

.history-name,
.history-artist,
.history-time {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-name {
    display: block;
    min-width: 0;
    max-width: 100%;
    color: var(--fg);
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    transition: color 0.15s ease;
}

.history-name:hover {
    color: var(--accent-hover);
}

.history-artist {
    margin-top: 4px;
    color: var(--fg-secondary);
    font-size: 0.69rem;
}

.history-time {
    margin-top: 5px;
    color: var(--fg-tertiary);
    font-size: 0.63rem;
}

.history-empty {
    grid-column: 1 / -1;
    padding: 18px;
    color: var(--fg-tertiary);
    background: var(--row-bg);
    font-size: 0.76rem;
    text-align: center;
}

.links-card {
    padding: 0;
}

.links-list {
    display: flex;
    flex-direction: column;
}

.link-row {
    min-height: 52px;
    padding: 0 16px;
    display: grid;
    grid-template-columns: minmax(120px, 0.30fr) minmax(0, 1fr) 16px;
    align-items: center;
    gap: 16px;
    border-top: 1px solid var(--border);
    transition: background 0.15s ease;
}

.link-row:first-child {
    border-top: 0;
}

.link-row:hover {
    background: var(--row-hover);
}

.link-row::after {
    content: "›";
    color: var(--fg-tertiary);
    font-size: 1.4rem;
    line-height: 1;
}

.link-label {
    color: var(--fg-secondary);
    font-size: 0.84rem;
    font-weight: 600;
}

.link-row a {
    justify-self: start;
    max-width: 100%;
    color: var(--accent-hover);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

.link-row a:hover {
    text-decoration: underline;
}

.badges {
    display: flex;
    justify-content: center;
    gap: 8px;
    opacity: 0.72;
}

.badges img {
    display: block;
    border-radius: 3px;
    image-rendering: pixelated;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.badges img:hover {
    opacity: 1;
    transform: translateY(-1px);
}

.caption {
    margin: -9px 0 0;
    color: var(--fg-tertiary);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    text-align: center;
}

.cover-lightbox[hidden] {
    display: none;
}

.cover-lightbox {
    position: fixed;
    z-index: 20;
    inset: 0;
    padding: 24px;
    display: grid;
    place-items: center;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: var(--lightbox-backdrop);
    cursor: zoom-out;
    backdrop-filter: blur(7px);
}

.lightbox-content {
    position: relative;
    z-index: 1;
    width: min(560px, 90vw);
    margin: 0;
    padding: 12px;
    background: var(--headerbar-bg);
    border: 1px solid var(--strong-border);
    border-radius: 16px;
    box-shadow: var(--shadow-lightbox);
}

.lightbox-content img {
    width: 100%;
    max-height: 75vh;
    display: block;
    object-fit: contain;
    background: var(--lightbox-img-bg);
    border-radius: 11px;
}

.lightbox-content figcaption {
    margin-top: 10px;
    color: var(--fg-secondary);
    font-size: 0.76rem;
    text-align: center;
}

.lightbox-close {
    position: absolute;
    z-index: 2;
    top: 18px;
    right: 18px;
    width: 34px;
    height: 34px;
    padding: 0;
    display: grid;
    place-items: center;
    color: var(--fg);
    background: var(--lightbox-close-bg);
    border: 1px solid var(--strong-border);
    border-radius: 50%;
    font: 22px/1 system-ui, sans-serif;
    cursor: pointer;
    box-shadow: var(--shadow-lightbox-close);
}

.lightbox-close:hover {
    background: var(--lightbox-close-hover);
}

body.lightbox-open {
    overflow: hidden;
}

.theme-toggle {
    width: 34px;
    height: 34px;
    padding: 0;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    color: var(--fg-secondary);
    background: var(--eq-top-bg);
    border: 1px solid var(--eq-top-border);
    border-radius: 9px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.theme-toggle:hover {
    color: var(--fg);
    background: var(--row-hover);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.theme-toggle svg {
    width: 17px;
    height: 17px;
    display: block;
}

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

.noscript-card {
    padding: 14px 16px;
    color: var(--fg-secondary);
    font-size: 0.82rem;
    line-height: 1.5;
}

.noscript-card a {
    color: var(--accent-hover);
}

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

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(51, 209, 122, 0.08), 0 0 5px rgba(51, 209, 122, 0.45); }
    50% { box-shadow: 0 0 0 4px rgba(51, 209, 122, 0.14), 0 0 9px rgba(51, 209, 122, 0.85); }
}

@keyframes eq-bounce {
    0%, 100% { transform: scaleY(0.18); }
    50% { transform: scaleY(1); }
}

.fade {
    animation: rise 0.42s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.d1 { animation-delay: 0.03s; }
.d2 { animation-delay: 0.10s; }
.d3 { animation-delay: 0.17s; }
.d4 { animation-delay: 0.24s; }
.d5 { animation-delay: 0.31s; }
.d6 { animation-delay: 0.38s; }

@media (prefers-reduced-motion: reduce) {
    .fade,
    .status-dot.now,
    .eq-top.on span {
        animation: none;
    }

    .cover,
    .history-cover,
    .history-item,
    .link-row,
    .badges img,
    .t-tag,
    .theme-toggle {
        transition: none;
    }
}

@media (max-width: 720px) {
    body {
        padding: 18px 12px;
        align-items: flex-start;
    }

    .content {
        padding: 18px;
    }

    .history-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0;
        background: var(--window-bg);
    }

    .window {
        min-height: 100vh;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .headerbar {
        position: sticky;
        z-index: 5;
        top: 0;
        grid-template-columns: 52px minmax(0, 1fr) 76px;
    }

    .content {
        padding: 16px;
        gap: 18px;
    }

    .track-row {
        gap: 13px;
    }

    .cover-button {
        width: 92px;
        height: 92px;
    }

    .cover {
        width: 90px;
        height: 90px;
    }

    .t-name {
        font-size: 1.08rem;
    }

    .t-artist {
        font-size: 0.86rem;
    }

    .link-row {
        grid-template-columns: 82px minmax(0, 1fr) 12px;
        gap: 10px;
        padding: 0 13px;
    }
}
