/*
 * IF线 · 周氏古宅 AVG 界面。
 * 暗调纸质纹理 + 暗红点缀的中式恐怖视觉；所有类名带 pa- / past-avg 前缀，避免影响其它 IF 世界线。
 */

.past-avg-screen--live {
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at 50% 12%, rgba(120, 30, 24, 0.14), transparent 42%),
        radial-gradient(circle at 18% 88%, rgba(60, 42, 24, 0.18), transparent 50%),
        linear-gradient(180deg, #100d0b 0%, #070606 100%);
    color: #e8ddc8;
}

.past-avg-screen--live::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 4px),
        repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.05) 0 2px, transparent 2px 7px);
    opacity: 0.6;
}

.past-avg-mount {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    --pa-font-size: 16px;
}

.past-avg-topbar {
    flex-shrink: 0;
}

/* 滚动条隐形，保留触控 / 滚轮滚动（与主屏 .home-scroll-wrapper 一致） */
.pa-landing,
.pa-scene-scroll,
.pa-ending,
.pa-sheet-body,
.pa-chat-list {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.pa-landing::-webkit-scrollbar,
.pa-scene-scroll::-webkit-scrollbar,
.pa-ending::-webkit-scrollbar,
.pa-sheet-body::-webkit-scrollbar,
.pa-chat-list::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

/* ============ 通用 ============ */

.pa-loading {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 40px 20px;
    color: rgba(232, 221, 200, 0.55);
    font-size: 14px;
    letter-spacing: 0.14em;
}

.pa-storage-gate {
    flex: 1;
    min-height: 0;
    margin: 18px;
    padding: 28px 22px calc(28px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    color: rgba(242, 231, 214, 0.86);
}

.pa-storage-gate strong {
    color: #f2e7d6;
    font-size: 17px;
    letter-spacing: 0.04em;
}

.pa-storage-gate span,
.pa-storage-gate p {
    width: min(100%, 440px);
    margin: 0;
    color: rgba(232, 221, 200, 0.62);
    font-size: 13px;
    line-height: 1.75;
}

.pa-storage-gate.pa-loading {
    display: flex;
}

.pa-empty {
    padding: 30px 12px;
    text-align: center;
    color: rgba(232, 221, 200, 0.4);
    font-size: 13px;
}

.pa-btn {
    appearance: none;
    display: block;
    width: 100%;
    padding: 13px 16px;
    border: 1px solid rgba(214, 177, 126, 0.26);
    border-radius: 10px;
    background: rgba(28, 23, 19, 0.85);
    color: #e8ddc8;
    font-size: 15px;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.12s ease;
    -webkit-tap-highlight-color: transparent;
}

.pa-btn:active {
    transform: scale(0.985);
}

.pa-btn--primary {
    border-color: rgba(178, 58, 44, 0.65);
    background: linear-gradient(180deg, rgba(112, 32, 24, 0.85), rgba(74, 20, 16, 0.9));
    box-shadow: 0 6px 22px rgba(120, 30, 24, 0.28);
}

.pa-btn--danger {
    border-color: rgba(178, 58, 44, 0.5);
    color: #e8a79b;
}

.pa-btn--small {
    display: inline-block;
    width: auto;
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 8px;
}

.pa-btn--block {
    margin-bottom: 12px;
}

.pa-btn-sub {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: rgba(232, 221, 200, 0.55);
    letter-spacing: 0.06em;
}

/* ============ 标题页 ============ */

.pa-landing {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 26px 22px calc(40px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    -webkit-overflow-scrolling: touch;
}

.pa-landing-art {
    text-align: center;
    padding: 20px 0 4px;
}

.pa-landing-seal {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    display: grid;
    place-items: center;
    border: 2px solid rgba(178, 58, 44, 0.8);
    border-radius: 8px;
    transform: rotate(-4deg);
    color: #c8493a;
    font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
    font-size: 34px;
    font-weight: 700;
    background: rgba(20, 10, 8, 0.6);
    box-shadow: 0 0 26px rgba(150, 40, 30, 0.28), inset 0 0 14px rgba(150, 40, 30, 0.18);
}

.pa-landing-title {
    margin: 0;
    font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
    font-size: clamp(34px, 10vw, 46px);
    font-weight: 600;
    letter-spacing: 0.22em;
    text-indent: 0.22em;
    color: #f2e7d6;
    text-shadow: 0 2px 18px rgba(150, 40, 30, 0.35);
}

.pa-landing-tagline {
    margin: 10px 0 0;
    color: rgba(200, 73, 58, 0.9);
    font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
    font-size: 14px;
    letter-spacing: 0.34em;
    text-indent: 0.34em;
}

.pa-landing-genre {
    margin: 12px 0 0;
    color: rgba(232, 221, 200, 0.45);
    font-size: 11px;
    letter-spacing: 0.12em;
}

.pa-landing-invite {
    width: min(100%, 400px);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 1px dashed rgba(214, 177, 126, 0.4);
    border-radius: 10px;
    background: rgba(28, 23, 19, 0.6);
    cursor: pointer;
    font-size: 13px;
}

.pa-invite-label {
    color: rgba(232, 221, 200, 0.5);
    flex-shrink: 0;
}

.pa-invite-name {
    flex: 1;
    color: #e8ddc8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pa-invite-change {
    color: rgba(200, 73, 58, 0.85);
    flex-shrink: 0;
}

.pa-landing-menu {
    width: min(100%, 400px);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pa-landing-warn {
    width: min(100%, 400px);
    margin: 6px 0 0;
    color: rgba(232, 221, 200, 0.35);
    font-size: 11px;
    line-height: 1.8;
    text-align: center;
}

.pa-storage-warning {
    width: min(100%, 400px);
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid rgba(203, 151, 67, 0.28);
    border-radius: 10px;
    background: rgba(92, 62, 20, 0.16);
    color: rgba(236, 204, 142, 0.78);
    font-size: 11px;
    line-height: 1.65;
}

/* ============ 游戏舞台 ============ */

.pa-game {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.pa-game-toolbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(214, 177, 126, 0.14);
    background: rgba(16, 13, 11, 0.72);
    backdrop-filter: blur(4px);
}

.pa-chapter-pill {
    padding: 4px 10px;
    border: 1px solid rgba(178, 58, 44, 0.5);
    border-radius: 999px;
    color: rgba(232, 168, 155, 0.9);
    font-size: 11px;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.pa-toolbar-spacer {
    flex: 1;
}

.pa-tool-btn {
    appearance: none;
    padding: 6px 9px;
    border: 1px solid rgba(214, 177, 126, 0.22);
    border-radius: 8px;
    background: rgba(28, 23, 19, 0.8);
    color: rgba(232, 221, 200, 0.85);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.pa-tool-btn i {
    font-style: normal;
    margin-left: 3px;
    color: rgba(200, 73, 58, 0.95);
    font-size: 11px;
}

.pa-tool-btn--chat {
    border-color: rgba(178, 58, 44, 0.55);
    background: rgba(74, 20, 16, 0.75);
    color: #f2e7d6;
    font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
    font-weight: 700;
}

.pa-scene-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 18px calc(28px + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
}

.pa-scene-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 12px;
}

.pa-scene-title {
    font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
    font-size: 19px;
    letter-spacing: 0.16em;
    color: #f2e7d6;
}

.pa-scene-loc {
    color: rgba(232, 221, 200, 0.4);
    font-size: 11px;
    letter-spacing: 0.06em;
}

.pa-scene-illust {
    margin: 0 0 14px;
    border: 1px solid rgba(214, 177, 126, 0.22);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(20, 16, 13, 0.8);
}

.pa-scene-illust img {
    display: block;
    width: 100%;
    height: auto;
    filter: saturate(0.85) contrast(1.05);
}

.pa-scene-illust--pending {
    padding: 26px 12px;
    text-align: center;
    color: rgba(232, 221, 200, 0.4);
    font-size: 12px;
    letter-spacing: 0.12em;
}

.pa-scene-text {
    font-size: var(--pa-font-size, 16px);
    line-height: 2;
    color: rgba(238, 229, 210, 0.94);
}

.pa-para {
    margin: 0 0 14px;
    text-align: justify;
}

.pa-para--dialogue {
    color: #ecd7b4;
}

.pa-tap-hint {
    margin-top: 6px;
    color: rgba(232, 221, 200, 0.3);
    font-size: 11px;
    text-align: center;
    letter-spacing: 0.2em;
    animation: paBlink 1.6s ease-in-out infinite;
}

@keyframes paBlink {
    0%, 100% { opacity: 0.25; }
    50% { opacity: 0.75; }
}

.pa-scene-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 34px 8px;
    color: rgba(232, 221, 200, 0.6);
    font-size: 14px;
    letter-spacing: 0.1em;
}

.pa-candle {
    width: 10px;
    height: 14px;
    border-radius: 50% 50% 42% 42%;
    background: radial-gradient(circle at 50% 68%, #e8b24a 0%, #b23a2c 62%, transparent 78%);
    box-shadow: 0 0 14px rgba(232, 178, 74, 0.6);
    animation: paFlicker 0.9s ease-in-out infinite;
}

@keyframes paFlicker {
    0%, 100% { transform: scaleY(1); opacity: 1; }
    35% { transform: scaleY(0.86) translateX(0.5px); opacity: 0.82; }
    70% { transform: scaleY(1.08) translateX(-0.5px); opacity: 0.95; }
}

.pa-scene-error {
    padding: 22px 14px;
    border: 1px solid rgba(178, 58, 44, 0.4);
    border-radius: 10px;
    background: rgba(48, 18, 14, 0.4);
    color: rgba(238, 205, 196, 0.9);
    font-size: 13px;
    line-height: 1.8;
}

.pa-error-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

/* ============ 选项与谜题 ============ */

.pa-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
}

.pa-option {
    appearance: none;
    position: relative;
    padding: 13px 16px 13px 34px;
    border: 1px solid rgba(214, 177, 126, 0.3);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(34, 28, 22, 0.92), rgba(24, 20, 16, 0.92));
    color: #eee5d2;
    font-size: 14px;
    line-height: 1.7;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.12s ease;
    -webkit-tap-highlight-color: transparent;
}

.pa-option::before {
    content: "◆";
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(178, 58, 44, 0.75);
    font-size: 10px;
}

.pa-option:active {
    transform: scale(0.985);
}

.pa-option:hover {
    border-color: rgba(200, 73, 58, 0.6);
    box-shadow: 0 4px 18px rgba(120, 30, 24, 0.22);
}

.pa-option--continue {
    text-align: center;
    padding-left: 16px;
    letter-spacing: 0.2em;
}

.pa-option--continue::before {
    content: none;
}

.pa-puzzle {
    margin-top: 18px;
    padding: 16px 14px;
    border: 1px solid rgba(150, 118, 66, 0.4);
    border-radius: 12px;
    background: rgba(30, 25, 18, 0.65);
}

.pa-puzzle-head {
    display: inline-block;
    margin-bottom: 10px;
    padding: 3px 12px;
    border: 1px solid rgba(200, 160, 90, 0.55);
    border-radius: 999px;
    color: #d9b878;
    font-size: 11px;
    letter-spacing: 0.24em;
    text-indent: 0.24em;
}

.pa-puzzle-intro {
    margin: 0 0 8px;
    color: rgba(232, 221, 200, 0.62);
    font-size: 13px;
    line-height: 1.8;
}

.pa-puzzle-question {
    margin: 0 0 4px;
    color: #f2e7d6;
    font-size: 14px;
    line-height: 1.8;
    font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
}

.pa-puzzle-result {
    margin: 0;
    font-size: 13px;
    line-height: 1.9;
}

.pa-puzzle-result.is-good { color: #d9c08a; }
.pa-puzzle-result.is-bad { color: rgba(220, 150, 138, 0.9); }

/* ============ 结局页 ============ */

.pa-ending {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 34px 24px calc(44px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    -webkit-overflow-scrolling: touch;
}

.pa-ending-type {
    padding: 4px 16px;
    border: 1px solid currentColor;
    border-radius: 2px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.4em;
    text-indent: 0.4em;
}

.pa-ending--bad .pa-ending-type { color: #c8493a; }
.pa-ending--normal .pa-ending-type { color: #b8a988; }
.pa-ending--god .pa-ending-type { color: #e2c37c; text-shadow: 0 0 16px rgba(226, 195, 124, 0.5); }

.pa-ending-title {
    margin: 20px 0 6px;
    font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
    font-size: clamp(26px, 8vw, 34px);
    font-weight: 600;
    letter-spacing: 0.18em;
    color: #f2e7d6;
}

.pa-ending--god .pa-ending-title {
    color: #ecd7a4;
    text-shadow: 0 0 26px rgba(226, 195, 124, 0.4);
}

.pa-ending-hint {
    margin: 0 0 22px;
    color: rgba(232, 221, 200, 0.5);
    font-size: 13px;
    letter-spacing: 0.1em;
}

/* 结局漫画页（分镜 + 台词气泡的单页插画） */
.pa-ending-illust {
    width: min(100%, 460px);
    margin: 0 auto 20px;
    border: 1px solid rgba(214, 177, 126, 0.24);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(12, 10, 8, 0.6);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.pa-ending-illust img {
    display: block;
    width: 100%;
    height: auto;
}

.pa-ending-illust--loading {
    padding: 30px 12px;
    text-align: center;
    font-size: 12px;
    letter-spacing: 0.16em;
    color: rgba(232, 221, 200, 0.45);
    animation: paBlink 2.2s ease-in-out infinite;
}

.pa-ending-body,
.pa-ending-epilogue {
    width: min(100%, 460px);
    text-align: justify;
    font-size: 14px;
    line-height: 2.05;
    color: rgba(238, 229, 210, 0.9);
}

.pa-ending-epilogue {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed rgba(214, 177, 126, 0.25);
    color: rgba(232, 221, 200, 0.6);
    font-size: 13px;
}

.pa-ending-actions {
    width: min(100%, 400px);
    margin-top: 28px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ============ 弹层 ============ */

.pa-sheet-mask {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(2px);
}

.pa-sheet {
    width: 100%;
    max-width: 560px;
    max-height: 86%;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(214, 177, 126, 0.24);
    border-bottom: none;
    border-radius: 16px 16px 0 0;
    background: linear-gradient(180deg, #171310 0%, #0d0b09 100%);
    box-shadow: 0 -14px 50px rgba(0, 0, 0, 0.5);
    animation: paSheetUp 0.22s ease;
}

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

.pa-sheet-head {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 10px;
    border-bottom: 1px solid rgba(214, 177, 126, 0.14);
    font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
    font-size: 16px;
    letter-spacing: 0.14em;
    color: #f2e7d6;
}

.pa-sheet-close {
    appearance: none;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(232, 221, 200, 0.7);
    font-size: 17px;
    cursor: pointer;
}

.pa-sheet-body {
    flex: 1;
    min-height: 120px;
    overflow-y: auto;
    padding: 14px 18px calc(20px + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
    font-size: 13px;
    line-height: 1.9;
}

.pa-sheet--chat .pa-sheet-body {
    display: flex;
    flex-direction: column;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

/* ---- 设置 ---- */

.pa-set-group {
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px dashed rgba(214, 177, 126, 0.15);
}

.pa-set-group:last-child {
    border-bottom: none;
}

.pa-set-title {
    margin-bottom: 10px;
    color: #d9b878;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.2em;
}

.pa-set-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 0;
    color: rgba(238, 229, 210, 0.9);
    font-size: 14px;
}

.pa-set-row select,
.pa-set-row input[type="range"] {
    max-width: 56%;
}

.pa-set-row select {
    appearance: none;
    padding: 7px 10px;
    border: 1px solid rgba(214, 177, 126, 0.3);
    border-radius: 8px;
    background: rgba(28, 23, 19, 0.9);
    color: #e8ddc8;
    font-size: 13px;
}

.pa-set-row input[type="range"] {
    flex: 1;
    accent-color: #b23a2c;
}

.pa-set-note {
    margin: 4px 0 0;
    color: rgba(232, 221, 200, 0.42);
    font-size: 11.5px;
    line-height: 1.8;
}

.pa-set-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* ---- 记忆注入 ---- */

.pa-set-title--sub {
    margin-top: 14px;
    font-size: 11px;
    color: rgba(217, 184, 120, 0.8);
}

.pa-mem-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 0;
    color: rgba(238, 229, 210, 0.9);
    font-size: 13px;
}

.pa-mem-input {
    width: 58px;
    padding: 7px 8px;
    border: 1px solid rgba(214, 177, 126, 0.3);
    border-radius: 8px;
    background: rgba(28, 23, 19, 0.9);
    color: #e8ddc8;
    font-size: 13px;
    text-align: center;
    appearance: textfield;
    -moz-appearance: textfield;
}

.pa-mem-input::-webkit-outer-spin-button,
.pa-mem-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pa-mem-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    padding: 9px 11px;
    border: 1px solid rgba(214, 177, 126, 0.18);
    border-radius: 10px;
    background: rgba(28, 23, 19, 0.6);
}

.pa-mem-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.pa-mem-item-label {
    color: #d9b878;
    font-size: 11px;
    letter-spacing: 0.06em;
}

.pa-mem-item-text {
    color: rgba(232, 221, 200, 0.72);
    font-size: 12px;
    line-height: 1.8;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- 好友选择 ---- */

.pa-friend-search {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(214, 177, 126, 0.28);
    border-radius: 8px;
    background: rgba(28, 23, 19, 0.9);
    color: #e8ddc8;
    font-size: 14px;
    margin-bottom: 8px;
}

.pa-friend-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.pa-friend-row {
    appearance: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(214, 177, 126, 0.2);
    border-radius: 10px;
    background: rgba(28, 23, 19, 0.7);
    color: #e8ddc8;
    font-size: 14px;
    cursor: pointer;
    text-align: left;
}

.pa-friend-row.is-selected {
    border-color: rgba(200, 73, 58, 0.65);
    background: rgba(74, 20, 16, 0.4);
}

.pa-friend-avatar {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(120, 90, 50, 0.3);
    color: #d9b878;
    font-size: 15px;
}

.pa-friend-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pa-friend-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pa-friend-tag {
    flex-shrink: 0;
    color: rgba(200, 73, 58, 0.9);
    font-size: 11px;
}

/* ---- 线索册 ---- */

.pa-clue {
    margin-bottom: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(214, 177, 126, 0.2);
    border-radius: 10px;
    background: rgba(28, 23, 19, 0.6);
}

.pa-clue--truth {
    border-color: rgba(200, 160, 90, 0.5);
    background: rgba(40, 32, 20, 0.55);
}

.pa-clue-name {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #f2e7d6;
    font-size: 14px;
    font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
    letter-spacing: 0.08em;
}

.pa-clue-star {
    padding: 1px 8px;
    border: 1px solid rgba(200, 160, 90, 0.6);
    border-radius: 999px;
    color: #d9b878;
    font-size: 10px;
    letter-spacing: 0.1em;
}

.pa-clue-desc {
    margin: 6px 0 0;
    color: rgba(232, 221, 200, 0.6);
    font-size: 12.5px;
    line-height: 1.85;
}

/* ---- 剧情回顾 ---- */

.pa-log-entry {
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px dashed rgba(214, 177, 126, 0.14);
}

.pa-log-title {
    margin-bottom: 8px;
    color: #d9b878;
    font-size: 13px;
    letter-spacing: 0.1em;
}

.pa-log-text {
    color: rgba(238, 229, 210, 0.8);
    font-size: 13px;
    line-height: 1.95;
}

.pa-log-text .pa-para {
    margin-bottom: 8px;
}

.pa-log-choice {
    margin-top: 8px;
    padding: 6px 10px;
    border-left: 2px solid rgba(178, 58, 44, 0.6);
    color: rgba(232, 168, 155, 0.85);
    font-size: 12px;
}

/* ---- 存档 ---- */

.pa-archive {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    padding: 11px 13px;
    border: 1px solid rgba(214, 177, 126, 0.2);
    border-radius: 10px;
    background: rgba(28, 23, 19, 0.65);
}

.pa-archive-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.pa-archive-name {
    color: #eee5d2;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pa-archive-meta {
    color: rgba(232, 221, 200, 0.42);
    font-size: 11px;
}

.pa-archive-actions {
    flex-shrink: 0;
    display: flex;
    gap: 6px;
}

/* ---- 结局图鉴 ---- */

.pa-ending-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    padding: 12px 14px;
    border: 1px solid rgba(214, 177, 126, 0.16);
    border-radius: 10px;
    background: rgba(24, 20, 17, 0.7);
    opacity: 0.55;
}

.pa-ending-card.is-unlocked {
    opacity: 1;
}

.pa-ending-card-type {
    flex-shrink: 0;
    width: 64px;
    text-align: center;
    padding: 3px 0;
    border: 1px solid rgba(184, 169, 136, 0.5);
    border-radius: 2px;
    color: #b8a988;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.16em;
}

.pa-ending-card--bad.is-unlocked .pa-ending-card-type { color: #c8493a; border-color: rgba(200, 73, 58, 0.6); }
.pa-ending-card--god.is-unlocked .pa-ending-card-type { color: #e2c37c; border-color: rgba(226, 195, 124, 0.6); }

.pa-ending-card-title {
    flex-shrink: 0;
    color: #f2e7d6;
    font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
    font-size: 14px;
    letter-spacing: 0.1em;
}

.pa-ending-card-hint {
    flex: 1;
    min-width: 0;
    color: rgba(232, 221, 200, 0.45);
    font-size: 11.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
}

/* ---- 同行聊天 ---- */

.pa-chat-list {
    flex: 1;
    min-height: 220px;
    max-height: 46vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 2px 10px;
    -webkit-overflow-scrolling: touch;
}

.pa-chat-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.pa-chat-msg--user {
    flex-direction: row-reverse;
}

.pa-chat-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(120, 90, 50, 0.3);
    color: #d9b878;
    font-size: 13px;
}

.pa-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pa-chat-avatar--ghost {
    background: radial-gradient(circle at 50% 40%, rgba(60, 30, 26, 0.95), rgba(14, 10, 9, 0.95));
    border: 1px solid rgba(178, 58, 44, 0.5);
    color: #c8493a;
    font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
}

.pa-chat-bubble {
    max-width: 76%;
    padding: 9px 13px;
    border-radius: 12px 12px 12px 4px;
    background: rgba(36, 30, 25, 0.9);
    border: 1px solid rgba(214, 177, 126, 0.16);
    color: rgba(238, 229, 210, 0.92);
    font-size: 13.5px;
    line-height: 1.8;
    word-break: break-word;
}

.pa-chat-msg--user .pa-chat-bubble {
    border-radius: 12px 12px 4px 12px;
    background: rgba(84, 28, 22, 0.55);
    border-color: rgba(178, 58, 44, 0.35);
}

.pa-chat-bubble--typing {
    letter-spacing: 0.3em;
    animation: paBlink 1.2s ease-in-out infinite;
}

/* Char 台词：逐行显示，行下 4px 重点下划线凸显台词 */
.pa-chat-line {
    display: block;
    width: fit-content;
    line-height: 1.75;
    padding-bottom: 2px;
    margin-bottom: 8px;
    text-decoration: underline;
    text-decoration-thickness: 4px;
    text-decoration-color: rgba(178, 58, 44, 0.5);
    text-underline-offset: 6px;
}

.pa-chat-line:last-child {
    margin-bottom: 2px;
}

/* 台词行内的双语折叠块（外语原文 + 点「译」展开中文译文，与微信气泡同款）：
   译文用 inline-block 阻断台词重点下划线的传播，只让外语原文保留下划线 */
.pa-chat-line .chat-bilingual-block--collapsible.is-expanded .chat-bilingual-translation {
    display: inline-block;
    width: 100%;
}

/* 动作神态描写：脱离气泡、界面居中，用衬线斜体与台词区分 */
.pa-chat-action {
    align-self: center;
    max-width: 88%;
    margin: 2px auto;
    padding: 1px 12px;
    text-align: center;
    color: rgba(217, 184, 120, 0.8);
    font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
    font-style: italic;
    font-size: 12px;
    letter-spacing: 0.1em;
    line-height: 1.9;
}

.pa-chat-action::before { content: "（"; opacity: 0.55; }
.pa-chat-action::after { content: "）"; opacity: 0.55; }

.pa-chat-inputbar {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid rgba(214, 177, 126, 0.14);
}

.pa-chat-inputbar input {
    flex: 1;
    padding: 10px 13px;
    border: 1px solid rgba(214, 177, 126, 0.28);
    border-radius: 999px;
    background: rgba(28, 23, 19, 0.9);
    color: #e8ddc8;
    font-size: 14px;
}

.pa-chat-send {
    appearance: none;
    flex-shrink: 0;
    padding: 0 18px;
    border: 1px solid rgba(178, 58, 44, 0.6);
    border-radius: 999px;
    background: rgba(112, 32, 24, 0.8);
    color: #f2e7d6;
    font-size: 13px;
    cursor: pointer;
}

.pa-chat-send:disabled {
    opacity: 0.5;
}

/* ---- 同行聊天：表情 / 引用 / 气泡菜单 / 输入感应 ---- */

.pa-sheet--chat {
    position: relative;
}

.pa-chat-emoji-btn {
    appearance: none;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(214, 177, 126, 0.28);
    border-radius: 50%;
    background: rgba(28, 23, 19, 0.9);
    color: rgba(232, 221, 200, 0.75);
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
}

.pa-chat-emoji-btn--on {
    border-color: rgba(214, 177, 126, 0.6);
    color: #e8c98a;
    background: rgba(50, 40, 28, 0.9);
}

.pa-emoji-panel {
    flex-shrink: 0;
    max-height: 150px;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    padding: 10px;
    border: 1px solid rgba(214, 177, 126, 0.2);
    border-radius: 10px;
    background: rgba(20, 16, 13, 0.92);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.pa-emoji-panel::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.pa-emoji-item {
    appearance: none;
    width: 52px;
    height: 52px;
    padding: 2px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}

.pa-emoji-item:hover {
    border-color: rgba(214, 177, 126, 0.4);
    background: rgba(50, 40, 28, 0.6);
}

.pa-emoji-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.pa-emoji-empty {
    padding: 10px 6px;
    color: rgba(232, 221, 200, 0.45);
    font-size: 12px;
    line-height: 1.8;
}

.pa-chat-bubble--emoji {
    padding: 6px;
    background: transparent;
    border: none;
}

.pa-chat-emoji-img {
    display: block;
    max-width: 110px;
    max-height: 110px;
    border-radius: 8px;
}

.pa-chat-quote-ref {
    display: block;
    margin-bottom: 6px;
    padding: 4px 8px;
    border-left: 3px solid rgba(214, 177, 126, 0.45);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.25);
    color: rgba(232, 221, 200, 0.55);
    font-size: 11.5px;
    line-height: 1.6;
}

.pa-chat-quote-chip {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 10px;
    border: 1px dashed rgba(214, 177, 126, 0.35);
    border-radius: 8px;
    background: rgba(28, 23, 19, 0.8);
}

.pa-chat-quote-chip-text {
    flex: 1;
    color: rgba(232, 221, 200, 0.65);
    font-size: 12px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.pa-chat-quote-chip-close {
    appearance: none;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(112, 32, 24, 0.7);
    color: #f2e7d6;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
}

.pa-chat-waiting {
    align-self: center;
    color: #e8b36a;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.1em;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(178, 58, 44, 0.16);
    border: 1px solid rgba(232, 179, 106, 0.35);
    text-shadow: 0 0 8px rgba(232, 179, 106, 0.25);
    animation: paWaitPulse 1.6s ease-in-out infinite;
}

@keyframes paWaitPulse {
    0%, 100% { opacity: 0.72; }
    50% { opacity: 1; }
}

.pa-msg-menu {
    position: absolute;
    z-index: 46;
    display: flex;
    padding: 4px;
    border: 1px solid rgba(214, 177, 126, 0.32);
    border-radius: 10px;
    background: rgba(16, 13, 10, 0.97);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    animation: paToastIn 0.16s ease;
}

.pa-msg-menu-item {
    appearance: none;
    padding: 8px 12px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: rgba(238, 229, 210, 0.88);
    font-size: 12.5px;
    letter-spacing: 0.04em;
    white-space: nowrap;
    cursor: pointer;
}

.pa-msg-menu-item:hover {
    background: rgba(112, 32, 24, 0.5);
    color: #f2e7d6;
}

.pa-msg-edit .pa-msg-edit-text {
    display: block;
    width: 100%;
    min-height: 96px;
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px solid rgba(214, 177, 126, 0.3);
    border-radius: 10px;
    background: rgba(28, 23, 19, 0.9);
    color: #e8ddc8;
    font-size: 13.5px;
    line-height: 1.8;
    resize: vertical;
    box-sizing: border-box;
}

/* ---- 确认弹窗 / toast ---- */

.pa-confirm-mask {
    align-items: center;
    z-index: 40;
}

.pa-confirm {
    width: min(84%, 340px);
    padding: 22px 20px 16px;
    border: 1px solid rgba(214, 177, 126, 0.3);
    border-radius: 14px;
    background: #17130f;
    color: rgba(238, 229, 210, 0.92);
    font-size: 14px;
    line-height: 1.9;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

.pa-confirm p {
    margin: 0 0 16px;
}

.pa-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.pa-toast {
    position: absolute;
    left: 50%;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 50;
    max-width: 84%;
    padding: 9px 18px;
    border: 1px solid rgba(214, 177, 126, 0.3);
    border-radius: 999px;
    background: rgba(14, 11, 9, 0.94);
    color: #eee5d2;
    font-size: 12.5px;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
    animation: paToastIn 0.2s ease;
    pointer-events: none;
}

@keyframes paToastIn {
    from { transform: translateX(-50%) translateY(8px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ============================ CG 收藏夹 ============================ */

/* 剧情/结局里的插画可点击进入 CG 查看器 */
.pa-cg-clickable {
    position: relative;
    cursor: pointer;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.pa-cg-clickable:hover {
    border-color: rgba(214, 177, 126, 0.5);
    box-shadow: 0 0 0 1px rgba(214, 177, 126, 0.25), 0 12px 32px rgba(0, 0, 0, 0.45);
}

.pa-cg-badge {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 2px 8px;
    border: 1px solid rgba(214, 177, 126, 0.4);
    border-radius: 999px;
    background: rgba(14, 11, 9, 0.78);
    color: rgba(232, 179, 106, 0.9);
    font-size: 10px;
    letter-spacing: 0.18em;
    pointer-events: none;
}

.pa-cg-note {
    margin: 0 0 14px;
    color: rgba(232, 221, 200, 0.55);
    font-size: 12px;
    line-height: 1.7;
}

.pa-cg-section-head {
    margin: 16px 0 10px;
    color: rgba(232, 179, 106, 0.85);
    font-size: 13px;
    letter-spacing: 0.22em;
}

.pa-cg-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.pa-cg-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 8px 10px;
    border: 1px solid rgba(214, 177, 126, 0.18);
    border-radius: 10px;
    background: rgba(20, 16, 13, 0.78);
}

.pa-cg-card.is-unlocked {
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.15s ease;
}

.pa-cg-card.is-unlocked:hover {
    border-color: rgba(214, 177, 126, 0.48);
    transform: translateY(-1px);
}

.pa-cg-card.is-locked {
    opacity: 0.62;
}

.pa-cg-thumb {
    aspect-ratio: 4 / 3;
    border-radius: 7px;
    overflow: hidden;
    background: rgba(12, 10, 8, 0.85);
}

.pa-cg-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(0.85) contrast(1.05);
}

.pa-cg-thumb--locked {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(232, 221, 200, 0.28);
    font-size: 11px;
    letter-spacing: 0.3em;
    border: 1px dashed rgba(214, 177, 126, 0.16);
}

.pa-cg-card-title {
    color: #eee5d2;
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pa-cg-card-sub {
    color: rgba(232, 221, 200, 0.42);
    font-size: 10.5px;
    letter-spacing: 0.08em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* CG 查看器（大图 + 信息 + 保存） */
.pa-cg-mask {
    position: absolute;
    inset: 0;
    z-index: 38;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 14px calc(18px + env(safe-area-inset-bottom, 0px));
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(3px);
}

.pa-cg-viewer {
    display: flex;
    flex-direction: column;
    width: min(100%, 480px);
    max-height: 100%;
    border: 1px solid rgba(214, 177, 126, 0.32);
    border-radius: 14px;
    overflow: hidden;
    background: #14100d;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.65);
}

.pa-cg-viewer-img {
    flex: 0 1 auto;
    min-height: 0;
    overflow: auto;
    scrollbar-width: none;
    background: rgba(8, 6, 5, 0.9);
}

.pa-cg-viewer-img::-webkit-scrollbar {
    display: none;
}

.pa-cg-viewer-img img {
    display: block;
    width: 100%;
    height: auto;
}

.pa-cg-viewer-info {
    padding: 12px 16px 4px;
    border-top: 1px solid rgba(214, 177, 126, 0.16);
}

.pa-cg-info-row {
    display: flex;
    gap: 12px;
    margin-bottom: 7px;
    font-size: 12.5px;
    line-height: 1.6;
}

.pa-cg-info-label {
    flex: 0 0 58px;
    color: rgba(232, 179, 106, 0.75);
    letter-spacing: 0.14em;
}

.pa-cg-info-value {
    flex: 1;
    color: #eee5d2;
}

.pa-cg-viewer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 8px 14px 14px;
}
