/* Edition 4 · illustrated chapter entrances and a cel-art adventure interface.
 * This layer preserves story progression, saved data and the tested playfield geometry. */
.st-sheet { --st-ink: #173e50; --st-paper: #fffdf5; }
.st-sheet .c-sheet__head { background: #155a73; border-bottom: 2px solid #f5cf61; }
.st-sheet .c-sheet__title, .st-sheet .c-sheet__x, .st-sheet .st-hbtn { color: #fffdf5; }
.st-sheet .c-sheet__title { letter-spacing: .04em; }
.st-sheet .st-hbtn:not(:disabled):hover, .st-sheet .st-hbtn:active { background: #ffffff24; }
.st-sheet .pl-sound.is-off { color: #c8e5e7; }
.adv-pip { border-color: #b3d2d5; background: #ffffff21; }
.adv-pip.is-earned { border-color: #fff1b0; background: #ffd65b; }

/* Four destinations are four landscape banners, with the chapter marker above the title. */
.cp-hub {
  background: radial-gradient(ellipse at 0 100%, #9eddd85e, transparent 48%),
    repeating-linear-gradient(135deg, transparent 0 39px, #9bc7c215 40px 41px), #f5f8e9;
}
.cp-hub__main { gap: 8px; padding: 10px var(--st-gutter) 6px; }
.cp-hub__head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px;
  min-height: 76px; padding: 6px 12px; border: 2px solid #21566b; border-radius: 18px;
  background: linear-gradient(100deg, #173e50f5, #174c68aa 55%, #174c6833), url('../ui/design4-book.webp') center / cover;
  box-shadow: 0 5px 12px #173e5020; color: #fffdf5;
}
.cp-hub__intro { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.cp-hub__intro > span { color: #b8ebeb; font-size: 12px; font-weight: 700; line-height: 1.3; white-space: nowrap; }
.cp-hub__intro strong { font-size: clamp(16px, 4.7vw, 19px); line-height: 1.35; font-weight: 800; white-space: nowrap; }
.cp-hub__progress { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 4px 6px; border: 1px solid #c6e8e36b; border-radius: 12px; background: #173e50c9; }
.cp-medals { position: relative; gap: 5px; flex-wrap: nowrap; max-width: none; }
.cp-medals::before { content: ''; position: absolute; left: 12px; right: 12px; top: 13px; height: 2px; background: #b8dfd7; }
.cp-medal { position: relative; width: 28px; height: 28px; border: 1px solid #b6d4d6; background: #eaf5f5; color: #476c7a; box-shadow: none; }
.cp-medal b { font-size: 16px; }
.cp-medal.is-earned { border-color: #fff4c7; background: #ffd44e; color: #173e50; box-shadow: 0 0 0 2px #ffdb5860; }
.cp-hub__count { color: #fffdf5; font-size: 12px; line-height: 1.3; letter-spacing: .03em; }
.cp-chapters { flex: none; display: grid; grid-template-columns: 1fr; gap: 7px; }
.cp-chapter {
  --world-ink: #176988;
  position: relative; isolation: isolate; display: block; height: clamp(81px, calc((100svh - 244px) / 4), 156px);
  min-height: 81px; padding: 0; overflow: hidden; border: 2px solid #aecbd0; border-radius: 17px;
  background: #c7e8ed; box-shadow: 0 4px 9px #173e501b; color: #173e50;
}
.cp-chapter[data-chapter="ch2"] { --world-ink: #26704f; }
.cp-chapter[data-chapter="ch3"] { --world-ink: #9a5728; }
.cp-chapter[data-chapter="ch4"] { --world-ink: #65528b; }
.cp-chapter::before {
  content: ''; position: absolute; z-index: 1; inset: 0; pointer-events: none;
  background: linear-gradient(0deg, #fffdf5f5, #fffdf5d9 28%, #fffdf508 68%),
    linear-gradient(90deg, #fffdf560, #fffdf500 60%);
}
.cp-chapter__pic { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 0; background: #c1e4ec; }
.cp-chapter__bg { object-position: center 44%; }
.cp-chapter__ordinal {
  position: absolute; z-index: 2; left: 10px; top: 7px; display: flex; align-items: baseline; justify-content: center; gap: 3px;
  min-width: 44px; padding: 3px 8px; border: 1px solid #fffdf5; border-radius: 10px 3px 10px 3px;
  background: var(--world-ink); color: #fffdf5; box-shadow: 2px 2px 0 #173e5021;
}
.cp-chapter__ordinal b { font-size: 22px; line-height: 1; font-weight: 800; }
.cp-chapter__ordinal > span { font-size: 11px; font-weight: 700; line-height: 1; }
.cp-chapter__copy { position: absolute; z-index: 2; left: 12px; right: 10px; bottom: 9px; display: block; padding: 0; border: 0; background: transparent; }
.cp-chapter__copy small { display: none; }
.cp-chapter__copy strong { display: block; color: #173e50; font-size: clamp(14px, 4.3vw, 18px); font-weight: 800; line-height: 1.35; letter-spacing: .02em; white-space: nowrap; text-shadow: 0 1px 4px #fffdf5; }
.cp-chapter__status { z-index: 2; top: 7px; right: 8px; padding: 3px 10px; border: 1px solid #d8b756; border-radius: 8px; background: #ffdc69; color: #51411b; font-size: 12px; line-height: 1.4; box-shadow: 0 2px 5px #173e5015; }
.cp-chapter:not(:disabled) .cp-chapter__status::after { content: ' ›'; margin-left: 3px; }
.cp-chapter__done, .cp-chapter__lock { position: absolute; z-index: 3; left: auto; top: auto; right: 10px; bottom: 11px; width: 24px; height: 24px; }
.cp-chapter__lock { display: none; }
.cp-chapter__done { right: 8px; top: 8px; bottom: auto; width: 25px; height: 25px; font-size: 15px; }
.cp-chapter.is-complete { border-color: #7fb398; }
.cp-chapter.is-complete .cp-chapter__status { right: 40px; border-color: #aac9aa; background: #e0f2db; color: #2c6243; }
.cp-chapter.is-locked { border-color: #bfd0ce; background: #dcebe6; box-shadow: 0 3px 8px #173e5014; }
.cp-chapter.is-locked .cp-chapter__bg { opacity: .82; filter: saturate(.85); }
.cp-chapter.is-locked .cp-chapter__copy { background: transparent; }
.cp-chapter.is-locked .cp-chapter__copy strong { color: #41616c; }
.cp-chapter.is-locked .cp-chapter__ordinal { background: #607d80; }
.cp-chapter.is-locked .cp-chapter__status { border-color: #bdced0; background: #eef6f1e8; color: #4c6971; }
.cp-chapter.is-locked .cp-chapter__status::before { content: '🔒'; margin-right: 4px; font-size: 10px; }
.cp-hub__foot { padding-top: 6px; padding-bottom: calc(10px + var(--safe-b, 0px)); background: linear-gradient(#f5f8e900, #f5f8e9 24%); }
.cp-objective--go {
  border: 2px solid #927127; border-radius: 16px; background: linear-gradient(110deg, #ffdd68, #ffeaa1 65%, #ffda5b);
  box-shadow: 0 4px 0 #b68c2b35, 0 6px 14px #80652222; color: #173e50;
}
.cp-objective__chapter { padding-right: 12px; border-right: 1px solid #ac872f6b; }
.cp-objective--all { min-height: 48px; background: #fffdf5c9; border: 1px solid #c4d7cd; border-radius: 14px; }

/* A speaker ribbon, a framed portrait and a squared next button form a speech panel. */
.adv-dialogue, .cp-dialogue {
  border: 2px solid #29576b; border-radius: 20px 20px 7px 20px;
  background: linear-gradient(180deg, #e5f1f4 0 18px, #fffdf5 18px 100%);
  box-shadow: 0 5px 0 #173e502b, 0 10px 22px #173e5026;
}
.adv-dialogue__name, .cp-dialogue__name {
  top: -18px; border: 2px solid #fffdf5; border-radius: 8px 8px 8px 2px; padding: 4px 14px;
  box-shadow: 0 3px 0 #173e502a; letter-spacing: .09em;
}
.st-sheet .adv-dialogue > .pl-face, .st-sheet .cp-dialogue > .pl-face {
  border: 2px solid #25556c; border-radius: 16px 16px 16px 5px; background: #fffdf5; box-shadow: 0 3px 0 #173e5029;
}
.adv-linecount i, .cp-linecount i { width: 11px; height: 5px; border-radius: 3px; border-width: 1px; }
.adv-next, .cp-next {
  border: 2px solid #27637b; border-radius: 15px; background: #ffdc66;
  color: #17475c; box-shadow: 0 3px 0 #1b4e643d, inset 0 2px 0 #fff1b4;
}
.adv-next:active, .cp-next:active { box-shadow: 0 1px 0 #1b4e643d; }
.adv-panel {
  border: 2px solid #29576b; border-radius: 21px 21px 8px 21px;
  background: linear-gradient(145deg, #fffdf5 50%, #e9f6f4); box-shadow: 0 5px 0 #173e5024, 0 10px 20px #173e501e;
}
.adv-kicker { color: #27738a; }
.adv-choice { border: 2px solid #84b5bd; border-radius: 15px; background: #fffdf5; box-shadow: 0 3px 0 #5a9ba32a; color: #173e50; }
.adv-choice.is-correct { border-color: #39875c; background: #e5f4d0; box-shadow: 0 3px 0 #39774e29; }
.adv-reference { border: 2px solid #d3b259; border-radius: 14px; background: #fff3c9; }
.adv-hint summary { border: 1px solid #96ba9b; background: #e0efd1; color: #3e6647; }
.adv-node { border: 2px solid #739eac; border-radius: 18px 5px 18px 5px; box-shadow: 0 5px 0 #173e5033, 0 9px 18px #173e501d; }
.adv-node__number { border: 2px solid #fffdf5; width: 30px; height: 30px; font-size: 15px; box-shadow: 0 2px 0 #173e5033; }
.adv-node.is-complete { border: 2px solid #c9a84b; background: #fff1bb; }
.adv-story-band { border: 2px solid #a9c5b6; border-radius: 13px; background: #fff9df; box-shadow: 0 3px 0 #173e5015; }
.adv-story-band__label { border-radius: 6px; background: #ffda60; color: #5a471a; }
.adv-map__heading { color: #19495f; text-shadow: 0 1px 0 #fffdf5, 0 0 8px #fffdf5; }
.adv-btn, .cp-button, .cg-btn { border-width: 2px; border-color: #89aeb9; border-radius: 14px; color: #17475c; }
.adv-btn--primary, .cp-button--primary, .cg-btn--primary { border-color: #927127; background: #ffdc66; color: #173e50; box-shadow: 0 3px 0 #a9802b45, inset 0 2px 0 #fff0b3; }
.adv-btn--quiet, .cp-button--quiet, .cg-btn--quiet { background: #eaf6f6; }

/* Each minigame has its own illustrated setting and a clear colored header. */
.cg-game { --world-ink: #276e7c; --world-bg: url('../ui/campaign/festival-20261017.webp'); background: linear-gradient(#fffdf5e8, #fffdf5f0), var(--world-bg) center / cover; }
.cg-game--seek { --world-ink: #306e47; --world-bg: url('../ui/campaign/farm-20261017.webp'); }
.cg-game--plate { --world-ink: #895a2b; --world-bg: url('../ui/campaign/kitchen-20261017.webp'); }
.cg-game--festival { --world-ink: #58658b; }
.cg-top { border-bottom: 2px solid #fff3bc; background: linear-gradient(90deg, var(--world-ink), #194554c9), var(--world-bg) center 45% / cover; }
.cg-top h3 { color: #fffdf5; font-weight: 800; text-shadow: 0 1px 1px #173e504a; }
.cg-help { color: #fff3c6; }
.cg-help::before { border-width: 2px; }
.cg-stamp { color: #ffffff73; }
.cg-stamp.is-earned { color: #ffdf6a; text-shadow: 0 1px 1px #173e50; }
.cg-bar, .cg-complete__bar { border-top: 2px solid #a7c4c5; background: #fffdf5; }
.cg-status { border: 0; border-left: 4px solid var(--world-ink); border-radius: 5px 12px 12px 5px; background: #eaf3ee; color: #31565d; }
.cg-target { border: 2px solid #69966e; background: #dfedc9; border-radius: 14px; }
.cg-target__picture { border: 2px solid #fffdf5; background: #fffdf5; box-shadow: 0 2px 4px #28513825; }
.cg-target small { color: #486d45; }
.cg-garden { border: 2px solid #75a25e; background: radial-gradient(ellipse at 0 100%, #bed98d 0 18%, transparent 18.5%), #d9eab7; box-shadow: inset 0 -3px 0 #86ae5e33; }
.cg-food, .cg-plant, .cg-pantry .cg-food, .cg-delivery .cg-food { border: 2px solid #9ab7af; border-radius: 13px; background: #fffef8; box-shadow: 0 3px 0 #456f5b27; }
.cg-food[aria-pressed="true"] { border-color: #176f8b; background: #d4eef1; box-shadow: 0 0 0 2px #ffcf50, 0 3px 0 #173e5033; }
.cg-plant.is-harvested { border: 2px solid #4a884a; background: #fff1a8; }
.cg-tray { border: 2px solid #a87940; border-radius: 18px; background: linear-gradient(180deg, #efd39a, #e4bb78); box-shadow: inset 0 3px 0 #fff0c2, inset 0 -3px 0 #b9874438; }
.cg-slot { border: 2px solid #7495ab; background: #fffef8; box-shadow: 0 3px 0 #77552c36, inset 0 0 0 2px #edf4f4; }
.cg-slot[data-slot="soup"] { border: 2px solid #ac6d43; box-shadow: 0 3px 0 #77552c36, inset 0 0 0 2px #fbecda; }
.cg-request { border: 2px solid #c3a757; border-radius: 18px 18px 5px 18px; background: #fff0bc; box-shadow: 0 4px 0 #94763324; }
.cg-order li { border: 2px solid #b4c4b8; border-radius: 12px; background: #fffef8; }
.cg-order b { border-color: #fffdf5; background: #516b8d; }
.cg-complete__card { border: 2px solid #bc9644; background: radial-gradient(circle at 50% 0, #fff9d8, #ffe49a); box-shadow: 0 5px 0 #8a69212c; }
.cg-complete__ribbon { background: #245f79; border-radius: 6px; }
.cp-eyebrow { border: 1px solid #d2ab44; border-radius: 7px; background: #ffda63; }
.cp-reward__title { padding-inline: 30px; border: 0; border-left: 3px solid #e4bd54; background: #fffdf5b0; }
.cp-reward h3 { word-break: keep-all; line-break: strict; overflow-wrap: anywhere; text-wrap: balance; }
.cp-reward__bg { opacity: .32; }
.cp-reward::after { background: radial-gradient(circle at 50% 28%, #fff2b9f0, #f0f8e6dd 64%); }
.cp-reward__main, .adv-finale .adv-screen__main { isolation: isolate; }
.cp-reward__main::before, .adv-finale .adv-screen__main::after {
  content: ''; position: absolute; z-index: -1; left: -5%; right: -5%; top: 48%; height: 38%;
  background: linear-gradient(100deg, #ffe798ad, #ffdb79d9 35%, #ffe798b0);
  border-block: 1px solid #d6b354; transform: rotate(-2deg); pointer-events: none;
}
.cp-reward__title, .adv-finale__title { border-radius: 5px 12px 12px 5px; border: 0; border-left: 3px solid #bd922b; background: #fffdf5db; box-shadow: none; color: #31576a; }
.adv-finale .adv-kicker { border-radius: 7px; background: #ffda63; border-color: #caaa4b; color: #5a471a; }
.adv-finale h3 { color: #173e50; }
.adv-story-summary { border: 2px solid #a9c5b6; background: #f4f7df; border-radius: 14px; }
.adv-story-mark { border-radius: 10px; background: #ffe191; }
.adv-journal > p:not(.adv-journal-resume) { padding: 10px 12px; border: 1px solid #c4d9da; border-left: 4px solid #3f8094; border-radius: 5px 12px 12px 5px; background: #fffdf5; box-shadow: 0 3px 8px #173e500c; }
.adv-journal p > strong { display: inline-block; margin-bottom: 4px; padding: 1px 8px; border-radius: 5px; background: #e2f0ef; color: #225b71; }

@media (max-width: 359px) {
  .cp-hub__head { gap: 6px; padding-inline: 9px; }
  .cp-hub__intro > span { font-size: 12px; }
  .cp-hub__intro strong { font-size: 16px; }
  .cp-medals { gap: 4px; }
  .cp-medal { width: 26px; height: 26px; }
  .cp-medals::before { top: 12px; }
  .cp-chapter__copy strong { font-size: 14px; }
  .cp-chapter__status { font-size: 12px; }
}
@media (max-width: 599px) and (max-height: 600px) and (orientation: portrait) {
  .adv-map__frame { min-height: min(330px, calc(100svh - 256px)); }
}
@media (orientation: landscape) and (max-height: 499px) {
  .cp-hub { grid-template-columns: minmax(218px, 34fr) minmax(0, 66fr); }
  .cp-hub__head { display: flex; flex-direction: column; justify-content: center; gap: 16px; margin: 8px 6px 0 12px; padding: 12px 8px; background-position: 30% center; text-align: center; }
  .cp-hub__intro { gap: 6px; }
  .cp-hub__intro > span { font-size: 12px; }
  .cp-hub__intro strong { font-size: 21px; }
  .cp-hub__progress { gap: 8px; }
  .cp-medal { width: 31px; height: 31px; }
  .cp-medal b { font-size: 18px; }
  .cp-medals::before { top: 15px; }
  .cp-hub__count { font-size: 12px; }
  .cp-chapters { display: grid; grid-template-columns: 1fr; grid-template-rows: repeat(4, minmax(0, 1fr)); gap: 5px; padding: 8px 12px calc(8px + var(--safe-b, 0px)) 0; }
  .cp-chapter { height: auto; min-height: 64px; border-radius: 13px; }
  .cp-chapter__pic { width: 100%; height: 100%; }
  .cp-chapter__ordinal { left: 8px; top: 5px; min-width: 37px; padding: 2px 6px; }
  .cp-chapter__ordinal b { font-size: 18px; }
  .cp-chapter__ordinal > span { font-size: 10px; }
  .cp-chapter__copy { left: 10px; right: 8px; bottom: 6px; }
  .cp-chapter__copy strong { font-size: 15px; }
  .cp-chapter__status { top: 5px; right: 7px; padding: 2px 9px; font-size: 12px; }
  .cp-hub__foot { padding-right: 6px; background: none; }
  .cp-objective { gap: 8px; padding-inline: 8px; }
  .cp-objective__chapter { padding-right: 8px; font-size: 15px; }
  .cp-objective__go { font-size: 17px; }
  .adv-dialogue__name, .cp-dialogue__name { top: -18px; }
}
@media (min-width: 600px) and (min-height: 500px) {
  .cp-hub__main { gap: 14px; padding-top: 16px; }
  .cp-hub__head { min-height: 92px; padding: 16px 24px; }
  .cp-hub__intro > span { font-size: 13px; }
  .cp-hub__intro strong { font-size: 26px; }
  .cp-medal { width: 36px; height: 36px; }
  .cp-medal b { font-size: 21px; }
  .cp-medals { gap: 12px; }
  .cp-medals::before { top: 17px; }
  .cp-hub__count { font-size: 12px; }
  .cp-chapters { flex: 1 1 auto; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(150px, 1fr); gap: 14px; }
  .cp-chapter { height: auto; min-height: 150px; border-radius: 20px; }
  .cp-chapter__ordinal { left: 14px; top: 12px; min-width: 54px; padding: 5px 10px; }
  .cp-chapter__ordinal b { font-size: 30px; }
  .cp-chapter__ordinal > span { font-size: 13px; }
  .cp-chapter__copy { left: 18px; right: 12px; bottom: 15px; }
  .cp-chapter__copy strong { font-size: 21px; line-height: 1.4; white-space: normal; }
  .cp-chapter__status { top: 13px; right: 12px; font-size: 13px; }
  .cp-chapter.is-complete .cp-chapter__status { right: 47px; }
  .cp-chapter__done { top: 13px; right: 12px; }
}
