:root {
    --ohm-bg: #fff8f4;
    --ohm-surface: #ffffff;
    --ohm-surface-2: #f5f7fb;
    --ohm-text: #151922;
    --ohm-muted: #606b7d;
    --ohm-accent: #ff7700;
    --ohm-accent-2: #20b7ff;
    --ohm-border: rgba(17, 24, 39, 0.12);
    --ohm-navbar: linear-gradient(90deg, var(--ohm-accent), var(--ohm-accent-2));
    --ohm-hero-start: rgba(12, 16, 23, 0.98);
    --ohm-hero-mid: rgba(31, 39, 49, 0.96);
    --ohm-hero-end: var(--ohm-accent);
    --ohm-transition: background-color 850ms ease, color 850ms ease, border-color 850ms ease, box-shadow 850ms ease;
}

html,
body,
.navbar,
.card,
.song-card,
.home-hero,
.play-hero,
.home-release-panel,
.play-panel,
.play-recommend-panel,
.home-signal-bar > div,
.home-category-tile,
#persistent-player,
.theme-panel {
    transition: var(--ohm-transition);
}

body:not(.dark-mode),
body.dark-mode {
    background: var(--ohm-bg) !important;
    color: var(--ohm-text) !important;
}

.navbar.navbar-dark,
body.dark-mode .navbar.navbar-dark {
    background: var(--ohm-navbar) !important;
}

.btn-primary,
body.dark-mode .btn-primary {
    background-color: var(--ohm-accent) !important;
    border-color: var(--ohm-accent) !important;
    color: #fff !important;
}

.btn-outline-primary,
body.dark-mode .btn-outline-primary {
    color: var(--ohm-accent) !important;
    border-color: var(--ohm-accent) !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
body.dark-mode .btn-outline-primary:hover,
body.dark-mode .btn-outline-primary:focus {
    background-color: var(--ohm-accent) !important;
    color: #fff !important;
}

a,
body.dark-mode a {
    color: var(--ohm-accent);
}

.card,
.song-card,
.category-card,
.listen-card,
.listen-sidecard,
body.dark-mode .card,
body.dark-mode .song-card,
body.dark-mode .category-card,
body.dark-mode .listen-card,
body.dark-mode .listen-sidecard {
    background-color: var(--ohm-surface) !important;
    border-color: var(--ohm-border) !important;
    color: var(--ohm-text) !important;
}

html[data-ohm-theme="classic-orange"] body:not(.dark-mode) .card,
html[data-ohm-theme="classic-orange"] body:not(.dark-mode) .song-card,
html[data-ohm-theme="classic-orange"] body:not(.dark-mode) .category-card,
html[data-ohm-theme="classic-orange"] body:not(.dark-mode) .listen-card,
html[data-ohm-theme="classic-orange"] body:not(.dark-mode) .listen-sidecard {
    border: none !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.card-title,
body.dark-mode .card-title,
.home-section-heading h2,
.play-section-heading h2 {
    color: var(--ohm-text) !important;
}

.card-text,
body.dark-mode .card-text,
.home-song-artist,
body.dark-mode .home-song-artist,
.play-recommend-panel .card-text,
body.dark-mode .play-recommend-panel .card-text,
.text-muted,
body.dark-mode .text-muted {
    color: var(--ohm-muted) !important;
}

.home-hero,
.play-hero {
    background: linear-gradient(135deg, var(--ohm-hero-start), var(--ohm-hero-mid) 50%, var(--ohm-hero-end)) !important;
}

.home-release-panel,
.play-stage {
    border-color: color-mix(in srgb, var(--ohm-accent) 28%, transparent) !important;
}

.home-signal-bar > div,
.home-category-tile,
.play-panel,
.play-recommend-panel,
.play-empty-panel,
body.dark-mode .home-signal-bar > div,
body.dark-mode .home-category-tile,
body.dark-mode .play-panel,
body.dark-mode .play-recommend-panel,
body.dark-mode .play-empty-panel {
    background: var(--ohm-surface) !important;
    border-color: var(--ohm-border) !important;
    color: var(--ohm-text) !important;
}

.home-signal-bar span,
.home-category-tile,
body.dark-mode .home-signal-bar span,
body.dark-mode .home-category-tile {
    color: var(--ohm-text) !important;
}

.home-signal-bar small,
.home-category-tile small,
body.dark-mode .home-signal-bar small,
body.dark-mode .home-category-tile small {
    color: var(--ohm-muted) !important;
}

#persistent-player,
body.dark-mode #persistent-player {
    background-color: color-mix(in srgb, var(--ohm-surface) 82%, #000 18%) !important;
    border-top: 1px solid var(--ohm-border);
}

.form-control,
body.dark-mode .form-control,
.list-group-item,
body.dark-mode .list-group-item {
    background-color: var(--ohm-surface-2) !important;
    border-color: var(--ohm-border) !important;
    color: var(--ohm-text) !important;
}

.badge.bg-primary,
body.dark-mode .badge.bg-primary {
    background-color: var(--ohm-accent) !important;
    color: #fff !important;
}

.theme-controls {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.theme-mode-toggle,
.theme-palette-toggle,
.theme-panel-close {
    border: 1px solid rgba(255, 255, 255, 0.34);
    color: #fff;
    background: rgba(255, 255, 255, 0.13);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border-radius: 8px;
}

.theme-mode-toggle {
    gap: 6px;
    padding: 0 10px;
    font-weight: 800;
}

.theme-palette-toggle,
.theme-panel-close {
    width: 36px;
}

.theme-mode-toggle:hover,
.theme-mode-toggle:focus,
.theme-palette-toggle:hover,
.theme-palette-toggle:focus,
.theme-panel-close:hover,
.theme-panel-close:focus {
    background: rgba(255, 255, 255, 0.23);
    color: #fff;
}

.theme-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 2200;
    width: min(420px, calc(100vw - 24px));
    max-height: min(680px, calc(100vh - 110px));
    overflow: auto;
    padding: 14px;
    border-radius: 8px;
    border: 1px solid var(--ohm-border);
    background: var(--ohm-surface);
    color: var(--ohm-text);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
}

.theme-panel-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: start;
    margin-bottom: 12px;
}

.theme-panel-header strong,
.theme-panel-header small {
    display: block;
}

.theme-panel-header small {
    color: var(--ohm-muted);
    font-weight: 700;
}

.theme-panel-close {
    color: var(--ohm-text);
    border-color: var(--ohm-border);
    background: var(--ohm-surface-2);
}

.theme-mode-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.theme-mode-tab,
.theme-autoplay-toggle,
.theme-swatch {
    border-radius: 8px;
    border: 1px solid var(--ohm-border);
    background: var(--ohm-surface-2);
    color: var(--ohm-text);
}

.theme-mode-tab {
    min-height: 38px;
    font-weight: 900;
}

.theme-mode-tab.is-active,
.theme-autoplay-toggle.is-active {
    color: #fff;
    border-color: var(--ohm-accent);
    background: var(--ohm-accent);
}

.theme-preview {
    display: grid;
    grid-template-columns: 1.4fr 1fr 0.7fr 0.9fr;
    gap: 8px;
    height: 42px;
    margin-bottom: 12px;
}

.theme-preview span {
    border-radius: 8px;
    border: 1px solid var(--ohm-border);
}

.theme-preview-bg {
    background: var(--ohm-bg);
}

.theme-preview-card {
    background: var(--ohm-surface);
}

.theme-preview-accent {
    background: var(--ohm-accent);
}

.theme-preview-button {
    background: var(--ohm-navbar);
}

.theme-autoplay-toggle {
    width: 100%;
    min-height: 38px;
    margin-bottom: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 900;
}

.theme-swatch-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.theme-swatch {
    min-width: 0;
    min-height: 74px;
    padding: 8px;
    text-align: left;
}

.theme-swatch.is-active {
    outline: 2px solid var(--ohm-accent);
    outline-offset: 1px;
}

.theme-swatch-preview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    height: 24px;
    overflow: hidden;
    border-radius: 6px;
    margin-bottom: 7px;
    border: 1px solid rgba(0, 0, 0, 0.12);
}

.theme-swatch-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.74rem;
    font-weight: 900;
}

@media (max-width: 575.98px) {
    .theme-controls {
        display: flex;
        width: 100%;
    }

    .theme-mode-toggle {
        flex: 1 1 auto;
    }

    .theme-panel {
        right: auto;
        left: 0;
    }

    .theme-swatch-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
