:root {
    --bg-card: rgba(255, 255, 255, 0.04);
    --border-subtle: rgba(255, 255, 255, 0.1);
    --color-primary: #8b5cf6;
    --player-height: 85vh;
}

body {
    background: #0b0b0b;
    color: white;

    margin: 0;
    padding: 0;
    overflow-x: hidden;
    width: 100%;
    font-family: system-ui, -apple-system, sans-serif;
}

.top-media-wrapper {
    position: relative;

    width: 100vw;
    left: 0;
    background: #000;
    transition: all 0.5s ease-in-out;
}

.hero-wrapper {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    z-index: 1;
}

.video-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}
.video-background iframe,
.video-background #trailer-player {
    position: absolute;
    top: 50%;
    left: 50%;

    width: 100vw;
    height: 56.25vw;
    min-height: 100vh;
    min-width: 177.77vh;

    transform: translate(-50%, -50%);

}

.hero-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.8) 70%, #0b0b0b 100%);
    z-index: 2;
}

.content-container {
    position: relative;
    z-index: 10;
    max-width: 1400px;
    margin: -45vh auto 0 auto;
    padding: 0 3rem 4rem 3rem;
    transition: margin-top 0.5s ease;
}

body.watch-mode .content-container { margin-top: 0; }
body.watch-mode .anime-header { margin-top: 2rem; }

.anime-header { margin-bottom: 5rem; max-width: 900px; }
.anime-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem); font-weight: 900;
    margin-bottom: 0.5rem; text-shadow: 0 4px 30px rgba(0,0,0,0.6);
}
.hero-meta-info {
    display: flex; align-items: center; gap: 0.8rem;
    color: rgba(255,255,255,0.7); font-weight: 600; margin-bottom: 1.2rem;
}
.pill-local {
    background: #22c55e; color: black; padding: 2px 8px;
    border-radius: 4px; font-size: 0.75rem; font-weight: 900;
}
.hero-description-mini {
    font-size: 1.05rem; line-height: 1.5; color: rgba(255,255,255,0.8);
    margin-bottom: 1.2rem; max-width: 700px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-tags {
    display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 2.5rem;
    color: rgba(255,255,255,0.5); font-weight: 500;
}

.action-row { display: flex; align-items: center; gap: 1rem; }
.btn-watch {
    padding: 0.8rem 2.2rem; background: white; color: black;
    border-radius: 8px; font-weight: 800; border: none; cursor: pointer;
    display: flex; align-items: center; gap: 0.6rem; transition: 0.2s ease;
}
.btn-watch:hover { transform: scale(1.03); filter: brightness(0.9); }

.btn-add-list {
    padding: 0.8rem 1.5rem; background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2); color: white;
    border-radius: 8px; font-weight: 700; cursor: pointer; transition: 0.2s;
}
.btn-add-list:hover { background: rgba(255,255,255,0.2); }

.main-layout { display: grid; grid-template-columns: 300px 1fr; gap: 4rem; margin-top: 2rem; }
.content-section { margin-top: 4rem; }
h2, .subsection-title { font-size: 1.8rem; font-weight: 800; margin-bottom: 1.5rem; color: white; }

.poster-card {
    border-radius: 12px; overflow: hidden;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5); border: 1px solid var(--border-subtle);
}
.poster-card img { width: 100%; height: auto; display: block; }

.relations-horizontal { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.relation-card-horizontal {
    display: flex; background: var(--bg-card); border: 1px solid var(--border-subtle);
    border-radius: 10px; overflow: hidden; transition: 0.2s; cursor: pointer;
}
.relation-card-horizontal:hover { background: rgba(255,255,255,0.08); transform: translateX(5px); }
.rel-img { width: 85px; height: 110px; object-fit: cover; }
.rel-info { padding: 1rem; display: flex; flex-direction: column; justify-content: center; }
.rel-type {
    font-size: 0.7rem; color: var(--color-primary); font-weight: 800;
    margin-bottom: 4px; background: rgba(139, 92, 246, 0.1); width: fit-content; padding: 2px 6px; border-radius: 4px;
}
.rel-title { font-size: 0.95rem; font-weight: 700; color: #eee; }

.characters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.character-item { display: flex; align-items: center; gap: 1rem; }
.char-avatar { width: 60px; height: 60px; border-radius: 10px; overflow: hidden; flex-shrink: 0; }
.char-avatar img { width: 100%; height: 100%; object-fit: cover; }
.char-info { display: flex; flex-direction: column; gap: 2px; }
.char-name { font-size: 1rem; font-weight: 700; color: #fff; }
.char-role { font-size: 0.8rem; color: #888; font-weight: 500; }
.btn-show-more { background: transparent; border: 1px solid var(--border-subtle); color: #aaa; padding: 10px; width: 100%; margin-top: 1rem; cursor: pointer; }

.episodes-section { margin-top: 3rem; }
.episodes-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.episode-search-input {
    background: rgba(255,255,255,0.05); border: 1px solid var(--border-subtle);
    color: white; padding: 8px 15px; border-radius: 8px; width: 100px;
}
.episodes-grid {
    display: grid;

    grid-template-columns: repeat(auto-fill, minmax(55px, 1fr));
    gap: 0.6rem;
}
.episode-btn {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-subtle);
    padding: 0.6rem 0;
    border-radius: 6px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: #ccc;
}
.episode-btn:hover {
    background: white;
    color: black;
    transform: translateY(-2px);
}
.episode-btn.active-playing {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.metadata-sidebar {
    margin-top: 2rem;
    background: rgba(255,255,255,0.03);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}
.meta-item-side {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 0.8rem;
}
.meta-item-side:last-child { border-bottom: none; padding-bottom: 0; }
.meta-item-side span {
    font-size: 0.8rem;
    color: #888;
    font-weight: 600;
}
.meta-item-side p {
    font-size: 0.95rem;
    font-weight: 500;
    color: #fff;
    margin: 0;
    text-align: right;
}

@media (max-width: 1024px) {
    .content-container { margin-top: -200px; padding: 0 1.5rem; }
    .main-layout { grid-template-columns: 1fr; gap: 2rem; }
    .poster-section { display: flex; flex-direction: column; align-items: center; }
    .poster-card { width: 220px; }
    .metadata-sidebar { width: 100%; max-width: 400px; }
}

.relation-card-horizontal.no-link {
    cursor: default;
    opacity: 0.7;
}
.relation-card-horizontal.no-link:hover {
    transform: none;
    background: var(--bg-card);
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.page-info {
    font-size: 0.9rem;
    font-weight: 700;
    color: #888;
    min-width: 100px;
    text-align: center;
}

.page-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.page-btn:hover:not(:disabled) {
    background: white;
    color: black;
    border-color: white;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: rgba(255, 255, 255, 0.1);
}