/* Approved screen studies: quiet artifacts, one next step and one golden dock.
   This final layer changes composition while keeping native game input intact. */
:root {
  --screen-cream: #faf5e8;
  --screen-teal: #195866;
  --dock-gold: linear-gradient(135deg, #fff8da 0%, #ffe8ac 32%, #f3c976 68%, #db9c51 100%);
}
body:not(.playing) { background-color: var(--screen-cream); }
body:is([data-screen="game"], [data-screen="poem"], [data-screen="poem-reading"]) .bottom-nav { display: none; }
body.has-play-dock .game-header {
  height: 64px;
  padding-block: 8px;
  background: transparent;
}
body.has-play-dock .game-header .brand { display: none; }
body.has-play-dock .player-supplies {
  flex: 1;
  width: auto;
  margin-left: 0;
  justify-content: flex-start;
}
body.has-play-dock #wallet { order: -1; }
body.has-play-dock #inventory-summary,
body.has-play-dock #fullscreen { display: none; }
/* The expedition keeps its finds in view, in the existing top row. The whole
   summary is one touch target and opens the full accessory inventory. */
body.has-play-dock[data-screen="journey"] #inventory-summary {
  display: flex;
  flex-shrink: 0;
  min-height: 44px;
  margin-left: auto;
  padding: 3px 7px;
  gap: 0;
  background: linear-gradient(135deg, #fffdf4, #fff1d4);
  border-color: #d7b97e;
}
body.has-play-dock[data-screen="journey"] .inventory-items { gap: 8px; }
body.has-play-dock[data-screen="journey"] .inventory-item { min-width: 26px; }
body.has-play-dock[data-screen="journey"] .inventory-item .icon { width: 22px; height: 22px; }
@media (max-width: 760px) {
  body.has-play-dock[data-screen="journey"] .game-header,
  body.has-play-dock[data-screen="journey"] .player-supplies { gap: 6px; }
  body.has-play-dock[data-screen="journey"] #inventory-summary { padding-inline: 5px; }
  body.has-play-dock[data-screen="journey"] .inventory-items { gap: 6px; }
  body.has-play-dock[data-screen="journey"] .inventory-item { min-width: 24px; }
  body.has-play-dock[data-screen="journey"] .inventory-item .icon { width: 20px; height: 20px; }
  body.has-play-dock[data-screen="journey"] .inventory-items.has-extras {
    display: grid;
    grid-template-columns: repeat(3, 32px);
    gap: 2px 3px;
  }
  body.has-play-dock[data-screen="journey"] .has-extras .inventory-item {
    min-width: 0;
    flex-direction: row;
    justify-content: center;
    gap: 1px;
  }
  body.has-play-dock[data-screen="journey"] .has-extras .inventory-item .icon { width: 14px; height: 16px; flex-shrink: 0; }
  body.has-play-dock[data-screen="journey"] .has-extras .inventory-item strong { font-size: 10px; line-height: 16px; }
}
@media (max-width: 350px) {
  body.has-play-dock[data-screen="journey"] #inventory-summary { padding-inline: 4px; }
  body.has-play-dock[data-screen="journey"] #wallet { padding-inline: 6px; }
}
body.has-play-dock .app-dock {
  width: min(880px, calc(100% - 40px));
  gap: 16px;
  background: var(--dock-gold);
  border-color: #c99a4f;
  box-shadow: inset 0 0 0 2px #fff8de, inset 0 5px #ffffed99,
    0 4px #a97739, 0 12px 28px #624b3033;
}
body.has-play-dock #home-play-slot { padding: 0; }
.home-play-context { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
body.has-play-dock .app-dock .primary,
.poem-reading-actions .primary,
.result-wrap > .dialog-actions .primary {
  min-height: 60px;
  border: 2px solid #207984;
  border-radius: 20px;
  color: #fffef0;
  background: linear-gradient(125deg, #32bfc2, #188f9f 43%, #216d92 100%);
  box-shadow: inset 0 0 0 2px #9be6df8c, inset 0 3px #dbfff02b,
    0 4px #14576e, 0 8px 12px #1b58682b;
  font: 650 21px/1.2 var(--heading);
}
body.has-play-dock .app-dock .bottom-nav { gap: 7px; }
body.has-play-dock .app-dock .bottom-nav button {
  min-height: 78px;
  border-radius: 20px;
  background: linear-gradient(140deg, #fffbe2, #ffe3a0 60%, #f2c473);
  border: 1px solid #d5a75f;
  box-shadow: inset 0 0 0 2px #fff7d9, 0 3px #b5843d55;
}
body.has-play-dock .app-dock .bottom-nav button.active {
  background: linear-gradient(135deg, #3cc5c3, #198fa1 50%, #285e8d);
  border-color: #227b88;
  box-shadow: inset 0 0 0 2px #aff2e980, 0 3px #145c73;
}
body.has-play-dock .app-dock .bottom-nav .illustrated-icon {
  width: 47px;
  height: 47px;
  filter: brightness(1.15) saturate(1.13) drop-shadow(0 2px 2px #855c2526);
}
body.has-play-dock .app-dock .nav-label { font-size: 12px; }
body:is([data-screen="collection"], [data-screen="trophies"], [data-screen="workshop"]) .app {
  padding-bottom: 0;
}
body[data-screen="home"] .home-hub-hero::before { display: none; }
body.has-play-dock .home-hub-hero .home-art-window {
  margin-top: -64px;
  width: 100vw;
  overflow: clip;
}
body.has-play-dock .home-art-window .expedition-art {
  max-width: 1000px;
  aspect-ratio: auto;
  height: clamp(360px, calc(100svh - 310px), 650px);
}
.home-hub-hero .home-art-backdrop { opacity: .58; }
.home-hub-hero .home-art-backdrop img {
  opacity: .68;
  mask-image: linear-gradient(#0009, #000 25%, #0008 62%, transparent 98%);
}
.home-hub-hero .expedition-art::after {
  z-index: 3;
  height: 22%;
  background: linear-gradient(#faf5e800, #faf5e899 58%, var(--screen-cream));
}
.home-hub-hero .home-art-brand {
  left: 6%; top: 22%; width: 50%;
}
.home-hub-hero .home-art-slogan { left: 11%; top: 67%; width: 40%; }
.home-hub-hero .home-art-guide {
  top: 12%; left: 52%; width: 47%; height: 88%;
  mask-image: linear-gradient(#000 72%, #000a 88%, transparent 99%);
}
.home-hub-hero .home-art-guide img { top: 0; }
.home-hub-hero .home-art-sully { left: 43%; top: 52%; width: 13%; }
.home-hub-hero .expedition-scan { display: none; }
.home-updates { max-width: 680px; margin-top: 0; }
.home-updates-heading { display: flex; align-items: center; gap: 18px; margin: 0 20px 16px; }
.home-updates-heading::before,
.home-updates-heading::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, #c3a365); }
.home-updates-heading::after { rotate: 180deg; }
.home-updates-heading h2 { margin: 0; font-size: 26px; font-weight: 600; color: #2e5958; }
.home-updates-grid { grid-template-columns: 1fr; }
.home-update-card { min-height: 125px; border-radius: 24px; padding: 12px 18px 12px 8px; }
.home-update-card b { min-height: 25px; }
.home-themes { max-width: 680px; margin-inline: auto; }
.first-run-options > summary { justify-content: center; }
.first-run-options #install-home-slot { margin-top: 14px; }
/* The incomplete phrase is the focal point. The letter board keeps its own
   measured viewport space; decorative scenery never receives pointer input. */
body.playing .game-title .eyebrow { letter-spacing: .08em; color: #6b816f; }
body.playing .phrase-heading { font-size: 21px; font-weight: 600; color: var(--screen-teal); }
body.playing .phrase-instruction { font-size: 12px; color: #6f7b70; }
body.playing .phrase-strip {
  background: radial-gradient(ellipse at 50% 25%, #fffef3, #fff2d947);
  border-image-source: url("../assets/parchment-nine-slice.svg");
  box-shadow: 0 8px 12px -12px #89632b80;
}
body.playing .game-stats { color: #526f70; }
body.playing #precision { margin-left: auto; color: #788278; }
body.playing .board-paper {
  border-color: #e3c78d;
  border-radius: 19px;
  background: linear-gradient(135deg, #fff3ce, #e6ce93 62%, #f3e4bf);
  box-shadow: inset 0 2px #fffef1, 0 4px #c5ad7955, 0 9px 17px #836a2e12;
}
body.playing .cell {
  border-radius: 9px;
  background: linear-gradient(145deg, #fffef8, #fff7e4 68%, #f9e8be);
  box-shadow: inset 0 1px #fff, inset 0 -2px #e6cc9266;
}
body.playing .cell.selected {
  color: #fffefa;
  background: linear-gradient(140deg, #50d6cd, #23a6ba 55%, #3781bc);
  box-shadow: inset 0 2px #c3fff099, inset 0 -2px #1b739677;
}
body.playing .cell.wrong { color: #fff; background: linear-gradient(140deg, #e88278, #ba5163); }
body.playing .tools-bar { padding: 8px; border: 1px solid #dec38e; border-radius: 20px; background: var(--dock-gold); box-shadow: inset 0 2px #fff9dc, 0 3px #bb965b3b; }
body.playing .tool-button { border-radius: 14px; min-height: 52px; background: linear-gradient(140deg, #fffef0, #ffedbf); }
body.playing .tool-button .icon { width: 27px; height: 27px; }
body.playing .tool-button.active { background: linear-gradient(140deg, #d9fff2, #9ee5e9); border-color: #288e98; }
body.playing .learning-game .tools-bar { display: none; }
/* Celebration is a composed sheet, not a dashboard of equal-weight numbers. */
.result-wrap { position: relative; }
.result-wrap .result-hero { height: 185px; margin-bottom: 0; }
.result-wrap .result-heading {
  position: relative; z-index: 3;
  margin: 0;
  padding: 4px 0 15px;
  text-align: center;
  font: 650 30px/1.15 var(--heading);
  color: #285457;
}
.result-wrap .result-card { border-radius: 28px 28px 0 0; background: var(--screen-cream); padding-top: 20px; }
.result-card .result-scroll { margin: 10px 0 12px; padding-block: 16px; }
.result-card .result-phrase { font-family: var(--heading); font-size: clamp(24px, 5vw, 34px); line-height: 1.3; font-weight: 600; }
.result-card .result-author { text-align: center; font-weight: 800; color: #315b60; }
.result-card .result-kind { display: block; text-align: center; color: #788174; }
.result-card .result-work { display: block; text-align: center; color: #647b70; font-size: 12px; margin: 4px 0; }
@media (pointer: coarse) {
  :is(button, a, label, summary) { -webkit-tap-highlight-color: transparent; }
}
.result-performance { margin: 0 0 4px; color: #727864; }
.result-performance > summary { min-height: 44px; display: flex; align-items: center; justify-content: center; cursor: pointer; font: 800 12px/1.4 var(--body); text-decoration: underline; text-underline-offset: 3px; }
.result-performance .result-stats { margin-bottom: 8px; }
.first-discovery .result-performance[open] .result-stats { display: grid; }
.first-discovery .result-performance[open] .reward-breakdown { display: block; }
.result-card.first-discovery .result-favorite { display: flex; justify-content: center; }
.result-performance .reward-breakdown { margin-bottom: 10px; }
.result-wrap > .dialog-actions {
  background: var(--dock-gold);
  border: 1px solid #d3ad6c;
  border-radius: 0 0 25px 25px;
  padding: 12px 14px 8px;
  margin-top: 0;
}
.result-wrap > .dialog-actions .secondary { font-size: 12px; }
.poem-reading-actions { background: var(--dock-gold); border: 2px solid #d3ac67; box-shadow: inset 0 0 0 2px #fff6d6, 0 5px #b27e3e, 0 12px 25px #59442d29; }
@media (max-width: 760px) {
  body.has-play-dock .app-dock { width: 100%; gap: 9px; border-radius: 25px 25px 0 0; padding: 10px max(10px, var(--safe-left, 0px)) calc(10px + var(--safe-bottom, env(safe-area-inset-bottom))) max(10px, var(--safe-right, 0px)); }
  body.has-play-dock .app-dock .primary { min-height: 56px; font-size: 20px; }
  body.has-play-dock .app-dock .bottom-nav button { min-height: 69px; }
  body.has-play-dock .app-dock .bottom-nav .illustrated-icon { width: 41px; height: 41px; }
  body.has-play-dock .app-dock .nav-label { font-size: 10px; }
  body.has-play-dock .home-art-window .expedition-art { height: clamp(310px, calc(100svh - 330px), 510px); }
  .home-hub-hero .home-art-brand { left: 17%; top: 16%; width: 66%; }
  .home-hub-hero .home-art-slogan { left: 25%; top: 44%; width: 50%; }
  .home-hub-hero .home-slogan-tile { font-size: clamp(12px, 3.3vw, 20px); }
  .home-hub-hero .home-tile-row { gap: 3px; margin-bottom: 3px; }
  .home-hub-hero .home-art-guide { left: 25%; top: 55%; width: 65%; height: 45%; }
  .home-hub-hero .home-art-guide img { top: -6%; }
  .home-hub-hero .home-art-sully { left: 13%; top: 64%; width: 22%; }
  .home-updates { margin-bottom: 14px; }
  .home-updates-heading { margin-bottom: 12px; }
  .home-updates-heading h2 { font-size: 24px; }
  .home-update-card { min-height: 113px; }
  .home-update-card strong { font-size: 19px; }
  body.playing .phrase-heading { font-size: 19px; }
  body.playing .tools-bar { padding: 6px; }
  body.playing .tool-button { min-height: 48px; padding: 5px; font-size: 11px; }
  body.playing .game-bottom { gap: 7px; }
  .result-wrap .result-heading { font-size: 26px; }
}
@media (max-height: 700px) {
  .result-wrap .result-hero { height: 124px; }
  .result-wrap .result-heading { padding-top: 0; font-size: 24px; }
  .result-card .result-scroll { padding-block: 11px; }
  .result-card .result-phrase { font-size: 24px; }
  body.playing .phrase-heading { font-size: 16px; }
}
@media (max-height: 650px) {
  body.playing .tools-bar { padding: 4px; }
  body.playing .tool-button { min-height: 44px; }
  body.playing .tool-button .icon { width: 22px; height: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .home-hub-hero .home-art-layer { transition: none; }
}

/* Exact sanctuary/desk pixels from desafio-a-desktop-v2, not a screenshot of
   the board. The transparent frame has no letters or controls in its center. */
body.playing::before,
body.playing::after {
  content: "";
  position: fixed;
  top: 0;
  bottom: 0;
  width: clamp(6px, 3vw, 115px);
  pointer-events: none;
  background-repeat: no-repeat;
  background-size: auto 100%;
  z-index: 0;
}
body.playing::before {
  left: 0;
  background-image: url("../assets/expedition/study-game-challenge-left.png");
  background-position: left center;
}
body.playing::after {
  right: 0;
  background-image: url("../assets/expedition/study-game-challenge-right.png");
  background-position: right center;
}
body.playing .app {
  position: relative;
  z-index: 1;
}
body.playing .board-paper {
  border-image-source: url("../assets/expedition/study-game-challenge-frame.png");
  border-image-slice: 25 24 20 24;
  border-image-width: 8px;
  border-image-outset: 3px;
  border-image-repeat: stretch;
}
.result-wrap .result-scroll {
  border: 1px solid transparent;
  border-image-source: url("../assets/expedition/study-game-reveal-frame.png");
  border-image-slice: 24 38 45 38;
  border-image-width: 15px;
  border-image-outset: 2px;
  background: #fff2d5 url("../assets/expedition/study-game-poem-paper.png") repeat;
  border-radius: 0;
  padding-inline: 18px;
}
@media (max-width: 760px) {
  body.playing::before,
  body.playing::after { width: min(2vw, 8px); }
}
