:root {
    --bg: #0b0d12;
    --surface: #151821;
    --surface-2: #1d212c;
    --text: #f4f5f7;
    --muted: #9ca3af;
    --accent: #e63956;
    --accent-hover: #ff4d69;
    --border: #2a2f3b;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at 20% 0%, #1d1720 0, var(--bg) 34rem);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button,
input,
select {
    font: inherit;
}

button,
select {
    cursor: pointer;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    padding: 0 5vw;
    border-bottom: 1px solid var(--border);
    background: rgba(11, 13, 18, .86);
    backdrop-filter: blur(14px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    font-weight: 800;
}

.brand-mark,
.login-icon {
    color: var(--accent);
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    color: var(--muted);
}

.user-nav form {
    margin: 0;
}

.link-button {
    border: 0;
    padding: 0;
    color: var(--text);
    background: none;
}

.logo {
    width: 50px;
}

.page {
    width: min(1400px, 90vw);
    margin: 0 auto;
    padding: 3rem 0 5rem;
}

.hero {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    align-items: end;
    margin-bottom: 2rem;
}

h1 {
    margin: .25rem 0;
    font-size: clamp(2rem, 5vw, 3.6rem);
    line-height: 1.05;
}

.eyebrow {
    margin: 0;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: .15em;
    font-size: .75rem;
    font-weight: 800;
}

.muted,
.meta,
.original-title {
    color: var(--muted);
}

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: .7rem;
}

.meta span:not(:first-child)::before {
    content: "•";
    margin-right: .7rem;
}

.search {
    display: flex;
    min-width: min(100%, 380px);
}

.search input,
.stack-form input {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: .85rem 1rem;
    outline: none;
}

.search input {
    border-radius: .7rem 0 0 .7rem;
}

.search button,
.primary-button,
.state-form button,
.quick-state button {
    border: 0;
    background: var(--accent);
    color: white;
    font-weight: 750;
    padding: .8rem 1.1rem;
}

.search button {
    border-radius: 0 .7rem .7rem 0;
}

button:hover,
.primary-button:hover {
    background: var(--accent-hover);
}

.filters {
    display: flex;
    align-items: center;
    gap: .5rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.filters a,
.filters select {
    white-space: nowrap;
    border: 1px solid var(--border);
    border-radius: 99px;
    background: var(--surface);
    padding: .6rem 1rem;
}

.filters a.active {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}

.filters select {
    margin-left: auto;
    color: var(--text);
}

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1.5rem;
}

.media-card {
    min-width: 0;
}

.poster {
    display: block;
    position: relative;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    border-radius: .9rem;
    background: linear-gradient(145deg, #282d39, #141720);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .25);
}

.poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s;
}

.poster:hover img {
    transform: scale(1.035);
}

.poster-placeholder {
    display: grid;
    place-items: center;
    height: 100%;
    color: #4a5160;
    font-size: 3rem;
}

.badge-row {
    position: absolute;
    top: .7rem;
    left: .7rem;
    max-width: calc(100% - 3.9rem);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem;
}

.type-badge,
.language-badge {
    white-space: nowrap;
    line-height: 1;
    border-radius: 99px;
    padding: .3rem .6rem;
    font-size: .72rem;
    font-weight: 800;
}

.type-badge {
    background: rgba(0, 0, 0, .72);
}

.language-badge {
    background: rgba(230, 57, 86, .86);
    text-transform: uppercase;
}

.watched-badge {
    position: absolute;
    top: .7rem;
    right: .7rem;
    border-radius: 99px;
    padding: .3rem .6rem;
    font-size: .72rem;
    font-weight: 800;
    background: #21a366;
}

.card-body h2 {
    margin: .8rem 0 .15rem;
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-body .meta {
    margin: 0 0 .7rem;
    font-size: .85rem;
}

.quick-state {
    display: flex;
    align-items: center;
    gap: .35rem;
}

.quick-state input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.quick-state label span,
.quick-state select,
.quick-state button {
    border: 1px solid var(--border);
    border-radius: .45rem;
    background: var(--surface);
    color: var(--muted);
    padding: .4rem .55rem;
    font-size: .72rem;
}

.quick-state input:checked+span {
    color: #ffd166;
    border-color: #6e5d2b;
}

.quick-state button {
    margin-left: auto;
    color: var(--text);
}

.back-link {
    display: inline-block;
    color: var(--muted);
    margin-bottom: 2rem;
}

.detail-heading {
    display: grid;
    grid-template-columns: 190px 1fr;
    gap: 2.5rem;
    align-items: start;
    max-width: 1000px;
}

.detail-poster {
    width: 100%;
    border-radius: .8rem;
}

.description {
    color: #c8ccd4;
    line-height: 1.7;
}

.state-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
}

.state-form label {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.state-form select,
.state-form button {
    border-radius: .5rem;
    padding: .55rem .8rem;
}

.player-section,
.episodes {
    margin-top: 3rem;
}

.video-js.video-player {
    width: 100%;
    max-height: 75vh;
    background: #000;
    border-radius: .8rem;
    overflow: hidden;
    border: 1px solid white;
}

.episodes details {
    border: 1px solid var(--muted);
    border-radius: .7rem;
    margin-bottom: 1rem;
    overflow: hidden;
}

.episodes summary {
    cursor: pointer;
    padding: 1rem 1.25rem;
    font-weight: 800;
    background: var(--surface);
}

.episode {
    display: grid;
    grid-template-columns: 1fr minmax(280px, 45%);
    gap: 1.5rem;
    align-items: center;
    padding: 1.25rem;
    border-top: 1px solid var(--muted);
}

.episode h3 {
    display: inline;
}

.episode-number {
    color: var(--accent);
    font-weight: 800;
}

.video-js.episode-player {
    width: 100%;
    background: #000;
    border-radius: .5rem;
    overflow: hidden;
    border: 1px solid white;
}

.video-js .vjs-control-bar {
    background: rgba(11, 13, 18, .92);
}

.video-js .vjs-big-play-button {
    border-color: rgba(255, 255, 255, .75);
    background: rgba(230, 57, 86, .9);
}

.video-js:hover .vjs-big-play-button,
.video-js .vjs-big-play-button:focus {
    background: var(--accent-hover);
}

.empty-inline {
    padding: 1rem 1.25rem;
    color: var(--muted);
}

.empty-state {
    text-align: center;
    padding: 5rem 1rem;
    border: 1px dashed var(--border);
    border-radius: 1rem;
}

.empty-state>span {
    font-size: 3rem;
}

.empty-state .primary-button {
    display: inline-block;
    border-radius: .5rem;
    margin-top: 1rem;
}

.login-shell {
    min-height: calc(100vh - 160px);
    display: grid;
    place-items: center;
}

.login-card {
    width: min(420px, 100%);
    padding: 2.5rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: rgba(21, 24, 33, .9);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}

.login-icon {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.login-card h1 {
    font-size: 2.2rem;
}

.stack-form {
    display: grid;
    gap: .6rem;
    margin-top: 1.5rem;
}

.stack-form input {
    border-radius: .5rem;
    margin-bottom: .6rem;
}

.stack-form .primary-button {
    border-radius: .5rem;
    margin-top: .5rem;
}

.form-error {
    color: #ff8295;
    padding: .7rem;
    background: #351720;
    border-radius: .5rem;
}

@media (max-width: 760px) {
    .page {
        width: min(92vw, 600px);
        padding-top: 2rem;
    }

    .hero {
        align-items: stretch;
        flex-direction: column;
    }

    .search {
        min-width: 0;
    }

    .filters select {
        margin-left: 0;
    }

    .catalog-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }

    .quick-state {
        flex-wrap: wrap;
    }

    .quick-state button {
        margin-left: 0;
    }

    .detail-heading {
        grid-template-columns: 1fr;
    }

    .detail-poster {
        width: 150px;
    }

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

    .user-nav span {
        display: none;
    }
}
