:root {
    --bg: #ffffff;
    --surface: #f7f7f5;
    --surface-strong: #f0f0ed;
    --text: #171717;
    --muted: #777772;
    --line: #e5e5e0;
    --accent: #147d72;
    --accent-soft: #e3f2ef;
    --danger: #b3261e;
    --radius: 14px;
    --shadow: 0 12px 36px rgba(20, 20, 16, .08);
    font-family: "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
    color: var(--text);
    background: var(--bg);
    font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; }
.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; max-width: 1180px; margin: 0 auto; padding: 0 28px; }
.brand { font-size: 21px; font-weight: 700; letter-spacing: .02em; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-button { width: 38px; height: 38px; border: 1px solid transparent; border-radius: 12px; display: grid; place-items: center; color: var(--muted); background: transparent; }
.icon-button:hover { color: var(--text); background: var(--surface); border-color: var(--line); }
.icon-button svg { width: 18px; height: 18px; }

.main { max-width: 1180px; margin: 0 auto; padding: 48px 28px 80px; }
.home-main { min-height: calc(100vh - 68px); display: grid; align-content: center; padding-top: 0; }
.home-intro { max-width: 820px; width: 100%; margin: -8vh auto 0; }
.home-intro h1 { margin: 0 0 18px; font-size: clamp(34px, 5vw, 54px); line-height: 1.08; letter-spacing: -.04em; }
.home-intro p { margin: 0 0 32px; color: var(--muted); font-size: 15px; }
.search-row { display: flex; gap: 10px; }
.search-input { min-width: 0; flex: 1; height: 58px; padding: 0 20px; border: 1px solid var(--line); border-radius: 18px; color: var(--text); background: var(--surface); outline: none; transition: border-color .2s, box-shadow .2s, background .2s; }
.search-input:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px var(--accent-soft); }
.primary-button { height: 58px; border: 0; border-radius: 18px; padding: 0 24px; color: #fff; background: var(--accent); font-weight: 650; }
.primary-button:hover { filter: brightness(.94); }
.secondary-button { min-height: 42px; padding: 0 16px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--bg); }
.secondary-button:hover { background: var(--surface); }

.view-header { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.view-header h1 { margin: 0; font-size: 27px; letter-spacing: -.03em; }
.back-button { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--muted); }
.back-button:hover { color: var(--text); background: var(--surface); }
.back-button svg { width: 18px; height: 18px; }
.result-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.result-toolbar .search-input { height: 48px; border-radius: 14px; }
.result-toolbar .primary-button { height: 48px; border-radius: 14px; }
.result-count { color: var(--muted); font-size: 14px; }

.result-list { border-top: 1px solid var(--line); }
.result-row { display: grid; grid-template-columns: 86px minmax(0, 1fr) auto; gap: 20px; align-items: center; padding: 18px 0; border-bottom: 1px solid var(--line); }
.poster { width: 86px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 10px; background: var(--surface-strong); }
.poster-fallback { display: grid; place-items: center; color: #a5a59f; font-size: 12px; }
.result-copy { min-width: 0; }
.result-title { margin: 0 0 8px; font-size: 21px; font-weight: 700; letter-spacing: -.025em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: 14px; }
.result-remarks { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.row-arrow { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: var(--bg); }
.result-row:hover .row-arrow { color: var(--accent); border-color: var(--accent); }
.row-arrow svg { width: 18px; height: 18px; }
.state { padding: 54px 0; color: var(--muted); text-align: center; }
.state.error { color: var(--danger); }
.sentinel { height: 1px; }
.app-footer { max-width:1180px; margin:0 auto; padding:0 28px 28px; display:flex; gap:18px; color:var(--muted); font-size:13px; }
.app-footer::after { content:'Copyright Xunying'; margin-left:auto; }
.app-footer a:hover { color:var(--text); }
.info-page { min-height:calc(100vh - 130px); }
.info-entry { max-width:720px; padding:24px 0; border-top:1px solid var(--line); }
.info-entry h2 { margin:0 0 14px; font-size:20px; }
.info-entry p { margin:0 0 12px; color:#55554f; line-height:1.85; }
.info-entry time { color:var(--muted); font-size:13px; }

.detail-layout { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 48px; align-items: start; }
.detail-poster { width: 100%; max-width: 300px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 14px; background: var(--surface-strong); }
.detail-copy h1 { margin: 0 0 10px; font-size: clamp(30px, 4vw, 48px); letter-spacing: -.045em; }
.detail-lead { margin: 0 0 20px; color: var(--muted); font-size: 16px; }
.detail-meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 12px 22px; margin: 26px 0; font-size: 14px; }
.detail-meta dt { color: var(--muted); }
.detail-meta dd { margin: 0; }
.description { color: #55554f; line-height: 1.85; max-width: 720px; }
.detail-action { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.ban-movie-button { min-height: 58px; padding: 0 24px; border: 1px solid #efc8c5; border-radius: 18px; color: var(--danger); background: #fff7f6; font-weight: 650; }
.ban-movie-button:hover { border-color: var(--danger); background: #fff0ee; }
.episode-section { margin-top: 54px; }
.section-title { margin: 0 0 18px; font-size: 20px; }
.episode-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.episode-button { min-width: 76px; min-height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--bg); }
.episode-button:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.player-page { background: #101111; color: #f6f3eb; min-height: 100vh; }
.player-page .topbar { color: #f6f3eb; }
.player-page .icon-button { color: #c9c6bd; }
.player-wrap { max-width: 1180px; margin: 0 auto; padding: 10px 28px 60px; }
.player-head { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; margin: 16px 0 20px; }
.player-head h1 { margin: 0; font-size: 24px; }
.player-head span { color: #a9a69d; font-size: 14px; }
.video-frame { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 14px; overflow: hidden; }
.video-frame video { width: 100%; height: 100%; display: block; }
.player-episodes { margin-top: 30px; padding-top: 24px; border-top: 1px solid #2a2c2b; }
.player-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.player-section-head h2 { margin: 0; font-size: 18px; }
.player-section-head span { color: #a9a69d; font-size: 13px; }
.player-episode-grid { display: flex; flex-wrap: wrap; gap: 9px; }
.player-episode-button { min-width: 70px; min-height: 40px; padding: 0 13px; border: 1px solid #353938; border-radius: 10px; color: #c9c6bd; background: #171918; }
.player-episode-button:hover, .player-episode-button.is-active { border-color: #5cb8aa; color: #f6f3eb; background: #195f57; }

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--surface); }
.auth-card { width: min(100%, 420px); padding: 34px; border: 1px solid var(--line); border-radius: 20px; background: var(--bg); box-shadow: var(--shadow); }
.auth-card h1 { margin: 0 0 8px; font-size: 28px; letter-spacing: -.04em; }
.auth-card p { margin: 0 0 28px; color: var(--muted); font-size: 14px; }
.field { display: grid; gap: 8px; margin-bottom: 16px; }
.field label { color: var(--muted); font-size: 13px; }
.field input { height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; outline: none; }
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.auth-card .primary-button { width: 100%; margin-top: 8px; }
.form-error { min-height: 20px; margin-top: 14px; color: var(--danger); font-size: 13px; }
.demo-note { margin-top: 22px; padding: 12px 14px; border-radius: 10px; color: var(--muted); background: var(--surface); font-size: 12px; line-height: 1.6; }
.text-button { margin-top: 14px; padding: 0; border: 0; color: var(--accent); background: transparent; font-size: 13px; }
.text-button:hover { text-decoration: underline; }
.login-announcement { margin: 0 0 20px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.login-announcement:empty { display: none; }
.login-announcement article + article { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.login-announcement strong { font-size: 14px; }
.login-announcement p { margin: 5px 0 0; line-height: 1.6; }
.announcement-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: start center; padding: 84px 20px 20px; background: rgba(16,17,17,.24); }
.announcement-modal { width: min(100%, 520px); position: relative; padding: 24px 28px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); box-shadow: var(--shadow); }
.announcement-modal article + article { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.announcement-modal h2 { margin: 0 0 8px; font-size: 18px; }
.announcement-modal p { margin: 0; color: #55554f; line-height: 1.75; white-space: pre-wrap; }
.announcement-close { position: absolute; top: 10px; right: 12px; width: 32px; height: 32px; border: 0; color: var(--muted); background: transparent; font-size: 20px; }
.blocked-notice { margin-top: 24px; padding: 12px 14px; border-radius: 10px; color: var(--danger); background: #fff7f6; }
.status-badge { display: inline-block; vertical-align: middle; padding: 4px 8px; border-radius: 7px; color: var(--danger); background: #fff0ee; font-size: 12px; font-weight: 650; letter-spacing: 0; }
.history-list { border-top: 1px solid var(--line); }
.history-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 18px; align-items: center; padding: 18px 0; border-bottom: 1px solid var(--line); }
.history-row h2 { margin: 0 0 7px; font-size: 18px; }
.history-row p { margin: 0; color: var(--muted); font-size: 13px; }

.admin-main { padding-top: 34px; }
.admin-toolbar { display:flex; align-items:center; justify-content:space-between; gap:16px; margin:-10px 0 18px; color:var(--muted); font-size:13px; }
.admin-section { margin-top:24px; padding:24px 0; border-top:1px solid var(--line); }
.admin-section-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:18px; }
.admin-section h2 { margin:0 0 6px; font-size:18px; }
.admin-section p { margin:0; color:var(--muted); font-size:13px; }
.admin-form { display:flex; gap:10px; align-items:center; margin-bottom:18px; }
.admin-form-grid { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); align-items:center; }
.admin-form input, .admin-form select { min-width:0; height:44px; padding:0 12px; border:1px solid var(--line); border-radius:10px; background:var(--bg); outline:none; }
.admin-form input:focus, .admin-form select:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
.admin-form .primary-button { height:44px; border-radius:10px; padding:0 18px; white-space:nowrap; }
.admin-form-inline label { display:flex; align-items:center; gap:8px; color:var(--muted); font-size:13px; }
.admin-form-inline select { height:42px; }
.checkbox-field { display:flex; align-items:center; gap:8px; color:var(--muted); font-size:13px; }
.checkbox-field input { width:16px; height:16px; }
.admin-table { overflow-x:auto; border-top:1px solid var(--line); }
.admin-table table { width:100%; border-collapse:collapse; font-size:13px; }
.admin-table th, .admin-table td { padding:12px 10px; border-bottom:1px solid var(--line); text-align:left; white-space:nowrap; }
.admin-table th { color:var(--muted); font-weight:500; }
.admin-table select { height:32px; padding:0 8px; border:1px solid var(--line); border-radius:8px; background:var(--bg); }
.admin-inline-button { min-height:32px; padding:0 10px; border-radius:8px; font-size:12px; }
.danger-button { min-height:32px; padding:0 10px; border:1px solid #efc8c5; border-radius:8px; color:var(--danger); background:#fff7f6; font-size:12px; }
.admin-result { display:flex; gap:8px; align-items:center; margin:0 0 16px; }
.admin-result-input { flex:1; min-width:0; height:40px; padding:0 10px; border:1px solid var(--line); border-radius:9px; background:var(--surface); color:var(--text); }
.admin-empty { padding:18px 0; color:var(--muted); font-size:13px; }

@media (max-width: 700px) {
    .topbar, .main, .player-wrap { padding-left: 18px; padding-right: 18px; }
    .topbar { height: 60px; }
    .main { padding-top: 32px; }
    .home-main { min-height: calc(100vh - 60px); padding-top: 0; }
    .home-intro { margin-top: -12vh; }
    .search-row, .result-toolbar { align-items: stretch; flex-direction: column; }
    .primary-button, .result-toolbar .primary-button { width: 100%; }
    .result-row { grid-template-columns: 64px minmax(0, 1fr) 34px; gap: 12px; padding: 14px 0; }
    .poster { width: 64px; border-radius: 8px; }
    .result-title { font-size: 16px; }
    .result-meta { gap: 5px 10px; font-size: 12px; }
    .result-remarks { display: none; }
    .detail-layout { grid-template-columns: 112px minmax(0, 1fr); gap: 18px; }
    .detail-poster { width: 112px; border-radius: 10px; }
    .detail-copy h1 { font-size: 25px; }
    .detail-lead { font-size: 13px; }
    .detail-meta { grid-template-columns: max-content minmax(0, 1fr); gap: 8px 12px; margin: 16px 0; font-size: 12px; }
    .detail-action { grid-column: 1 / -1; margin-top: 8px; }
    .episode-section { margin-top: 34px; }
    .player-head { align-items: flex-start; flex-direction: column; gap: 6px; }
    .video-frame { border-radius: 0; margin: 0 -18px; width: calc(100% + 36px); }
    .player-episode-grid { gap: 8px; }
    .player-episode-button { min-width: 64px; min-height: 38px; padding: 0 10px; }
    .admin-form, .admin-form-grid { display:flex; align-items:stretch; flex-direction:column; }
    .admin-form .primary-button { width:100%; }
    .admin-section { padding:20px 0; }
    .admin-result { align-items:stretch; flex-direction:column; }
}
