:root {
    color-scheme: dark;
    --bg: #090b10;
    --surface: rgba(24, 28, 36, .74);
    --surface-2: rgba(36, 43, 55, .82);
    --glass: rgba(255, 255, 255, .065);
    --text: #f7f4ef;
    --muted: #aeb6c5;
    --line: rgba(255, 255, 255, .1);
    --accent: #f4b860;
    --accent-2: #59d3be;
    --danger: #ff6b6b;
    --soft: rgba(255, 255, 255, .055);
    --shadow: 0 22px 70px rgba(0, 0, 0, .34);
    --shadow-soft: 0 14px 36px rgba(0, 0, 0, .24);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(135deg, rgba(89, 211, 190, .08), transparent 34%),
        linear-gradient(225deg, rgba(244, 184, 96, .07), transparent 38%),
        linear-gradient(180deg, #151922 0%, var(--bg) 54%);
    color: var(--text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: auto auto minmax(180px, 460px) auto;
    gap: 16px;
    align-items: center;
    padding: 14px clamp(18px, 4vw, 56px);
    border-bottom: 1px solid var(--line);
    background: rgba(9, 11, 16, .76);
    backdrop-filter: blur(18px);
    box-shadow: 0 12px 36px rgba(0, 0, 0, .2);
}

.brand {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent);
}

.main-tabs {
    display: inline-flex;
    gap: 6px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 10px;
    background: rgba(255, 255, 255, .035);
}

.main-tabs a {
    min-height: 34px;
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
}

.main-tabs a.active,
.main-tabs a:hover {
    background: var(--soft);
    color: var(--text);
}

.top-search input,
.auth-form input,
.progress-form input,
.profile-form input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(8, 10, 15, .7);
    color: var(--text);
    padding: 11px 13px;
    outline: none;
}

.top-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
}

.top-search input {
    min-width: 0;
    border-radius: 8px 0 0 8px;
}

.search-button {
    min-width: 72px;
    border: 1px solid var(--line);
    border-left: 0;
    border-radius: 0 8px 8px 0;
    background: var(--accent);
    color: #111318;
    padding: 0 12px;
    font-weight: 800;
    cursor: pointer;
}

.search-button:hover {
    background: #ffd083;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0;
    color: var(--text);
    font-weight: 700;
}

.check-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-2);
}

.check-row.tight {
    margin: 0;
    font-size: 13px;
}

.top-search input:focus,
.auth-form input:focus,
.progress-form input:focus {
    border-color: var(--accent-2);
}

.nav {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    color: var(--muted);
}

.profile-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 700;
}

.profile-link img,
.profile-link span {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent-2);
    color: #071612;
    object-fit: cover;
    font-size: 14px;
    font-weight: 900;
}

.nav form {
    margin: 0;
}

.accent-link {
    color: var(--accent);
}

.link-button {
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    padding: 0;
}

.page {
    width: min(1440px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0 56px;
    min-height: calc(100vh - 132px);
}

.home-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    align-items: end;
    margin-bottom: 30px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(89, 211, 190, .16), transparent 44%),
        linear-gradient(180deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .035));
    padding: clamp(22px, 4vw, 38px);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.home-hero h1 {
    max-width: 760px;
    margin-bottom: 12px;
}

.home-hero p {
    max-width: 650px;
    margin: 0;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.55;
}

.hero-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin-bottom: 22px;
}

.section-head.compact {
    margin: 6px 0 14px;
}

.section-head.compact h2 {
    margin: 0;
    font-size: 22px;
}

.section-link {
    color: var(--accent);
    font-size: 14px;
    font-weight: 800;
}

.page-counter {
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 12px;
    background: rgba(26, 29, 36, .7);
}

.eyebrow {
    margin: 0 0 7px;
    color: var(--accent-2);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(30px, 5vw, 52px);
    line-height: 1;
}

.anime-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 20px;
    transition: opacity .16s ease;
}

@media (max-width: 1200px) {
    .anime-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .anime-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.anime-grid[data-loading="1"] {
    opacity: .42;
    pointer-events: none;
}

.catalog-status {
    display: flex;
    min-height: 40px;
    align-items: center;
    gap: 10px;
}

.catalog-loader {
    display: block;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border: 3px solid rgba(255, 255, 255, .18);
    border-top-color: var(--accent-2);
    border-radius: 50%;
    animation: awatch-spin .72s linear infinite;
}

.catalog-loader[hidden] {
    display: none;
}

.anime-card {
    display: block;
    min-width: 0;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, .085);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .075), rgba(255, 255, 255, .025));
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.anime-card:hover {
    border-color: rgba(89, 211, 190, .42);
    box-shadow: 0 24px 68px rgba(0, 0, 0, .36);
    transform: translateY(-4px);
}

.poster {
    position: relative;
    overflow: hidden;
    aspect-ratio: 2 / 3;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid rgba(255, 255, 255, .09);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

.poster img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .18s ease, filter .18s ease;
}

.anime-card:hover img {
    transform: scale(1.035);
    filter: brightness(.82);
}

.poster-fallback {
    display: grid;
    place-items: center;
    height: 100%;
    color: var(--accent);
    font-size: 54px;
    font-weight: 800;
}

.image-placeholder {
    width: 100%;
    height: 100%;
    min-height: 72px;
    border-radius: inherit;
    object-fit: cover;
    background: var(--surface-2);
}

.detail-poster + .image-placeholder,
.poster > .image-placeholder {
    aspect-ratio: 2 / 3;
}

.shot-button > .image-placeholder {
    aspect-ratio: 16 / 9;
}

.library-main > .image-placeholder {
    width: 64px;
    height: 88px;
    min-height: 88px;
    border-radius: 6px;
}

.related-card > .image-placeholder {
    width: 62px;
    height: 82px;
    min-height: 82px;
    border-radius: 6px;
}

.continue-card > .image-placeholder {
    width: 58px;
    height: 76px;
    min-height: 76px;
    border-radius: 6px;
}

.badge {
    position: absolute;
    top: 10px;
    padding: 6px 9px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    color: #111318;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .28);
}

.score {
    right: 10px;
    background: var(--accent);
}

.episodes {
    left: 10px;
    background: var(--accent-2);
}

.anime-meta {
    padding: 10px 2px 0;
}

.anime-meta h2,
.library-row h2 {
    margin: 0 0 5px;
    font-size: 16px;
    line-height: 1.25;
}

.anime-meta h2 {
    display: -webkit-box;
    min-height: 60px;
    overflow: hidden;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.anime-meta p,
.library-row p {
    color: var(--muted);
    margin: 0;
}

.notice,
.empty {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px 16px;
    background: var(--surface);
    color: var(--muted);
    margin-bottom: 18px;
}

.success {
    border-color: rgba(69, 196, 176, .45);
    color: #b9fff4;
}

.danger {
    border-color: rgba(255, 107, 107, .45);
    color: #ffd0d0;
}

.auth-shell {
    display: grid;
    place-items: start center;
    padding-top: 44px;
}

.auth-form {
    width: min(420px, 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 24px;
}

.auth-form label,
.progress-form label {
    display: grid;
    gap: 8px;
    margin: 16px 0;
    color: var(--muted);
    font-size: 14px;
}

.primary-button,
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #17120a;
    padding: 10px 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .22);
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.primary-button:hover,
.secondary-button:hover {
    transform: translateY(-1px);
    filter: brightness(1.04);
}

.secondary-button {
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-top: 28px;
}

.page-pages {
    display: grid;
    grid-template-columns: auto 1fr auto;
}

.page-numbers {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.page-numbers a {
    display: grid;
    place-items: center;
    min-width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(26, 29, 36, .72);
    color: var(--muted);
    font-weight: 900;
}

.page-numbers a.active,
.page-numbers a:hover {
    border-color: rgba(244, 184, 96, .55);
    background: rgba(244, 184, 96, .14);
    color: var(--accent);
}

.continue-section {
    margin-bottom: 30px;
}

.profile-continue {
    margin-top: 26px;
}

.continue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
}

.continue-card {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    min-height: 86px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 10px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
}

.continue-card:hover {
    border-color: rgba(244, 184, 96, .55);
    background: rgba(35, 40, 50, .9);
}

.continue-card img {
    width: 58px;
    height: 76px;
    object-fit: cover;
    border-radius: 6px;
}

.continue-card h3 {
    margin: 0 0 6px;
    font-size: 15px;
    line-height: 1.25;
}

.continue-card p {
    margin: 0;
    color: var(--accent-2);
    font-size: 13px;
    font-weight: 800;
}

.home-rails {
    display: grid;
    gap: 26px;
    margin-top: 34px;
}

.rail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.rail-card {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    min-height: 84px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 10px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
}

.rail-card:hover {
    border-color: rgba(244, 184, 96, .52);
}

.rail-poster,
.rail-card img {
    width: 58px;
    height: 76px;
}

.rail-poster {
    overflow: hidden;
    border-radius: 6px;
    background: var(--surface-2);
}

.rail-card img {
    display: block;
    object-fit: cover;
}

.rail-poster .poster-fallback {
    font-size: 24px;
}

.rail-card h3 {
    display: -webkit-box;
    margin: 0 0 6px;
    overflow: hidden;
    overflow-wrap: anywhere;
    font-size: 15px;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.rail-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.top-list {
    display: grid;
    gap: 10px;
}

.top-row {
    display: grid;
    grid-template-columns: 54px 58px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    min-height: 94px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(26, 29, 36, .72);
    padding: 12px;
}

.top-row:hover {
    border-color: rgba(244, 184, 96, .52);
    background: rgba(35, 40, 50, .86);
}

.top-rank {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(244, 184, 96, .14);
    color: var(--accent);
    font-weight: 900;
}

.top-row img,
.top-fallback {
    width: 58px;
    height: 76px;
    border-radius: 6px;
}

.top-row img {
    object-fit: cover;
}

.top-fallback {
    display: grid;
    place-items: center;
    background: var(--surface-2);
    color: var(--accent);
    font-size: 24px;
    font-weight: 900;
}

.top-row h2 {
    margin: 0 0 6px;
    font-size: 18px;
}

.top-row p {
    margin: 0;
    color: var(--muted);
}

.top-row strong {
    color: var(--accent);
    font-size: 20px;
}

.anime-page {
    display: grid;
    gap: 24px;
}

.anime-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: stretch;
}

.anime-title-card,
.anime-description {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 18px;
    min-height: 300px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(16px);
}

.anime-title-card {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.anime-description {
    overflow: auto;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.55;
}

.anime-description p:last-child {
    margin-bottom: 0;
}

.detail-poster {
    width: 240px;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, .08);
}

.detail-copy {
    margin: 0;
    min-width: 0;
}

.detail-copy h1 {
    font-size: 32px;
    line-height: 1.1;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: manual;
}

.facts {
    display: grid;
    gap: 9px;
    margin: 16px 0 0;
}

.facts div {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 9px;
}

.facts dt {
    color: var(--muted);
}

.facts dd {
    margin: 0;
    font-weight: 700;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-list span {
    border: 1px solid rgba(69, 196, 176, .32);
    border-radius: 999px;
    background: rgba(69, 196, 176, .08);
    color: #bff7ee;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 800;
}

.compact-tags {
    margin-top: 16px;
}

.description-tags {
    margin-bottom: 14px;
}

.progress-form {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 16px;
}

.progress-form.is-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    border: 0;
    padding: 0;
}

.autosave-status {
    min-height: 19px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.autosave-status[data-state="saving"] {
    color: var(--accent);
}

.autosave-status[data-state="saved"] {
    color: var(--accent-2);
}

.autosave-status[data-state="error"] {
    color: var(--danger);
}

.player-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.player-tab {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .07);
    color: var(--muted);
    padding: 0 14px;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
    transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease;
}

.player-tab:hover,
.player-tab.active {
    border-color: rgba(89, 211, 190, .62);
    background: rgba(89, 211, 190, .16);
    color: var(--text);
}

.player-tab:hover {
    transform: translateY(-1px);
}

.player {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    min-height: 0;
    border: 0;
    border-radius: 8px;
    background: #000;
    box-shadow: var(--shadow);
}

.player-section,
.related-section {
    min-width: 0;
}

.player-empty {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(89, 211, 190, .12), transparent 42%),
        var(--surface);
    padding: 28px;
    color: var(--muted);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(16px);
}

.player-empty h2 {
    margin: 4px 0 8px;
    color: var(--text);
    font-size: 24px;
}

.player-empty p {
    margin: 0;
}

.player-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.loading-orbit {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    margin-bottom: 18px;
    border-radius: 50%;
    background: rgba(89, 211, 190, .1);
}

.loading-orbit::before {
    content: "";
    width: 44px;
    height: 44px;
    border: 4px solid rgba(255, 255, 255, .16);
    border-top-color: var(--accent);
    border-right-color: var(--accent-2);
    border-radius: 50%;
    animation: awatch-spin .8s linear infinite;
}

@keyframes awatch-spin {
    to {
        transform: rotate(360deg);
    }
}

.shots {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 12px;
}

.shot-button {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 8px;
    background: transparent;
    padding: 0;
    cursor: zoom-in;
}

.shot-button img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 8px;
    transition: filter .16s ease, transform .16s ease;
}

.shot-button:hover img {
    filter: brightness(.78);
    transform: scale(1.015);
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, .84);
    padding: 24px;
}

.lightbox[hidden] {
    display: none;
}

.lightbox img {
    max-width: min(1120px, 94vw);
    max-height: 86vh;
    border-radius: 8px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .48);
}

.lightbox-close {
    position: fixed;
    top: 18px;
    right: 22px;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 50%;
    background: rgba(17, 19, 24, .86);
    color: var(--text);
    cursor: pointer;
    font-size: 30px;
    line-height: 1;
}

.related-group {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.related-group h3 {
    margin: 0;
    color: var(--text);
    font-size: 18px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
}

.related-card {
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    min-height: 96px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(26, 29, 36, .78);
    padding: 10px;
}

.related-card:hover {
    border-color: rgba(69, 196, 176, .55);
}

.related-card img,
.related-fallback {
    width: 62px;
    height: 82px;
    border-radius: 6px;
}

.related-card img {
    object-fit: cover;
}

.related-fallback {
    display: grid;
    place-items: center;
    background: var(--surface-2);
    color: var(--accent);
    font-size: 26px;
    font-weight: 900;
}

.related-card h4 {
    margin: 0 0 6px;
    font-size: 16px;
    line-height: 1.25;
}

.related-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.library-list {
    display: grid;
    gap: 12px;
}

.library-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 14px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 10px;
}

.notify-toggle {
    display: flex;
    align-items: center;
    min-height: 42px;
}

.library-main {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    min-width: 0;
}

.library-main img {
    width: 64px;
    height: 88px;
    object-fit: cover;
    border-radius: 6px;
}

.library-row span {
    color: var(--muted);
    font-size: 13px;
}

.icon-danger-button {
    border: 1px solid rgba(255, 107, 107, .45);
    border-radius: 8px;
    background: rgba(255, 107, 107, .08);
    color: #ffd0d0;
    padding: 9px 12px;
    cursor: pointer;
    font-weight: 800;
}

.profile-layout {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(300px, 420px);
    gap: 24px;
    align-items: start;
}

.profile-dashboard {
    display: grid;
    grid-template-columns: minmax(300px, 1.1fr) repeat(2, minmax(280px, .95fr));
    gap: 16px;
    align-items: stretch;
}

.profile-card {
    display: flex;
    gap: 20px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(26, 29, 36, .78);
    padding: 22px;
}

.profile-main-card,
.profile-panel {
    min-height: 100%;
}

.profile-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(26, 29, 36, .78);
    padding: 18px;
}

.profile-panel h2 {
    margin: 0 0 12px;
}

.profile-panel label {
    display: grid;
    gap: 8px;
    margin: 14px 0;
    color: var(--muted);
    font-size: 14px;
}

.profile-panel .check-row {
    display: flex;
}

.profile-panel input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0f1116;
    color: var(--text);
    padding: 11px 13px;
    outline: none;
}

.profile-panel .check-row input {
    width: 18px;
    height: 18px;
    padding: 0;
}

.profile-avatar {
    display: grid;
    place-items: center;
    width: 112px;
    height: 112px;
    flex: 0 0 112px;
    overflow: hidden;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #111318;
    font-size: 46px;
    font-weight: 900;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-form h2 {
    margin: 0 0 12px;
}

.telegram-form {
    width: min(520px, 100%);
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 22px;
}

.admin-stats div,
.admin-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(26, 29, 36, .78);
    padding: 16px;
}

.admin-panel {
    min-width: 0;
}

.admin-stats span {
    display: block;
    color: var(--accent);
    font-size: 34px;
    font-weight: 900;
}

.admin-stats p {
    margin: 5px 0 0;
    color: var(--muted);
}

.admin-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.admin-profile-layout {
    grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
    margin-bottom: 22px;
}

.stat-list {
    display: grid;
    gap: 10px;
}

.compact-list {
    margin: 14px 0;
}

.stat-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    padding-bottom: 10px;
}

.stat-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.stat-row strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-row p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.activity-bar {
    overflow: hidden;
    height: 6px;
    margin-top: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
}

.activity-bar i {
    display: block;
    height: 100%;
    min-width: 4px;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent-2), var(--accent));
}

.stat-row span {
    color: var(--accent-2);
    font-weight: 900;
}

.admin-table {
    display: grid;
    gap: 8px;
    overflow-x: auto;
}

.admin-table-head,
.admin-table-row {
    display: grid;
    grid-template-columns: 150px 130px 140px 80px minmax(220px, 1fr) 70px;
    gap: 12px;
    align-items: center;
    min-width: 820px;
}

.users-table .admin-table-head,
.users-table .admin-table-row {
    grid-template-columns: minmax(170px, 1fr) 150px 140px 110px 95px 190px;
    min-width: 920px;
}

.user-log-table .admin-table-head,
.user-log-table .admin-table-row {
    grid-template-columns: 160px 140px 90px minmax(280px, 1fr) 80px;
    min-width: 780px;
}

.admin-table-head {
    color: var(--accent-2);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.admin-table-row {
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 8px;
    background: rgba(15, 17, 22, .58);
    padding: 10px;
    color: var(--muted);
    font-size: 13px;
}

.admin-table-row strong {
    color: var(--text);
}

.admin-table-row small {
    color: var(--accent);
    font-weight: 900;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: end;
    margin-bottom: 22px;
}

.admin-header h1 {
    margin-bottom: 8px;
}

.admin-updated {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.admin-actions {
    display: flex;
    gap: 10px;
}

.admin-stats {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.admin-stats div {
    min-width: 0;
}

.admin-stats span {
    overflow: hidden;
    font-size: 30px;
    text-overflow: ellipsis;
}

.admin-activity-panel {
    margin-bottom: 18px;
}

.chart-legend {
    display: flex;
    gap: 14px;
    color: var(--muted);
    font-size: 12px;
}

.chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.chart-legend i {
    width: 9px;
    height: 9px;
    border-radius: 2px;
}

.legend-requests {
    background: var(--accent-2);
}

.legend-errors {
    background: var(--danger);
}

.activity-chart {
    display: grid;
    grid-template-columns: repeat(24, minmax(12px, 1fr));
    gap: 6px;
    height: 230px;
    min-width: 0;
    overflow: hidden;
    padding-top: 10px;
}

.activity-column {
    display: grid;
    grid-template-rows: minmax(0, 1fr) 22px;
    gap: 7px;
    min-width: 0;
}

.activity-column-track {
    position: relative;
    display: flex;
    align-items: end;
    overflow: hidden;
    border-radius: 4px 4px 2px 2px;
    background: rgba(255, 255, 255, .045);
}

.activity-column-value {
    position: relative;
    display: block;
    width: 100%;
    min-height: 2px;
    background: var(--accent-2);
    transition: height .2s ease;
}

.activity-column-value b {
    position: absolute;
    inset: auto 0 0;
    min-height: 2px;
    background: var(--danger);
}

.activity-column > span {
    overflow: visible;
    color: var(--muted);
    font-size: 10px;
    text-align: center;
    white-space: nowrap;
}

.admin-dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr);
    gap: 16px;
    margin-bottom: 18px;
}

.request-groups,
.job-list {
    display: grid;
}

.request-group {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    width: 100%;
    min-height: 58px;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    background: transparent;
    color: var(--text);
    padding: 10px 0;
    text-align: left;
    cursor: pointer;
}

.request-group:hover {
    background: rgba(255, 255, 255, .035);
}

.request-group-identity,
.request-group-metrics {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.request-group-identity strong,
.request-group-identity small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.request-group small {
    color: var(--muted);
    font-size: 12px;
}

.request-group-metrics {
    text-align: right;
}

.request-group-metrics b {
    color: var(--accent);
    font-size: 18px;
}

.job-row {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    padding: 12px 0;
}

.job-row p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.job-row time {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}

.job-state {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--muted);
}

.job-state.is-done {
    background: var(--accent-2);
}

.job-state.is-running {
    background: var(--accent);
    box-shadow: 0 0 0 5px rgba(244, 184, 96, .12);
}

.job-state.is-error {
    background: var(--danger);
}

.admin-command {
    margin-top: 16px;
}

.admin-log-panel {
    margin-bottom: 18px;
}

.log-total {
    color: var(--muted);
    font-size: 13px;
}

.log-filters {
    display: grid;
    grid-template-columns: 170px 150px 130px minmax(240px, 1fr) auto;
    gap: 10px;
    margin: 16px 0;
}

.log-filters select,
.log-filters input {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(8, 10, 15, .72);
    color: var(--text);
    padding: 10px 11px;
}

.log-table-head,
.log-entry summary {
    display: grid;
    grid-template-columns: 145px 160px minmax(280px, 1fr) 64px 76px;
    gap: 12px;
    align-items: center;
    min-width: 820px;
}

.log-table-head {
    padding: 0 12px 8px;
    color: var(--accent-2);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.log-table-scroll {
    max-width: 100%;
    overflow-x: auto;
}

.log-list {
    display: grid;
    gap: 7px;
    min-width: 0;
    max-width: 100%;
    overflow: visible;
    transition: opacity .15s ease;
}

.log-list[data-loading] {
    opacity: .45;
}

.log-entry {
    min-width: 820px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 7px;
    background: rgba(15, 17, 22, .56);
}

.log-entry summary {
    padding: 10px 12px;
    color: var(--muted);
    font-size: 12px;
    cursor: pointer;
    list-style: none;
}

.log-entry summary::-webkit-details-marker {
    display: none;
}

.log-entry summary strong,
.log-entry summary span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.log-entry summary strong {
    color: var(--text);
}

.status-code {
    border-radius: 5px;
    padding: 5px 7px;
    color: #101317;
    text-align: center;
}

.status-2xx {
    background: var(--accent-2);
}

.status-3xx {
    background: #80bfff;
}

.status-4xx,
.status-5xx {
    background: var(--danger);
}

.log-details {
    display: grid;
    grid-template-columns: 160px 180px minmax(280px, 1fr) 80px;
    gap: 12px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    padding: 12px;
    color: var(--muted);
    font-size: 12px;
}

.log-details span {
    overflow-wrap: anywhere;
}

.log-details b {
    display: block;
    margin-bottom: 4px;
    color: var(--text);
}

.log-more {
    margin-top: 14px;
}

.admin-settings-grid {
    display: grid;
    grid-template-columns: minmax(320px, 620px);
    gap: 16px;
}

.inline-form {
    margin: 0;
}

.admin-user-link {
    color: var(--text);
}

.admin-user-link:hover {
    color: var(--accent);
}

.table-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.small-button {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 13px;
}

.muted {
    color: var(--muted);
}

.footer {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 22px 0 30px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    color: var(--muted);
    text-align: center;
}

@media (max-width: 820px) {
    .topbar {
        grid-template-columns: 1fr;
        gap: 12px;
    }

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

    .main-tabs {
        width: 100%;
    }

    .main-tabs a {
        flex: 1;
        text-align: center;
    }

    .home-hero,
    .page-pages {
        grid-template-columns: 1fr;
    }

    .hero-actions,
    .page-numbers {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .anime-hero {
        grid-template-columns: 1fr;
    }

    .anime-title-card {
        grid-template-columns: 148px minmax(0, 1fr);
    }

    .detail-poster {
        width: 148px;
    }

    .player {
        aspect-ratio: 16 / 9;
    }

    .shots {
        grid-template-columns: 1fr 1fr;
    }

    .library-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .library-main {
        grid-template-columns: 54px minmax(0, 1fr);
    }

    .library-row span {
        grid-column: 2;
    }

    .profile-layout {
        grid-template-columns: 1fr;
    }

    .profile-dashboard {
        grid-template-columns: 1fr;
    }

    .profile-card {
        align-items: flex-start;
    }

    .admin-stats,
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .admin-header {
        align-items: flex-start;
    }

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

    .admin-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .log-filters {
        grid-template-columns: 1fr 1fr;
    }

    .log-filters input {
        grid-column: 1 / -1;
    }

    .activity-chart {
        grid-template-columns: repeat(24, minmax(4px, 1fr));
        gap: 3px;
    }

    .top-row {
        grid-template-columns: 42px 52px minmax(0, 1fr);
    }

    .top-row strong {
        grid-column: 3;
    }
}

@media (min-width: 821px) and (max-width: 1180px) {
    .admin-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .admin-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .log-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .log-filters input {
        grid-column: span 2;
    }
}

@media (max-width: 560px) {
    .topbar {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 10px 14px;
        padding: 12px 16px;
    }

    .brand {
        grid-column: 1;
        grid-row: 1;
    }

    .nav {
        grid-column: 2;
        grid-row: 1;
        flex-wrap: wrap;
        gap: 8px 12px;
        font-size: 14px;
    }

    .main-tabs {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .top-search {
        grid-column: 1 / -1;
        grid-row: 3;
    }

    .page {
        width: min(100% - 20px, 1440px);
        padding-top: 20px;
    }

    .home-hero {
        padding: 20px;
    }

    .home-hero h1 {
        font-size: 34px;
        line-height: 1.08;
    }

    .section-head {
        align-items: flex-start;
        gap: 12px;
    }

    .anime-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .anime-card {
        padding: 7px;
    }

    .anime-meta {
        padding-top: 8px;
    }

    .anime-meta h2 {
        min-height: 52px;
        font-size: 14px;
        line-height: 1.24;
    }

    .badge {
        top: 7px;
        padding: 5px 7px;
        font-size: 12px;
    }

    .score {
        right: 7px;
    }

    .episodes {
        left: 7px;
    }
}

@media (max-width: 360px) {
    .anime-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}
