:root {
    --bg: #070d18;
    --bg-card: #0e1525;
    --bg-card-soft: #101a2d;
    --text-primary: #eef3ff;
    --text-muted: #95a3b8;
    --text-soft: #d4dceb;
    --border-warm: rgba(255, 255, 255, 0.10);
    --border-cool: rgba(148, 163, 184, 0.16);
    --accent: #e50914;
    --accent-2: #ff4f5b;
    --accent-soft: rgba(229, 9, 20, 0.14);
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
    --radius-lg: 18px;
    --radius-md: 14px;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-primary);
    background: #070d18;
    overflow-x: hidden;
}

/* Keep detail page on the same visual base as index/search. */
body#kt_body {
    background: #070d18 !important;
}

.detail-page-shell {
    width: 100%;
}

.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.28) 0.35px, transparent 0.35px);
    background-size: 3px 3px;
    z-index: 0;
}

.app-wrapper {
    width: min(1280px, calc(100% - 24px));
    margin: 20px auto 40px;
    position: relative;
    z-index: 2;
}

.detail-page-shell {
    margin: 0;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
    background: rgba(16, 21, 30, 0.82);
    border: 1px solid var(--border-warm);
    border-radius: 20px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.detail-header {
    margin-bottom: 16px;
}

.detail-brand {
    gap: 12px;
}

.detail-logo {
    width: 56px;
    height: 56px;
    flex: 0 0 auto;
}

.detail-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(246, 198, 87, 0.22);
    background: rgba(246, 198, 87, 0.08);
    color: #f4dc9d;
    font-weight: 700;
    white-space: nowrap;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(246, 198, 87, 0.22), rgba(255, 138, 91, 0.2));
    border: 1px solid rgba(246, 198, 87, 0.18);
    color: #ffe8aa;
    font-size: 1rem;
}

.header-brand h1,
.brand-title,
.topbar-title,
.section-title {
    margin: 0;
    font-family: 'Fraunces', serif;
    letter-spacing: 0.01em;
}

.header-brand h1 { font-size: 1.8rem; }

.header-brand span,
.user-greeting,
.brand-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.btn-logout,
.back-link,
.movie-cta-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(246, 198, 87, 0.26);
    background: rgba(246, 198, 87, 0.12);
    color: #ffe7b2;
    text-decoration: none;
    font-weight: 700;
}

.nav-tabs {
    display: flex;
    gap: 10px;
    padding: 12px 0 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab {
    border: 1px solid var(--border-warm);
    background: rgba(18, 24, 34, 0.78);
    color: var(--text-muted);
    border-radius: 999px;
    padding: 10px 14px;
    cursor: pointer;
    font: inherit;
    white-space: nowrap;
    transition: all 0.18s ease;
}

.nav-tab.active,
.nav-tab:hover {
    color: #fff;
    border-color: rgba(246, 198, 87, 0.26);
    background: rgba(246, 198, 87, 0.12);
}

.movie-topbar {
    margin-top: 14px;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 14px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.movie-topbar-left {
    display: grid;
    align-content: center;
    gap: 10px;
}

.movie-search-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 16px 18px;
    border-radius: 22px;
    border: 1px solid var(--border-warm);
    background: linear-gradient(180deg, rgba(18, 24, 34, 0.96), rgba(14, 18, 26, 0.92));
    box-shadow: var(--shadow);
}

.movie-search-input-wide {
    min-height: 52px;
    font-size: 1rem;
}

.movie-topbar-subline {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.movie-topbar-note {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.movie-topbar-right {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    padding: 16px 18px;
    border-radius: 22px;
    border: 1px solid var(--border-warm);
    background: linear-gradient(180deg, rgba(18, 24, 34, 0.96), rgba(14, 18, 26, 0.92));
    box-shadow: var(--shadow);
}

.movie-quick-chip {
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    border-radius: 999px;
    padding: 10px 14px;
    cursor: pointer;
    font: inherit;
    transition: all 0.18s ease;
}

.movie-quick-chip:hover,
.movie-quick-chip.active {
    border-color: rgba(246, 198, 87, 0.36);
    background: rgba(246, 198, 87, 0.14);
    color: #fff4d1;
}

.movie-quick-more {
    letter-spacing: 0.1em;
}

.category-filter {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.chip,
.page-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 0;
    padding: 8px 0;
    border: 0;
    background: transparent;
    color: var(--text-soft);
    box-shadow: none;
}

.chip-soft strong,
.page-chip { color: #fff; }

.main-content {
    margin-top: 16px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

.question-section,
.diary-section,
.feed-section,
.podcast-section,
.hero-card,
.panel-card {
    border-radius: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
}

.movie-hero { padding: 18px; }

.detail-main {
    gap: 18px;
}

.detail-hero-card {
    border-radius: 24px;
    padding: 18px;
    border: 1px solid var(--border-warm);
    background: #0e1525;
    border: 1px solid #232f47;
    box-shadow: var(--shadow);
}

.detail-hero-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.detail-page-title,
.detail-section-title {
    margin: 8px 0 0;
    font-family: 'Fraunces', serif;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    color: #fff;
}

.detail-hero-note,
.detail-section-subtitle {
    max-width: 56ch;
    color: var(--text-muted);
    line-height: 1.6;
}

.detail-section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.detail-player-section {
    padding: 18px;
    border-radius: 24px;
    border: 1px solid #232f47;
    background: #0e1525;
    box-shadow: var(--shadow);
}

.detail-layout {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 18px;
    padding: 0;
}

.detail-poster-frame {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #111722;
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.34);
}

.detail-poster-frame img {
    width: 100%;
    display: block;
    aspect-ratio: 2 / 3;
    object-fit: cover;
}

.detail-poster-ribbon {
    position: absolute;
    left: 14px;
    top: 14px;
    z-index: 2;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(5, 8, 14, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffd1d5;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.detail-meta-card {
    display: grid;
    gap: 16px;
    padding: 4px 2px 4px 0;
}

.detail-kicker {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(229, 9, 20, 0.12);
    border: 1px solid rgba(229, 9, 20, 0.24);
    color: #ffd1d5;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.detail-title {
    margin: 0;
    font-family: 'Fraunces', serif;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1.02;
    color: #fff;
}

.detail-origin {
    margin: 0;
    color: #d6dbea;
    font-size: 1rem;
}

.detail-info-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.detail-info-item {
    padding: 12px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.detail-info-item span {
    display: block;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.detail-info-item strong {
    display: block;
    margin-top: 6px;
    color: #fff;
    font-size: 1rem;
}

.detail-tag-row,
.detail-cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.detail-chip {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(229, 9, 20, 0.26);
    background: rgba(229, 9, 20, 0.12);
    color: #ffd1d5;
    font-size: 0.8rem;
    font-weight: 700;
}

.detail-summary {
    max-height: none;
    color: #d8e2f3;
}

.detail-cta-row .movie-cta-link {
    text-decoration: none;
}

.detail-cta-row .btn-light,
.detail-cta-row .btn-logout {
    min-height: 44px;
}

.detail-action-btn {
    min-height: 44px;
}

.detail-action-btn.is-active {
    border-color: rgba(246, 198, 87, 0.58);
    background: linear-gradient(135deg, rgba(246, 198, 87, 0.34), rgba(255, 138, 91, 0.26));
    color: #fff4cf;
}

.detail-player-section .detail-section-head {
    margin-bottom: 16px;
}

.question-card {
    padding: 18px;
    border-radius: 0;
    border: 0;
    background: transparent;
}

.category-badge,
.question-counter,
.eyebrow {
    display: inline-flex;
    align-items: center;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    font-weight: 700;
    color: #f9e2a0;
}

.question-text,
.movie-title-block {
    margin-top: 12px;
    font-family: 'Fraunces', serif;
    font-size: clamp(1.6rem, 3vw, 2.45rem);
    line-height: 1.18;
    color: var(--text-primary);
    max-width: 18ch;
}

.answer-area { margin-top: 14px; }

.search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.search-row-two {
    margin-top: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.movie-search-input,
.input,
.select,
.btn {
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(10, 14, 20, 0.82);
    color: var(--text-primary);
    border-radius: 16px;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 0.95rem;
}

.movie-search-input:focus,
.input:focus,
.select:focus {
    outline: none;
    border-color: rgba(246, 198, 87, 0.72);
    box-shadow: 0 0 0 3px rgba(246, 198, 87, 0.12);
}

.btn {
    cursor: pointer;
    font-weight: 700;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.btn:hover { transform: translateY(-1px); }

.btn-save,
.btn-next {
    background: linear-gradient(135deg, rgba(246, 198, 87, 0.18), rgba(255, 138, 91, 0.18));
    border-color: rgba(246, 198, 87, 0.18);
}

.btn-letgo {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-soft);
}

.action-buttons {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.char-count,
.movie-status-line,
.status {
    margin-top: 12px;
    color: var(--text-muted);
    min-height: 22px;
}

.status.ok { color: #8de5b8; }
.status.error { color: #ff9393; }

.feed-header { padding: 18px 18px 0; }

.feed-header h2 {
    margin: 0;
    font-family: 'Fraunces', serif;
    font-size: 1.45rem;
}

.feed-header p {
    margin: 8px 0 0;
    color: var(--text-muted);
    line-height: 1.6;
}

.movie-filter-panel,
.movie-results-card { padding-bottom: 18px; }

.movie-filter-panel,
.movie-results-card {
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
}

.movie-toolbar {
    margin: 16px 0 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.movie-grid {
    margin: 16px 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
}

.movie-card {
    overflow: hidden;
    border-radius: 0;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: transparent;
    box-shadow: none;
    transition: opacity 0.18s ease;
}

.movie-card:hover {
    opacity: 0.92;
}

.poster {
    position: relative;
    aspect-ratio: 2 / 3;
    background: #111722;
    border-radius: 0;
}

.poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tag {
    position: absolute;
    left: 10px;
    bottom: 10px;
    font-size: 0.72rem;
    padding: 6px 10px;
    border-radius: 999px;
    color: #fff;
    background: rgba(10, 14, 20, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.movie-body { padding: 12px; }

.movie-title {
    margin: 0;
    min-height: 2.6em;
    font-weight: 700;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.84rem;
}

.actions {
    margin-top: 10px;
    display: grid;
}

.actions .btn {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-color: rgba(246, 198, 87, 0.36);
    color: #ffeab4;
}

.pagination,
.movie-pagination {
    margin-top: 16px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.movie-page-info { color: var(--text-muted); }

.modal {
    position: fixed;
    inset: 0;
    background: rgba(3, 8, 16, 0.8);
    display: none;
    z-index: 100;
    padding: 18px;
    overflow-y: auto;
}

.modal.show { display: block; }

.modal-box {
    width: min(1020px, 100%);
    margin: 20px auto;
    border-radius: 0;
    background: rgba(12, 16, 22, 0.96);
    border: 0;
    box-shadow: none;
    overflow: hidden;
    animation: reveal 300ms ease;
}

.modal-grid {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 18px;
    padding: 16px;
}

.modal-grid img {
    width: 100%;
    border-radius: 0;
    max-height: 420px;
    object-fit: cover;
    border: 0;
}

.movie-des,
.detail-desc {
    color: var(--text-soft);
    font-size: 0.95rem;
    line-height: 1.72;
    max-height: 240px;
    overflow: auto;
    padding-right: 4px;
}

.player,
.detail-player { padding: 0 16px 16px; }

.detail-player-shell {
    margin: 0;
    padding: 16px;
    border-radius: 20px;
    border: 1px solid #2a3753;
    background: #101a2d;
    box-shadow: 0 20px 42px rgba(0, 0, 0, 0.34);
}

.detail-player-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 14px;
}

.detail-player-title {
    margin: 0;
    font-family: 'Fraunces', serif;
    font-size: 1.2rem;
    color: #fff7df;
}

.detail-player-subtitle {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.detail-player-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.detail-player-badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(246, 198, 87, 0.28);
    background: rgba(246, 198, 87, 0.12);
    color: #ffe9b5;
    font-size: 0.78rem;
    letter-spacing: 0.03em;
}

.detail-player-stage {
    padding: 10px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(4, 7, 12, 0.72);
}

.detail-player-stage video,
.detail-player-stage iframe {
    min-height: 260px;
}

.detail-player-choose {
    margin-top: 14px;
    color: #ffccd1;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}

.player video,
.player iframe,
.detail-player video,
.detail-player iframe {
    width: 100%;
    border: 0;
    border-radius: 14px;
    background: #000;
    aspect-ratio: 16/9;
}

.episode-wrap {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.detail-server-wrap {
    margin-top: 10px;
    margin-bottom: 2px;
}

.episode-btn {
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.episode-btn:hover {
    border-color: rgba(229, 9, 20, 0.36);
    background: rgba(229, 9, 20, 0.14);
}

.episode-btn.active {
    border-color: rgba(229, 9, 20, 0.65);
    background: rgba(229, 9, 20, 0.2);
    color: #ffe6e8;
}

.close-btn {
    margin-left: auto;
    margin-right: 16px;
    margin-top: 12px;
    display: block;
    width: fit-content;
    background: rgba(255, 255, 255, 0.04);
}

.detail-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 18px;
    padding: 16px;
}

.detail-poster {
    width: 100%;
    border-radius: 0;
    overflow: hidden;
    border: 0;
    background: #111722;
}

.detail-poster img {
    width: 100%;
    display: block;
}

.detail-meta h2 {
    margin: 0;
    font-family: 'Fraunces', serif;
    font-size: 1.8rem;
}

.detail-meta p {
    margin: 8px 0;
    color: var(--text-soft);
    line-height: 1.68;
}

.detail-shell { margin-top: 16px; }

.detail-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.back-link { text-decoration: none; }

@keyframes reveal {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 1100px) {
    .detail-layout,
    .detail-info-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 1100px) {
    .movie-topbar {
        grid-template-columns: 1fr;
    }

    .movie-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .modal-grid,
    .detail-layout { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .app-wrapper { width: min(100% - 16px, 100%); margin-top: 12px; }
    .app-header { align-items: flex-start; }
    .search-row,
    .search-row-two,
    .movie-toolbar,
    .movie-grid { grid-template-columns: 1fr; }

    .movie-search-shell { grid-template-columns: 1fr; }

    .pagination,
    .movie-pagination { justify-content: center; }
    .header-right { justify-content: flex-start; }

    .movie-topbar-right { justify-content: flex-start; }

    .detail-page-shell {
        width: 100%;
        margin-top: 0;
    }

    .detail-header {
        align-items: flex-start;
    }

    .detail-info-grid {
        grid-template-columns: 1fr 1fr;
    }

    .detail-layout {
        grid-template-columns: 1fr;
    }

    .detail-player-shell {
        border-radius: 14px;
        padding: 12px;
    }

    .detail-player-head {
        flex-direction: column;
        align-items: flex-start;
    }
}
