:root {
    --primary-50: #f0f9ff;
    --primary-500: #0ea5e9;
    --primary-600: #0284c7;
    --primary-700: #0369a1;
    --primary-900: #0c4a6e;
    --secondary-50: #f8fafc;
    --secondary-100: #f1f5f9;
    --secondary-200: #e2e8f0;
    --secondary-300: #cbd5e1;
    --secondary-400: #94a3b8;
    --secondary-500: #64748b;
    --secondary-600: #475569;
    --secondary-700: #334155;
    --secondary-800: #1e293b;
    --secondary-900: #0f172a;
    --accent-50: #fef3c7;
    --accent-500: #d97706;
    --accent-600: #b45309;
    --page-width: 80rem;
    --radius-lg: 0.75rem;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.05);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.10), 0 4px 6px -4px rgb(0 0 0 / 0.10);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.10), 0 8px 10px -6px rgb(0 0 0 / 0.10);
}

body {
    background: var(--secondary-50);
    color: var(--secondary-900);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

img {
    display: block;
    max-width: 100%;
}

.container-custom {
    width: 100%;
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 0 1rem;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgb(255 255 255 / 0.95);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--secondary-900);
}

.logo-mark {
    display: inline-grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    color: white;
    background: linear-gradient(135deg, var(--primary-600), var(--accent-500));
    box-shadow: 0 8px 20px rgb(2 132 199 / 0.25);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-weight: 600;
    color: var(--secondary-700);
}

.nav-links a:hover,
.nav-links a.is-active {
    color: var(--primary-600);
}

.mobile-toggle {
    display: none;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.6rem;
    color: var(--secondary-700);
    background: var(--secondary-100);
}

.mobile-menu {
    display: none;
    padding: 0 0 1rem;
}

.mobile-menu a {
    display: block;
    padding: 0.75rem 0;
    font-weight: 600;
    color: var(--secondary-700);
}

.hero-carousel {
    position: relative;
    height: 500px;
    overflow: hidden;
    background: var(--secondary-900);
}

.hero-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 520ms ease;
}

.hero-slide.is-active {
    opacity: 1;
    pointer-events: auto;
}

.hero-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.02);
}

.hero-slide img.image-unavailable {
    opacity: 0;
}

.hero-slide::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 75% 35%, rgb(14 165 233 / 0.30), transparent 38%), linear-gradient(135deg, #0f172a, #082f49 48%, #0f172a);
}

.hero-slide::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgb(0 0 0 / 0.82), rgb(0 0 0 / 0.52), rgb(0 0 0 / 0.28));
}

.hero-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    height: 100%;
    color: white;
}

.hero-copy {
    max-width: 44rem;
    animation: slideUp 0.52s ease-out;
}

.hero-kicker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1.2rem;
    font-size: 0.9rem;
    color: rgb(255 255 255 / 0.86);
}

.badge-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    color: white;
    background: var(--primary-600);
    font-weight: 700;
}

.hero-title {
    margin: 0;
    font-size: clamp(2.35rem, 5vw, 4.1rem);
    line-height: 1.05;
    font-weight: 900;
    letter-spacing: -0.04em;
}

.hero-description {
    max-width: 42rem;
    margin: 1.25rem 0 1.6rem;
    color: rgb(255 255 255 / 0.9);
    font-size: 1.08rem;
    line-height: 1.78;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.btn-primary,
.btn-secondary,
.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border-radius: 0.65rem;
    font-weight: 700;
    transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

.btn-primary {
    padding: 0.75rem 1.45rem;
    color: white;
    background: var(--primary-600);
    box-shadow: 0 12px 28px rgb(2 132 199 / 0.26);
}

.btn-primary:hover {
    background: var(--primary-700);
    transform: translateY(-1px);
    box-shadow: var(--shadow-xl);
}

.btn-secondary {
    padding: 0.7rem 1.25rem;
    color: var(--primary-700);
    background: var(--primary-50);
}

.btn-secondary:hover {
    color: white;
    background: var(--primary-600);
}

.btn-ghost {
    padding: 0.65rem 1.1rem;
    color: var(--secondary-700);
    background: var(--secondary-100);
}

.btn-ghost:hover {
    color: var(--primary-700);
    background: var(--primary-50);
}

.hero-rating {
    color: rgb(255 255 255 / 0.82);
    font-size: 0.96rem;
}

.hero-rating strong {
    color: #fbbf24;
    font-size: 1.2rem;
}

.hero-arrow {
    position: absolute;
    z-index: 4;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 999px;
    color: white;
    background: rgb(0 0 0 / 0.32);
    transition: background 180ms ease;
}

.hero-arrow:hover {
    background: rgb(0 0 0 / 0.52);
}

.hero-arrow.prev {
    left: 1rem;
}

.hero-arrow.next {
    right: 1rem;
}

.hero-dots {
    position: absolute;
    z-index: 4;
    left: 50%;
    bottom: 1.5rem;
    display: flex;
    gap: 0.55rem;
    transform: translateX(-50%);
}

.hero-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 999px;
    background: rgb(255 255 255 / 0.55);
    transition: width 220ms ease, background 220ms ease;
}

.hero-dot.is-active {
    width: 2rem;
    background: white;
}

.section {
    padding: 2.2rem 0;
}

.section-white {
    background: white;
}

.section-soft {
    background: linear-gradient(135deg, var(--primary-50), var(--accent-50));
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.section-title {
    margin: 0;
    color: var(--secondary-900);
    font-size: clamp(1.55rem, 2.6vw, 2rem);
    line-height: 1.2;
    font-weight: 900;
}

.section-subtitle {
    margin: 0.5rem 0 0;
    color: var(--secondary-600);
}

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

.card,
.movie-card,
.detail-card,
.rank-row,
.search-panel {
    border-radius: var(--radius-lg);
    background: white;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 240ms ease, transform 240ms ease;
}

.movie-card {
    display: block;
    overflow: hidden;
    height: 100%;
}

.movie-card:hover,
.rank-row:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.poster-frame {
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at 30% 20%, rgb(14 165 233 / 0.32), transparent 38%), linear-gradient(135deg, #0f172a, #1e3a8a 58%, #92400e);
}

.poster-frame.vertical {
    aspect-ratio: 3 / 4;
}

.poster-frame.video {
    aspect-ratio: 16 / 9;
}

.poster-frame.small {
    width: 8rem;
    height: 5rem;
    flex: 0 0 auto;
}

.poster-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 280ms ease, opacity 180ms ease;
}

.poster-frame img.image-unavailable {
    opacity: 0;
}

.movie-card:hover .poster-frame img,
.related-card:hover .poster-frame img,
.rank-row:hover .poster-frame img {
    transform: scale(1.06);
}

.play-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: white;
    font-size: 2.5rem;
    background: rgb(0 0 0 / 0.38);
    opacity: 0;
    transition: opacity 220ms ease;
}

.movie-card:hover .play-overlay,
.related-card:hover .play-overlay,
.rank-row:hover .play-overlay {
    opacity: 1;
}

.movie-rating {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.22rem 0.5rem;
    border-radius: 0.35rem;
    color: white;
    background: rgb(0 0 0 / 0.72);
    font-size: 0.78rem;
    font-weight: 800;
}

.movie-card-body {
    padding: 0.9rem;
}

.movie-title {
    margin: 0 0 0.55rem;
    color: var(--secondary-900);
    font-size: 1rem;
    line-height: 1.38;
    font-weight: 800;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.movie-card:hover .movie-title {
    color: var(--primary-600);
}

.movie-meta,
.movie-extra {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    color: var(--secondary-500);
    font-size: 0.8rem;
}

.movie-extra {
    margin-top: 0.55rem;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.type-pill,
.tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.56rem;
    border-radius: 999px;
    background: var(--primary-50);
    color: var(--primary-700);
    font-size: 0.76rem;
    font-weight: 700;
}

.tag-pill {
    background: var(--secondary-100);
    color: var(--secondary-700);
}

.rail-wrap {
    position: relative;
}

.movie-rail {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding: 0.25rem 0 0.85rem;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.movie-rail::-webkit-scrollbar {
    display: none;
}

.rail-item {
    width: 200px;
    flex: 0 0 auto;
}

.rail-controls {
    display: flex;
    gap: 0.5rem;
}

.round-btn {
    display: grid;
    place-items: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 999px;
    color: var(--secondary-700);
    background: var(--secondary-100);
    transition: background 180ms ease, color 180ms ease;
}

.round-btn:hover {
    color: white;
    background: var(--primary-600);
}

.category-tabs {
    display: flex;
    gap: 0.65rem;
    margin-bottom: 1.35rem;
    overflow-x: auto;
    padding-bottom: 0.35rem;
}

.category-tab {
    flex: 0 0 auto;
    padding: 0.65rem 1.25rem;
    border-radius: 0.65rem;
    color: var(--secondary-700);
    background: var(--secondary-100);
    font-weight: 800;
    white-space: nowrap;
}

.category-tab.is-active {
    color: white;
    background: var(--primary-600);
    box-shadow: 0 10px 22px rgb(2 132 199 / 0.22);
}

.tab-panel {
    display: none;
}

.tab-panel.is-active {
    display: block;
}

.editor-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.movie-card.large .poster-frame {
    aspect-ratio: 16 / 9;
}

.movie-card.large .movie-title {
    font-size: 1.35rem;
}

.page-hero {
    padding: 3.5rem 0;
    color: white;
    background: radial-gradient(circle at 85% 25%, rgb(14 165 233 / 0.35), transparent 35%), linear-gradient(135deg, var(--secondary-900), #082f49 54%, #111827);
}

.page-hero h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1.15;
    font-weight: 900;
}

.page-hero p {
    max-width: 48rem;
    margin: 1rem 0 0;
    color: rgb(255 255 255 / 0.86);
    line-height: 1.8;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 1rem;
    color: rgb(255 255 255 / 0.78);
    font-size: 0.9rem;
}

.breadcrumb a:hover {
    color: white;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination a,
.pagination span {
    min-width: 2.4rem;
    padding: 0.55rem 0.75rem;
    border-radius: 0.55rem;
    text-align: center;
    font-weight: 800;
    background: white;
    color: var(--secondary-700);
    box-shadow: var(--shadow-sm);
}

.pagination span.current,
.pagination a:hover {
    color: white;
    background: var(--primary-600);
}

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    padding-top: 2rem;
}

.player-shell {
    overflow: hidden;
    border-radius: 1rem;
    background: black;
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.28);
}

.player-video {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: black;
}

.detail-card {
    padding: 1.25rem;
}

.detail-title {
    margin: 0 0 1rem;
    font-size: clamp(1.75rem, 3vw, 2.35rem);
    line-height: 1.18;
    font-weight: 900;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    color: var(--secondary-600);
}

.detail-meta strong {
    color: var(--accent-600);
}

.one-line-box {
    margin: 1rem 0 1.25rem;
    padding: 1rem;
    border-radius: 0.75rem;
    color: var(--primary-900);
    background: var(--primary-50);
    font-weight: 700;
    line-height: 1.7;
}

.content-section {
    border-top: 1px solid var(--secondary-200);
    padding-top: 1.25rem;
    margin-top: 1.25rem;
}

.content-section h2,
.side-title {
    margin: 0 0 0.75rem;
    color: var(--secondary-900);
    font-size: 1.25rem;
    font-weight: 900;
}

.content-section p {
    margin: 0 0 1rem;
    color: var(--secondary-700);
    line-height: 1.86;
}

.related-card {
    display: flex;
    gap: 0.9rem;
    overflow: hidden;
    border-radius: 0.75rem;
    background: white;
}

.related-card-body {
    min-width: 0;
    padding: 0.55rem 0.7rem 0.55rem 0;
}

.related-title {
    margin: 0 0 0.4rem;
    color: var(--secondary-900);
    font-size: 0.95rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.related-card:hover .related-title {
    color: var(--primary-600);
}

.related-meta {
    color: var(--secondary-500);
    font-size: 0.78rem;
}

.sidebar-card {
    padding: 1rem;
    border-radius: var(--radius-lg);
    background: white;
    box-shadow: var(--shadow-sm);
}

.sidebar-list {
    display: grid;
    gap: 0.85rem;
}

.rank-list {
    display: grid;
    gap: 0.9rem;
}

.rank-row {
    display: grid;
    grid-template-columns: 3rem 8rem minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
    padding: 0.8rem;
}

.rank-index {
    display: grid;
    place-items: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 999px;
    color: white;
    background: var(--primary-600);
    font-weight: 900;
}

.rank-title {
    margin: 0 0 0.45rem;
    font-size: 1.08rem;
    font-weight: 900;
}

.rank-desc {
    margin: 0;
    color: var(--secondary-600);
    line-height: 1.65;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.search-panel {
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.search-box {
    width: 100%;
    min-height: 3.3rem;
    border: 1px solid var(--secondary-300);
    border-radius: 0.8rem;
    padding: 0 1rem;
    background: white;
    color: var(--secondary-900);
    outline: none;
}

.search-box:focus {
    border-color: var(--primary-600);
    box-shadow: 0 0 0 4px rgb(2 132 199 / 0.12);
}

.search-results {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1rem;
}

.site-footer {
    margin-top: 4rem;
    padding: 3rem 0 2rem;
    color: var(--secondary-300);
    background: var(--secondary-900);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.site-footer h3 {
    margin: 0 0 1rem;
    color: white;
    font-weight: 800;
}

.site-footer p,
.site-footer li {
    color: var(--secondary-400);
    line-height: 1.8;
}

.site-footer a:hover {
    color: var(--primary-500);
}

.footer-links {
    display: grid;
    gap: 0.45rem;
}

.footer-bottom {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--secondary-800);
    color: var(--secondary-400);
    text-align: center;
    font-size: 0.9rem;
}

.back-to-top {
    position: fixed;
    right: 1.4rem;
    bottom: 1.4rem;
    z-index: 45;
    display: none;
    width: 3rem;
    height: 3rem;
    border-radius: 999px;
    color: white;
    background: var(--primary-600);
    box-shadow: var(--shadow-xl);
}

.back-to-top.is-visible {
    display: grid;
    place-items: center;
}

.empty-state {
    padding: 2rem;
    border-radius: var(--radius-lg);
    background: white;
    color: var(--secondary-600);
    text-align: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 640px) {
    .container-custom {
        padding: 0 1.5rem;
    }

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

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

@media (min-width: 768px) {
    .hero-carousel {
        height: 600px;
    }

    .movie-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 1.25rem;
    }

    .editor-layout {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .editor-layout .editor-feature {
        grid-column: span 2;
        grid-row: span 2;
    }

    .footer-grid {
        grid-template-columns: 1.25fr 1fr 1fr 1fr;
    }
}

@media (min-width: 1024px) {
    .container-custom {
        padding: 0 2rem;
    }

    .movie-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .detail-layout {
        grid-template-columns: minmax(0, 2fr) minmax(18rem, 1fr);
        gap: 2rem;
    }

    .sidebar-sticky {
        position: sticky;
        top: 6rem;
    }
}

@media (min-width: 1280px) {
    .movie-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .nav-links {
        display: none;
    }

    .mobile-toggle {
        display: grid;
        place-items: center;
    }

    .mobile-menu.is-open {
        display: block;
    }

    .hero-arrow {
        display: none;
    }

    .hero-carousel {
        height: 520px;
    }

    .hero-description {
        font-size: 1rem;
    }

    .rank-row {
        grid-template-columns: 2.6rem 6rem minmax(0, 1fr);
        gap: 0.75rem;
    }

    .poster-frame.small {
        width: 6rem;
        height: 4.25rem;
    }
}
