/* PPReader brand layer, on top of style.css: the warm night palette of the home page. */
:root {
    --primary-color: #14182e;
    --primary-hover: #2c3358;
    --danger-color: #14182e;
    --bg-color: #faf5ea;
    --card-bg: #ffffff;
    --text-color: #23263a;
    --text-muted: #666a80;
    --border-color: #e2d8c3;
    --shadow: 0 1px 3px rgba(40, 30, 10, .08);
    --shadow-hover: 0 8px 22px rgba(40, 30, 10, .16);
    --radius: 10px;
    --radius-large: 14px;
    --gold: #f2b552;
    --gold-deep: #d9952c;
    --serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", STSong, Georgia, serif;
}
body { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }

#login-page { background: radial-gradient(900px 480px at 80% -10%, #39406f 0%, transparent 65%), linear-gradient(180deg, #14182e 0%, #1e2442 100%); }
.login-container { position: relative; border-radius: 18px; box-shadow: 0 28px 60px rgba(4, 6, 20, .5); }
.login-header h1 { font-family: var(--serif); }
.login-container input { border-radius: 10px; }
.auth-form .btn-primary { background: var(--gold); color: #14182e; font-weight: 600; justify-content: center; width: 100%; }
.auth-form .btn-primary:hover { background: #f7c267; }

.main-header { background: #14182e; color: #eef0f8; box-shadow: none; }
.main-header h1 { font-family: var(--serif); color: inherit; }
.main-header #user-info { color: #aab0cc; }
.main-header .membership-chip { background: var(--gold); border-color: var(--gold); color: #14182e; }
.main-header .membership-chip.is-member { background: transparent; border-color: #4a5280; color: #eef0f8; }
.main-header #logout-btn { background: transparent; border: 1px solid #4a5280; color: #cfd3e6; }
.main-header .lang-toggle { color: #cfd3e6; border-color: #4a5280; }

.sidebar { background: #fdfaf2; border-color: var(--border-color); }
.folder-item { border-radius: 8px; }
.folder-item:hover { background: #f1e9d8; }
.folder-item.active { background: #14182e; color: #fff; }

#upload-btn { background: var(--gold); color: #14182e; font-weight: 600; }
#upload-btn:hover { background: #f7c267; }
.btn-shuffle { background: #fff; color: #14182e; border: 1px solid var(--border-color); }
.btn-shuffle:hover { background: #f1e9d8; color: #14182e; }

.book-card { border-radius: 12px; border: 1px solid var(--border-color); transition: transform .15s, box-shadow .15s; }
.book-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.book-cover { background: #f1e9d8; }
.book-title { font-weight: 600; }

.reader-header { background: #14182e; color: #eef0f8; }
.reader-header h2, .reader-header #page-indicator, .reader-header .btn-icon { color: #eef0f8; }
.reader-header .btn-icon { background: transparent; }
.highlight-line, #share-highlight-overlay .highlight-line { background: var(--gold-deep); }
.btn-nav { border-radius: 10px; }
.btn-play { background: var(--gold); color: #14182e; }
.btn-play:hover { background: #f7c267; }
.progress-fill { background: var(--gold-deep); }

.modal-content { border-radius: 16px; }
.modal-content h3 { font-family: var(--serif); }
.share-header { background: #14182e; color: #eef0f8; }

@media (max-width: 560px) {
    .main-header .header-left h1 { font-size: 17px; }
    #user-info { display: none; }
}

/* ==========================================================================
   PPReader 听书 · 网页应用增强层
   用法：追加在 css/brand.css 之后（加载顺序应为 style.css → billing.css → brand.css → 本文件）。
   只改颜色、圆角、阴影、间距和字体；不改 display / position 布局逻辑，不隐藏任何控件。
   ========================================================================== */

:root {
    --ink: #14182e;
    --ink-2: #1e2442;
    --paper: #faf5ea;
    --paper-2: #f1e9d8;
    --card-bg: #fffdf8;
    --gold-ink: #8a5a0c;          /* 浅底上的金色文字，>= 4.9:1 */
    --text-muted: #5c6078;        /* 原 #666a80 在 paper-2 上不够 AA */
    --border-color: #e3d7bd;
    --shadow: 0 1px 2px rgba(60, 44, 12, .06), 0 8px 22px rgba(60, 44, 12, .07);
    --shadow-hover: 0 2px 4px rgba(60, 44, 12, .08), 0 16px 36px rgba(60, 44, 12, .15);
    --focus-ring: 0 0 0 3px rgba(242, 181, 82, .45);
}
:root:lang(en) { --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif; }

::selection { background: #f7d596; color: #14182e; }
button:focus-visible, a:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 2px; }
.main-header :focus-visible, .reader-header :focus-visible, #login-page > :focus-visible { outline-color: var(--gold); }

/* ---------- 登录页：夜空下的一张纸 ---------- */
#login-page {
    background:
        radial-gradient(1.4px 1.4px at 12% 22%, #fff 50%, transparent 52%),
        radial-gradient(1px 1px at 28% 64%, #dfe3f5 50%, transparent 52%),
        radial-gradient(1.2px 1.2px at 44% 12%, #f5d48f 50%, transparent 52%),
        radial-gradient(1px 1px at 63% 78%, #dfe3f5 50%, transparent 52%),
        radial-gradient(1.4px 1.4px at 78% 34%, #fff 50%, transparent 52%),
        radial-gradient(1px 1px at 91% 70%, #dfe3f5 50%, transparent 52%),
        radial-gradient(460px 320px at 84% 4%, rgba(245, 212, 143, .16), transparent 70%),
        radial-gradient(900px 480px at 80% -10%, #343b66 0%, transparent 65%),
        linear-gradient(180deg, #11142a 0%, #14182e 40%, #1e2442 100%);
}
.login-container {
    background: var(--card-bg); border-radius: 22px; border-top: 3px solid var(--gold);
    box-shadow: 0 0 80px rgba(242, 181, 82, .12), 0 30px 70px rgba(4, 6, 20, .55);
}
.login-header h1 { font-size: 30px; letter-spacing: .02em; color: var(--ink); }
.login-header p { color: var(--text-muted); line-height: 1.6; }
.login-container input { min-height: 48px; padding-left: 16px; padding-right: 16px; font-size: 16px; border: 1.5px solid #d5c9ae; border-radius: 12px; background: #fff; color: var(--text-color); }
.login-container input::placeholder { color: #6f7388; }
.login-container input:focus { outline: 0; border-color: var(--gold-deep); box-shadow: var(--focus-ring); }
.auth-form .btn-primary { min-height: 50px; border-radius: 12px; font-size: 16.5px; text-align: center; letter-spacing: .02em; box-shadow: inset 0 -2px 0 rgba(140, 86, 8, .28), 0 8px 22px rgba(242, 181, 82, .3); }
.auth-form a { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--gold-deep); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.login-container .lang-toggle { min-height: 36px; padding: 0 12px; border-color: #cdbf9f; border-radius: 999px; color: var(--ink); background: transparent; }
.login-container .lang-toggle:hover { background: var(--paper-2); }

/* ---------- 书架顶栏 ---------- */
.main-header { border-bottom: 1px solid rgba(242, 181, 82, .2); background: linear-gradient(180deg, #171b34, #14182e); }
.main-header h1 { letter-spacing: .02em; color: #fbf6ea; }
.main-header #user-info { color: #b9bfd8; font-size: 14px; }
.main-header .membership-chip { min-height: 36px; padding: 0 16px; font-size: 13.5px; letter-spacing: .01em; box-shadow: 0 4px 14px rgba(242, 181, 82, .2); }
.main-header .membership-chip:hover { background: #f7c267; border-color: #f7c267; }
.main-header .membership-chip.is-member { box-shadow: none; border-color: rgba(242, 181, 82, .6); color: #f5d48f; }
.main-header .membership-chip.is-member:hover { background: rgba(242, 181, 82, .12); }
.main-header .membership-chip.is-low { box-shadow: 0 0 0 3px rgba(242, 181, 82, .35); }
.main-header #logout-btn, .main-header .lang-toggle { min-height: 36px; padding: 0 14px; border-radius: 999px; border-color: #4a5280; color: #d5d9ea; font-size: 13.5px; }
.main-header #logout-btn:hover, .main-header .lang-toggle:hover { background: rgba(255, 255, 255, .08); border-color: #7078a6; color: #fff; }

/* ---------- 侧栏 ---------- */
.sidebar { background: #fcf8ee; }
.folder-item { border-radius: 10px; color: var(--text-color); }
.folder-item.active { background: var(--ink); color: #fbf6ea; box-shadow: inset 3px 0 0 var(--gold); }

/* ---------- 书架操作与提示条 ---------- */
#upload-btn, .btn-shuffle { min-height: 44px; padding-left: 18px; padding-right: 18px; border-radius: 12px; font-size: 15px; }
#upload-btn { box-shadow: inset 0 -2px 0 rgba(140, 86, 8, .28), 0 6px 18px rgba(242, 181, 82, .28); }
.btn-shuffle { background: var(--card-bg); border-color: #d5c9ae; }
.billing-banner { padding: 14px 16px; border: 1px solid #f0dcae; border-left: 4px solid var(--gold); border-radius: 14px; background: #fff6df; color: #4a3608; line-height: 1.55; }
.billing-banner-cta { min-height: 38px; padding: 0 16px; border-radius: 10px; background: var(--ink); }
.billing-banner-cta:hover { background: var(--primary-hover); }
.billing-banner-close { width: 40px; height: 40px; border-radius: 50%; color: #6b5420; }
.billing-banner-close:hover { background: rgba(138, 90, 12, .12); }

/* ---------- 书卡：像一本立在架上的书 ---------- */
.book-card { position: relative; border-radius: 6px 14px 14px 6px; border-color: #e3d7bd; background: var(--card-bg); box-shadow: -3px 0 0 -1px #dccfb4, var(--shadow); }
/* 书脊的一道压痕，纯装饰，不拦截点击 */
.book-card::before { content: ""; position: absolute; z-index: 1; left: 0; top: 0; bottom: 0; width: 16px; background: linear-gradient(90deg, rgba(60, 44, 12, .2), rgba(60, 44, 12, .05) 45%, rgba(255, 255, 255, .22) 62%, transparent); pointer-events: none; }
.book-card:hover { box-shadow: -3px 0 0 -1px #dccfb4, var(--shadow-hover); }
.book-cover { background: radial-gradient(120% 80% at 70% 0%, #f7efdd, #ebe0c8); }
.book-title { font-family: var(--serif); font-size: 16px; line-height: 1.4; color: var(--ink); }

/* ---------- 空状态（class 名按常见写法推测，见 NOTES.md） ---------- */
.empty-state, .empty-message, .no-books { max-width: 30em; margin-left: auto; margin-right: auto; padding: 56px 24px; border: 1.5px dashed #cdbd97; border-radius: 20px; background: rgba(255, 253, 248, .6); color: var(--text-muted); line-height: 1.7; text-align: center; }
.empty-state h3, .empty-message h3, .no-books h3 { font-family: var(--serif); font-size: 21px; color: var(--ink); }

/* ---------- 阅读器 ---------- */
.reader-header { border-bottom: 1px solid rgba(242, 181, 82, .2); }
.reader-header h2 { font-family: var(--serif); letter-spacing: .01em; }
.reader-header #page-indicator { font-variant-numeric: tabular-nums; color: #c3c8de; }
.reader-header .btn-icon { min-width: 44px; min-height: 44px; border-radius: 10px; }
.reader-header .btn-icon:hover { background: rgba(255, 255, 255, .1); }
.reader-header select { min-height: 36px; border-radius: 8px; }

/* 进度条：加粗，四周有更大的点击热区，末端一个小圆点 */
.progress-bar { position: relative; height: 8px; border-radius: 4px; background: #e6dbc2; overflow: visible; cursor: pointer; }
.progress-bar::before { content: ""; position: absolute; left: 0; right: 0; top: -14px; bottom: -14px; }
.progress-fill { position: relative; height: 100%; min-width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--gold-deep), var(--gold)); }
.progress-fill::after { content: ""; position: absolute; right: -7px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: #fff; border: 3px solid var(--gold-deep); box-shadow: 0 2px 6px rgba(60, 44, 12, .3); pointer-events: none; }

/* 播放键：全页唯一的大金色圆键 */
.btn-play { width: 60px; height: 60px; min-width: 60px; padding: 0; border: 0; border-radius: 50%; font-size: 24px; line-height: 1; font-family: "Apple Symbols", "Segoe UI Symbol", "Noto Sans Symbols 2", sans-serif; font-variant-emoji: text; color: #14182e; box-shadow: inset 0 -3px 0 rgba(140, 86, 8, .3), 0 10px 24px rgba(242, 181, 82, .4); }
.btn-play:active { box-shadow: inset 0 2px 0 rgba(140, 86, 8, .3); }
.btn-nav { min-width: 44px; min-height: 44px; border: 1px solid #d5c9ae; border-radius: 12px; background: var(--card-bg); color: var(--ink); }
.btn-nav:hover { background: var(--paper-2); border-color: #b9ad92; }
.btn-nav:disabled { opacity: .45; }

/* ---------- 弹窗通用 ---------- */
.modal-content { border-radius: 20px; background: var(--card-bg); box-shadow: 0 30px 80px rgba(4, 6, 20, .45); }
.modal-content h3 { letter-spacing: .02em; color: var(--ink); }

/* ---------- 会员中心 ---------- */
.membership-panel { padding: 28px; border-top: 3px solid var(--gold); }
.membership-panel h3 { font-size: 23px; margin-bottom: 16px; padding-right: 44px; }
.membership-close { top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 50%; color: #4b4737; }
.membership-close:hover { background: var(--paper-2); }
.membership-notice { padding: 14px 16px; border: 1px solid #f0dcae; border-left: 4px solid var(--gold); border-radius: 12px; background: #fff6df; color: #4a3608; line-height: 1.55; }
.membership-notice b { display: block; margin-bottom: 2px; font-family: var(--serif); font-size: 17px; color: #3a2a06; }
.membership-state { padding: 16px; border: 1px solid #e9dfc8; border-radius: 14px; background: var(--paper); }
.membership-state-row b { font-family: var(--serif); font-size: 17px; color: var(--ink); }
.membership-state-row span, #membership-usage, .plan-detail, .membership-foot, .membership-soon { color: var(--text-muted); }
.membership-meter { height: 8px; border-radius: 4px; background: #e6dbc2; }
.membership-meter span { border-radius: 4px; background: linear-gradient(90deg, var(--gold-deep), var(--gold)); }
.membership-pack { color: var(--gold-ink); font-weight: 600; }
.membership-group { margin: 6px 0 12px; font-size: 13px; letter-spacing: .08em; color: var(--text-muted); }
.membership-plans { gap: 12px; margin-bottom: 18px; }
.membership-plan { gap: 3px; min-height: 44px; padding: 16px; border: 1.5px solid #d5c9ae; border-radius: 14px; background: #fff; color: var(--ink); }
.membership-plan:hover:not(:disabled) { border-color: #b9ad92; }
.membership-plan.selected { border-color: var(--gold-deep); background: #fff6df; box-shadow: inset 0 0 0 1px var(--gold-deep), 0 8px 20px rgba(217, 149, 44, .18); }
.membership-plan:disabled { opacity: 1; background: #f6f1e4; border-style: dashed; color: #5c6078; }
.membership-plan:disabled .plan-hint { color: #5c6078; }
.plan-name { font-size: 14px; color: inherit; }
.plan-price { font-family: var(--serif); font-size: 30px; line-height: 1.15; font-variant-numeric: lining-nums tabular-nums; }
.plan-hint { color: var(--gold-ink); }
.plan-tag { top: -11px; right: 12px; padding: 2px 11px; letter-spacing: .04em; box-shadow: 0 4px 10px rgba(20, 24, 46, .18); }
.membership-channel { gap: 8px; margin-bottom: 12px; }
.membership-channel button { min-height: 40px; padding: 0 16px; border-color: #d5c9ae; background: #fff; color: var(--ink); }
.membership-channel button.on { background: var(--ink); border-color: var(--ink); color: #fbf6ea; }
.membership-pay { min-height: 52px; border: 0; border-radius: 14px; background: var(--gold); color: #14182e; font-size: 17px; font-weight: 700; letter-spacing: .02em; box-shadow: inset 0 -2px 0 rgba(140, 86, 8, .28), 0 10px 24px rgba(242, 181, 82, .32); }
.membership-pay:hover:not(:disabled) { background: #f7c267; }
.membership-pay:disabled { opacity: 1; background: #e9dfc8; color: #5c6078; box-shadow: none; }
.membership-promise { margin-top: 16px; font-family: var(--serif); font-size: 15px; color: var(--ink); }
.membership-foot { margin-top: 10px; text-align: center; line-height: 1.7; }
.membership-foot a, .membership-soon a, .membership-after a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--gold-deep); text-underline-offset: 3px; }
.membership-after { padding: 14px 16px; border-radius: 12px; background: var(--paper); border: 1px solid #e9dfc8; }
.membership-after.is-success { background: #e9f6ec; border-color: #bfe0c6; color: #14532d; }
.membership-error { padding: 10px 12px; border-radius: 10px; background: #fdecee; color: #8f0a1e; }
.membership-orders summary { min-height: 40px; display: flex; align-items: center; color: var(--text-muted); }
.membership-orders li { padding: 8px 0; border-bottom-color: #ebe1cb; color: #3d4155; }
.share-header { border-bottom: 1px solid rgba(242, 181, 82, .2); }
.share-invite { text-decoration-color: var(--gold); text-underline-offset: 3px; }

/* ---------- 动效 ---------- */
@media (prefers-reduced-motion: no-preference) {
    .btn-play, .btn-nav, .membership-plan, .membership-pay, .folder-item, .main-header .membership-chip { transition: background .15s, border-color .15s, box-shadow .15s, transform .15s; }
    .btn-play:hover { transform: scale(1.05); }
    .btn-play:active { transform: scale(.96); }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .book-card:hover, .btn-play:hover { transform: none; }
}

/* ---------- 手机 ---------- */
@media (max-width: 560px) {
    .login-container { border-radius: 20px; }
    .login-header h1 { font-size: 27px; }
    .main-header { padding-top: 10px; padding-bottom: 10px; }
    .main-header .membership-chip, .main-header #logout-btn, .main-header .lang-toggle { min-height: 40px; }
    #upload-btn, .btn-shuffle { min-height: 48px; }
    .billing-banner { flex-wrap: wrap; }
    .billing-banner span { flex: 1 1 100%; }
    .billing-banner-cta { min-height: 44px; flex: 1; }
    .book-title { font-size: 15px; }
    .btn-play { width: 64px; height: 64px; min-width: 64px; }
    .btn-nav { min-width: 48px; min-height: 48px; }
    .progress-bar { height: 10px; border-radius: 5px; }
    .progress-fill { border-radius: 5px; }
    .progress-fill::after { width: 18px; height: 18px; margin-top: -9px; right: -9px; }
    .empty-state, .empty-message, .no-books { padding: 40px 20px; }
    .membership-panel { padding: 24px 16px 20px; border-radius: 20px; }
    .membership-plans { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .membership-plan { padding: 14px 12px; }
    .plan-price { font-size: 26px; }
    .membership-channel button { flex: 1; min-height: 44px; }
    .membership-pay { min-height: 54px; }
}

.logo-img { display: inline-block; border-radius: 22%; vertical-align: middle; }
.login-header .logo-img { width: 72px; height: 72px; margin-bottom: 8px; }
.login-free { margin-top: 6px; font-size: 13.5px; font-weight: 600; color: #8a5a0c; }
.empty-upload { margin-top: 14px; }
.highlight-word { position: absolute; display: none; border-radius: 4px; background: rgba(242, 181, 82, .5); mix-blend-mode: multiply; pointer-events: none; transition: left .08s linear, width .08s linear; }
.player-rate, .player-sleep, .player-highlight { flex: none; height: 34px; max-width: 74px; padding: 0 4px; border: 1px solid var(--border-color); border-radius: 8px; background: #fffdf8; color: #23263a; font-size: 13px; }
@media (max-width: 560px) {
    .audio-controls { flex-wrap: wrap; justify-content: center; width: 100%; row-gap: 10px; }
    .audio-controls .progress-bar { order: -1; flex: 1 0 100%; }
    .player-rate, .player-sleep, .player-highlight { max-width: 66px; font-size: 12.5px; }
}

.reader-nav { flex-wrap: wrap; row-gap: 10px; }
.audio-controls { flex: 1 1 520px; width: auto; max-width: 720px; min-width: 0; gap: 8px; }
.audio-controls .progress-bar { flex: 1 1 140px; min-width: 120px; }
#fullscreen-btn, #share-fullscreen-btn, #skip-page-btn, #share-skip-page-btn { flex: none; }
