*{box-sizing:border-box}
:root{--ink:var(--hh-ink,#fff4df);--muted:var(--hh-muted,#dacfc4);--cream:#fff5df;--paper:var(--hh-panel,#242938);--brass:#ac8352;--wine:var(--hh-gold,#f6cf94);--line:var(--hh-edge,#79664e);--serif:var(--hh-font-title,"Hehe Serif"),"Songti SC",SimSun,serif;--sans:var(--hh-font-body,"Hehe Sans"),"Microsoft Yahei",sans-serif}
body{margin:0;background:#2e211d;color:var(--cream);font:16px/1.55 var(--sans);min-height:100svh}
[hidden]{display:none!important}
button,a{touch-action:manipulation}
button{cursor:pointer;font:inherit;color:inherit;border:0}
button:disabled{cursor:default;opacity:.56}
button:focus-visible,a:focus-visible{outline:3px solid #d19536;outline-offset:2px}
/* Room art is shared by the selector, the playing surface and its backdrop. */
.shop-view{position:fixed;inset:0;z-index:-1;overflow:hidden;pointer-events:none;background:#141824}
.shop-view img{width:100%;height:100%;object-fit:cover;display:block}
.shop-view::after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,#101521df 0%,#16202f97 40%,#13182616 73%),linear-gradient(0deg,#1215236b,transparent 35%)}
body[data-view=game] .shop-view img{filter:blur(19px) brightness(.46) saturate(.85);transform:scale(1.07)}
body[data-view=game] .shop-view::after{background:linear-gradient(130deg,#0b122969,#0e132130 65%,#14142e55)}
body[data-view=result] .shop-view img{filter:brightness(.7)}
.shop-nav .hh-tilt{display:none}
.shop-nav{display:flex;align-items:center;justify-content:space-between;position:relative;z-index:2;padding:12px clamp(18px,5.2vw,110px);border-bottom:1px solid #f2d8aa44;background:linear-gradient(90deg,#171b29f5,#26283ad9);min-height:60px;font-size:15px}
.shop-nav>div{display:flex;align-items:center;gap:22px;margin-left:auto}.shop-nav{gap:12px}.shop-nav a,.classic{color:inherit;text-decoration:none}.shop-nav button{background:none;padding:6px 0}.shop-nav button span{font:12px Georgia,serif;color:#eed5b0;border:1px solid #ac8e6f;margin-left:4px;padding:2px 5px}
.desk{position:relative;width:min(43vw,720px);margin:clamp(36px,6vh,80px) 0 40px clamp(28px,5.2vw,112px)}
.mast,.game-heading,.game-heading>div,.stats,.view-tools,.advice,.records,.book header,.pager,.folio,.daily-card{display:flex;align-items:center}
.mast{gap:18px}.seal{display:grid;place-items:center;width:46px;height:50px;border:1px solid #f7d5a2;outline:1px solid #f7d5a270;outline-offset:-5px;color:#f9deb4;font:600 29px var(--serif);transform:rotate(-4deg);background:#713f38}
.kicker,.folio,.caption p{margin:0;font:600 12px/1.4 Georgia,var(--serif);letter-spacing:.18em;color:#e5c69a}
.mast h1,.mast h2,.game-heading h2,.caption h2,.book h2,.collection h3{margin:0;font:600 clamp(36px,3.9vw,70px)/1.18 var(--serif);letter-spacing:.06em}
.intro{margin:14px 0 24px;max-width:37em;line-height:1.8;color:#fff1dc;text-shadow:0 2px 5px #35241b}
.chapter,.result-paper,.daily-card,.book{background-color:var(--paper);color:var(--ink);border:1px solid var(--line);box-shadow:var(--hh-shadow,0 12px 32px #17182178)}
.chapter{border-radius:5px;overflow:hidden}.chapter-art{position:relative;height:clamp(170px,22vh,248px);background:#664655;isolation:isolate;overflow:hidden}
.chapter-art>img{position:absolute;width:100%;height:100%;object-fit:cover;object-position:center 52%;z-index:-2}
.chapter-art::after{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(0deg,#221621ec,transparent 75%),linear-gradient(90deg,#38212b66,transparent 75%)}
.folio{position:absolute;top:16px;left:22px;gap:10px;color:#fff3db;font-size:12px;background:#342528d9;border:1px solid #dec09999;padding:4px 9px}
.caption{position:absolute;bottom:18px;left:23px;color:white}.caption p{font:500 13px var(--sans);letter-spacing:.1em;color:#f1dcc3}.caption h2{margin-top:3px;font-size:clamp(26px,2.15vw,40px)}
.chapter-body{position:relative;padding:17px 22px 20px}.chapter-body p{margin:0 0 16px;max-width:calc(100% - 142px);min-height:44px;font-size:15px;line-height:1.6}
.pager{position:absolute;top:17px;right:20px;border-bottom:1px solid var(--line)}.pager button{background:none;min-height:36px;padding:0 5px;color:var(--muted);font-size:13px}.pager button:first-child,.pager button:last-child{font:25px Georgia;min-width:26px}
.modes{display:inline-flex;gap:3px;padding:3px;background:#131a28;border-radius:4px;vertical-align:middle}.modes button{background:none;border-radius:3px;padding:9px 14px;color:var(--muted);font-size:14px}.modes [aria-pressed=true]{background:#f1d09a;color:#322620;box-shadow:0 1px 4px #3c2b271a}
.primary{min-height:44px;border:1px solid #f5d69f;border-radius:var(--hh-radius,6px);color:#32251f;background:linear-gradient(120deg,#ffe9bb,#e1b476);font-weight:600;padding:9px 22px;letter-spacing:.05em}
#enter{float:right;min-width:35%}.chapter-body::after{content:"";display:block;clear:both}.daily-card{width:100%;margin-top:14px;padding:10px 17px;gap:16px;text-align:left;background:linear-gradient(105deg,#30394c,#212638);border-radius:5px}.date-block{border-right:1px solid #b99c7f;padding-right:16px;text-align:center;min-width:55px}.date-block small{display:block;font:11px Georgia;color:var(--wine);letter-spacing:.12em}.date-block b{display:block;font:600 28px/1.05 Georgia,var(--serif)}.daily-card>span:nth-child(2)>b{font:600 20px var(--serif)}.daily-card small:not(.date-block small){display:block;margin-top:3px;color:var(--muted);font-size:13px}.daily-card>i{margin-left:auto;color:var(--wine);font:23px Georgia}
.classic{display:inline-block;margin-top:14px;color:#fae4c9;font-size:13px;border-bottom:1px solid #d4b28b80}
.result-paper{border-radius:5px;padding:20px}.game-heading{justify-content:space-between;gap:8px}.game-heading>div{align-items:start;flex-direction:column;gap:4px}.game-heading h2{font-size:clamp(24px,2vw,34px)}.game-heading .kicker{color:var(--wine)}.quiet,.view-tools button,.book button{border:1px solid var(--line);border-radius:4px;background:#303548;padding:7px 11px;color:var(--ink);font-size:14px}
.stats{margin:13px 0 9px;font-size:14px;gap:14px;font-variant-numeric:tabular-nums}.stats b{font-variant-numeric:tabular-nums}.stats span:last-child{margin-left:auto;color:var(--wine)}.stats .urgent{color:#ff9ca4}
#viewport{width:100%;aspect-ratio:1.55;overflow:clip;position:relative;touch-action:none;user-select:none;border:1px solid #785f4b;background:#4f3b36;border-radius:3px;cursor:grab}#viewport:active{cursor:grabbing}
#world,#backdrop,#objects{position:absolute;inset:0;width:100%;height:100%}#world{transform-origin:0 0;will-change:transform}#backdrop{object-fit:cover;pointer-events:none}.piece{position:absolute;transform:translate(-50%,-50%);aspect-ratio:1;border:0;background:none;padding:0;touch-action:none;min-width:22px}.piece img{display:block;width:100%;height:100%;object-fit:contain;pointer-events:none;filter:drop-shadow(0 1px 1.5px #2a1b166f)}.piece::before{content:"";position:absolute;inset:-5px}.piece.hinted{outline:3px solid #ffdd63;outline-offset:3px;border-radius:50%;box-shadow:0 0 15px #faca65}
.view-tools{justify-content:flex-end;gap:4px;margin-top:7px;color:var(--muted);font-size:12px}.view-tools span{margin-right:auto}.view-tools button{min-width:33px;padding:3px 6px;font-size:13px;min-height:30px}
.collection{margin-top:14px;border-block:1px solid var(--line);padding:10px 0}.collection h3{font-size:17px;margin-bottom:8px}#slots{display:grid;grid-template-columns:repeat(var(--slot-count,5),1fr);gap:4px}.slot{display:flex;flex-direction:column;align-items:center;min-width:0;position:relative;padding:3px 0 5px;border-radius:4px;background:radial-gradient(ellipse at 50% 5%,#535066,#2c3044)}.slot img{height:clamp(28px,3.6vw,48px);width:auto;max-width:90%;object-fit:contain}.slot small{font-size:12px;color:var(--ink)}.slot.done{background:#33483f}.slot.done::after{content:"✓";position:absolute;right:3px;top:0;color:#c6f2cf;font-weight:bold}.advice{gap:10px;min-height:60px;margin-top:11px}.advice>img{width:44px;height:44px;border-radius:50%;object-fit:cover;object-position:60% 13%;border:1px solid var(--brass)}.advice p{flex:1;margin:0;font-size:14px;color:var(--muted)}.advice button{padding:5px 12px;background:#3b3240;color:#fff5dd;border-radius:4px;font-size:14px}.advice small{display:block;color:#f0ce8f}
.fly-piece{position:fixed;pointer-events:none;z-index:6;object-fit:contain;filter:drop-shadow(0 4px 8px #351a1777)}
.result-paper{margin-top:20px}.records{gap:18px;border-block:1px solid var(--line);padding:12px 0;flex-wrap:wrap}.records small,.records b{display:block}.records small{color:var(--muted);font-size:12px}.records b{font:600 22px Georgia,var(--serif);margin-top:4px}
#rating{color:var(--wine);font-size:36px;letter-spacing:.12em}#story h3,.book h3{font:600 22px var(--serif);margin:16px 0 6px}#story p{margin:4px 0;line-height:1.8}#earn{color:var(--wine);font-weight:600}#home{margin-left:8px}
.book{padding:20px;width:min(92vw,590px);max-height:80dvh;overflow:auto;border-radius:6px}.book::backdrop{background:#25191bbc}.book header{justify-content:space-between;border-bottom:1px solid var(--line);margin-bottom:12px;padding-bottom:10px}.book h2{font-size:26px}.book header button{font-size:22px;line-height:1.2}.room-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.book .room-option{justify-content:flex-start;text-align:left;display:flex;align-items:center;gap:10px;padding:5px;line-height:1.3}.room-option img{width:52px;height:42px;object-fit:cover}.room-option small{display:block;color:var(--muted);font-size:11px;margin-bottom:2px}.entry{border-bottom:1px solid var(--line);padding:0 0 11px}.entry p{margin:4px 0}.entry small{color:var(--wine)}
button:hover:not(:disabled){filter:brightness(1.05)}button:active:not(:disabled){translate:0 1px}
@media(min-width:801px) and (max-height:780px){.desk{margin-top:22px}.chapter-art{height:155px}.intro{margin:8px 0 12px}.mast h1{font-size:44px}}
@media(max-width:1050px) and (min-width:801px){.desk{width:50vw;margin-left:3vw}.modes button{padding-inline:9px}.chapter-body{padding:14px}.chapter-body p{max-width:100%;padding-top:36px}.pager{top:4px;right:12px}}
@media(max-width:800px){body{background:#342525}.shop-nav{min-height:47px;padding:4px 16px;background:#302222}.shop-nav>div{gap:12px}.shop-view::after{background:linear-gradient(0deg,#111724da,#14192780 65%,#15213733)}.desk{width:auto;max-width:620px;margin:clamp(144px,22svh,226px) auto 24px;padding:0 13px}.mast{gap:12px}.mast h1,.mast h2{font-size:36px}.seal{width:35px;height:39px;font-size:22px}.kicker{font-size:10px}.intro{font-size:14px;margin:9px 0 13px;line-height:1.55}.chapter-art{height:clamp(130px,19svh,170px)}.folio{top:10px;left:14px;padding:3px 7px;font-size:11px}.caption{bottom:11px;left:14px}.caption h2{font-size:25px}.chapter-body{padding:11px 13px 13px}.chapter-body p{max-width:100%;min-height:0;margin:0 0 10px;font-size:14px}.pager{position:static;float:right;margin:-3px -3px 1px 9px}.pager button{min-height:31px}.modes{clear:both}.modes button{padding:8px 10px;font-size:13px}.primary{min-height:39px;padding:8px 12px}.daily-card{margin-top:10px;padding:8px 12px}.classic{margin-top:9px}.shop-nav,.shop-nav button{font-size:13px}.result-paper{padding:13px}.view-tools span{font-size:11px}.slot small{font-size:11px}.advice>img{width:35px;height:35px}.advice p{font-size:13px}.stats{gap:8px}.room-option img{width:38px}.room-list{gap:5px}.book{padding:13px}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}

#hint{display:flex;align-items:center;justify-content:center;gap:5px;flex:none}
#hint img{width:30px;height:36px;object-fit:contain}
.keepsake-art{display:block;width:100%;height:auto;border:1px solid var(--line);border-radius:3px}
@media(max-width:800px){#hint{padding:5px 7px;gap:3px}#hint img{width:24px;height:30px}}

.shop-nav .hh-button{line-height:1.2;min-height:36px;padding:6px 9px}
.chapter,.result-paper,.book,.daily-card{border-radius:var(--hh-radius,9px)}
.modes.hh-tabs{display:inline-flex;width:auto}.modes .hh-tab{min-height:36px}
#modeName.hh-tag{padding:2px 8px;min-height:0}.pager .hh-button{border:0}
.shop-nav .hh-icon,.daily-card .hh-icon{width:1.05em;height:1.05em;vertical-align:-.12em}.daily-card .hh-icon{margin-right:.35em}
@media(max-width:800px){.shop-nav{background:#1a1d2b}.desk{padding-inline:12px}.shop-nav>div{gap:8px}.shop-nav .hh-button{font-size:13px}}

@media(max-width:800px){.shop-nav{gap:5px;padding-inline:8px}.shop-nav .hh-button{white-space:nowrap;gap:4px;padding-inline:5px}.shop-nav>div{gap:5px}.shop-nav .hh-tilt{padding-inline:3px;white-space:nowrap}}

/* The room keeps its own frame, with the notebook beside it on a wide screen. */
body[data-view=game] .desk {
  --board-width: min(72vw, 154svh);
  --notes-width: clamp(238px, 17vw, 336px);
  --gutter: clamp(14px, 1.5vw, 32px);
  width: min(95%, calc(var(--board-width) + var(--gutter) + var(--notes-width)));
  max-width: none;
  margin: clamp(16px, 2.8svh, 36px) auto 18px;
  padding: 0;
}
.game-heading { margin: 0 0 15px; }
.game-heading > div { flex-direction: row; align-items: center; gap: 13px; }
.game-heading h2 { font-size: clamp(26px, 2.2vw, 44px); text-shadow: 0 2px 12px #111626aa; }
.room-layout { display: grid; grid-template-columns: minmax(0, 1fr) var(--notes-width); align-items: start; gap: var(--gutter); }
.room-board { min-width: 0; }
#viewport {
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 5px;
  outline: 1px solid #ecd3a8b8;
  box-shadow: 0 0 0 4px #1a202d99, 0 16px 40px #07091460;
}
/* The authored coordinates occupy the centered 1.55:1 crop of the 16:9 artwork. */
#objects { inset: 0 auto 0 6.40625%; width: 87.1875%; }
.room-board .view-tools { justify-content: flex-end; margin-top: 12px; gap: 6px; color: #f3e9d6; }
.room-board .view-tools span { text-shadow: 0 1px 6px #101623; font-size: 14px; }
.room-board .view-tools button { min-width: 40px; min-height: 34px; }
.room-notes { padding: clamp(15px, 1.25vw, 26px); }
.collection { padding: 0; margin: 0; border: 0; }
.notes-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 7px; margin: 3px 0 16px; }
.collection h3 { margin: 0; font-size: clamp(20px, 1.3vw, 26px); letter-spacing: .06em; }
#counter { color: var(--wine); font-size: 13px; white-space: nowrap; }
#slots { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.slot { gap: 3px; padding: 9px 4px 8px; border: 1px solid #c4ab8259; border-radius: 6px; }
.slot img { width: 100%; height: clamp(45px, 3.8vw, 72px); }
.slot small { font-size: 14px; }
.stats { justify-content: space-between; margin: 16px 0 0; padding-top: 13px; border-top: 1px solid var(--line); }
.advice { display: grid; gap: 12px; margin-top: 14px; }
.advice p { line-height: 1.6; }
#hint { justify-self: start; padding: 6px 12px; }
#hint span { display: flex; align-items: center; gap: 7px; }
#hint small { font-size: 12px; }

@media (min-width: 801px) and (max-width: 1100px) {
  body[data-view=game] .desk { --notes-width: 210px; --gutter: 14px; width: 96%; }
  .room-notes { padding: 12px; }
  .slot img { height: 40px; }
}
@media (max-width: 800px) {
  body[data-view=game] .desk { width: 100%; margin: 15px 0; }
  .game-heading { margin: 0 12px 11px; }
  .game-heading > div { align-items: flex-start; flex-direction: column; gap: 3px; }
  .game-heading h2 { font-size: 25px; }
  .room-layout { display: block; }
  #viewport { width: 100%; aspect-ratio: 1.55; border-radius: 0; outline: 0; box-shadow: 0 1px 0 var(--line), 0 -1px 0 var(--line); }
  #objects { inset: 0; width: 100%; }
  .room-board .view-tools { margin: 8px 12px 0; }
  .room-board .view-tools span { font-size: 12px; }
  .room-notes { margin: 12px; padding: 12px 14px; }
  .notes-heading { margin: 0 0 9px; }
  #slots { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .slot { flex-direction: row; justify-content: center; gap: 3px; padding: 4px 2px; }
  .slot img { width: 36%; height: 38px; }
  .slot small { font-size: 12px; }
  .stats { margin-top: 10px; padding-top: 9px; }
  .advice { display: flex; gap: 6px; margin-top: 7px; min-height: 42px; }
  .advice p { flex: 1; font-size: 13px; }
  #hint { padding: 5px 8px; }
  #hint span { display: block; }
}
