/* v2026.09.09.1 / 纸页阅读与响应式 UI；最后加载，兼容两种运行入口。 */
:root {
    --reading-font: 'Microsoft YaHei', 'PingFang SC', 'Noto Sans SC', sans-serif;
    --reading-paper: #f3ead7;
    --reading-ink: #392e24;
    --reading-line: #cdbb99;
}

/* 书的厚度留在外缘，正文纸面跟随内容延展。 */
html.art-book-open #app::before { display: none; }
#app {
    max-width: 940px;
    padding: 32px 32px 64px;
}
#app .privacy-banner {
    background: transparent;
    border: 0;
    color: #d2c1a2;
    font: 12px/1.6 var(--reading-font);
    margin-bottom: 24px;
    padding: 0;
}
#app .privacy-dot { background: #9aaf7d; }
#app .app-bar { margin-bottom: 28px; min-height: 48px; }
#app .wordmark { font-size: 22px; letter-spacing: 6px; }
#app #close-book-button {
    min-height: 44px;
    padding: 8px 14px;
    border: 1px solid #998064;
    border-image: none;
    color: #f3ead7;
    background: #30251c;
    font-size: 13px;
    text-shadow: none;
}
#app .tabs {
    gap: 8px;
    padding: 0;
    margin-bottom: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}
html #app .tabs .tab {
    flex: 1;
    min-width: 0;
    min-height: 52px;
    border: 1px solid #8b7150;
    border-bottom: 0;
    border-image: none;
    background: #3a2d22;
    color: #ded0b7;
    box-shadow: none;
    padding: 12px 8px;
    font-size: 14px;
    letter-spacing: 0;
    line-height: 1.5;
    text-shadow: none;
}
html #app .tabs .tab.active {
    background: var(--reading-paper);
    color: var(--reading-ink);
    border-color: var(--reading-line);
    box-shadow: inset 0 4px 0 #bf893a;
}
#app .main {
    background: var(--reading-paper);
    border: 1px solid var(--reading-line);
    border-top: 0;
    box-shadow: 4px 4px 0 #d6c5a4, 7px 7px 0 #765b3c, 10px 10px 0 #251c15;
    min-height: 60vh;
}
#app .panel {
    background: transparent;
    border: 0;
    border-image: none;
    box-shadow: none;
    padding: 40px 52px;
    margin: 0;
    color: var(--reading-ink);
}
#app .panel + .panel { border-top: 1px solid var(--reading-line); }
#app .panel-ornament { display: none; }
#app .page-mark {
    position: static;
    display: block;
    width: fit-content;
    margin: 0 0 16px;
    padding: 0 0 0 10px;
    border: 0;
    border-left: 3px solid #a77734;
    transform: none;
    opacity: 1;
    color: #756044;
    font-size: 12px;
}
#app .panel h2 { font-size: 24px; margin-bottom: 20px; line-height: 1.5; }
#app .panel p, #app .panel-desc {
    font-family: var(--reading-font);
    font-size: 15px;
    line-height: 1.85;
    font-weight: 400;
}
#app .field-label, #app label { line-height: 1.65; }
#app input[type='text'], #app select {
    font-family: var(--reading-font);
    font-size: 16px;
    min-height: 46px;
    background-color: #fbf5e8;
    box-shadow: none;
    border: 1px solid #9a805f;
}
#app .button-group button, #app .actions button, #app .import-label,
#app button.primary, #app #create-character-form button[type='submit'] {
    min-height: 46px;
    border: 1px solid #9a805f;
    border-image: none;
    background: #e9dcc2;
    color: var(--reading-ink);
    text-shadow: none;
    padding: 11px 16px;
    font-size: 15px;
    line-height: 1.5;
}
#app button.primary, #app #create-character-form button[type='submit'],
#app .button-group button.active {
    background: #e8b75e;
    border-color: #916529;
    color: #392a19;
    box-shadow: 0 2px 0 #916529;
}
#app .pixel-item { min-height: 46px; line-height: 1.6; }
#app .character-header { padding-bottom: 24px; border-bottom: 1px solid var(--reading-line); }
#app .archive-row { padding: 12px 0; border-bottom: 1px solid var(--reading-line); line-height: 1.7; }
#app .archive-val { word-break: normal; overflow-wrap: anywhere; }
#app .section-label { color: #715a3c; margin-bottom: 14px; }
#app .stats-section, #app .archive-section { margin-top: 28px; }
#app .event-narrative {
    font: 18px/1.95 var(--reading-font);
    color: var(--reading-ink);
    overflow-wrap: anywhere;
}
#app .log-list { gap: 0; }
#app .log-item {
    border: 0;
    border-left: 3px solid #b89c72;
    border-bottom: 1px solid var(--reading-line);
    background: transparent;
    box-shadow: none;
    margin: 0;
    padding: 20px 20px 20px 24px;
}
#app .log-item:hover { background: #ebdfc8; }
#app .log-title { font-size: 17px; line-height: 1.65; }
#app .log-detail, #app .result-line { font: 15px/1.85 var(--reading-font); }

/* 嵌入与独立冒险共享同一阅读宽度和按钮层级。 */
#branch-app {
    --page-width: 860px;
    padding: 48px 64px;
    margin: 32px auto 64px;
    background: var(--reading-paper);
}
:is(#branch-app, #branch-tree-content) {
    --ink-faint: #78664e;
    font-family: var(--reading-font);
    font-size: 17px;
    line-height: 1.85;
    overflow-wrap: anywhere;
}
:is(#branch-app, #branch-tree-content) .branch-head { margin-bottom: 24px; }
:is(#branch-app, #branch-tree-content) .game-meta { flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }
:is(#branch-app, #branch-tree-content) #b-title { font-size: 26px; line-height: 1.6; margin-bottom: 24px; }
#app #branch-tree-content .b-para,
:is(#branch-app, #branch-tree-content) .b-para {
    font-size: 18px;
    line-height: 1.95;
    font-weight: 400;
    text-align: left;
    margin-bottom: 1.25em;
}
:is(#branch-app, #branch-tree-content) #b-stats { gap: 8px; padding: 12px 0; }
:is(#branch-app, #branch-tree-content) .intro-actions,
:is(#branch-app, #branch-tree-content) .settle-actions { flex-wrap: wrap; gap: 12px; }
:is(#branch-app, #branch-tree-content) .btn-main,
:is(#branch-app, #branch-tree-content) .btn-sub { min-height: 46px; letter-spacing: 0.04em; }
html #app .choice-btn,
:is(#branch-app, #branch-tree-content) .branch-choice {
    border: 1px solid #b6a17e;
    border-left: 3px solid #a58a60;
    border-image: none;
    background: #faf4e7;
    color: var(--reading-ink);
    text-shadow: none;
    box-shadow: none;
    padding: 16px 18px;
    min-height: 52px;
    font: 17px/1.8 var(--reading-font);
    gap: 14px;
    margin-bottom: 12px;
}
html #app .choice-btn:hover,
:is(#branch-app, #branch-tree-content) .branch-choice:not(:disabled):hover {
    background: #efe0bf;
    border-color: #9c733b;
    transform: none;
}
:is(#branch-app, #branch-tree-content) .choice-body { min-width: 0; }
:is(#branch-app, #branch-tree-content) .choice-meta,
:is(#branch-app, #branch-tree-content) .choice-lock { font-size: 14px; line-height: 1.65; }
:is(#branch-app, #branch-tree-content) .journal-tabs { flex-wrap: wrap; gap: 8px; }
:is(#branch-app, #branch-tree-content) .journal-tab { min-height: 44px; letter-spacing: 0; }
:is(#branch-app, #branch-tree-content) .journal-card { padding: 20px; margin-bottom: 16px; }
:is(#branch-app, #branch-tree-content) .journal-card-head { flex-wrap: wrap; gap: 4px 12px; }
:is(#branch-app, #branch-tree-content) .journal-card-from { white-space: normal; }
:is(#branch-app, #branch-tree-content) .journal-card-desc { font-size: 17px; line-height: 1.95; text-align: left; }
:is(#branch-app, #branch-tree-content) .settle-endtext { font-size: 18px; line-height: 1.95; }
.log-pagination button { min-width: 44px; min-height: 44px; }
html :is(button, a, input, select, .import-label):focus-visible {
    outline: 3px solid #96702e;
    outline-offset: 3px;
}
html body .bt-scroll-button {
    width: 44px; height: 44px; padding: 0; line-height: 40px;
    border: 1px solid #9a805f; border-image: none;
    background: #f3ead7; color: #392e24; text-shadow: none;
    font-family: var(--reading-font);
}
.bt-scroll-fab { right: max(12px, calc((100vw - 1040px) / 2)); bottom: 28px; }

@media (max-width: 600px) {
    #app { padding: 24px 12px 88px; }
    #app .privacy-banner { margin-bottom: 18px; font-size: 11px; }
    #app .wordmark { font-size: 18px; letter-spacing: 3px; text-align: left; text-indent: 0; }
    #app .wordmark-en { font-size: 6px; letter-spacing: 1px; text-indent: 0; }
    #app .app-bar { margin-bottom: 20px; }
    #app .tabs { gap: 4px; }
    html #app .tabs .tab { flex: 1; padding: 12px 4px; font-size: 15px; min-height: 48px; }
    #app .nav-chapter { display: none; }
    #app .panel { padding: 24px 20px 32px; }
    #app .panel h2 { font-size: 21px; }
    #app .page-mark { margin-bottom: 12px; }
    #app .main { box-shadow: 3px 3px 0 #d6c5a4, 5px 5px 0 #765b3c; }
    #branch-app { margin: 16px 8px 88px; padding: 28px 20px; }
    :is(#branch-app, #branch-tree-content) #b-title { font-size: 23px; }
    :is(#branch-app, #branch-tree-content) .intro-actions > button { flex: 1 1 130px; }
    html #app .choice-btn,
    :is(#branch-app, #branch-tree-content) .branch-choice { padding: 14px 12px; gap: 10px; }
    :is(#branch-app, #branch-tree-content) .journal-card { padding: 16px 12px; }
    #app .log-item { padding: 16px 12px; }
    .bt-scroll-fab {
        inset: auto 0 0; flex-direction: row; justify-content: flex-end;
        padding: 8px 12px max(8px, env(safe-area-inset-bottom));
        background: #30251c; border-top: 1px solid #9a805f;
    }
    /* 长文工具悬浮在独立底栏，正文和最后一个操作均可滚动到它上方。 */
    body:has(.bt-scroll-fab:not(.hidden)) { padding-bottom: 64px; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    #app .view, #app button { transition: none; }
}

/* 开场层键盘焦点：仅 :focus-visible 时显示，鼠标点击不出现焦点环 */
#intro-scene .menu-item:focus-visible {
    outline: 3px solid #f5e9cd;
    outline-offset: -3px;
}
#intro-scene .menu-title:focus-visible {
    outline: 3px solid #f5e9cd;
    outline-offset: -3px;
}
