/* Chapter 1 · A painted map, character stage and a hand-built treasure.
 * The first section ("ものがたりの画面") lays out every story screen, chapter 1 (.adv-*) and the
 * campaign (.cp-*) alike: one top bar, a stage that fills the screen, the dialogue box at the bottom.
 * The sheet itself (kind 'screen') is the foundation's; this file only sizes what is inside it.
 * Map node centres (percent of the map frame): phones (30,17) (70,50) (30,83); wide and landscape
 * (20,44) (50,64) (80,44).
 */
.st-sheet {
  --st-ink: #173d59; --st-paper: #fffef8; --st-line: #d7dfcb; --st-gutter: 12px;
}
.adv-sheet {
  --adv-ink: #214a49; --adv-muted: #536d67; --adv-green: #286c58;
  --adv-paper: #fffdf1; --adv-line: #d4decb; --adv-gold: #f4c654;
  --adv-gold-deep: #89651e; --adv-shadow: rgba(27,69,58,.16);
}

/* ============ ものがたりの画面 (chapter 1 and the campaign) ============ */

/* -- the top bar: [×][title][tools][音], 44 px on phones -- */
.st-sheet .c-sheet__panel { background: var(--st-paper); }
.st-sheet .c-sheet__head {
  z-index: 10; gap: 2px; min-height: 44px; height: 44px; padding: 0 4px;
  color: var(--st-ink); background: var(--st-paper); border-bottom: 2px solid var(--st-ink);
}
.st-sheet .c-sheet__x { order: 0; margin-left: 0; color: var(--st-ink); }
.st-sheet .c-sheet__title { order: 2; flex: 1 1 auto; min-width: 0; padding: 0 4px; font-family: var(--font-body); font-size: 16px; font-weight: 700; line-height: 1.3; white-space: nowrap; overflow: hidden; }
.st-sheet .c-sheet__tools { order: 3; flex: none; gap: 2px; }
.st-sheet .pl-sound { order: 4; }
.cp-sheet .c-sheet__tools { order: 1; }
/* The chapter's name joins 「第１章」 where the bar has room for it (landscape and 600 px wide; a portrait phone bar holds × 会話 地図 音 and the gems). */
.st-title__sub { display: none; }
/* furigana wider than its kanji (しょくたく over 食卓) reaches over the neighbours instead of spacing the words apart */
.st-title rt { margin-inline: -.6em; }
.st-hbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 2px; flex: none;
  min-width: 44px; height: 44px; padding: 0 6px; border: 0; border-radius: 12px; background: transparent;
  color: var(--st-ink); font: 700 14px/1 var(--font-body); letter-spacing: 0; white-space: nowrap; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.st-hbtn .c-icon { width: 24px; height: 24px; }
.st-hbtn:active { background: #fff3b8; transform: scale(.95); }
.st-hbtn:disabled { color: #8a9aa4; cursor: default; }
.st-hbtn:focus-visible { outline: 3px solid #176c86; outline-offset: -3px; }
.pl-sound.is-off { color: #6a7d89; }
@media (hover: hover) and (pointer: fine) { .st-hbtn:not(:disabled):hover { background: #fff7d3; } }

/* fragments collected (chapter 1): three small gems, drawn without text */
.adv-tools { display: flex; flex-wrap: nowrap; align-items: center; gap: 2px; }
.adv-progress { display: flex; flex: none; align-items: center; gap: 5px; padding: 0 6px 0 2px; }
.adv-pip { display: block; width: 13px; height: 13px; border: 2px solid #8fa79a; border-radius: 3px; background: #fffdf3; transform: rotate(45deg); }
.adv-pip.is-earned { border-color: #9d7622; background: linear-gradient(135deg, #fff2a9, #edbb3c); box-shadow: 0 0 0 2px #f3cf6044; }
.adv-saving { flex: none; padding: 0 6px; color: #5b6e63; font-size: 12px; font-weight: 700; line-height: 44px; white-space: nowrap; }
.adv-saving:not([hidden]) ~ .adv-progress { display: none; }

/* -- the body: one screen, the view fills it (the body scrolls only if a very short screen needs it) -- */
.st-sheet .c-sheet__body { display: flex; flex-direction: column; padding: 0; overflow-x: hidden; }
.adv-app, .cp-app { position: relative; flex: 1 0 auto; display: flex; flex-direction: column; min-width: 0; color: var(--st-ink); }
.adv-content, .cp-content { position: relative; isolation: isolate; flex: 1 0 auto; display: flex; flex-direction: column; min-width: 0; }
.adv-content > *, .cp-content > * { flex: 1 0 auto; min-width: 0; }
.adv-app *, .cp-app * { box-sizing: border-box; }
.adv-app h3, .adv-app p, .cp-app h3, .cp-app p { margin-top: 0; }
.adv-app img { max-width: 100%; }

/* -- stage: the painted place fills the screen; the cast stands on the box below it.
 * The light and art reach past the edges: clip (not hidden) so focus or scrollIntoView can never scroll the stage. -- */
.adv-stage, .cp-stage {
  position: relative; isolation: isolate; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 8px var(--st-gutter) calc(12px + var(--safe-b, 0px)); overflow: hidden; overflow: clip; background: #c9e7d6;
}
.adv-stage__background, .cp-stage__bg { position: absolute; z-index: -3; inset: 0; width: 100%; height: 100%; max-width: none!important; object-fit: cover; object-position: center 40%; }
.adv-stage::before { content: ''; position: absolute; z-index: -2; inset: 0; pointer-events: none; background: linear-gradient(180deg, #f8f6dd22 0%, #dce4bc11 48%, #1c674033 75%, #16473666 100%); }
.cp-stage::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(#ffffff00, #ffffff00 50%, #e9faff88); pointer-events: none; }
.adv-stage__light { position: absolute; z-index: -1; inset: -20%; background: conic-gradient(from 135deg at 22% 0, #fff7b900 0deg, #fff7b945 14deg, #fff7b900 25deg, #fff7b926 39deg, transparent 55deg); pointer-events: none; }
.adv-stage__motes { position: absolute; z-index: -1; inset: 0; pointer-events: none; }
.adv-cast, .cp-cast { position: relative; flex: 1 1 auto; width: 100%; max-width: 760px; min-height: 200px; max-height: 470px; margin: 0 auto -6px; }
.adv-cast::before, .cp-cast::before { content: ''; position: absolute; left: 7%; right: 7%; bottom: -4px; height: 36px; border-radius: 50%; background: radial-gradient(ellipse, #234f4a44, transparent 70%); pointer-events: none; }
.adv-person, .cp-person { position: absolute; bottom: 0; left: 50%; z-index: 1; display: flex; align-items: flex-end; justify-content: center; width: 43%; height: 90%; transform: translateX(-50%); transform-origin: 50% 95%; }
.adv-person[data-person="boy"], .cp-person[data-person="boy"] { left: 22%; z-index: 2; }
.adv-person[data-person="teacher"], .cp-person[data-person="teacher"] { left: 50%; height: 100%; z-index: 1; }
.adv-person[data-person="girl"], .cp-person[data-person="girl"] { left: 78%; z-index: 3; }
.adv-person img, .cp-person img.cp-pose { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
.cp-person__visual { width: 100%; height: 100%; }
.adv-person.is-speaking, .cp-person.is-speaking { z-index: 4; }

/* -- dialogue box: face and name on its top edge, three lines, the round ▶ at the bottom right -- */
.adv-dialogue, .cp-dialogue {
  --pl-face: 56px;
  position: relative; z-index: 5; flex: none; width: 100%; max-width: 860px; min-height: 120px; margin: 0 auto;
  --st-next: 56px; padding: 30px 14px 12px 16px; border: 2px solid var(--st-ink); border-radius: 20px;
  background: var(--st-paper); box-shadow: 0 4px 0 #173d5933, 0 10px 24px #173d5922; color: #24414f; cursor: pointer;
}
.adv-dialogue > .pl-face, .cp-dialogue > .pl-face { position: absolute; z-index: 3; top: calc(var(--pl-face) * -.5); left: 12px; }
.adv-dialogue__name, .cp-dialogue__name {
  position: absolute; top: -16px; left: calc(var(--pl-face) + 18px); max-width: calc(100% - var(--pl-face) - 96px);
  padding: 3px 14px; border: 2px solid var(--st-ink); border-radius: 12px; background: var(--speaker-color, #2d6f56); color: #fffdf0;
  font: 700 14px/1.4 var(--font-body); letter-spacing: .08em; white-space: nowrap; text-align: center;
}
.adv-dialogue:not(.pl-has-face) .adv-dialogue__name, .cp-dialogue:not(.pl-has-face) .cp-dialogue__name { left: 16px; }
.adv-dialogue__text, .cp-dialogue__text { --pl-min-lines: 3; min-height: 3.4em; margin: 0; font-family: var(--font-body); font-size: 17px; font-weight: 400; line-height: 1.7; letter-spacing: .02em; }
/* The ▶ sits beside the last two lines; the first line runs the full width (a float with a notch at its foot). */
.adv-dialogue__text::before, .cp-dialogue__text::before { content: ''; float: right; width: calc(var(--st-next) + 4px); height: calc(var(--pl-lines, 3) * 1.7em); margin-right: -6px; shape-outside: inset(calc((var(--pl-lines, 3) - 2) * 1.7em) 0 0 0); pointer-events: none; }
.adv-dialogue__text rt, .cp-dialogue__text rt { font-size: 10px; }
.adv-linecount, .cp-linecount { position: absolute; top: 9px; right: 18px; display: flex; gap: 5px; }
.adv-linecount i, .cp-linecount i { display: block; width: 7px; height: 7px; border: 1.5px solid #8aa0ad; border-radius: 50%; background: #fff; }
.adv-linecount i.is-on, .cp-linecount i.is-on { border-color: var(--speaker-color, #2d6f56); background: var(--speaker-color, #2d6f56); }
.adv-next, .cp-next {
  position: absolute; right: 8px; bottom: 8px; display: grid; place-items: center; width: var(--st-next); height: var(--st-next); min-width: 0; min-height: 0; padding: 0;
  border: 2px solid var(--st-ink); border-radius: 50%; background: linear-gradient(180deg, #ffe898, #f5cd5a); color: var(--st-ink);
  box-shadow: 0 4px 0 #a8842c; font: 700 20px/1 var(--font-body); cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.adv-next__arrow, .cp-next__arrow { display: block; margin-left: 4px; line-height: 1; }
.adv-next:active, .cp-next:active { transform: translateY(3px); box-shadow: 0 1px 0 #a8842c; }
.adv-next:focus-visible, .cp-next:focus-visible { outline: 3px solid #176c86; outline-offset: 3px; }

/* -- panel: a choice or a question under the stage (the cast stays above it) -- */
.adv-panel {
  position: relative; z-index: 5; flex: none; display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 720px; margin: 0 auto;
  padding: 14px; border: 2px solid var(--st-ink); border-radius: 20px; background: var(--st-paper);
  box-shadow: 0 4px 0 #173d5933, 0 10px 24px #173d5922; color: var(--adv-ink); text-align: center;
}
.adv-panel h3 { margin: 0; font-family: var(--font-title, var(--font-display)); font-size: 18px; font-weight: 400; line-height: 1.4; letter-spacing: .04em; color: var(--st-ink); word-break: keep-all; line-break: strict; overflow-wrap: anywhere; text-wrap: balance; }
.adv-panel > p { margin: 0; color: #4f6a5c; font-size: 15px; line-height: 1.6; }
.adv-kicker { display: block; color: #4e705e; font-size: 13px; font-weight: 700; line-height: 1.5; letter-spacing: .08em; }

/* ============ chapter 1 ============ */
/* Shared actions. */
.adv-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px;
  border: 2px solid #94b2bf; border-radius: 14px; background: #fff; color: #2e644c; box-shadow: 0 3px 0 #c1d6df;
  font: 700 15px/1.4 var(--font-body); letter-spacing: .04em; text-align: center; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform .18s, box-shadow .18s, background .18s; touch-action: manipulation;
}
.adv-btn--primary { min-height: 56px; border-color: #856126; background: #ffd447; color: #4f371b; box-shadow: 0 4px 0 #b6812b; font-size: 17px; }
.adv-btn--quiet { border-color: #d3dcc5; background: #fffdf0; color: #52705e; box-shadow: 0 2px 0 #d3dcc54d; font-size: 14px; }
.adv-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #8d9b6d; }
.adv-btn:disabled, .adv-btn[aria-disabled="true"] { color: #6b7867; border-color: #c0cbb5; background: #e4e9dc; box-shadow: 0 2px 0 #bbc5b1; cursor: default; }
.adv-app button:focus-visible, .adv-app summary:focus-visible { outline: 3px solid #176c86; outline-offset: 3px; }

/* Choices: two destinations, or three pictures to compare with the example. */
.adv-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; max-width: 560px; margin: 0 auto; }
.adv-choices--two { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 460px; }
.adv-choice {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; min-height: 104px; padding: 8px 4px;
  border: 2px solid #b9c9ad; border-radius: 16px; background: linear-gradient(155deg, #fff, #f5f6e8); color: #335e4d;
  box-shadow: 0 4px 0 #bdcdb1; cursor: pointer; transition: transform .2s, border-color .2s, box-shadow .2s; touch-action: manipulation;
}
.adv-choice img { width: 68px; height: 68px; max-width: 95%; object-fit: contain; }
.adv-choice span, .adv-choice strong { font-size: 15px; line-height: 1.35; font-weight: 700; white-space: nowrap; }
/* a destination name of nine letters or more may take two lines, at its space only */
.adv-choices--two .adv-choice strong { white-space: normal; word-break: keep-all; line-break: strict; text-wrap: balance; }
.adv-choices--two .adv-choice { min-height: 120px; }
.adv-choices--two .adv-choice img { width: 76px; height: 76px; }
.adv-choice.is-correct { border-color: #4c9664; background: #f0f8de; box-shadow: 0 4px 0 #65935e; }
.adv-choice.is-correct::after { content: '✓'; position: absolute; top: -10px; right: -6px; display: grid; place-items: center; width: 30px; height: 30px; border: 2px solid #fffde9; border-radius: 50%; color: #fff; background: #347753; font-size: 17px; font-weight: 700; }
.adv-choice:active { transform: translateY(3px); box-shadow: 0 1px 0 #a4bc93; }
.adv-question__heading { display: flex; align-items: center; gap: 12px; text-align: left; }
.adv-question__copy { flex: 1 1 auto; min-width: 0; }
.adv-question__copy .adv-kicker { margin-bottom: 2px; }
.adv-reference { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; width: 88px; padding: 4px; border: 2px dashed #d4af4e; border-radius: 16px; background: #fffef9; }
.adv-reference img { width: 64px; height: 64px; object-fit: contain; }
.adv-reference span { color: #7b652d; font-size: 12px; font-weight: 700; line-height: 1.4; }
.adv-hint { align-self: center; max-width: 100%; color: #4e6c53; }
.adv-hint summary { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border: 2px solid #c9d8b7; border-radius: 99px; background: #f0f5e4; font-size: 14px; font-weight: 700; cursor: pointer; list-style: none; }
.adv-hint summary::-webkit-details-marker { display: none; }
.adv-hint[open] summary { background: #fff3b8; border-color: #d4af4e; }
.adv-hint p { margin: 6px 0 0; font-size: 15px; line-height: 1.6; word-break: keep-all; line-break: strict; text-wrap: pretty; }
.adv-memory-intro > .adv-btn { align-self: center; min-width: 240px; }
.adv-save-error { position: absolute; z-index: 30; top: 8px; left: 12px; right: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 14px; border: 2px solid #d0a46d; border-radius: 14px; background: #fff2de; color: #7b4c25; font-size: 14px; font-weight: 700; line-height: 1.6; text-align: center; box-shadow: 0 6px 18px #7b4c2533; }
.adv-save-error p { margin: 0; }

/* Map: one screen. A one-line story band, the heading, the frame with three places, the status. */
.adv-map { position: relative; isolation: isolate; display: flex; flex-direction: column; gap: 6px; padding: 8px var(--st-gutter) calc(10px + var(--safe-b, 0px)); overflow: hidden; overflow: clip; background: #d8ecdc; }
.adv-map::after { content: ''; position: absolute; z-index: -1; inset: 0; background: linear-gradient(180deg, #edf5dde6, transparent 30%, #edf5dd26 70%, #f6f4dfcc 100%); pointer-events: none; }
.adv-map__image { position: absolute; z-index: -2; inset: 0; width: 100%; height: 100%; max-width: none!important; object-fit: cover; object-position: 58% center; opacity: .86; }
.adv-map__heading { position: relative; z-index: 2; margin: 2px 0 0; color: var(--st-ink); font-family: var(--font-title, var(--font-display)); font-size: 20px; font-weight: 400; line-height: 1.35; letter-spacing: .05em; text-align: center; text-shadow: 0 2px 0 #fff, 0 -1px 0 #fff, 2px 0 0 #fff, -2px 0 0 #fff; }
.adv-map__frame { position: relative; flex: 1 1 auto; min-height: 330px; }
.adv-map__route { position: absolute; z-index: 0; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.adv-map__route--desktop { display: none; }
.adv-map__route path { fill: none; stroke: #fffbdd; stroke-width: 3px; stroke-dasharray: 7 8; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.adv-node {
  position: absolute; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 146px; min-height: 108px; padding: 8px 6px 7px; gap: 1px; transform: translate(-50%, -50%);
  border: 2px solid #42718a; border-radius: 22px; color: #244c43; text-align: center; background: #fffef6;
  box-shadow: 0 5px 0 #315f7b36, 0 10px 24px #294c3026; cursor: pointer; transition: transform .22s, box-shadow .22s, border-color .22s; touch-action: manipulation;
}
.adv-node[data-node="harbor"] { left: 30%; top: 17%; --node-color: #277b96; }
.adv-node[data-node="market"] { left: 70%; top: 50%; --node-color: #8c652b; }
.adv-node[data-node="memory"] { left: 30%; top: 83%; --node-color: #8a4b7e; }
.adv-node__art { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: radial-gradient(circle, #fff 12%, #fff7ddaa 65%, transparent 67%); }
.adv-node__art img { width: 56px; height: 56px; object-fit: contain; }
.adv-node__number { position: absolute; left: -8px; top: -9px; display: grid; place-items: center; width: 28px; height: 28px; border: 2px solid #fff7d9; border-radius: 50%; color: #fff; background: var(--node-color, #178cba); font: 700 13px/1 var(--font-body); }
.adv-node strong { font-size: 15px; line-height: 1.4; font-weight: 700; letter-spacing: 0; white-space: nowrap; }
.adv-node small { display: block; color: #4f6359; font-size: 12px; line-height: 1.4; font-weight: 700; white-space: nowrap; }
.adv-node.is-complete { border-color: #e4b949; background: linear-gradient(145deg, #fffbed, #fff2bd); box-shadow: 0 5px 0 #a8843a55, 0 10px 24px #7c633122; }
.adv-node.is-complete::after { content: '✓'; display: grid; place-items: center; position: absolute; right: -7px; top: -9px; width: 28px; height: 28px; border: 2px solid #fffce9; border-radius: 50%; color: #fff; background: #347753; font-size: 15px; font-weight: 700; }
.adv-node.is-locked { background: linear-gradient(145deg, #eef2e5, #e1e8d9); border-color: #a9b9a5; color: #5a7062; box-shadow: 0 4px 0 #6a866344; cursor: default; }
.adv-node.is-locked .adv-node__art { opacity: .55; }
.adv-node.is-locked .adv-node__number { background: #7a8d79; }
.adv-map__bottom { position: relative; z-index: 3; flex: none; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.adv-map__status { margin: 0 auto; max-width: 100%; padding: 6px 14px; border-radius: 99px; background: #fffdf0e6; color: #3b634d; font-size: 15px; font-weight: 700; line-height: 1.5; text-align: center; }
.adv-map__bottom .adv-btn--primary { width: 100%; max-width: 420px; align-self: center; }

/* Fragment and finale: one centred card; the main button at the bottom, the others small beside each other. */
.adv-screen { position: relative; isolation: isolate; display: flex; flex-direction: column; overflow: hidden; overflow: clip; text-align: center; }
.adv-screen__main { position: relative; flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 16px 16px 8px; }
.adv-screen__main h3 { margin: 0; font-family: var(--font-title, var(--font-display)); font-size: 24px; font-weight: 400; line-height: 1.4; letter-spacing: .05em; color: var(--st-ink); }
.adv-screen__main p { max-width: 480px; margin: 0; font-size: 15px; font-weight: 700; line-height: 1.7; color: #5f5a3c; text-wrap: pretty; }
.adv-screen__actions { position: relative; flex: none; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 8px var(--st-gutter) calc(14px + var(--safe-b, 0px)); }
.adv-screen__actions > .adv-btn--primary { width: 100%; max-width: 420px; }
.adv-screen__more { display: flex; justify-content: center; gap: 8px; width: 100%; max-width: 420px; }
.adv-screen__more > .adv-btn { flex: 1 1 0; min-width: 0; padding: 8px 6px; }
.adv-fragment { background: radial-gradient(circle at 50% 34%, #ffedaa 0%, #fff9dc 37%, #fffdf2 71%); }
.adv-fragment .adv-screen__main::before { content: ''; position: absolute; z-index: -1; width: 220px; height: 220px; top: calc(50% - 170px); left: calc(50% - 110px); border: 1px solid #e7c87455; border-radius: 50%; box-shadow: 0 0 0 17px #f3d99014, 0 0 0 34px #f3d9900d; }
.adv-fragment h3 { color: #5a6436; }
.adv-fragment__count { padding: 2px 14px; border-radius: 99px; background: #fff3c4; color: #765a21!important; font-size: 14px!important; }
.adv-gem { --gem-light: #a2eaff; --gem-main: var(--gem-color, #48add4); --gem-dark: #2c739b; position: relative; display: block; width: min(96px, 18svh); aspect-ratio: 105 / 116; margin: 4px auto 8px; font-size: 0; -webkit-clip-path: polygon(50% 0, 90% 21%, 100% 66%, 50% 100%, 0 66%, 10% 21%); clip-path: polygon(50% 0, 90% 21%, 100% 66%, 50% 100%, 0 66%, 10% 21%); background: conic-gradient(from 10deg at 50% 43%, var(--gem-light) 0deg, var(--gem-main) 65deg, var(--gem-dark) 120deg, var(--gem-main) 185deg, var(--gem-light) 238deg, var(--gem-main) 290deg, var(--gem-light) 360deg); }
.adv-gem::before { content: ''; position: absolute; inset: 12%; -webkit-clip-path: polygon(50% 0, 90% 28%, 86% 71%, 50% 100%, 10% 68%, 12% 26%); clip-path: polygon(50% 0, 90% 28%, 86% 71%, 50% 100%, 10% 68%, 12% 26%); background: linear-gradient(125deg, #ffffffa8, transparent 47%, #ffffff48); }
.adv-gem::after { content: ''; position: absolute; width: 8%; height: 25%; top: 15%; left: 27%; background: #ffffffcc; border-radius: 100%; transform: rotate(38deg); }
.adv-finale { background: radial-gradient(ellipse at 50% 30%, #fff5b7 0, #fffbe8 42%, #eef9ff 100%); }
.adv-finale__halo { position: absolute; z-index: -1; width: 260px; height: 260px; left: calc(50% - 130px); top: calc(50% - 230px); border: 1px solid #dcb55a80; border-radius: 50%; background: radial-gradient(circle, #fff7d16b 35%, #ffe08344 60%, transparent 70%); pointer-events: none; }
.adv-finale__rays { position: absolute; z-index: -2; width: 420px; height: 420px; left: calc(50% - 210px); top: calc(50% - 310px); border-radius: 50%; background: repeating-conic-gradient(from 0deg, #ffe18b55 0deg 8deg, transparent 8deg 23deg); -webkit-mask-image: radial-gradient(circle, #000 10%, transparent 68%); mask-image: radial-gradient(circle, #000 10%, transparent 68%); pointer-events: none; }
img.adv-finale__compass { position: relative; z-index: 1; display: block; width: auto; height: min(150px, 24svh); margin: 0 auto 4px; object-fit: contain; }
.adv-finale__pieces { position: absolute; top: calc(50% - 160px); left: 50%; z-index: 3; width: 0; height: 160px; pointer-events: none; }
.adv-finale__piece { --piece-x: -120px; --piece-y: -25px; --piece-r: -35deg; position: absolute; left: -21px; top: 56px; display: block; width: 42px; height: 48px; color: #fff; font: normal 26px/48px serif; text-align: center; background: var(--gem-color); clip-path: polygon(50% 0, 91% 22%, 100% 64%, 50% 100%, 0 64%, 9% 22%); opacity: 0; }
.adv-finale__piece:nth-child(2) { --piece-x: 120px; --piece-y: -15px; --piece-r: 35deg; }
.adv-finale__piece:nth-child(3) { --piece-x: 10px; --piece-y: -95px; --piece-r: 12deg; }
.adv-finale .adv-kicker { padding: 3px 14px; color: #765a21; border: 1px solid #e1c86e; border-radius: 99px; background: #fff5c4; font-size: 14px; letter-spacing: .1em; }
.adv-finale h3 { color: #52663b; font-size: 26px; }
.adv-finale__title { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 200px; max-width: 100%; margin: 4px auto 0; padding: 6px 22px 8px; border: 1px solid #d4b76b; border-radius: 13px; background: linear-gradient(135deg, #fff9df, #f6e5ae); box-shadow: inset 0 0 0 3px #fff7da; color: #705a2a; }
.adv-finale__title small { font-size: 12px; line-height: 1.6; }
.adv-finale__title strong { font-size: 18px; line-height: 1.5; }
.adv-confetti { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.adv-confetti i { position: absolute; display: block; left: var(--x, 15%); top: 12%; width: 7px; height: 13px; border-radius: 2px; background: #dcae40; transform: rotate(24deg); opacity: .65; }
.adv-confetti i:nth-child(3n) { background: #5caa87; border-radius: 50%; width: 9px; height: 9px; }
.adv-confetti i:nth-child(3n + 2) { background: #cd83a6; }

/* 会話 (journal): a sheet over the story, about two thirds of the screen. */
.adv-journal { margin: 4px 0 8px; color: #46604f; font-size: 14px; line-height: 1.75; word-break: keep-all; line-break: strict; overflow-wrap: anywhere; }
.adv-journal p { margin: 0 0 10px; }
.adv-journal p > strong { display: block; color: #2c664d; font-size: 15px; }
.adv-journal p > span { display: block; font-size: 15px; }
.adv-journal p:last-child { margin-bottom: 0; }
@media (max-width: 599px) and (min-height: 500px) {
  .adv-journal-sheet .c-sheet__panel { top: max(var(--sheet-top), 28%); }
}

@media (hover: hover) and (pointer: fine) {
  .adv-node:not(.is-locked):hover { transform: translate(-50%, calc(-50% - 4px)); box-shadow: 0 9px 0 #315f7b30, 0 16px 25px #294c3030; }
  .adv-choice:not(:disabled):hover { transform: translateY(-3px); border-color: #8db188; box-shadow: 0 7px 0 #aec69e; }
  .adv-btn--primary:hover, .adv-next:hover, .cp-next:hover { background: linear-gradient(180deg, #fff0b5, #f8d771); }
  .adv-btn--quiet:hover { background: #f2f6e7; }
}
.adv-node:not(.is-locked):active { transform: translate(-50%, calc(-50% + 3px)); box-shadow: 0 2px 0 #315f7b55; }

@keyframes adv-gem-reveal { from { transform: translateY(25px) rotate(-14deg) scale(.8); opacity: 0; } 65% { transform: translateY(-5px) rotate(4deg) scale(1.04); opacity: 1; } to { transform: none; opacity: 1; } }
@keyframes adv-compass-reveal { from { opacity: 0; transform: scale(.72) rotate(-22deg); } 70% { opacity: 1; transform: scale(1.04) rotate(3deg); } to { opacity: 1; transform: none; } }
@keyframes adv-pieces-gather { 0% { opacity: 0; transform: translate(var(--piece-x), var(--piece-y)) rotate(var(--piece-r)) scale(.65); } 20% { opacity: 1; transform: translate(var(--piece-x), var(--piece-y)) rotate(var(--piece-r)) scale(1); } 74% { opacity: 1; } 100% { opacity: 0; transform: translate(0, 0) rotate(0) scale(.12); } }
@keyframes adv-compass-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes adv-halo-breathe { 0%,100% { opacity: .6; transform: scale(.98); } 50% { opacity: 1; transform: scale(1.04); } }
@keyframes adv-confetti-drift { 0% { opacity: 0; transform: translateY(-18px) rotate(-10deg); } 20%,65% { opacity: .7; } 100% { opacity: 0; transform: translate(17px, 95px) rotate(160deg); } }
[data-motion="full"] .adv-gem { animation: adv-gem-reveal .65s cubic-bezier(.2,.75,.2,1) both; }
[data-motion="full"] .adv-finale__piece { animation: adv-pieces-gather 1.2s cubic-bezier(.2,.75,.2,1) both; }
[data-motion="full"] .adv-finale__compass { animation: adv-compass-reveal .8s cubic-bezier(.2,.75,.2,1) .9s both, adv-compass-float 5s ease-in-out 1.7s infinite; }
[data-motion="full"] .adv-finale__halo { animation: adv-halo-breathe 6s ease-in-out 1.2s infinite; }
[data-motion="full"] .adv-confetti i { animation: adv-confetti-drift 3.5s ease-in-out calc(1.2s + var(--delay, 0s)) 1 both; }
html.quality-paused .adv-sheet * { animation-play-state: paused!important; }

/* ---- small phones ---- */
@media (max-width: 359px) {
  .st-sheet { --st-gutter: 8px; }
  .st-sheet .c-sheet__title { font-size: 15px; }
  .adv-progress { gap: 4px; padding-right: 4px; }
  .adv-pip { width: 11px; height: 11px; }
  .adv-dialogue, .cp-dialogue { --pl-face: 50px; --st-next: 52px; padding: 28px 10px 10px 12px; }
  .adv-dialogue__text, .cp-dialogue__text { font-size: 16px; }
  .adv-node { width: 140px; }
  .adv-node strong { font-size: 14px; }
  .adv-choice span, .adv-choice strong { font-size: 14px; }
  .adv-reference { width: 80px; }
}
/* ---- phones up to 374 px: one more character per line ---- */
@media (max-width: 374px) {
  .adv-dialogue__text, .cp-dialogue__text { font-size: 16px; letter-spacing: .02em; }
}
/* ---- phones held sideways: characters on the left, the box and panels on the right ---- */
@media (orientation: landscape) and (max-height: 499px) {
  .st-title__sub { display: inline; }
  .adv-stage, .cp-stage { display: grid; grid-template-columns: minmax(0, 45fr) minmax(0, 55fr); grid-template-rows: 1fr; align-items: end; column-gap: 12px; padding: 6px max(12px, var(--safe-r)) calc(8px + var(--safe-b, 0px)) max(12px, var(--safe-l)); }
  .adv-stage > .adv-cast, .cp-stage > .cp-cast { grid-column: 1; grid-row: 1; align-self: stretch; height: auto; min-height: 0; max-height: none; margin: 0; }
  .adv-stage > .adv-dialogue, .cp-stage > .cp-dialogue, .adv-stage > .adv-panel { grid-column: 2; grid-row: 1; align-self: end; margin: 0; }
  .adv-dialogue, .cp-dialogue { --pl-face: 48px; --st-next: 52px; padding: 26px 10px 10px 12px; }
  .adv-dialogue__text, .cp-dialogue__text { font-size: 16px; line-height: 1.65; }
  .adv-panel { gap: 6px; padding: 10px; }
  .adv-panel h3 { font-size: 17px; }
  .adv-choice { min-height: 88px; padding: 6px 4px; }
  .adv-choice img { width: 52px; height: 52px; }
  .adv-choices--two .adv-choice { min-height: 96px; }
  .adv-choices--two .adv-choice img { width: 56px; height: 56px; }
  .adv-reference { width: 72px; }
  .adv-reference img { width: 48px; height: 48px; }
  .adv-map { gap: 4px; padding-top: 4px; padding-left: max(12px, var(--safe-l)); padding-right: max(12px, var(--safe-r)); }
  .adv-map__heading { font-size: 18px; }
  .adv-map__frame { min-height: 180px; }
  .adv-map__route--desktop { display: block; }
  .adv-map__route--mobile { display: none; }
  .adv-node { width: 150px; min-height: 96px; padding: 6px; }
  .adv-node__art, .adv-node__art img { width: 44px; height: 44px; }
  .adv-node[data-node="harbor"] { left: 18%; top: 40%; }
  .adv-node[data-node="market"] { left: 50%; top: 62%; }
  .adv-node[data-node="memory"] { left: 82%; top: 40%; }
  .adv-map__bottom { flex-direction: row; justify-content: center; align-items: center; }
  .adv-map__bottom .adv-btn--primary { width: auto; min-width: 220px; }
  .adv-map__status { margin: 0; }
  .adv-story-band summary { min-height: 40px; }
  .adv-screen { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); grid-template-rows: minmax(0, 1fr) auto; }
  .adv-screen__main { grid-column: 1 / -1; grid-row: 1; display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-content: center; justify-items: center; column-gap: 12px; row-gap: 4px; padding: 8px 16px 0; }
  .adv-screen__main > * { grid-column: 2; }
  .adv-screen__main > .adv-gem-wrap, .adv-screen__main > .adv-finale__compass { grid-column: 1; grid-row: 1 / span 5; align-self: center; }
  .adv-screen__actions { grid-column: 2; grid-row: 2; padding-top: 6px; padding-bottom: calc(8px + var(--safe-b, 0px)); }
  .adv-gem { width: 84px; }
  img.adv-finale__compass { height: 130px; }
  .adv-screen__main h3 { font-size: 21px; }
  .adv-finale__halo, .adv-finale__rays, .adv-finale__pieces { left: calc(20% - 130px); }
}
/* ---- tablets and desktops: the story is a tall panel in the middle ---- */
@media (min-width: 600px) and (min-height: 500px) {
  .st-sheet { --st-gutter: 20px; }
  .st-sheet .c-sheet__head { height: 52px; min-height: 52px; padding: 0 8px; }
  .st-sheet .c-sheet__title { font-size: 18px; }
  .st-title__sub { display: inline; }
  .adv-dialogue, .cp-dialogue { --pl-face: 64px; --st-next: 60px; min-height: 132px; padding: 34px 16px 14px 20px; border-radius: 22px; }
  .adv-dialogue__name, .cp-dialogue__name { font-size: 15px; top: -17px; }
  .adv-dialogue__text, .cp-dialogue__text { --pl-min-lines: 2; font-size: 19px; }
  .adv-next, .cp-next { right: 12px; bottom: 12px; font-size: 22px; }
  .adv-stage, .cp-stage { padding-top: 16px; padding-bottom: 18px; }
  .adv-panel { padding: 18px; gap: 12px; }
  .adv-panel h3 { font-size: 22px; }
  .adv-choices { gap: 14px; }
  .adv-choice { min-height: 140px; }
  .adv-choice img { width: 96px; height: 96px; }
  .adv-choices--two .adv-choice { min-height: 160px; }
  .adv-choices--two .adv-choice img { width: 104px; height: 104px; }
  .adv-reference { width: 112px; }
  .adv-reference img { width: 88px; height: 88px; }
  .adv-map__heading { font-size: 26px; }
  .adv-map__route--desktop { display: block; }
  .adv-map__route--mobile { display: none; }
  .adv-node { width: 168px; min-height: 140px; padding: 12px 8px 10px; border-radius: 24px; }
  .adv-node__art, .adv-node__art img { width: 76px; height: 76px; }
  .adv-node strong { font-size: 16px; }
  .adv-node small { font-size: 13px; }
  .adv-node[data-node="harbor"] { left: 20%; top: 44%; }
  .adv-node[data-node="market"] { left: 50%; top: 64%; }
  .adv-node[data-node="memory"] { left: 80%; top: 44%; }
  .adv-map__bottom { flex-direction: row; justify-content: center; align-items: center; gap: 16px; }
  .adv-map__bottom .adv-btn--primary { width: auto; min-width: 260px; }
  .adv-map__status { margin: 0; font-size: 15px; }
  .adv-screen__main { gap: 10px; }
  .adv-screen__main h3 { font-size: 30px; }
  .adv-gem { width: 110px; }
  img.adv-finale__compass { height: min(200px, 28svh); }
  .adv-finale h3 { font-size: 34px; }
}

/* Motion preferences never hide content or suppress the earned state. */
[data-motion="reduced"] .adv-sheet *, [data-motion="reduced"] .adv-sheet *::before, [data-motion="reduced"] .adv-sheet *::after { animation: none!important; transition: none!important; }
[data-motion="reduced"] .adv-finale__pieces { display: none; }
@media (prefers-reduced-motion: reduce) {
  .adv-sheet *, .adv-sheet *::before, .adv-sheet *::after { animation: none!important; transition: none!important; }
  .adv-finale__pieces { display: none; }
}
.adv-sheet[hidden], .adv-sheet [hidden] { display: none!important; }
