/* ============================================================
   《消失的遗书》样式表
   低饱和冷色调复古刑侦风 · 390px 竖屏 AVG 布局
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
    height: 100%;
    background: #0a0d12;
    font-family: "Songti SC", "SimSun", "Noto Serif CJK SC", serif;
    color: #d0d8e0;
    overflow: hidden;
}

/* 桌面端居中模拟手机；移动端铺满 */
#phone-frame {
    position: relative;
    width: 100%;
    max-width: 390px;
    height: 100vh;
    max-height: 100vh;
    margin: 0 auto;
    background: #11141a;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(0,0,0,0.8);
}
@media (min-width: 420px) {
    #phone-frame { height: 844px; margin-top: 20px; border-radius: 18px; }
}

/* ===== 屏幕切换 ===== */
.screen {
    position: absolute; inset: 0;
    display: none;
    flex-direction: column;
    animation: fadeIn 0.45s ease;
}
.screen.active { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ===== 顶部导航 ===== */
.topbar {
    height: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    background: linear-gradient(180deg, rgba(15,18,24,0.95), rgba(15,18,24,0.7));
    border-bottom: 1px solid rgba(230,200,138,0.15);
    z-index: 10;
}
.topbar-btn {
    background: transparent; border: none;
    color: #8aa0b8; font-size: 15px;
    height: 48px; padding: 0 8px; cursor: pointer;
    font-family: inherit;
}
.topbar-btn:active { color: #e6c88a; }
.topbar-title {
    color: #e6c88a; font-size: 13px;
    letter-spacing: 0.1rem;
}
.topbar-placeholder { width: 48px; }

/* ===== 启动页 ===== */
#screen-start { justify-content: center; align-items: center; }
.start-bg {
    position: absolute; inset: 0;
    background: url('../images/bg_gate.png') center center / cover no-repeat,
        linear-gradient(180deg, #0a0d12 0%, #1a1f2a 50%, #0a0d12 100%);
    z-index: 0;
}
.start-bg::after {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(10,13,18,0.55) 0%, rgba(10,13,18,0.25) 40%, rgba(10,13,18,0.75) 100%);
    pointer-events: none;
}
.start-content {
    position: relative; z-index: 1;
    text-align: center; padding: 24px;
}
.start-title-small {
    color: #7a8598; font-size: 12px; letter-spacing: 0.4rem;
    margin-bottom: 18px;
}
.start-title {
    font-size: 42px;
    color: #e6c88a;
    letter-spacing: 0.3rem;
    font-weight: 500;
    text-shadow: 0 0 24px rgba(230,200,138,0.25);
    margin-bottom: 12px;
}
.start-sub {
    color: #9aa5b5; font-size: 13px; letter-spacing: 0.2rem;
    margin-bottom: 48px;
}
.start-buttons { display: flex; flex-direction: column; gap: 12px; }
.start-foot {
    margin-top: 48px; color: #556; font-size: 11px; letter-spacing: 0.1rem;
}

/* ===== 按钮 ===== */
.btn-primary, .btn-secondary, .btn-ghost, .btn-confront {
    font-family: inherit;
    height: 48px;
    border-radius: 4px;
    font-size: 15px;
    letter-spacing: 0.15rem;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-primary {
    background: linear-gradient(180deg, #6b4f26, #4a3618);
    color: #e6c88a;
    border: 1px solid #b8975a;
}
.btn-primary:active { background: linear-gradient(180deg, #7d5e2e, #5a4220); transform: scale(0.98); }
.btn-primary.danger { border-color: #8a4a3a; color: #e8a89a; background: linear-gradient(180deg,#5a2a20,#3a1a14); }
.btn-secondary {
    background: rgba(30,42,58,0.8);
    color: #d0d8e0;
    border: 1px solid #3a4a5e;
}
.btn-ghost {
    background: transparent;
    color: #8aa0b8;
    border: 1px solid #2a3545;
}
.btn-block { width: 100%; }
.btn-confront {
    flex: 1;
    background: rgba(80,60,30,0.85);
    color: #e6c88a;
    border: 1px solid #b8975a;
    letter-spacing: 0.2rem;
}

/* ===== 序幕页 ===== */
#screen-prologue { background: #0e1118; }
.prologue-body {
    flex: 1; padding: 32px 24px; overflow-y: auto;
}
#prologue-text {
    font-family: inherit;
    color: #c0c8d4;
    font-size: 15px;
    line-height: 1.9;
    white-space: pre-wrap;
    letter-spacing: 0.05rem;
}

/* ===== 勘查页 ===== */
#screen-scene { background: #0a0d12; }
.scene-stage {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #1a1a20;
}
.scene-bg {
    position: absolute; inset: 0;
    transition: opacity 0.5s;
}
.hotspot {
    position: absolute;
    width: 44px; height: 44px;
    margin: -22px 0 0 -22px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2;
}
.hotspot::before {
    content: "";
    position: absolute; inset: 8px;
    border-radius: 50%;
    border: 1px solid rgba(230,200,138,0.7);
    animation: breathe 2.2s ease-in-out infinite;
}
.hotspot::after {
    content: attr(data-hint);
    position: absolute;
    bottom: 120%; left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: #e6c88a;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 3px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.hotspot:active::after, .hotspot:hover::after { opacity: 1; }
.hotspot.collected { pointer-events: none; }
.hotspot.collected::before {
    border-color: rgba(120,120,120,0.3);
    animation: none;
}
.hotspot.collected::after { content: "已勘查"; color: #666; }
@keyframes breathe {
    0%, 100% { box-shadow: 0 0 0 0 rgba(230,200,138,0.5); }
    50% { box-shadow: 0 0 0 12px rgba(230,200,138,0); }
}

/* 嫌疑人入口（勘查页可点击） */
.suspect-entry {
    position: absolute;
    z-index: 15;
    padding: 10px 16px;
    background: rgba(20,28,40,0.92);
    border: 1px solid #b8975a;
    color: #e6c88a;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    min-width: 80px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.suspect-entry:active { border-color: #b8975a; color: #e6c88a; }

/* 场景抽屉 */
.drawer {
    position: absolute; left: 0; right: 0; bottom: 48px;
    background: rgba(15,20,28,0.98);
    border-top: 1px solid rgba(230,200,138,0.2);
    max-height: 50%;
    overflow-y: auto;
    transform: translateY(calc(100% + 60px));
    transition: transform 0.25s;
    z-index: 20;
}
.drawer.open { transform: translateY(0); }
.drawer-title { padding: 14px 16px; color: #e6c88a; font-size: 13px; letter-spacing: 0.2rem; border-bottom: 1px solid #2a3545; }
.drawer-list { padding: 8px; }
.drawer-item {
    display: block; width: 100%;
    padding: 14px 16px;
    background: transparent; border: none;
    color: #c0c8d4; font-size: 14px;
    border-bottom: 1px solid #1f2836;
    cursor: pointer; text-align: left;
    font-family: inherit;
}
.drawer-item:active { background: rgba(230,200,138,0.08); color: #e6c88a; }
.drawer-item.current { color: #e6c88a; }

/* 底部功能栏 */
.bottom-bar {
    min-height: 56px;
    display: flex;
    background: rgba(12,15,20,0.98);
    border-top: 1px solid rgba(230,200,138,0.15);
    padding: 6px 8px;
    gap: 6px;
    z-index: 10;
}
.tab-btn {
    flex: 1;
    background: transparent;
    border: 1px solid transparent;
    color: #8aa0b8;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    border-radius: 4px;
    position: relative;
}
.tab-btn:active { background: rgba(230,200,138,0.1); color: #e6c88a; }
.badge {
    display: inline-block;
    min-width: 18px; height: 18px; line-height: 18px;
    background: #b8975a; color: #1a1a1a;
    border-radius: 9px; font-size: 11px;
    padding: 0 5px; margin-left: 2px;
}

/* ===== 对话页（竖屏 AVG） ===== */
#screen-talk { background: #0e1118; }
.talk-stage {
    flex: 1;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 70% 20%, rgba(230,200,138,0.08) 0%, transparent 50%),
        linear-gradient(180deg, #1a2230 0%, #242a36 60%, #14181f 100%);
}
.talk-stage::before {
    content: "";
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1;
}
.portrait {
    position: absolute;
    left: 20px; bottom: 0;
    width: 160px; height: 320px;
    z-index: 2;
    filter: drop-shadow(0 0 20px rgba(0,0,0,0.6));
    transition: filter 0.3s;
}
.portrait.tense { filter: brightness(0.7) drop-shadow(0 0 20px rgba(0,0,0,0.6)); }
.portrait.break { filter: brightness(0.55) drop-shadow(0 0 24px rgba(180,80,60,0.4)); }

/* 立绘 CSS 生成（无图片素材，用渐变+剪影） */
.portrait-butler   { background: linear-gradient(180deg, transparent 0%, #2a2a30 30%, #1a1a20 100%); }
.portrait-nephew   { background: linear-gradient(180deg, transparent 0%, #3a2a2a 30%, #201818 100%); }
.portrait-maid     { background: linear-gradient(180deg, transparent 0%, #3a3028 30%, #201814 100%); }
.portrait-nurse    { background: linear-gradient(180deg, transparent 0%, #2a3a3a 30%, #142020 100%); }
.portrait-partner  { background: linear-gradient(180deg, transparent 0%, #3a3520 30%, #201c10 100%); }
.portrait-coroner  { background: linear-gradient(180deg, transparent 0%, #2a3040 30%, #141820 100%); }

.dialog-box {
    position: relative;
    margin: 0 12px;
    padding: 14px 16px;
    background: rgba(35,28,22,0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid #b8975a;
    border-radius: 6px;
    min-height: 130px;
    z-index: 5;
}
.dialog-name {
    color: #e6c88a;
    font-size: 15px;
    letter-spacing: 0.15rem;
    padding-bottom: 6px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(230,200,138,0.3);
}
.dialog-text {
    color: #d0d8e0;
    font-size: 14.5px;
    line-height: 1.7;
    min-height: 60px;
    white-space: pre-wrap;
}
.dialog-text.highlight { color: #f0d890; }
.dialog-hint {
    text-align: right;
    color: #6a7a8a;
    font-size: 11px;
    margin-top: 6px;
}

.dialog-options {
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(10,13,18,0.6);
    z-index: 5;
}
.option-btn {
    min-height: 48px;
    padding: 10px 14px;
    background: rgba(30,42,58,0.85);
    border: 1px solid #2a3a4e;
    color: #d0d8e0;
    font-size: 13.5px;
    text-align: left;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.4;
}
.option-btn:active { background: rgba(50,70,95,0.9); border-color: #b8975a; }
.option-btn.locked {
    opacity: 0.45;
    color: #7a8598;
    border-style: dashed;
}
.option-btn.type-confront { border-color: #b8975a; color: #e6c88a; }

/* ===== 指认页 ===== */
#screen-accuse { background: #0e1118; }
.accuse-body { flex: 1; padding: 24px 20px; overflow-y: auto; }
.accuse-title {
    color: #e6c88a; font-size: 22px; text-align: center;
    letter-spacing: 0.2rem; margin-bottom: 8px;
}
.accuse-sub {
    color: #7a8598; font-size: 12px; text-align: center;
    margin-bottom: 28px;
}
.accuse-list { display: flex; flex-direction: column; gap: 10px; }
.accuse-item {
    padding: 16px;
    background: rgba(30,42,58,0.7);
    border: 1px solid #2a3a4e;
    color: #d0d8e0;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}
.accuse-item:active { border-color: #b8975a; }
.accuse-item .name { color: #e6c88a; font-size: 16px; letter-spacing: 0.1rem; }
.accuse-item .desc { color: #8a95a5; font-size: 12px; margin-top: 4px; }
.accuse-item.self { border-color: #8a4a3a; }
.accuse-item.self .name { color: #e8a89a; }

/* ===== 结局页 ===== */
#screen-ending { background: #000; }
.ending-bg { position: absolute; inset: 0; opacity: 0.5; }
.ending-bg.dawn     { background: linear-gradient(180deg, #2a3a4a, #6a7a8a 60%, #b8975a); }
.ending-bg.grey     { background: linear-gradient(180deg, #1a1a20, #3a3a40); }
.ending-bg.dark     { background: linear-gradient(180deg, #0a0a0f, #1a1a24); }
.ending-bg.fire     { background: linear-gradient(180deg, #3a1a0a, #8a3a1a); }
.ending-bg.mist     { background: linear-gradient(180deg, #1a2028, #4a5560); }
.ending-bg.golden   { background: linear-gradient(180deg, #2a2010, #8a6a2a 60%, #e6c88a); }
.ending-content {
    position: relative; z-index: 1;
    padding: 40px 24px;
    display: flex; flex-direction: column;
    height: 100%;
}
.ending-label {
    color: rgba(255,255,255,0.5); font-size: 12px;
    letter-spacing: 0.4rem; text-align: center; margin-bottom: 12px;
}
.ending-title {
    color: #fff; font-size: 30px;
    text-align: center; letter-spacing: 0.3rem;
    margin-bottom: 28px;
    text-shadow: 0 2px 12px rgba(0,0,0,0.6);
}
.ending-text {
    flex: 1;
    color: rgba(255,255,255,0.88);
    font-size: 14.5px;
    line-height: 1.9;
    white-space: pre-wrap;
    overflow-y: auto;
    font-family: inherit;
}

/* ===== 弹窗 ===== */
.modal {
    position: absolute; inset: 0;
    display: none;
    z-index: 100;
}
.modal.show { display: block; }
.modal-mask {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.7);
}
.modal-panel {
    position: absolute;
    left: 50%; bottom: 0;
    transform: translateX(-50%);
    width: 100%;
    max-width: 390px;
    max-height: 80%;
    background: linear-gradient(180deg, #1e242e, #14181f);
    border-top: 1px solid #b8975a;
    border-radius: 12px 12px 0 0;
    padding: 18px;
    display: flex; flex-direction: column;
    overflow-y: auto;
    animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
.modal-panel.tall { max-height: 85%; }
.modal-title {
    color: #e6c88a; font-size: 16px;
    letter-spacing: 0.2rem; margin-bottom: 10px;
}
.ev-img { width: 100%; max-height: 280px; object-fit: contain; border-radius: 8px; margin: 8px 0; display: block; }
.modal-tag {
    display: inline-block;
    padding: 2px 8px; font-size: 11px;
    border: 1px solid #3a4a5e; color: #8aa0b8;
    border-radius: 3px; margin-bottom: 10px;
}
.modal-tag.verified { border-color: #5a8a5a; color: #9ad09a; }
.modal-tag.misleading { border-color: #8a5a5a; color: #d09a9a; }
.modal-body {
    color: #c0c8d4; font-size: 14px; line-height: 1.7;
    margin-bottom: 10px;
}
.modal-detail {
    color: #9aa5b5; font-size: 13px; line-height: 1.7;
    padding: 10px;
    background: rgba(0,0,0,0.25);
    border-left: 2px solid #b8975a;
    margin-bottom: 14px;
    white-space: pre-wrap;
}
.modal-actions {
    display: flex; gap: 10px;
    padding-top: 8px;
    border-top: 1px solid #2a3545;
}
.modal-actions button { flex: 1; }

/* 背包 */
.bag-cats {
    display: flex; gap: 6px; margin-bottom: 10px;
}
.bag-cat {
    flex: 1; padding: 8px;
    background: transparent; border: 1px solid #2a3545;
    color: #8aa0b8; font-size: 12px;
    border-radius: 4px; cursor: pointer;
    font-family: inherit;
}
.bag-cat.active { color: #e6c88a; border-color: #b8975a; }
.bag-list { flex: 1; overflow-y: auto; }
.bag-item {
    padding: 12px;
    background: rgba(30,42,58,0.5);
    border: 1px solid #2a3545;
    border-radius: 4px;
    margin-bottom: 6px;
    cursor: pointer;
}
.bag-item:active { border-color: #b8975a; }
.bag-item .name { color: #d0d8e0; font-size: 14px; }
.bag-item .meta { color: #7a8598; font-size: 11px; margin-top: 3px; }
.bag-item.empty { opacity: 0.4; cursor: default; }

/* 笔记 */
.notes-list { flex: 1; overflow-y: auto; }
.note-item {
    padding: 10px 12px;
    border-left: 2px solid #b8975a;
    background: rgba(0,0,0,0.2);
    margin-bottom: 8px;
    color: #c0c8d4; font-size: 13px; line-height: 1.6;
}
.note-item.key { border-left-color: #e8a89a; color: #e6c88a; }

/* 菜单 */
.menu-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.menu-item {
    padding: 14px;
    background: rgba(30,42,58,0.6);
    border: 1px solid #2a3545;
    color: #d0d8e0; font-size: 14px;
    border-radius: 4px; cursor: pointer;
    text-align: left; font-family: inherit;
}
.menu-item:active { border-color: #b8975a; }
.menu-item.danger { color: #e8a89a; border-color: #8a4a3a; }

/* 滚动条 */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: #3a4a5e; }



/* 关系数值 */
.relation-stats { font-size: 0.7rem; color: #e6c88a; white-space: nowrap; }
.relation-stats .trust { color: #7ec8a0; }
.relation-stats .guard { color: #d48a8a; margin-left: 8px; }

/* 浮动数值变化 */
.stat-float { position: fixed; pointer-events: none; font-size: 1.1rem; font-weight: bold; z-index: 9999; animation: floatUp 1.5s ease-out forwards; }
.stat-float.trust-up { color: #7ec8a0; }
.stat-float.trust-down { color: #d48a8a; }
.stat-float.guard-up { color: #d48a8a; }
.stat-float.guard-down { color: #7ec8a0; }
@keyframes floatUp { 0% { opacity:1; transform: translateY(0); } 100% { opacity:0; transform: translateY(-60px); } }
