:root[data-theme] .ah-shell :is(#songsSection, #gallerySection, #photoHistorySection, #photoGallerySection, #videoHistorySection, #videoGallerySection) {
    padding: 20px;
    background: var(--ah-surface);
    border: 1px solid var(--ah-line);
    border-radius: var(--ah-radius-card);
    box-shadow: none;
}

:root[data-theme] .ah-shell :is(#photoHistorySection, #videoHistorySection) > h2,
:root[data-theme] .ah-shell :is(#songsSection, #gallerySection, #photoHistorySection, #photoGallerySection, #videoHistorySection, #videoGallerySection) > .back-btn {
    display: none;
}

:root[data-theme] .ah-shell .history-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
}

:root[data-theme] .ah-shell .history-filters input[type="text"],
:root[data-theme] .ah-shell .history-filters input[type="search"] {
    flex: 1 1 260px;
    width: auto;
    min-width: 0;
    height: 42px;
    margin: 0;
    padding: 0 14px 0 40px;
    border-radius: 12px;
    background: var(--ah-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235E6380' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E") no-repeat 14px center / 16px;
    font: 500 14px/1 var(--ah-font-ui);
}

:root[data-theme] .ah-shell .history-filters select {
    flex: 0 1 auto;
    width: auto;
    min-width: 150px;
    max-width: 240px;
    height: 42px;
    margin: 0;
    padding: 0 38px 0 14px;
    border-radius: 12px;
    appearance: none;
    background-color: var(--ah-surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23151833' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    font: 600 13px/1 var(--ah-font-ui);
    cursor: pointer;
}

.ah-worklist--page {
    gap: 2px;
}

:root[data-theme] .ah-shell .ah-work--page {
    grid-template-columns: 56px minmax(0, 1fr) auto;
    gap: 14px;
    padding: 10px;
    border-bottom: 1px solid var(--ah-line);
    border-radius: 0;
}

:root[data-theme] .ah-shell .ah-work--page:last-child {
    border-bottom: 0;
}

:root[data-theme] .ah-shell .ah-work--page:hover {
    border-radius: 14px;
}

:root[data-theme] .ah-shell .ah-work--page .ah-work-thumb {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 12px;
}

.ah-work-thumb img,
.ah-tile-art img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ah-work--page .ah-work-title {
    font-size: 15px;
}

.ah-work-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

:root[data-theme] .ah-shell .ah-btn--sm {
    min-height: 36px;
    padding: 0 14px;
    font-size: 13px;
}

.ah-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

:root[data-theme] .ah-shell .ah-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    border: 0;
    border-radius: 999px;
    background: var(--ah-sunken);
    color: var(--ah-ink-2);
    font: 700 11px/1 var(--ah-font-ui);
    box-shadow: none;
}

:root[data-theme] .ah-shell .ah-badge--ok { background: rgba(11, 107, 96, 0.1); color: var(--ah-success); }
:root[data-theme] .ah-shell .ah-badge--accent { background: var(--ah-accent-soft); color: var(--ah-accent); cursor: pointer; }
:root[data-theme] .ah-shell .ah-badge--error { background: rgba(163, 50, 31, 0.08); color: var(--ah-danger); }

:root[data-theme] .ah-shell .ah-icon-btn.is-playing {
    background: var(--ah-accent);
    border-color: var(--ah-accent);
    color: #fff;
}

.ah-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 18px 16px;
}

.ah-tile {
    display: grid;
    align-content: start;
    gap: 6px;
    min-width: 0;
    cursor: pointer;
}

.ah-tile-cover {
    position: relative;
    display: block;
    aspect-ratio: 1;
    border-radius: 16px;
    overflow: hidden;
}

.ah-tile-art {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, hsl(var(--thumb-h, 245) 42% 52%), hsl(calc(var(--thumb-h, 245) + 40) 46% 32%));
    color: rgba(255, 255, 255, 0.8);
}

.ah-tile-art > .ah-ico {
    width: 36px;
    height: 36px;
}

:root[data-theme] .ah-shell .ah-tile-play {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #151833;
    box-shadow: 0 4px 14px rgba(21, 24, 51, 0.25);
    cursor: pointer;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.ah-tile:hover .ah-tile-play,
.ah-tile:focus-within .ah-tile-play,
:root[data-theme] .ah-shell .ah-tile-play.is-playing {
    opacity: 1;
    transform: none;
}

:root[data-theme] .ah-shell .ah-tile-play.is-playing {
    background: var(--ah-accent);
    color: #fff;
}

.ah-tile-play .ah-ico {
    width: 18px;
    height: 18px;
}

.ah-tile-title {
    margin-top: 4px;
    font: 800 14px/1.25 var(--ah-font-ui);
    color: var(--ah-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ah-tile-meta {
    font: 500 12px/1.35 var(--ah-font-ui);
    color: var(--ah-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ah-tile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

:root[data-theme] .ah-shell .ah-tile-actions .icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--ah-line);
    border-radius: 999px;
    background: var(--ah-surface);
    color: var(--ah-ink);
    font: 700 12px/1 var(--ah-font-ui);
    box-shadow: none;
}

:root[data-theme] .ah-shell .ah-tile-actions .icon-btn:hover {
    border-color: var(--ah-accent);
}

:root[data-theme] .ah-shell .ah-tile-actions .icon-btn.star-btn {
    color: #B26A00;
    border-color: rgba(178, 106, 0, 0.35);
}

:root[data-theme] .ah-shell .ah-tile-actions .ah-ico {
    width: 14px;
    height: 14px;
}

:root[data-theme] .ah-shell .history-load-more {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    color: var(--ah-muted);
    font: 600 12px/1 var(--ah-font-ui);
}

:root[data-theme] .ah-shell .history-load-more button {
    min-height: 40px;
    padding: 0 20px;
    border: 1px solid var(--ah-line);
    border-radius: 999px;
    background: var(--ah-surface);
    color: var(--ah-ink);
    font: 700 13px/1 var(--ah-font-ui);
    box-shadow: none;
}

:root[data-theme] .ah-shell :is(#photoHistoryGrid, #photoGalleryGrid, #videoHistoryGrid, #videoGalleryGrid) {
    display: block;
}

:root[data-theme] .ah-shell :is(#photoHistoryGrid, #photoGalleryGrid, #videoHistoryGrid, #videoGalleryGrid) .song-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px 16px;
}

:root[data-theme] .ah-shell :is(#videoHistoryGrid, #videoGalleryGrid) .song-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

:root[data-theme] .ah-shell .ah-tile-cover--video {
    aspect-ratio: 9 / 12;
}

.ah-tile-art img,
.ah-tile-art video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ah-tile-count {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 1;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(21, 24, 51, 0.72);
    color: #fff;
    font: 800 12px/24px var(--ah-font-ui);
    text-align: center;
}

:root[data-theme] .ah-shell .photo-history-header {
    display: none;
}

.ah-tile-badges {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 1;
    max-width: calc(100% - 16px);
}

.ah-tile-badges .ah-badge {
    background: rgba(255, 255, 255, 0.94);
    color: #151833;
    box-shadow: 0 2px 8px rgba(21, 24, 51, 0.16);
}

.ah-tile-badge-play {
    position: absolute;
    left: 10px;
    bottom: 10px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #151833;
}

.ah-tile-badge-play .ah-ico {
    width: 14px;
    height: 14px;
}

.ah-tile:hover .ah-tile-cover {
    box-shadow: 0 0 0 2px var(--ah-accent);
}

:root[data-theme] .ah-shell .ah-tile-actions .ah-pub-btn {
    color: var(--ah-accent);
}

:root[data-theme] .ah-shell .ah-tile-actions .ah-danger-btn:hover {
    border-color: var(--ah-danger);
    color: var(--ah-danger);
}

:root[data-theme] .ah-shell :is(#photoHistoryGrid, #photoGalleryGrid, #videoHistoryGrid, #videoGalleryGrid) > p,
:root[data-theme] .ah-shell #songsList > p,
:root[data-theme] .ah-shell #galleryList > p {
    margin: 0;
    padding: 32px 16px;
    border: 1.5px dashed var(--ah-line-strong);
    border-radius: 16px;
    color: var(--ah-muted);
    font: 600 14px/1.4 var(--ah-font-ui);
    text-align: center;
}

@media (max-width: 700px) {
    :root[data-theme] .ah-shell :is(#photoHistoryGrid, #photoGalleryGrid, #videoHistoryGrid, #videoGalleryGrid) .song-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px 10px;
    }

    :root[data-theme] .ah-shell :is(#songsSection, #gallerySection, #photoHistorySection, #photoGallerySection, #videoHistorySection, #videoGallerySection) {
        padding: 14px;
    }

    :root[data-theme] .ah-shell .history-filters {
        flex-wrap: wrap;
        gap: 8px;
    }

    :root[data-theme] .ah-shell .history-filters input[type="text"],
    :root[data-theme] .ah-shell .history-filters input[type="search"] {
        flex: 1 1 100%;
    }

    :root[data-theme] .ah-shell .history-filters select {
        flex: 1 1 140px;
        min-width: 0;
        max-width: none;
    }

    :root[data-theme] .ah-shell .ah-work--page {
        grid-template-columns: 48px minmax(0, 1fr) auto;
        gap: 10px;
        padding: 10px 4px;
    }

    :root[data-theme] .ah-shell .ah-work--page .ah-work-thumb {
        width: 48px;
        height: 48px;
    }

    :root[data-theme] .ah-shell .ah-work--page [data-w-download],
    :root[data-theme] .ah-shell .ah-work--page .ah-btn--sm {
        display: none;
    }

    .ah-tiles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px 10px;
    }

    .ah-tile-play {
        opacity: 1 !important;
        transform: none !important;
    }
}

:root[data-theme] .ah-shell #detailSection > .back-btn {
    display: none;
}

:root[data-theme] .ah-shell .sd {
    display: grid;
    gap: 20px;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: none;
}

.sd-head {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr) auto;
    gap: 20px;
    align-items: start;
}

.sd-cover,
.sd-variant-cover {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 16px;
    background: linear-gradient(150deg, #4B3BD6, #151833);
    color: rgba(255, 255, 255, 0.85);
}

.sd-cover {
    width: 120px;
    height: 120px;
}

.sd-cover .ah-ico {
    width: 36px;
    height: 36px;
}

.sd-cover img,
.sd-variant-cover img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sd-info {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.sd-kicker {
    color: var(--ah-muted);
    font-size: 13px;
    font-weight: 600;
}

.sd-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.sd-title-row[hidden],
.sd-rename[hidden],
.sd-panel[hidden] {
    display: none;
}

:root[data-theme] .ah-shell .sd-title {
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--ah-ink);
    font: 600 24px/1.25 var(--ah-font-display);
}

.sd-rename {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sd-rename .ah-input {
    flex: 1 1 240px;
}

.sd-meta {
    color: var(--ah-muted);
    font-size: 14px;
}

.sd-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sd-variants {
    display: grid;
    border: 1px solid var(--ah-line);
    border-radius: 16px;
}

.sd-variant {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 12px 14px;
}

.sd-variant + .sd-variant {
    border-top: 1px solid var(--ah-line);
}

.sd-variant.is-playing {
    background: var(--ah-accent-soft);
}

.sd-variant-cover {
    width: 52px;
    height: 52px;
    border-radius: 12px;
}

.sd-variant-cover .ah-ico {
    width: 20px;
    height: 20px;
}

.sd-variant-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.sd-variant-title {
    font-weight: 700;
    color: var(--ah-ink);
}

.sd-variant-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
}

.sd-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sd-tabs .ah-chip .ah-ico,
.sd-head-actions .ah-btn .ah-ico,
.sd-variant-actions .ah-btn .ah-ico,
.sd-foot .ah-btn .ah-ico {
    width: 16px;
    height: 16px;
}

.sd-panel {
    padding: 18px 20px;
    border-radius: 16px;
    background: var(--ah-bg);
}

.sd-lyrics {
    color: var(--ah-ink);
    font-size: 15px;
    line-height: 1.65;
    white-space: pre-line;
}

.sd-how {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 10px 16px;
    margin: 0;
}

.sd-how dt {
    color: var(--ah-muted);
    font-size: 14px;
}

.sd-how dd {
    margin: 0;
    color: var(--ah-ink);
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.sd-muted {
    color: var(--ah-muted);
}

.sd-block {
    display: grid;
    gap: 8px;
}

.sd-block-title {
    font-weight: 700;
    color: var(--ah-ink);
}

.sd-clip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--ah-line);
    border-radius: 14px;
    font-size: 14px;
}

.sd-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    padding-top: 4px;
}

@media (max-width: 700px) {
    :root[data-theme] .ah-shell .sd {
        gap: 16px;
    }

    .sd-head {
        grid-template-columns: 72px minmax(0, 1fr);
        gap: 14px;
    }

    .sd-cover {
        width: 72px;
        height: 72px;
    }

    .sd-head-actions {
        grid-column: 1 / -1;
    }

    :root[data-theme] .ah-shell .sd-title {
        font-size: 19px;
    }

    .sd-variant {
        grid-template-columns: 44px minmax(0, 1fr);
        padding: 12px;
    }

    .sd-variant-cover {
        width: 44px;
        height: 44px;
    }

    .sd-variant-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .sd-how {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .sd-how dd {
        margin-bottom: 10px;
    }
}

:root[data-theme] .ah-shell .ah-tile-similar {
    justify-self: start;
    margin-top: 2px;
}
