/* Expedition identity. Geometry, touch targets and screen flow stay with the
   existing layout styles; this layer changes materials, light and colour. */
:root {
  --paper: #f5efdf;
  --surface: #fffaf0;
  --ink: #203d3d;
  --muted: #656655;
  --blue-top: #2b9494;
  --blue: #187781;
  --blue-deep: #225e72;
  --blue-edge: #1b5865;
  --blue-base: #173f4b;
  --blue-paper: #e1eeea;
  --gold: #bd934e;
  --gold-paper: #eee0bc;
  --sage-paper: #e4e9d7;
  --green: #397064;
  --line: #d7cbb3;
  --heading: Fredoka, Nunito, sans-serif;
  --finish-paper: linear-gradient(145deg, #fffaf0, #f5ecd7 62%, #e9dab9);
  --finish-honey: linear-gradient(150deg, #f5e7bb, #d6b575 40%, #b9894c 78%, #b47b4b);
  --finish-gold-edge: #936a39;
}
body {
  background:
    radial-gradient(ellipse at 12% 0, #e2eada70, transparent 52%),
    radial-gradient(ellipse at 94% 12%, #f0dfb650, transparent 48%), var(--paper);
}
h1, h2, h3 { font-weight: 650; }
.ambient {
  background-image: radial-gradient(#9c88572b .7px, transparent .8px);
  background-size: 27px 27px;
}
.home-action .primary,
.clean-play .primary {
  --blue-top: #279696;
  --blue: #197f85;
  --blue-deep: #245f73;
  --blue-edge: #23565f;
  --blue-base: #173f48;
}
.primary {
  border-color: var(--blue-edge);
  box-shadow: inset 0 0 0 2px #a6e8db66, inset 0 2px 0 #e4fff288,
    inset 0 -2px 0 #133c4955, 0 5px 0 var(--blue-base), 0 9px 16px #153f4028;
}
.secondary, .small-btn {
  background: linear-gradient(150deg, #fffaf0, #f4e8cc 62%, #e4cc9d);
  border-color: #c2a476;
}
.inventory-summary, .icon-btn {
  background: var(--finish-paper);
  border-color: #cbb895;
  color: var(--ink);
}
.coin-pill { color: #49381f; border-color: #b38b4a; }
.theme-card, .level-card, .tool-card, .award,
.kids-banner, .poem-cover, .poem-progress-card {
  border-color: #cbb78e;
  box-shadow: inset 0 2px 0 #fffaf5, inset 0 -1px 0 #d0b27755,
    0 3px 0 #bd9a6270, 0 8px 18px #67492913;
}
.theme-card {
  background: radial-gradient(ellipse at 85% 0, var(--tint), transparent 70%), var(--finish-paper);
}
.theme-card.is-complete { border-color: #b89451; }
.theme-meta, .theme-meta .icon, .theme-card h3 { color: var(--ink); }
.first-run-options > summary,
.journey-entry, .poems-entry {
  background: linear-gradient(130deg, #fcf3dd, #e6e9d7 58%, #d4e7de);
  border-color: #bc9b62;
  color: var(--ink);
}
.journey-entry small, .poems-entry small { color: #46695d; }
.board-paper {
  background: linear-gradient(150deg, #f2e7cc, #e4d3aa);
  border-color: #c5ae7d;
  box-shadow: inset 0 2px 0 #fff9e9, 0 5px 0 #bda57980, 0 10px 22px #725c2511;
}
.cell { background: linear-gradient(145deg, #fffdf4, #faf3e2); color: #254648; border-color: #d2c2a0; }
.cell.selected { background: linear-gradient(145deg, #278b8c, #266174); color: #fffdf3; }
.cell.wrong { background: #a84f49; color: #fff; }
.phrase-strip { color: #397369; }
.game-stats .time { color: #426d62; }
dialog { background: var(--paper); border-color: #c6ab7b; }
dialog::backdrop { background: #112e3999; backdrop-filter: blur(4px); }
.speech-bubble, .dialog-speech {
  background-color: #fffaf0;
  color: #2b4545;
}
.speaker-aura {
  background: radial-gradient(ellipse, #b6ece680, #e6e3bc50 45%, transparent 73%);
}
.speaker-name { background: #e9dfc0; color: #50503a; }
.speaker-star img { filter: drop-shadow(0 2px 5px #58cec84a); }
.speaker-star .speaker-glint { color: #279b9c; }
.result-topline .stars, .result-coins { color: #956d2d; }
.result-scroll { background-color: #fff8e5; }
.result-story, .result-reading { border-color: #d3c09a; }
.result-success-glow {
  background: radial-gradient(ellipse, #c3eee28f, #eddaaa44 55%, transparent 75%);
}
.result-spark { color: #c09645; }
.kids-tabs button.active, .practice-cell.practice-chosen {
  background: linear-gradient(145deg, #258a8c, #285e70);
  color: #fff;
}
.kids-counter, .result-coins { background: var(--finish-honey); }
.study-note { border-color: #b9c6a7; }
/* The original luminous gold dock and saturated blue active button live in
   illustrated-controls.css. Keep those materials alongside the familiar art. */
.expedition-icon img { filter: brightness(1.2) saturate(1.15) drop-shadow(0 2px 2px #a46e2324); }
.install-entry.install-entry-compact { min-height: 48px; padding: 9px 12px; margin: 8px 0 16px; }
.install-entry.install-entry-compact > .icon { width: 23px; height: 23px; }
.install-entry.install-entry-compact strong { font-size: 14px; }
/* Finger scrolling stays native, including nested journal lists. Hide only
   scrollbar chrome, never content or the accessibility zoom fallback. */
@media (max-width: 700px), (hover: none) and (pointer: coarse) {
  :root, :root *, :root *::before, :root *::after { scrollbar-width: none; }
  ::-webkit-scrollbar { display: none; width: 0; height: 0; }
}
body[data-screen="journey"] { background: #e4e8d0; }
body[data-screen="journey"] .game-header { background: linear-gradient(110deg, #f9edce, #e6ead9); }
.journey-page, .journey-heading h1 { color: var(--ink); }
.journey-heading small { color: #506c5c; }
.journey-node.is-current .journey-node-face { border-color: #bc9251; }
.journey-map-stage { background-color: #dbe3c3; }
.home-hero.is-docked { background-color: var(--paper); }
body.home-docked .game-header { background-color: var(--paper); }
.home-hero::before {
  background-image: radial-gradient(ellipse at 55% 0, #d3e3d9 0, #e8dfc5 48%, var(--paper) 84%) !important;
}
.home-hero.is-docked::before {
  background-image: linear-gradient(#eee4c9 0%, #f5efdf 78%, #f5efdf00 100%) !important;
}
.home-dock-paper { background-color: var(--paper); }
.expedition-art .home-art-fallback {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 450ms cubic-bezier(.2,.8,.2,1);
}
.expedition-art { background: #eee3c9; }
/* Cheap, finite light sweep when returning to the expedition; no idle loop. */
.expedition-scan {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(110deg, transparent 35%, #b2fff426 49%, transparent 62%);
}
.is-docked .expedition-scan { visibility: hidden; }
@media (hover: hover) and (pointer: fine) {
  html:not(.touch-preview) .theme-card:hover { border-color: #b08a50; }
}
@media (max-width: 760px) {
  body[data-screen="home"] .game-header { background: #f5efdf12; }
  .home-art-window .expedition-art { /* Same cover dimensions and dock trajectory. */
    width: 100%; left: 0; aspect-ratio: 1200 / 770;
  }
  body.home-docked .game-header { background: none; }
}
@media (prefers-reduced-motion: reduce) {
  .expedition-art .home-art-fallback { transition: none; }
}

@media (max-width: 760px) {
  .expedition-art .home-art-fallback { aspect-ratio: auto; object-fit: contain; object-position: top; }
  .expedition-art { background: linear-gradient(#e9dbc0, var(--paper)); }
  /* The contained cover ends at 630/770 (81.8%) of this registered frame.
     Finish the fade there, after the signature, instead of leaving a seam. */
  .expedition-art::after { content: ""; position: absolute; inset: 70% 0 0; pointer-events: none; background: linear-gradient(#f5efdf00, var(--paper) 40%); }
}

/* Field notes and excavation tools use the same bronze/ivory materials. */
.book-cover {
  color: #f4dfae;
  border-color: #947044;
  border-left-color: #54452d;
  background: linear-gradient(145deg, #87633f, #65543a 45%, #43534a);
  box-shadow: inset 0 0 0 1px #d3b16f80, inset 0 -3px 0 #ddcdaa,
    2px 3px 0 #64513940;
}
.book-cover .book-complete { color: #68512e; }
.board[data-feedback-tool="eraser"] { --aim-color: #a67a3e; --aim-paper: #f4e7c4; }
.board[data-feedback-tool="pickaxe"] { --aim-color: #587378; --aim-paper: #e0ece8; }

.kids-banner, .upgrade-card {
  background: linear-gradient(135deg, #f8eed3, #e9dfc6 52%, #d9e4d7);
  border-color: #bea475;
}

/* The unfinished quotation is the task: one prominent artifact, no clue title. */
.phrase-strip, .clean-play .phrase-strip {
  display: block;
  margin: 6px 0 12px;
  padding: 4px 5px 7px;
  min-height: 0;
  border: 12px solid transparent;
  border-image: url("../assets/parchment-nine-slice.svg") 24 fill / 12px / 0 stretch;
  font-size: clamp(23px, 3vw, 29px);
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 5px 8px -7px #62452880;
}
.phrase-strip.compact, .clean-play .phrase-strip.compact { font-size: 21px; }
.phrase-heading {
  margin: 0 0 2px;
  font: 600 15px/1.25 var(--heading);
  color: var(--ink);
}
.phrase-instruction { margin: 0 0 8px; font: 14px/1.35 var(--body); color: #62644e; }
.phrase-line { display: flex; justify-content: center; align-items: baseline; gap: 4px; }
.phrase-words {
  min-width: 0; display: flex; flex-wrap: wrap;
  justify-content: center; align-items: baseline;
  gap: .15em .35em;
}
.phrase-strip:has(.phrase-credit) { padding-bottom: 7px; }
.phrase-credit { position: static; display: block; margin-top: 6px; color: #646050; font-size: 11px; }
.phrase-quote { line-height: 1; color: #aa813f; }
.word-mask { gap: .09em; }
.mask-letter {
  display: inline-grid; place-items: center; width: .6em;
  border-bottom: 2px solid #b99758;
  color: transparent;
  background: linear-gradient(#fcf8e9, #efe3c530);
  border-radius: 3px 3px 0 0;
  line-height: 1.2;
  min-height: 1.2em;
}
.mask-letter.hint-letter { color: #245e5c; background: #dbe8d8; }
.word-slot.hinted .word-mask { filter: drop-shadow(0 2px 3px #b99c5b30); }
.cell.letter-cue { outline: 3px solid #b17e35; outline-offset: -3px; background: #ffefb8; }
.cell.letter-cue::after { content: ""; position: absolute; inset: 4px; border: 1px solid #fff; border-radius: 6px; pointer-events: none; }
.game-title { align-items: center; }
.game-title .eyebrow { margin-bottom: 0; }

/* A single next-play action owns the result footer. Utilities remain touchable. */
.result-wrap > .dialog-actions {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 8px; padding: 12px 16px 10px;
  background: linear-gradient(#f5efdf, #f4e9ce 70%, #eee1be);
  border-top-color: #cab17b66;
  box-shadow: 0 -7px 18px -15px #7d5528;
}
.result-wrap > .dialog-actions .primary,
.poem-reading-actions .primary,
.illustrated-wrap[data-scene="retry"] .dialog-actions .primary,
.character-dialog:has(.favorite-lesson) .dialog-actions .primary {
  grid-column: 1 / -1;
  min-height: 60px; width: 100%; padding: 13px 16px;
  font-size: 19px; font-weight: 900; line-height: 1.3;
}
.result-wrap > .dialog-actions .continue-arrow { margin-left: 8px; }
.result-wrap > .dialog-actions .secondary,
.poem-reading-actions .secondary,
.illustrated-wrap[data-scene="retry"] .dialog-actions .secondary {
  min-height: 44px; padding: 6px 5px; min-width: 0;
  border: 0; background: none; box-shadow: none;
  color: #5b624f; font-size: 12px; font-weight: 700;
  line-height: 1.3; text-decoration: underline; text-underline-offset: 3px;
}
.result-wrap > .dialog-actions .secondary:only-of-type { grid-column: 1 / -1; }
.result-more { margin: 0; border-top: 1px solid #ccb98a60; }
.result-more > summary { min-height: 44px; display: list-item; padding: 12px 4px; font: 700 12px/1.5 var(--body); color: #66634c; cursor: pointer; }
.result-more[open] { padding-bottom: 10px; }
.result-card .result-favorite { margin: 0 0 8px; }
.result-card .favorite-button { padding: 5px 14px; min-height: 44px; font-size: 13px; }
.result-card .favorite-button .icon { width: 25px; height: 25px; }
.first-discovery .result-more { display: none; }

/* Reading can be long; its next-play action is visible before any scrolling. */
body[data-screen="poem-reading"] .bottom-nav { display: none; }
.poem-reading { padding-bottom: 175px; }
.poem-reading-actions {
  position: fixed; bottom: calc(10px + var(--safe-bottom, env(safe-area-inset-bottom)));
  left: 50%; transform: translateX(-50%); z-index: 30;
  width: min(540px, calc(100% - 24px)); padding: 10px 12px 4px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px; border: 1px solid #cab17b;
  border-radius: 20px;
  background: linear-gradient(125deg, #faf2df, #f4e9ce 65%, #eee1be);
  box-shadow: 0 -5px 25px -16px #58432188, 0 5px 15px #58432128;
}
.poem-reading-actions .poem-favorite { margin: 0; }
.poem-reading-actions .favorite-button .icon { width: 25px; height: 25px; }
@media (max-width: 600px) {
  .phrase-strip, .clean-play .phrase-strip { margin: 2px 0 5px; padding: 3px 2px 4px; font-size: 23px; }
  .phrase-strip.compact, .clean-play .phrase-strip.compact { font-size: 20px; }
  .phrase-instruction { margin-bottom: 6px; font-size: 13px; }
  .phrase-credit { margin-top: 4px; font-size: 10px; }
  .result-wrap > .dialog-actions .primary { font-size: 18px; }
}
@media (max-height: 650px) {
  .clean-play .phrase-strip, .clean-play .phrase-strip.compact {
    font-size: 18px; line-height: 1.25;
    border-width: 6px; border-image-width: 6px;
    margin: 0; padding: 2px;
  }
  .clean-play .phrase-heading { font-size: 14px; line-height: 1.15; }
  .clean-play .phrase-strip:has(.phrase-credit) { padding-bottom: 2px; }
  /* Complete a frase plus the live input instruction already explain the task.
     On a short screen, removing the repeated caption protects the playfield. */
  .clean-play .phrase-instruction { display: none; }
  .clean-play .word-slot { line-height: 1.3; }
  .clean-play .phrase-strip.compact { font-size: 15px; }
  .clean-play .phrase-line { position: relative; display: block; padding: 0 7px; }
  .clean-play .phrase-quote { position: absolute; top: 0; left: -2px; }
  .clean-play .phrase-quote:last-child { left: auto; right: -2px; }
  .clean-play .phrase-credit { margin-top: 0; font-size: 9px; }
}
@media (max-width: 499px) and (max-height: 650px) {
  .clean-play .game-main { gap: 3px; }
  .clean-play .game-title { align-items: flex-start; }
  .clean-play .game-title .eyebrow { font-size: 9px; }
  /* Share the pause button's header row; reserve its complete touch target. */
  .clean-play .game-stats { margin-top: -19px; padding-right: 48px; }
}
@media (min-width: 500px) and (max-height: 360px) {
  .clean-play .phrase-strip, .clean-play .phrase-strip.compact { font-size: 14px; }
  .clean-play .phrase-heading { font-size: 12px; }
}
