:root[data-bs-theme="dark"] {
    --as-bg: #0c0c0e;
    --as-fg: #f1f2f3;
    --as-card: #111113;
    --as-popover: #131416;
    --as-muted: #222325;
    --as-hover: #242628;
    --as-muted-fg: #9a9ca3;
    --as-hairline: rgba(255, 255, 255, .08);
    --as-hairline-strong: rgba(255, 255, 255, .16);
    --as-primary: #fafafa;
    --as-primary-fg: #131416;
    --as-violet: #8b5cf6;
    --as-danger: #7f1d1d;
    --bs-body-bg: var(--as-bg);
    --bs-body-color: var(--as-fg);
    --bs-secondary-color: var(--as-muted-fg);
    --bs-border-color: var(--as-hairline);
}

html[data-bs-theme="dark"] body {
    background: var(--as-bg);
    color: var(--as-fg);
}

body .navbar {
    background: var(--as-card) !important;
    border-color: var(--as-hairline) !important;
}

body :is(.as-card, .card-dark, .auth-card, .welcome-hero-bar, .anisync-sidebar) {
    background: var(--as-card) !important;
    border: 1px solid var(--as-hairline) !important;
    border-radius: 12px;
    box-shadow: none;
    backdrop-filter: none;
}

body :is(.form-control, .form-select, .as-input, .as-select, .custom-select) {
    background-color: var(--as-muted);
    color: var(--as-fg);
    border-color: var(--as-hairline);
    border-radius: 10px;
}

body :is(.as-input, .as-select, .as-btn, .as-nav-item, .modal .btn) {
    min-height: 44px;
}

body :focus-visible {
    outline: 3px solid var(--as-violet) !important;
    outline-offset: 2px;
}

body :is(.as-switch, .form-check-input[role="switch"]):checked {
    background-color: var(--as-violet) !important;
    border-color: var(--as-violet) !important;
}

body :is(.as-btn--primary, .btn-save-preferences, .btn-primary) {
    background: var(--as-primary) !important;
    color: var(--as-primary-fg) !important;
    border: 1px solid var(--as-primary) !important;
    font-weight: 650;
}

.as-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .5rem .9rem;
    color: var(--as-fg);
    background: var(--as-muted);
    border: 1px solid var(--as-hairline);
    border-radius: 10px;
    text-decoration: none;
}

.as-btn:hover,
.as-btn:focus-visible {
    color: var(--as-fg);
    background: var(--as-hover);
}

.as-btn--primary:hover {
    opacity: .9;
}

.as-btn:disabled {
    opacity: .55;
}

.as-icon-btn {
    width: 44px;
    padding: 0;
}

.as-card {
    padding: clamp(1rem, 3vw, 1.5rem);
    margin-bottom: 1rem;
}

.as-card > :last-child {
    margin-bottom: 0;
}

.as-card h3,
.as-section h6 {
    font-size: 1.05rem;
    font-weight: 650;
}

.as-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 44px;
    padding-block: .375rem;
}

.as-row-help {
    margin-block: .2rem 0;
    color: var(--as-muted-fg);
    font-size: .875rem;
}

.as-advanced {
    padding: .75rem 1rem;
    border: 1px solid var(--as-hairline);
    border-radius: 12px;
    margin-bottom: 1rem;
}

.as-advanced > summary {
    min-height: 44px;
    padding-block: .6rem;
    cursor: pointer;
}

body .modal-content {
    background: var(--as-popover) !important;
    border: 1px solid var(--as-hairline-strong) !important;
    border-radius: 16px;
    color: var(--as-fg);
}

body .modal-content :is(.modal-header, .modal-footer) {
    border-color: var(--as-hairline);
}

.as-note {
    padding: .75rem 1rem;
    border: 1px solid var(--as-hairline-strong);
    border-radius: 10px;
    background: var(--as-muted);
}

.as-note--warn {
    border-color: #6b5024;
    color: #ffdf9a;
    background: #241d12;
}

body .bg-simkl {
    background: #713916 !important;
    color: #fff !important;
}

@media (max-width: 767.98px) {
    body :is(.form-control, .form-select, .as-input, .as-select) {
        font-size: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

.as-configure {
    max-width: 1180px;
    margin-inline: auto;
    padding-bottom: 1rem;
}

.as-shell {
    display: grid;
    grid-template-columns: minmax(10rem, 13rem) minmax(0, 1fr);
    gap: clamp(1rem, 3vw, 2rem);
    align-items: start;
}

.as-sidebar {
    position: sticky;
    top: 1rem;
}

.as-nav-group + .as-nav-group {
    margin-top: 1rem;
}

.as-nav-group-label {
    margin: 0 0 .25rem .75rem;
    color: var(--as-muted-fg);
    font-size: .75rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.as-nav-item {
    display: flex;
    align-items: center;
    gap: .7rem;
    width: 100%;
    background: transparent;
    color: var(--as-fg);
    border: 1px solid transparent;
    border-radius: 10px;
    padding: .5rem .75rem;
    text-align: left;
}

.as-nav-item > i {
    width: 1.1rem;
    color: var(--as-muted-fg);
    text-align: center;
}

.as-nav-item:hover {
    background: var(--as-hover);
}

.as-nav-item.is-active {
    background: color-mix(in srgb, var(--as-violet) 16%, var(--as-card));
    color: #d9ceff;
}

.as-sidebar-save {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--as-hairline);
}

.as-sidebar-save > button {
    width: 100%;
}

.as-save-status {
    margin: .5rem 0 0;
    min-height: 1.25rem;
    color: var(--as-muted-fg);
    font-size: .8rem;
}

.as-save-status[data-dirty="true"]::before {
    content: "";
    display: inline-block;
    width: .42rem;
    height: .42rem;
    margin-right: .35rem;
    border-radius: 50%;
    background: #ffd087;
    vertical-align: .12em;
}

.as-section-head {
    color: var(--as-fg);
    font-size: 1.5rem;
    font-weight: 650;
    line-height: 1.3;
    margin: 0 0 1rem;
}

.as-section[hidden],
.as-pager [hidden],
[data-configure-aux][hidden] {
    display: none !important;
}

.as-back,
.as-pager,
.as-bottom-bar {
    display: none;
}

@media (max-width: 767.98px) {
    .as-configure {
        padding-bottom: calc(4.75rem + env(safe-area-inset-bottom));
    }

    .as-shell {
        display: block;
    }

    .as-sidebar {
        position: static;
        background: var(--as-card);
        border: 1px solid var(--as-hairline);
        border-radius: 12px;
        padding: .75rem;
    }

    .as-shell[data-mobile-menu="false"] .as-sidebar,
    .as-shell[data-mobile-menu="true"] .as-content,
    .as-sidebar-save {
        display: none;
    }

    .as-back {
        display: inline-flex;
        margin-bottom: .75rem;
    }

    .as-pager {
        display: flex;
        justify-content: space-between;
        gap: .5rem;
        margin-top: 1rem;
    }

    .as-bottom-bar {
        position: fixed;
        z-index: 1030;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        gap: .5rem;
        inset: auto 0 0;
        background: var(--as-popover);
        border-top: 1px solid var(--as-hairline-strong);
        padding: .5rem .75rem calc(.5rem + env(safe-area-inset-bottom));
    }

    .as-bottom-bar .as-save-status {
        margin: 0 auto 0 0;
    }
}

.as-row.form-switch {
    padding-left: 0;
}

.as-row.form-switch .as-switch {
    float: none;
    flex: none;
    width: 2.75rem;
    height: 1.5rem;
    margin: 0;
    cursor: pointer;
}

.as-row.form-switch label {
    flex: 1;
    cursor: pointer;
    padding-block: .45rem;
}

@media (min-width: 992px) {
    .as-artwork-preview {
        position: sticky;
        top: 1rem;
    }
}

.as-grid-2 {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
    margin-bottom: 1rem;
}

.as-grid-2 > .as-card {
    margin: 0;
}

body .as-account-card {
    background: linear-gradient(150deg, color-mix(in srgb, var(--as-brand) 9%, var(--as-card)), var(--as-card) 60%) !important;
}

.as-account-mal { --as-brand: #6579e0; }
.as-account-anilist { --as-brand: #42b9e4; }
.as-account-simkl { --as-brand: #e6873f; }
.as-account-kitsu { --as-brand: #f75239; }

.as-account-head,
.as-account-actions {
    display: flex;
    align-items: center;
    gap: .65rem;
}

.as-account-head {
    margin-bottom: .75rem;
}

.as-account-head img {
    border-radius: 6px;
}

.as-account-head h3 {
    margin: 0 0 .25rem;
}

.as-account-actions {
    flex-wrap: wrap;
    margin-top: .75rem;
}

.as-account-status {
    color: var(--as-muted-fg);
    font-size: .82rem;
}

.as-account-status--ok,
.as-account-status--warn {
    display: inline-block;
    border-radius: 999px;
    padding: .15rem .55rem;
}

.as-account-status--ok {
    color: #bbf0d7;
    background: #153427;
}

.as-account-status--warn,
.as-nav-alert {
    color: #ffdf9a;
    background: #422d11;
}

.as-nav-alert {
    margin-left: auto;
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 50%;
    text-align: center;
    font-weight: 700;
    font-size: .8rem;
}

.as-playback summary {
    min-height: 44px;
    padding-block: .55rem;
    cursor: pointer;
    font-weight: 650;
}

.as-playback fieldset {
    margin-top: .75rem;
}

.as-playback form :is(.as-input, .as-select) {
    max-width: 28rem;
    margin-bottom: .75rem;
}

.as-playback :is(fieldset[hidden], div[hidden]) {
    display: none;
}

.as-playback [role="status"]:empty {
    display: none;
}

body :is(.as-playback, #playback-watched) .as-switch {
    margin-right: .4rem;
}

body .as-list-row {
    background: var(--as-card);
    border: 1px solid var(--as-hairline);
    border-radius: 10px !important;
}

body .as-list-row:hover {
    border-color: var(--as-hairline-strong);
}

.as-catalog-filtered {
    display: none !important;
}

.as-catalog-dragging {
    opacity: .42;
}

.as-list-row .grip-handle {
    cursor: grab;
    width: 1.6rem;
    flex: none;
    text-align: center;
}

.as-row-actions,
.as-row-quick-actions {
    display: flex;
    gap: .25rem;
    align-items: center;
}

.as-row-menu {
    position: relative;
}

.as-row-menu > summary {
    list-style: none;
    cursor: pointer;
}

.as-row-menu > summary::-webkit-details-marker {
    display: none;
}

.as-row-menu-actions {
    position: absolute;
    z-index: 5;
    inset: calc(100% + .25rem) 0 auto auto;
    display: grid;
    min-width: 9.5rem;
    padding: .35rem;
    gap: .25rem;
    background: var(--as-popover);
    border: 1px solid var(--as-hairline-strong);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}

.as-menu-narrow {
    display: none;
}

#catalogConfigModal .modal-dialog .modal-content :is(.btn-modal-reset-field, .modal-segmented-btn) {
    min-height: 44px;
}

@media (max-width: 767.98px) {
    .as-row-quick-actions {
        display: none;
    }
    .as-row-menu-actions .as-menu-narrow {
        display: inline-flex;
    }
}

@media (max-width: 575.98px) {
    #catalogConfigModal .modal-dialog.modal-fullscreen-sm-down {
        width: 100%;
        max-width: 100%;
        height: 100%;
        margin: 0;
    }
    #catalogConfigModal .modal-dialog .modal-content {
        min-height: 100%;
        border-radius: 0;
    }
}

.as-stepper {
    display: flex;
    align-items: center;
    gap: .35rem;
}

.as-stepper input {
    width: 4.5rem;
    text-align: center;
}

.as-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.as-chip {
    position: relative;
    cursor: pointer;
}

.as-chip input {
    position: absolute;
    opacity: 0;
}

.as-chip span {
    display: inline-flex;
    align-items: center;
    padding: .4rem .75rem;
    min-height: 44px;
    border: 1px solid var(--as-hairline-strong);
    border-radius: 999px;
}

.as-chip input:checked + span {
    background: #fafafa;
    color: #131416;
}

.as-chip input:focus-visible + span {
    outline: 3px solid var(--as-violet);
    outline-offset: 2px;
}

.as-privacy {
    max-width: 52rem;
}

.as-privacy h2 {
    font-size: 1.25rem;
    margin-top: 1.5rem;
}

.as-privacy dt {
    border-top: 1px solid var(--as-hairline);
    padding-top: .65rem;
}

.as-privacy dd,
.as-privacy footer {
    color: var(--as-muted-fg);
}

[data-reinstall-banner][hidden],
#nuvio-install-status:empty {
    display: none;
}

#tab-tracking #tracking_events_threshold {
    max-width: 7rem;
}

.as-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
}

.as-whats-new {
    border-radius: 999px;
    font-size: .8rem;
}

.as-search-results {
    list-style: none;
    display: grid;
    gap: .3rem;
    padding: 0;
    margin: 0 0 .75rem;
    max-height: 50vh;
    overflow: auto;
}

.as-search-results[hidden],
#settings-search-status:empty {
    display: none;
}

.as-search-results button {
    width: 100%;
    justify-content: start;
    text-align: left;
    font-size: .85rem;
}

.as-starter-choices {
    display: grid;
    gap: .6rem;
}

.as-starter-choices label {
    cursor: pointer;
}

.as-signin {
    max-width: 30rem;
}

.as-signin-card {
    text-align: center;
}

.as-signin-card h1 {
    font-size: 1.5rem;
    margin: .75rem 0 .25rem;
}

.as-signin-logo {
    object-fit: contain;
}

.as-signin-methods {
    list-style: none;
    padding: 0;
    margin: 1.25rem 0 0;
    display: grid;
    gap: .5rem;
}

.as-signin-methods .as-btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
}

.as-signin-card .as-playback-accounts,
.as-signin-card details {
    text-align: left;
}

.as-configure :is(.gemini-btn, .preview-mode-btn, .btn-poster-nav) {
    min-width: 44px;
    min-height: 44px;
}

.as-configure .as-input:read-only {
    opacity: .8;
}

body .as-configure .welcome-username {
    color: var(--as-fg);
    background: none;
    -webkit-text-fill-color: currentColor;
}

body .navbar .btn-whats-new {
    color: var(--as-fg);
    background: var(--as-muted);
    border-color: var(--as-hairline-strong);
}

body .as-configure :is(.artwork-preview-panel, .guest-avatar-box) {
    border-color: var(--as-hairline);
    background: var(--as-card);
    box-shadow: none;
}
