/* Four-chapter story campaign: bright comic colors, bold outlines and readable white panels.
 * The screen frame (top bar, stage, dialogue box) is in adventure-20261016.css ("ものがたりの画面");
 * this file draws the chapter list, the clear screen and the campaign's own colours. */
.cp-sheet { --cp-ink: #183f5a; --cp-deep: #173d59; --cp-gold: #ffdc3e; --st-paper: #ffffff; color: var(--cp-ink); }
.cp-sheet .c-sheet__title { font-family: var(--font-body); color: #173d59; }
.cp-home { padding: 0 8px 0 2px; }
.cp-home .c-icon { width: 20px; height: 20px; }
.cp-status { position: absolute; z-index: 30; top: 8px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); margin: 0; padding: 8px 16px; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; border: 2px solid #c79a2a; border-radius: 16px; color: #674210; background: #fff2b4; font-size: 14px; font-weight: 700; line-height: 1.5; text-align: center; box-shadow: 0 6px 16px #67421026; }
.cp-status[hidden], .cp-sheet [hidden] { display: none!important; }
.cp-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px; border: 2px solid #173d59; border-radius: 14px; background: #e6f8ff; box-shadow: 0 3px 0 #173d59; color: #173d59; font: 700 15px/1.4 var(--font-body); letter-spacing: .04em; white-space: nowrap; cursor: pointer; touch-action: manipulation; transition: transform 140ms, box-shadow 140ms, background 140ms; }
.cp-button:active { transform: translateY(2px); box-shadow: 0 1px 0 #173d59; }
.cp-button--primary { min-height: 56px; background: #ffe352; box-shadow: 0 4px 0 #173d59; font-size: 17px; }
.cp-button--quiet { background: #ffffff; }
.cp-button:disabled { cursor: default; opacity: .6; }
.cp-button:focus-visible, .cp-chapter:focus-visible, .cp-objective:focus-visible { outline: 3px solid #ed6b27; outline-offset: 4px; }
@media (hover: hover) and (pointer: fine) {
  .cp-button:not(:disabled):hover { background: #c8f0ff; }
  .cp-button--primary:not(:disabled):hover, .cp-objective--go:hover { background: #ffeb79; }
}
.cp-eyebrow { display: inline-block; padding: 3px 14px; border: 2px solid #173d59; border-radius: 99px; background: #ffdc3e; color: #173d59; font-size: 14px; font-weight: 700; letter-spacing: .08em; line-height: 1.5; }

/* -- chapter list: medals, four rows, the next chapter's button at the bottom -- */
.cp-hub { display: flex; flex-direction: column; background: linear-gradient(#a5eaff, #f1fcff 58%); }
.cp-hub__main { flex: 1 1 auto; display: flex; flex-direction: column; gap: 10px; padding: 12px var(--st-gutter) 8px; }
.cp-hub__head { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; }
.cp-medals { display: flex; justify-content: center; gap: 6px; }
.cp-medal { display: grid; place-items: center; width: 48px; height: 48px; border: 3px solid #173d59; border-radius: 50%; background: #e5f6fc; color: #5d7a8c; box-shadow: 0 3px 0 #173d59; }
.cp-medal b { font: 700 24px/1 var(--font-body); }
.cp-medal.is-earned { background: #ffdc3e; color: #173d59; }
.cp-hub__count { flex: none; margin: 0; color: #0b5d86; font-size: 14px; font-weight: 700; line-height: 1.4; white-space: nowrap; }
.cp-chapters { display: flex; flex-direction: column; gap: 8px; }
.cp-chapter {
  position: relative; display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; column-gap: 10px; min-height: 72px; padding: 4px 12px 4px 4px;
  border: 2px solid #173d59; border-radius: 16px; background: #fff; box-shadow: 0 3px 0 #173d59; color: #173d59; text-align: left; cursor: pointer; touch-action: manipulation;
  transition: transform 180ms, box-shadow 180ms;
}
.cp-chapter:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 #173d59; }
.cp-chapter__pic { position: relative; display: grid; place-items: center; width: 64px; height: 64px; overflow: hidden; border-radius: 12px; background: #61cbec; }
.cp-chapter__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cp-chapter__lock { position: relative; width: 28px; height: 28px; padding: 4px; border-radius: 50%; background: #ffffffe6; color: #466579; }
.cp-chapter__done { position: absolute; right: 3px; bottom: 3px; display: grid; place-items: center; width: 24px; height: 24px; border: 2px solid #fff; border-radius: 50%; background: #198b4e; color: #fff; font-size: 14px; line-height: 1; }
.cp-chapter__copy { display: flex; flex-direction: column; min-width: 0; }
.cp-chapter__copy small { min-height: 26px; color: #086a98; font-size: 13px; font-weight: 700; line-height: 26px; }
.cp-chapter__copy strong { font-family: var(--font-body); font-size: 16px; font-weight: 700; line-height: 1.5; letter-spacing: .03em; white-space: nowrap; }
/* furigana wider than its kanji may reach over the neighbours' top instead of spacing the words apart */
.cp-chapter__copy strong rt { margin-inline: -.6em; }
.cp-chapter__status { position: absolute; top: 6px; right: 8px; padding: 2px 10px; border-radius: 99px; background: #ffdc3e; color: #173d59; font-size: 13px; font-weight: 700; line-height: 1.6; white-space: nowrap; }
.cp-chapter.is-complete { border-color: #c98a17; }
.cp-chapter.is-complete .cp-chapter__status { background: #e3f6e3; color: #17663a; }
.cp-chapter.is-locked { cursor: default; background: #eef4f7; box-shadow: 0 2px 0 #9fb6c3; border-color: #9fb6c3; color: #466579; }
.cp-chapter.is-locked .cp-chapter__bg { opacity: .45; }
.cp-chapter.is-locked .cp-chapter__status { background: #dcecf4; color: #466579; }
.cp-hub__foot { position: sticky; bottom: 0; z-index: 2; flex: none; padding: 8px var(--st-gutter) calc(12px + var(--safe-b, 0px)); background: linear-gradient(#f1fcff00, #f1fcff 24%); }
.cp-objective { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; max-width: 440px; min-height: 56px; margin: 0 auto; padding: 8px 18px; border: 2px solid #173d59; border-radius: 16px; background: #ffe352; box-shadow: 0 4px 0 #173d59; color: #173d59; font: 700 17px/1.3 var(--font-body); cursor: pointer; touch-action: manipulation; }
.cp-objective:active { transform: translateY(3px); box-shadow: 0 1px 0 #173d59; }
.cp-objective__chapter { font-size: 16px; white-space: nowrap; }
.cp-objective__go { font-size: 18px; letter-spacing: .04em; white-space: nowrap; }
.cp-objective--all { cursor: default; border-color: transparent; background: transparent; box-shadow: none; font-size: 15px; text-align: center; word-break: keep-all; line-break: strict; }

/* -- picture-game page (the game's own frame is campaign-games-20261017.css) -- */
.cp-game { display: flex; flex-direction: column; background: linear-gradient(#dff7ff, #ffffff); }
.cp-game-host { flex: 1 0 auto; display: flex; flex-direction: column; min-width: 0; }

/* -- chapter clear: medal, cheering cast, the treasure; the next chapter's button at the bottom -- */
.cp-reward { position: relative; isolation: isolate; display: flex; flex-direction: column; overflow: hidden; overflow: clip; text-align: center; background: #fff3a9; }
.cp-reward__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; opacity: .18; }
.cp-reward::after { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle at 50% 30%, #fff3a9, #f5fcffd9 65%); }
.cp-reward__main { position: relative; flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 12px 16px 4px; }
.cp-reward__kicker { margin: 4px 0 0; font-size: 13px; font-weight: 700; line-height: 1.5; color: #466579; }
.cp-reward h3 { margin: 0; font-family: var(--font-title, var(--font-display)); font-size: 22px; font-weight: 400; line-height: 1.45; letter-spacing: .05em; }
.cp-reward__title { display: inline-flex; flex-direction: column; gap: 2px; margin: 4px 0; padding: 6px 28px; border-top: 1px solid #173d59; border-bottom: 1px solid #173d59; }
.cp-reward__title small { font-size: 12px; line-height: 1.5; }
.cp-reward__title strong { font-size: 17px; line-height: 1.5; }
.cp-reward__note { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.6; }
.cp-reward__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)); }
.cp-reward__actions > .cp-button--primary { width: 100%; max-width: 420px; }
.cp-reward__more { display: flex; justify-content: center; gap: 8px; width: 100%; max-width: 420px; }
.cp-reward__more .cp-button { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 6px 8px; font-size: 14px; letter-spacing: .02em; }

.cp-enter { position: relative; z-index: 1; }
.cp-exit { position: absolute!important; inset: 0; z-index: 2; opacity: 0; pointer-events: none!important; overflow: hidden; }
.cp-exit * { pointer-events: none!important; }
@keyframes cp-in { from { opacity: .1; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes cp-out { from { opacity: 1; } to { opacity: 0; } }
[data-motion="full"] .cp-enter { animation: cp-in 260ms ease-out both; }
[data-motion="full"] .cp-exit { animation: cp-out 180ms ease-out both; }
html.quality-paused .cp-sheet * { animation-play-state: paused!important; }

@media (max-width: 359px) {
  .cp-hub__head { flex-direction: column; gap: 4px; }
  .cp-chapter { grid-template-columns: 56px minmax(0, 1fr); }
  .cp-chapter__pic { width: 56px; height: 56px; }
  .cp-chapter__copy strong { font-size: 14px; }
}
/* phones held sideways: medals and the button on the left, the four chapters on the right */
@media (orientation: landscape) and (max-height: 499px) {
  .cp-hub { display: grid; grid-template-columns: minmax(244px, 36fr) minmax(0, 64fr); grid-template-rows: minmax(0, 1fr) auto; padding-left: var(--safe-l); padding-right: var(--safe-r); }
  .cp-hub__main { display: contents; }
  .cp-hub__head { grid-column: 1; grid-row: 1; flex-direction: column; justify-content: center; padding: 8px 4px 0 12px; }
  .cp-medals { flex-wrap: wrap; max-width: 120px; }
  .cp-chapters { grid-column: 2; grid-row: 1 / span 2; gap: 6px; padding: 8px 12px calc(8px + var(--safe-b, 0px)) 4px; }
  .cp-chapter { min-height: 64px; grid-template-columns: 56px minmax(0, 1fr); }
  .cp-chapter__pic { width: 56px; height: 56px; }
  .cp-chapter__copy small { min-height: 24px; line-height: 24px; }
  .cp-hub__foot { grid-column: 1; grid-row: 2; position: static; padding: 8px 4px calc(10px + var(--safe-b, 0px)) 12px; background: none; }
  .cp-objective { gap: 8px; padding: 8px 10px; }
  .cp-reward { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .cp-reward__main { grid-column: 1 / -1; grid-row: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-content: center; justify-items: center; column-gap: 12px; padding: 8px 16px 0; }
  .cp-reward__main > * { grid-column: 2; }
  .cp-reward__main > .cp-reward__hero { grid-column: 1; grid-row: 1 / span 6; align-self: center; }
  .cp-reward__actions { grid-column: 2; grid-row: 2; padding-top: 6px; padding-bottom: calc(8px + var(--safe-b, 0px)); }
}
/* tablets and desktops: two columns of chapter cards (the panel keeps its former 1140 px width) */
@media (min-width: 600px) and (min-height: 500px) {
  .cp-sheet .c-sheet__panel { max-width: 1140px; }
  .cp-hub__main { gap: 16px; padding-top: 20px; }
  .cp-medal { width: 60px; height: 60px; }
  .cp-medal b { font-size: 28px; }
  .cp-hub__count { font-size: 16px; }
  /* picture cards: the chapter's place fills the card, its name on a white band below */
  .cp-chapters { flex: 1 1 auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(150px, 1fr); gap: 16px; width: 100%; max-width: 980px; margin: 0 auto; }
  .cp-chapter { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; min-height: 150px; padding: 0; overflow: hidden; border-width: 3px; border-radius: 22px; box-shadow: 0 5px 0 #173d59; }
  .cp-chapter__pic { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 0; }
  .cp-chapter__lock { width: 44px; height: 44px; padding: 8px; }
  .cp-chapter__done { left: 12px; right: auto; top: 12px; bottom: auto; width: 32px; height: 32px; font-size: 18px; }
  .cp-chapter__copy { position: relative; padding: 8px 18px 12px; background: #fffffff2; border-top: 2px solid #173d5922; }
  .cp-chapter.is-locked .cp-chapter__copy { background: #eef4f7f2; }
  .cp-chapter__copy small { min-height: 0; font-size: 14px; line-height: 1.5; }
  .cp-chapter__copy strong { font-size: 20px; white-space: normal; }
  .cp-chapter__status { top: 12px; right: 12px; padding: 3px 12px; font-size: 14px; box-shadow: 0 2px 0 #173d5933; }
  .cp-reward h3 { font-size: 28px; }
  .cp-reward__main { gap: 8px; }
}
@media (hover: hover) and (pointer: fine) { .cp-chapter:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 7px 0 #173d59; } }
[data-motion="reduced"] .cp-sheet * { animation: none!important; transition: none!important; }
@media (prefers-reduced-motion: reduce) { .cp-sheet * { animation: none!important; transition: none!important; } }
