:root {
  --ink: #293f37;
  --muted: #77776a;
  --red: #9e4e3b;
  --paper: #f5efdc;
  --grid: rgba(96, 128, 118, .12);
  --banner-top-height: 52px;
  --banner-bottom-height: 60px;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  color: var(--ink);
  background: #e5e0d3;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; }
[hidden] { display: none !important; }
.app-frame { max-width: 520px; margin: auto; padding: 0 12px; }
.banner-slot { width: 100%; flex-shrink: 0; }
.banner-top { height: calc(var(--banner-top-height) + env(safe-area-inset-top)); }
.banner-bottom { height: calc(var(--banner-bottom-height) + env(safe-area-inset-bottom)); }
.book { position: relative; isolation: isolate; margin: 0 3px 0 8px; perspective: 1700px; background: #29463c; border-radius: 5px 13px 13px 4px; padding: 3px 4px 7px 7px; box-shadow: 0 9px 23px #37362923, 1px 2px 2px #37362930; }
.book::before { content: ""; position: absolute; z-index: -1; inset: 7px 3px 3px 12px; border-radius: 0 10px 11px 0; background: repeating-linear-gradient(#e9dec7 0 2px, #c8bea7 2px 3px); transform: translate(2px, 3px); }
.book-binding { position: absolute; z-index: 4; top: 0; bottom: 0; left: 0; width: 13px; background: linear-gradient(90deg, #203b31, #3c5748 65%, #263e32); border-radius: 5px 0 0 4px; pointer-events: none; }
.notebook-page { position: relative; min-height: 630px; padding: 24px 25px 20px 31px; border-radius: 0 10px 14px 0; background-color: var(--paper); background-image: linear-gradient(90deg, transparent 22px, #bd776344 22px, #bd776344 23px, transparent 23px), linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: auto, 22px 22px, 22px 22px; box-shadow: inset 10px 0 15px -12px #63543dcc, inset -1px 0 5px #a89b6f22; }
.notebook-page::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: .22; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23877758' opacity='.22' filter='url(%23n)' d='M0 0h180v180H0z'/%3E%3C/svg%3E"); }
.cover-page { display: flex; flex-direction: column; transform-origin: 0 50%; backface-visibility: hidden; z-index: 3; }
.cover-topline, .page-header, .chapter, .notes-heading, .page-footer, .cover-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cover-topline { font-size: 12px; color: var(--muted); letter-spacing: .12em; padding-bottom: 10px; border-bottom: 1px solid #83908466; }
.cover-topline span:last-child, .cover-number, .page-counter { font-family: Georgia, serif; font-variant-numeric: tabular-nums; }
.cover-heading { padding: 26px 0 22px; }
.cover-heading p { margin: 0 0 12px; color: var(--muted); font-size: 12px; letter-spacing: .12em; }
.cover-heading h1 { font-size: clamp(31px, 8.9vw, 43px); line-height: 1.35; letter-spacing: .12em; margin: 0; font-weight: 700; }
.cover-heading h1 span { color: var(--red); }
.pasted-picture { margin: 0; position: relative; padding: 5px 5px 0; background: #faf7e9; box-shadow: 1px 3px 4px #3b3c3024; transform: rotate(-1deg); }
.pasted-picture::before { content: ""; position: absolute; top: -8px; left: 39%; width: 58px; height: 17px; background: #d6c38e80; border: 1px solid #bfae7720; transform: rotate(5deg); z-index: 1; }
.pasted-picture img { display: block; width: 100%; height: auto; }
.pasted-picture figcaption { font-size: 11px; color: #6b7165; line-height: 1.7; text-align: right; padding: 6px 3px; letter-spacing: .05em; }
.cover-note { font-size: 16px; line-height: 1.9; margin: 26px 0 20px; }
.open-action { margin-top: auto; display: grid; justify-items: start; gap: 10px; padding-bottom: 28px; }
.open-button { min-height: 48px; background: #f8f3e3aa; padding: 10px 19px; border: 1.5px solid var(--ink); border-radius: 2px 4px 2px 3px; font-size: 18px; letter-spacing: .08em; box-shadow: 2px 2px 0 #66745b22; }
.open-button span { margin-left: 13px; }
.open-button:hover { background: #e7e8d6; }
.open-action small { font-size: 11px; color: var(--muted); }
.cover-footer { font-size: 12px; color: var(--muted); justify-content: start; }
.cover-footer > span:first-child { border-bottom: 1px solid #87908188; min-width: 106px; padding-bottom: 4px; }
.cover-footer .cover-number { margin-left: auto; }
.inside-page { min-height: 680px; }
.page-header { font-size: 12px; padding-bottom: 8px; border-bottom: 1px solid #77857566; }
.text-button { border: 0; background: transparent; min-height: 44px; padding: 8px 0 8px 10px; color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 4px; }
.chapter { margin: 12px 0 18px; font-size: 15px; }
.page-counter { font-size: 12px; color: var(--muted); }
.status-notes { margin-bottom: 23px; padding-bottom: 13px; border-bottom: 1px solid #8b958266; }
.notes-heading { margin-bottom: 12px; font-size: 12px; }
.notes-heading small { font-size: 10px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.stat { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.score { white-space: nowrap; font-family: Georgia, serif; font-variant-numeric: tabular-nums; }
.score strong { font-size: 20px; font-weight: normal; }
.score small { font-size: 11px; color: var(--muted); }
meter { width: 100%; height: 5px; border: 0; background: #d7d5bf; border-radius: 0; }
meter::-webkit-meter-bar { background: #d7d5bf; border: 0; border-radius: 0; }
meter::-webkit-meter-optimum-value { background: #6d8267; border-radius: 0; }
meter::-moz-meter-bar { background: #6d8267; }
.event-picture { margin-bottom: 24px; }
.event-notes h1 { font-size: 23px; line-height: 1.5; margin: 0 0 12px; letter-spacing: .02em; outline: none; }
.event-notes p { font-size: 16px; line-height: 1.85; margin: 0; }
.event-notes h2 { font-size: 14px; margin: 22px 0 8px; font-weight: normal; color: var(--red); }
.choices { display: grid; }
.choice { display: flex; gap: 11px; align-items: flex-start; width: 100%; padding: 12px 0; min-height: 48px; border: 0; border-bottom: 1px dashed #8a92734d; text-align: left; background: transparent; font-size: 15px; line-height: 1.65; }
.checkbox { display: block; flex-shrink: 0; width: 14px; height: 14px; border: 1px solid #68775d; margin-top: 5px; border-radius: 1px; }
.choice:hover { background: #d8deca44; }
.choice[aria-pressed="true"] .checkbox { background: var(--ink); box-shadow: inset 0 0 0 3px var(--paper); }
.choice[aria-pressed="true"] { color: var(--red); }
.event-notes .preview-note { font-size: 12px; color: var(--muted); margin-top: 12px; }
.page-footer { margin-top: 25px; font-size: 11px; color: var(--muted); }
.book.is-opening .cover-page { position: absolute; inset: 3px 4px 7px 7px; animation: open-notebook 800ms cubic-bezier(.3,.05,.2,1) both; pointer-events: none; }
.book.is-opening .inside-page { animation: reveal-page 800ms ease both; }
@keyframes open-notebook { 0% { transform: rotateY(0); opacity: 1; } 65% { opacity: 1; } 100% { transform: rotateY(-110deg); opacity: 0; } }
@keyframes reveal-page { from { filter: brightness(.84); } to { filter: brightness(1); } }
@media (max-width: 380px) { .app-frame { padding: 0 7px; } .notebook-page { padding-right: 17px; padding-left: 28px; } .stats { gap: 6px; } .notes-heading small { font-size: 9px; } .cover-heading { padding-top: 23px; } }
@media (prefers-reduced-motion: reduce) { .book.is-opening .cover-page, .book.is-opening .inside-page { animation: none; } }


/* 事件、反馈和考核继续写在同一张纸页上。 */
.event-notes .branch-note { font-size: 13px; color: #735d37; margin: 0 0 12px; padding-left: 9px; border-left: 2px solid #9a9670; }
.event-notes .result-note { margin: 22px 0 14px; padding: 2px 0 14px; border-top: 1px solid #929b7a66; border-bottom: 1px solid #929b7a66; }
.event-notes .result-note h2 { font-size: 14px; margin: 12px 0; }
.changes { display: flex; flex-wrap: wrap; gap: 7px 14px; margin-top: 10px; font-size: 14px; }
.change { color: var(--muted); }
.change.gain { color: #3c6144; }
.change.loss, .state-warning { color: #9e4e3b !important; }
.next-button { background: #f8f3e3aa; border: 1px solid #6d795e; padding: 12px 15px; min-height: 48px; width: 100%; margin: 14px 0 4px; text-align: left; font-size: 16px; line-height: 1.5; }
.next-button:hover { background: #e4e5d1; }
.journal, .rules-note { margin-top: 20px; font-size: 13px; color: #626956; }
summary { cursor: pointer; padding: 12px 0; min-height: 44px; }
.journal ol { padding-left: 22px; }
.journal li { padding-bottom: 16px; }
.event-notes .journal p, .event-notes .rules-note p { font-size: 13px; line-height: 1.8; margin: 4px 0; }
.journal .changes { font-size: 12px; gap: 5px 8px; }
.event-notes .chapter-label { font-size: 13px; margin: 20px 0 10px; color: var(--muted); }
.event-notes .review-grade { margin: 20px 0; font-size: 22px; color: var(--red); }
.review-grade span { font-family: Georgia, serif; font-size: 16px; white-space: nowrap; }
.event-notes .review-rest { font-size: 14px; margin: 18px 0; color: #506746; }
.event-notes .route-tags { font-size: 14px; margin: 20px 0; color: var(--red); }
.ending-reasons li { font-size: 14px; line-height: 1.8; margin-bottom: 7px; }


/* 少量笔迹陪着图片换页，不遮挡阅读和按钮。 */
.how-to { margin: 0 0 25px; padding: 12px 0; border-top: 1px solid #929b7a66; border-bottom: 1px solid #929b7a66; }
.how-to h2 { font-size: 16px; margin: 0 0 9px; font-weight: normal; }
.how-to p, .how-to li { font-size: 14px; line-height: 1.8; }
.how-to p { margin: 0 0 8px; }
.how-to ul { margin: 0 0 10px; padding-left: 19px; }
.how-to small { display: block; font-size: 11px; line-height: 1.8; color: var(--muted); }
.event-picture { transform: rotate(-.65deg); }
.event-picture[data-scene="classroom"], .event-picture[data-scene="campus"] { transform: rotate(.65deg); }
.event-picture img { aspect-ratio: 2.2 / 1; object-fit: cover; background: #ded9bc; }
.event-picture[data-scene="paperwork"] img, .event-picture[data-scene="coffee"] img { object-fit: contain; }
.event-picture[data-scene="meeting"]::before { left: 68%; transform: rotate(-7deg); }
.result-note h2 { position: relative; padding-left: 22px; }
.result-note h2::before { content: ""; position: absolute; left: 1px; top: 3px; width: 7px; height: 14px; border-right: 2px solid #886146; border-bottom: 2px solid #886146; transform: rotate(37deg); }
.doodle-transition { position: absolute; z-index: 5; top: 230px; right: 8%; width: 65%; height: 100px; pointer-events: none; opacity: 0; color: #a05d43; }
.doodle-transition svg { width: 100%; height: 100%; overflow: visible; }
.doodle-transition path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.is-turning .doodle-transition { animation: pencil-fade 430ms ease both; }
.is-turning .pencil-line { animation: pencil-write 350ms ease both; }
.is-turning .pencil-mark { animation: pencil-write 250ms 80ms ease both; }
.is-turning .event-picture { animation: paste-page 430ms ease both; }
.is-turning .next-button { pointer-events: none; }
@keyframes pencil-write { to { stroke-dashoffset: 0; } }
@keyframes pencil-fade { 0% { opacity: 0; } 20%, 70% { opacity: .8; } 100% { opacity: 0; } }
@keyframes paste-page { 0% { opacity: 1; } 28% { opacity: .15; transform: translateY(-3px) rotate(-1deg); } 65% { opacity: .8; transform: translateY(3px) rotate(.6deg); } 100% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .is-turning .doodle-transition, .is-turning .doodle-transition path, .is-turning .event-picture { animation: none !important; } }



/* Viewport-aware notebook layout for mobile browsers and embedded H5 hosts. */
:root { --banner-top-height: clamp(6px, 1.6svh, 14px); --banner-bottom-height: clamp(8px, 2svh, 18px); --page-gutter: clamp(12px, 4vw, 25px); }
html { height: 100%; }
body { min-height: 100%; }
.app-frame { width: min(100%, 544px); height: 100vh; height: var(--viewport-height, 100dvh); min-height: 0; display: flex; flex-direction: column; padding: 0 max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left)); overflow: hidden; }
.banner-top { height: calc(var(--banner-top-height) + env(safe-area-inset-top)); }
.banner-bottom { height: calc(var(--banner-bottom-height) + env(safe-area-inset-bottom)); }
.book { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.notebook-page { width: 100%; height: auto; flex: 1 1 auto; min-height: 0; overflow: hidden; padding: clamp(10px, 2.2svh, 18px) var(--page-gutter) clamp(9px, 1.8svh, 16px) clamp(27px, 7vw, 34px); }
.cover-page { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.cover-page::-webkit-scrollbar { display: none; }
.cover-topline { padding-bottom: clamp(4px, 1svh, 8px); }
.cover-heading { padding: clamp(6px, 1.6svh, 13px) 0 clamp(6px, 1.3svh, 11px); }
.cover-heading p { margin-bottom: clamp(4px, 1svh, 8px); }
.cover-heading h1 { font-size: clamp(30px, 8.6vw, 43px); line-height: 1.18; }
.cover-picture img { height: clamp(92px, 22svh, 172px); object-fit: cover; }
.cover-picture figcaption { padding: 3px; line-height: 1.4; }
.cover-note { margin: clamp(7px, 1.8svh, 14px) 0 clamp(5px, 1.3svh, 10px); font-size: 15px; line-height: 1.55; }
.how-to { margin: 0 0 8px; padding: 7px 0; }
.how-to h2 { margin-bottom: 4px; font-size: 14px; }
.how-to p, .how-to li { font-size: 13px; line-height: 1.55; }
.how-to p { margin-bottom: 3px; }
.how-to ul { margin-bottom: 4px; padding-left: 17px; }
.how-to li + li { margin-top: 1px; }
.how-to small { font-size: 10px; line-height: 1.5; }
.open-action { padding-bottom: clamp(7px, 1.6svh, 13px); gap: 5px; }
.open-button { min-height: 48px; }
.inside-page { display: flex; flex-direction: column; }
.inside-page[hidden] { display: none; }
.page-header { flex: 0 0 auto; }
.chapter { flex: 0 0 auto; margin: 5px 0 8px; }
.status-notes { flex: 0 0 auto; margin-bottom: clamp(8px, 1.8svh, 14px); padding-bottom: 8px; }
.notes-heading { margin-bottom: 6px; }
.stats { gap: clamp(5px, 1.8vw, 10px); }
.event-picture { flex: 0 0 auto; margin-bottom: 9px; }
.event-picture img { height: clamp(74px, 17svh, 130px); }
.event-picture figcaption { padding: 3px; }
.event-notes { padding: 2px 2px 12px 0; overflow: visible; }
.event-notes h1 { font-size: 22px; line-height: 1.35; margin-bottom: 7px; }
.event-notes p { line-height: 1.65; }
.event-notes h2 { margin-top: 14px; }
.event-notes .result-note { margin-top: 13px; }
.page-footer { flex: 0 0 auto; margin-top: 6px; padding-top: 5px; border-top: 1px solid #8b958244; }
.doodle-transition { top: 30%; }
@media (max-height: 680px) {
  :root { --banner-top-height: 2px; --banner-bottom-height: 6px; }
  .cover-heading { padding-top: 5px; padding-bottom: 5px; }
  .cover-heading p { margin-bottom: 3px; }
  .cover-picture img { height: clamp(78px, 18svh, 118px); }
  .cover-note { margin-top: 5px; margin-bottom: 4px; line-height: 1.4; }
  .how-to { padding: 5px 0; margin-bottom: 4px; }
  .open-action { padding-bottom: 5px; }
}
@media (orientation: landscape) and (max-height: 520px) and (min-width: 560px) {
  .app-frame { max-width: 900px; }
  .cover-page { display: grid; grid-template-columns: 1fr 1.1fr; grid-template-rows: auto auto 1fr auto; column-gap: 20px; align-items: center; }
  .cover-topline, .cover-footer { grid-column: 1 / -1; }
  .cover-heading { grid-column: 1; grid-row: 2; }
  .cover-picture { grid-column: 2; grid-row: 2 / 4; }
  .cover-picture img { height: 28svh; }
  .cover-note { grid-column: 1; margin: 0; }
  .how-to { grid-column: 1; align-self: start; }
  .how-to li:nth-child(n+2), .how-to small { display: none; }
  .open-action { grid-column: 2; grid-row: 4; justify-self: end; align-self: end; margin-top: 0; }
  .cover-footer { grid-row: 5; }
}
@media (prefers-reduced-motion: reduce) { .cover-page { scroll-behavior: auto; } }

/* Restrained digital notebook: retain illustrations and responsive structure. */
:root { --paper: #f7f2e4; --grid: rgba(96, 128, 118, .085); }
.book { box-shadow: 0 5px 16px #3736291c, 1px 2px 2px #37362926; }
.notebook-page::after { opacity: .12; }
.cover-topline { letter-spacing: .08em; }
.cover-note { padding-left: 10px; border-left: 2px solid #9e4e3b55; font-size: 14px; line-height: 1.65; }
.how-to p { font-size: 14px; line-height: 1.7; margin-bottom: 5px; }
.how-to small { font-size: 11px; line-height: 1.65; }
.pasted-picture { box-shadow: 1px 2px 4px #3b3c301c; }
.event-notes { overflow-wrap: break-word; }

/* One reading surface; only compact navigation and current scores stay visible. */
.inside-page { padding-top: 4px; padding-bottom: 5px; }
.inside-page .page-header { min-height: 44px; padding: 0; gap: 6px; }
.inside-page .chapter { flex: 1; min-width: 0; margin: 0; justify-content: flex-start; gap: 10px; font-size: 14px; line-height: 1.3; }
.inside-page .chapter > span:first-child { min-width: 0; }
.inside-page .page-counter { white-space: nowrap; font-size: 11px; }
.inside-page .text-button { flex-shrink: 0; min-height: 44px; padding: 0 0 0 8px; }
.inside-page .status-notes { margin: 0; padding: 6px 0 7px; }
.inside-page .notes-heading { margin: 0; }
.inside-page .notes-heading small { display: none; }
.inside-page .notes-heading small.state-warning { display: block; font-size: 11px; line-height: 1.4; padding-bottom: 4px; }
.inside-page .stats { gap: clamp(5px, 1.8vw, 10px); }
.inside-page .stat { display: grid; grid-template-columns: auto 1fr; column-gap: 4px; row-gap: 3px; align-items: baseline; font-size: 12px; line-height: 20px; }
.inside-page .score { justify-self: end; }
.inside-page .score strong { font-size: 17px; }
.inside-page .score small { display: none; }
.inside-page meter { grid-column: 1 / -1; height: 3px; }
.page-scroll { flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; padding: 14px 3px 8px 1px; scrollbar-width: thin; scrollbar-color: #8b958266 transparent; scroll-padding-block: 10px; }
.page-scroll:focus-visible { outline: 1px solid #6d8267; outline-offset: -1px; }
.page-scroll .event-picture { margin-bottom: 14px; }
.page-scroll .event-picture img { height: auto; aspect-ratio: 2.2 / 1; }
.page-scroll .page-footer { margin-top: 14px; }

/* Story expansion readability; preserve the existing reading surface. */
.cover-page > * { flex-shrink: 0; }
.event-notes > ul { padding-left: 20px; line-height: 1.8; }
.event-notes > ul > li { margin-bottom: 10px; }
.ending-reasons p + p { margin-top: 12px; }

.consequence-note { margin: 14px 0; padding: 10px 12px; border-left: 3px solid #9e4e3b; background: #9e4e3b0a; }
.event-notes .consequence-note h2 { margin-top: 0; font-weight: bold; }

/* Equal-weight, muted ink outlines: colors do not encode outcomes. */
.event-notes .story-emphasis { font-weight: 700; color: inherit; }
.choices { gap: 10px; margin-top: 12px; }
.choice { --choice-ink: #6f8067; --choice-rgb: 111, 128, 103; border: 1.5px solid var(--choice-ink); border-radius: 2px; background: rgba(var(--choice-rgb), .08); padding: 12px 13px; min-height: 50px; gap: 10px; font-size: 15px; font-weight: 400; line-height: 1.8; }
.choice:nth-child(2) { --choice-ink: #a07856; --choice-rgb: 160, 120, 86; }
.choice:nth-child(3) { --choice-ink: #6c8799; --choice-rgb: 108, 135, 153; }
.choice .choice-emphasis { font-weight: 400; text-decoration-line: underline; text-decoration-style: wavy; text-decoration-color: var(--choice-ink); text-decoration-thickness: 1px; text-underline-offset: 4px; text-decoration-skip-ink: none; }
.choice .checkbox { width: 12px; height: 12px; margin-top: 6px; border-color: var(--choice-ink); }
.choice:hover { background: rgba(var(--choice-rgb), .13); }
.choice:active { background: rgba(var(--choice-rgb), .18); }
.choice:focus-visible { outline: 2px solid var(--choice-ink); outline-offset: 3px; }
