/* assets/cinema.css —— 双影院页面样式（neo-brutalist 风格延续） */

/* ===== 屏幕阅读辅助 ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== 背景滚动锁 ===== */
body.cinema-scroll-locked {
    overflow: hidden;
}

/* ===== hidden 属性显式隐藏（任务58） =====
   以下组件的作者 display 规则（flex / inline-block）特异性高于 UA 默认的
   [hidden]{display:none}，会导致 hidden 属性失效；此处显式声明隐藏态。 */
.cinema-loading[hidden],
.cinema-pagination[hidden],
.cinema-source-badge[hidden] {
    display: none !important;
}

/* ===== 影院头部 ===== */
.cinema-header {
    grid-template-columns: 250px 1fr auto;
}

.cinema-mobile-nav {
    display: none;
}

.cinema-type-nav {
    display: flex;
    align-items: stretch;
    overflow-x: auto;
    scrollbar-width: none;
}

.cinema-type-nav::-webkit-scrollbar {
    display: none;
}

.cinema-type-link {
    min-width: 130px;
    padding: 13px 22px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 5px;
    border: 0;
    border-right: 1px solid rgba(17, 17, 17, .25);
    background: transparent;
    font-weight: 800;
    font-size: 14px;
    transition: background-color .16s ease, color .16s ease;
    text-decoration: none;
    color: inherit;
}

.cinema-type-link small {
    font-size: 10px;
    color: var(--muted);
}

.cinema-type-link:hover,
.cinema-type-link.is-active {
    color: #fff;
    background: var(--ink);
}

.cinema-type-link:hover small,
.cinema-type-link.is-active small {
    color: rgba(255, 255, 255, .65);
}

.cinema-home-link {
    padding: 0 22px;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 0;
    border-left: 2px solid var(--line);
    background: var(--orange);
    font-weight: 900;
    font-size: 14px;
    color: var(--ink);
    text-decoration: none;
    transition: background .16s ease;
}

.cinema-home-link:hover {
    background: var(--blue);
    color: #fff;
}

/* ===== 影院标题区 ===== */
.cinema-hero {
    border-bottom: 2px solid var(--line);
    background: var(--paper);
}

.cinema-hero-copy {
    padding: clamp(32px, 5vw, 64px) clamp(20px, 5vw, 64px);
    position: relative;
    overflow: hidden;
}

.cinema-hero-copy::after {
    content: "CINEMA";
    position: absolute;
    right: -40px;
    bottom: 20px;
    color: rgba(17, 17, 17, .045);
    font-family: Impact, "Arial Black", sans-serif;
    font-size: clamp(60px, 9vw, 130px);
    line-height: .8;
    letter-spacing: .02em;
    transform: rotate(-90deg);
    transform-origin: right bottom;
    pointer-events: none;
}

.cinema-hero-copy h1 {
    margin: 0 0 12px;
    font-family: Impact, "Arial Black", "Microsoft YaHei", sans-serif;
    font-size: clamp(42px, 6vw, 80px);
    font-weight: 900;
    line-height: .95;
    letter-spacing: -.03em;
}

.cinema-hero-intro {
    margin: 0;
    max-width: 600px;
    font-size: 16px;
    line-height: 1.7;
    color: #34322e;
}

/* ===== 搜索工具栏 ===== */
.cinema-toolbar {
    padding: 20px clamp(20px, 4vw, 64px) 0;
}

.cinema-search {
    width: min(100%, 560px);
}

.cinema-search-control {
    height: 52px;
    grid-template-columns: 1fr auto;
}

.cinema-search-btn {
    padding: 0 20px;
    border: 0;
    border-left: 2px solid var(--line);
    background: var(--blue);
    color: #fff;
    font-weight: 900;
    font-size: 14px;
    cursor: pointer;
    transition: background .16s ease;
}

.cinema-search-btn:hover {
    background: var(--ink);
}

/* ===== 分类横滑栏 ===== */
.cinema-categories {
    padding: 16px clamp(20px, 4vw, 64px) 0;
}

.cinema-category-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.cinema-category-strip::-webkit-scrollbar {
    height: 4px;
}

.cinema-category-strip::-webkit-scrollbar-thumb {
    background: var(--line);
}

.cinema-category-btn {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 8px 16px;
    border: 2px solid var(--line);
    background: var(--card);
    box-shadow: 3px 3px 0 var(--line);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    transition: transform .14s ease, box-shadow .14s ease, background .14s ease, color .14s ease;
}

.cinema-category-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 var(--line);
}

.cinema-category-btn.is-active {
    color: #fff;
    background: var(--ink);
    box-shadow: 3px 3px 0 var(--blue);
}

/* ===== 状态提示 ===== */
.cinema-status {
    min-height: 0;
    padding: 0 clamp(20px, 4vw, 64px);
    font-family: Consolas, monospace;
    font-size: 12px;
    color: var(--muted);
}

.cinema-status:empty {
    display: none;
}

/* ===== 来源/降级提示 ===== */
.cinema-source-badge {
    margin: 8px clamp(20px, 4vw, 64px) 0;
    padding: 6px 12px;
    display: inline-block;
    border: 1px solid var(--line);
    background: #fff8e1;
    font-family: Consolas, monospace;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
}

.cinema-source-badge[data-type="fallback"] {
    background: #fff3e0;
    color: #bf360c;
}

.cinema-source-badge[data-type="stale"] {
    background: #e8eaf6;
    color: #3949ab;
}

/* ===== 影片网格 ===== */
.cinema-grid-wrap {
    padding: 20px clamp(20px, 4vw, 64px) 40px;
}

.cinema-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 20px;
}

/* ===== 影片卡片 ===== */
.cinema-card {
    border: 2px solid var(--line);
    background: var(--card);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
    overflow: hidden;
}

.cinema-card:hover {
    transform: translate(3px, 3px);
    box-shadow: 4px 4px 0 var(--line);
}

.cinema-card:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
}

.cinema-card-cover {
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--paper-dark);
}

.cinema-card-cover img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform .3s ease;
}

.cinema-card:hover .cinema-card-cover img {
    transform: scale(1.04);
}

.cinema-card-cover .cinema-cover-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: var(--paper-dark);
    color: var(--muted);
    font-size: 32px;
    font-weight: 900;
}

.cinema-card-year-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 2px 8px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .92);
    font-family: Consolas, monospace;
    font-size: 11px;
    font-weight: 700;
}

.cinema-card-episode-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 8px;
    border: 1px solid var(--line);
    background: var(--blue);
    color: #fff;
    font-family: Consolas, monospace;
    font-size: 11px;
    font-weight: 700;
}

.cinema-card-info {
    padding: 12px 14px;
}

.cinema-card-title {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cinema-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cinema-card-meta span {
    padding: 2px 6px;
    border: 1px solid rgba(17, 17, 17, .35);
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
}

/* ===== 分页 ===== */
.cinema-pagination {
    padding: 0 clamp(20px, 4vw, 64px) 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.cinema-page-btn {
    min-width: 40px;
    min-height: 40px;
    padding: 6px 10px;
    border: 2px solid var(--line);
    background: var(--card);
    box-shadow: 3px 3px 0 var(--line);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .14s ease, box-shadow .14s ease;
}

.cinema-page-btn:hover:not(:disabled) {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 var(--line);
}

.cinema-page-btn:disabled {
    opacity: .45;
    cursor: default;
}

.cinema-page-btn.is-active {
    color: #fff;
    background: var(--ink);
    box-shadow: 3px 3px 0 var(--blue);
}

.cinema-page-ellipsis {
    padding: 0 4px;
    font-size: 14px;
    font-weight: 900;
    color: var(--muted);
}

/* ===== 加载状态 ===== */
.cinema-loading {
    padding: 60px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: var(--muted);
    font-size: 14px;
}

.cinema-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--paper-dark);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: cinema-spin .8s linear infinite;
}

@keyframes cinema-spin {
    to { transform: rotate(360deg); }
}

/* ===== 空/错误状态 ===== */
.cinema-empty,
.cinema-error {
    margin: 40px clamp(20px, 4vw, 64px);
    padding: 60px 25px;
    border: 2px dashed var(--line);
    text-align: center;
}

.cinema-empty span,
.cinema-error span {
    color: var(--blue);
    font-family: Consolas, monospace;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .15em;
}

.cinema-error span {
    color: #e50914;
}

.cinema-empty h2,
.cinema-error h2 {
    margin: 12px 0 8px;
    font-size: 28px;
}

.cinema-empty p,
.cinema-error p {
    color: var(--muted);
    margin: 0 0 15px;
}

.cinema-empty button,
.cinema-error button {
    padding: 10px 20px;
    border: 2px solid var(--line);
    background: var(--orange);
    box-shadow: 4px 4px 0 var(--line);
    font-weight: 900;
    cursor: pointer;
}

/* ===== 详情弹窗 ===== */
.cinema-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    background: rgba(17, 17, 17, .65);
    backdrop-filter: blur(4px);
    padding: 20px;
    overflow-y: auto;
}

.cinema-modal-overlay[hidden] {
    display: none;
}

.cinema-modal {
    position: relative;
    width: min(100%, 960px);
    max-height: 90vh;
    overflow-y: auto;
    border: 2px solid var(--line);
    background: var(--paper);
    box-shadow: 10px 10px 0 rgba(17, 17, 17, .3);
}

.cinema-modal-close {
    position: sticky;
    top: 0;
    z-index: 5;
    float: right;
    width: 48px;
    height: 48px;
    border: 0;
    border-left: 2px solid var(--line);
    border-bottom: 2px solid var(--line);
    background: var(--orange);
    font-size: 26px;
    font-weight: 900;
    cursor: pointer;
    line-height: 1;
}

.cinema-modal-close:hover {
    background: var(--ink);
    color: #fff;
}

.cinema-modal-body {
    padding: 0;
}

/* 详情布局（任务58）：左主栏（标题/元数据/播放器/状态/选集）+ 右侧栏（3:4 海报/简介/提示） */
.cinema-detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 0;
    align-items: start;
}

/* 左主栏 */
.cinema-detail-main {
    padding: 24px;
    min-width: 0;
}

/* 右侧栏：海报 + 简介 + 不可播放提示；内容超高时在栏内滚动 */
.cinema-detail-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    border-left: 2px solid var(--line);
    min-width: 0;
    position: sticky;
    top: 48px; /* 避开 sticky 关闭按钮（高 48px） */
    max-height: calc(90vh - 48px); /* 与 .cinema-modal 的 max-height 90vh 对齐 */
    overflow-y: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.cinema-detail-cover {
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--paper-dark);
    border: 2px solid var(--line);
}

.cinema-detail-cover img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.cinema-detail-cover .cinema-cover-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    font-size: 48px;
    font-weight: 900;
    color: var(--muted);
}

.cinema-detail-title {
    margin: 0 0 16px;
    padding-right: 56px; /* 避开右上角浮动关闭按钮 */
    font-size: 26px;
    font-weight: 900;
    line-height: 1.2;
}

.cinema-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.cinema-detail-meta span {
    padding: 4px 10px;
    border: 1px solid rgba(17, 17, 17, .4);
    font-size: 12px;
    font-weight: 700;
}

/* 简介（任务58）：取消 120px 截断，完整展示，滚动由右栏承担 */
.cinema-detail-desc {
    margin: 0;
    font-size: 13px;
    line-height: 1.7;
    color: #444;
}

.cinema-detail-desc:empty {
    display: none;
}

/* 不可播放提示（右栏） */
.cinema-unplayable-notice {
    padding: 12px 14px;
    margin: 0;
    border: 2px solid var(--line);
    background: #fff3e0;
    font-size: 13px;
    font-weight: 700;
    color: #bf360c;
}

/* 选集列表（任务58）：最大约 180px 内滚动 */
.cinema-episodes-label {
    margin: 20px 0 10px;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: .08em;
}

.cinema-episodes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 180px;
    overflow-y: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

/* 零集数友好提示（任务58） */
.cinema-episodes-empty {
    margin: 0;
    padding: 14px 16px;
    border: 2px dashed var(--line);
    background: var(--paper-dark);
    font-size: 13px;
    color: var(--muted);
}

.cinema-episode-btn {
    min-width: 44px;
    min-height: 36px;
    padding: 6px 10px;
    border: 2px solid var(--line);
    background: var(--card);
    box-shadow: 2px 2px 0 var(--line);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .14s ease, box-shadow .14s ease;
}

.cinema-episode-btn:hover:not(:disabled) {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--line);
}

.cinema-episode-btn.is-active {
    color: #fff;
    background: var(--blue);
    box-shadow: 2px 2px 0 var(--line);
}

.cinema-episode-btn:disabled {
    opacity: .4;
    cursor: default;
    text-decoration: line-through;
}

/* 播放器区域（任务58）：位于左主栏元数据之后、选集之前；保持默认 16:9，
   比例由 player.js 通过 postMessage 的 ratio 消息动态覆盖 */
.cinema-player-section {
    margin-top: 20px;
    border-top: 2px solid var(--line);
    padding-top: 20px;
}

.cinema-player-shell {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border: 2px solid var(--line);
    overflow: hidden;
}

.cinema-player-shell iframe {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
}

.cinema-player-status {
    padding: 12px 16px;
    margin-top: 8px;
    font-family: Consolas, monospace;
    font-size: 12px;
    color: var(--muted);
}

.cinema-player-status[data-state="playing"] {
    color: #2e7d32;
}

.cinema-player-status[data-state="error"] {
    color: #c62828;
}

.cinema-player-status:empty {
    display: none;
}

/* ===== 成人年龄确认层 ===== */
.cinema-age-gate {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    background: rgba(17, 17, 17, .85);
    backdrop-filter: blur(8px);
    padding: 20px;
}

.cinema-age-gate[hidden] {
    display: none;
}

.cinema-age-gate-card {
    width: min(100%, 480px);
    padding: clamp(30px, 5vw, 50px);
    border: 2px solid var(--line);
    background: var(--paper);
    box-shadow: 10px 10px 0 rgba(17, 17, 17, .3);
    text-align: center;
}

.cinema-age-gate-badge {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    display: grid;
    place-items: center;
    border: 2px solid var(--line);
    border-radius: 50%;
    background: #7b2cbf;
    color: #fff;
    font-family: Impact, "Arial Black", sans-serif;
    font-size: 28px;
    box-shadow: 4px 4px 0 var(--line);
}

.cinema-age-gate-card h2 {
    margin: 0 0 12px;
    font-size: 28px;
}

.cinema-age-gate-card > p {
    margin: 0 0 24px;
    font-size: 14px;
    line-height: 1.7;
    color: #444;
}

.cinema-age-gate-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.cinema-age-confirm-btn {
    min-height: 52px;
    padding: 12px 24px;
    border: 2px solid var(--line);
    background: var(--orange);
    box-shadow: 5px 5px 0 var(--line);
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease;
}

.cinema-age-confirm-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 7px 7px 0 var(--line);
}

.cinema-age-leave {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: 2px solid var(--line);
    background: var(--card);
    font-size: 14px;
    font-weight: 800;
    color: var(--ink);
    text-decoration: none;
    transition: background .16s ease;
}

.cinema-age-leave:hover {
    background: var(--paper-dark);
}

.cinema-age-gate-note {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.6;
}

/* ===== 详情加载态 ===== */
.cinema-detail-loading {
    padding: 40px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--muted);
    font-size: 14px;
}

/* ===== 响应式 ===== */
@media (max-width: 1200px) {
    .cinema-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 960px) {
    .cinema-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    /* 任务58：右栏收窄至 220px */
    .cinema-detail {
        grid-template-columns: minmax(0, 1fr) 220px;
    }
}

@media (max-width: 820px) {
    .cinema-header {
        grid-template-columns: 1fr auto;
    }

    .cinema-type-nav {
        display: none;
    }

    .cinema-mobile-nav {
        display: flex;
        position: sticky;
        top: 72px;
        z-index: 19;
        padding: 10px;
        gap: 8px;
        border-bottom: 2px solid var(--line);
        background: var(--paper-dark);
    }

    .cinema-mobile-nav .cinema-type-link {
        flex: 1;
        min-height: 42px;
        min-width: auto;
        padding: 8px 12px;
        border: 1px solid var(--line);
        flex-direction: row;
        justify-content: center;
        gap: 6px;
        font-size: 12px;
        font-weight: 900;
        background: #fff;
    }

    .cinema-mobile-nav .cinema-type-link.is-active {
        color: #fff;
        background: var(--ink);
    }

    .cinema-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    /* 任务58：单列布局，DOM 顺序即视觉顺序：
       标题 → 元数据 → 播放器 → 状态 → 选集 → 海报 → 简介 → 提示 */
    .cinema-detail {
        grid-template-columns: 1fr;
    }

    .cinema-detail-side {
        position: static;
        top: auto;
        max-height: none;
        overflow-y: visible;
        border-left: 0;
        border-top: 2px solid var(--line);
        padding: 16px;
    }

    .cinema-detail-cover {
        width: 100%;
        max-width: 240px;
        margin: 0 auto;
    }
}

@media (max-width: 600px) {
    .cinema-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cinema-card-info {
        padding: 10px 10px;
    }

    .cinema-card-title {
        font-size: 13px;
    }

    .cinema-detail-main {
        padding: 16px;
    }

    .cinema-detail-title {
        font-size: 20px;
    }

    .cinema-modal {
        box-shadow: 5px 5px 0 rgba(17, 17, 17, .3);
    }
}

@media (max-width: 380px) {
    .cinema-grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cinema-loading-spinner {
        animation: none;
    }

    .cinema-card,
    .cinema-category-btn,
    .cinema-page-btn,
    .cinema-age-confirm-btn {
        transition-duration: .01ms !important;
    }
}
