/* Lourdes scenery. The original coloring surface stays in #layout. */
:root { --ink: #203d3d; --muted: #536967; --line: #d4dfd6; --panel: #fffdf6f2; --gold: #9c7233; }
[hidden] { display: none !important; }
body { background: #bed3cd; color: var(--ink); }
#lourdes-world { position: fixed; inset: 0; overflow: hidden; }
#lourdes-world canvas { display: block; width: 100%; height: 100%; touch-action: none; outline-offset: -5px; }
.scene-header { position: fixed; z-index: 10; top: max(18px, env(safe-area-inset-top)); left: max(22px, env(safe-area-inset-left)); right: max(22px, env(safe-area-inset-right)); display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; pointer-events: none; }
.scene-heading, .scene-actions, .scene-waypoints, .scene-tools, .scene-note { pointer-events: auto; background: #fffdf5ed; border: 1px solid #ffffffe6; box-shadow: 0 5px 24px #183f3720; backdrop-filter: blur(12px); }
.scene-heading { border-radius: 20px; padding: 17px 24px 18px; }
.scene-heading p { margin: 0 0 6px; font-size: 12px; font-weight: 750; color: #586e61; letter-spacing: .15em; text-transform: uppercase; }
.scene-heading h1 { font-size: clamp(24px, 2.7vw, 36px); text-shadow: none; color: #29483e; }
.scene-heading small { display: block; margin-top: 7px; font-size: 14px; color: #637569; }
.scene-actions { display: flex; align-items: center; gap: 8px; padding: 7px; border-radius: 16px; }
.scene-button, .scene-actions a { min-height: 44px; border: 1px solid #c5d4c8; border-radius: 10px; padding: 10px 16px; background: #fffdf6; color: #2c4b3f; font: 650 15px/1.3 system-ui, sans-serif; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.scene-button.primary { background: #315e50; border-color: #315e50; color: #fffdf6; }
.scene-button:hover, .scene-actions a:hover { background: #e7eee2; }
.scene-button.primary:hover { background: #234637; }
.scene-button:focus-visible, .scene-actions a:focus-visible, #lourdes-world canvas:focus-visible { outline: 3px solid #b17b2f; outline-offset: 3px; }
.scene-footer { position: fixed; z-index: 10; bottom: max(20px, env(safe-area-inset-bottom)); left: max(22px, env(safe-area-inset-left)); right: max(22px, env(safe-area-inset-right)); display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; pointer-events: none; }
.scene-waypoints { border-radius: 18px; padding: 8px; display: flex; gap: 6px; }
.scene-waypoints button { background: transparent; border-color: transparent; }
.scene-waypoints button[aria-pressed="true"] { background: #e3ecdf; border-color: #c8d7c3; }
.scene-tools { border-radius: 16px; display: flex; gap: 4px; padding: 6px; }
.scene-tools button { padding: 8px; min-width: 44px; font-size: 20px; }
.scene-tools button[data-view="home"] { font-size: 14px; padding: 8px 12px; }
.scene-note { position: fixed; z-index: 8; left: 50%; bottom: 92px; transform: translateX(-50%); border-radius: 12px; padding: 10px 18px; text-align: center; max-width: min(480px, calc(100vw - 36px)); }
.scene-note p { margin: 0; font: 500 14px/1.45 system-ui, sans-serif; color: #47604e; }
.scene-note strong { font-weight: 650; color: #2d493d; }
#scene-loading { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 16px 20px; background: #fffdf5; border-radius: 12px; color: #345643; }
#scene-walk { position: fixed; z-index: 11; bottom: 96px; left: 24px; display: grid; grid-template-columns: repeat(3, 46px); grid-template-rows: repeat(2, 46px); gap: 5px; }
#scene-walk button { border-radius: 12px; border: 1px solid #ffffffe8; background: #fffdf5e8; color: #365640; font-size: 18px; touch-action: none; box-shadow: 0 3px 12px #1a3b2a20; }
#scene-walk button:active { background: #c8dbc2; }
#scene-walk [data-walk="up"] { grid-column: 2; }
#scene-walk [data-walk="left"] { grid-row: 2; grid-column: 1; }
#scene-walk [data-walk="down"] { grid-row: 2; grid-column: 2; }
#scene-walk [data-walk="right"] { grid-row: 2; grid-column: 3; }
#layout { display: none; z-index: 9; top: 86px; padding-top: 12px; }
body.is-painting #layout { display: grid; }
body.is-painting .scene-footer, body.is-painting .scene-note { display: none; }
body.is-painting #scene-walk { display: none; }
body.is-painting .scene-heading { padding: 11px 18px; }
body.is-painting .scene-heading p, body.is-painting .scene-heading small { display: none; }
body.is-painting .scene-heading h1 { font-size: 23px; line-height: 1.4; }
body.is-painting #lourdes-world { filter: blur(3px); }
body.is-painting #lourdes-world::after { content: ""; position: absolute; inset: 0; background: #e4ecde70; }
.panel { background: #fffdf5f5; border-color: #e0e5d9; box-shadow: 0 5px 20px #1e4c3720; border-radius: 16px; }
.panel h1 { text-shadow: none; }
.side > .panel:first-child { display: none; }
.side > .panel:nth-child(2) { display: none; }
.eyebrow, .sb-kicker { color: #647849; }
.challenge-text, .challenge-count { color: #36543e; }
.btn { background: #eff3e9; color: #304c3d; border-color: #c6d4c1; min-height: 44px; }
.btn:hover { background: #dfe8d8; }
.btn.gold, .sb-btn.gold { background: #315e50; color: #fffdf5; border-color: #315e50; }
.btn.gold:hover { background: #274e40; }
.swatch { min-height: 44px; border-color: #c7d3c4; }
.swatch.selected { outline-color: #315e50; }
.swatch-name { color: #425a46; }
.swatch-badge { color: #263b2c; background: #fffffff0; }
#frame { background: linear-gradient(135deg, #b69865, #e5d1a5, #8b704a); box-shadow: 0 20px 60px #153e3a40; padding: 12px; }
#paint-canvas { max-height: calc(100dvh - 235px); }
#caption { display: block; position: static; width: 100%; max-width: 560px; padding: 10px 8px 2px; color: #293c2d; font-size: 15px; line-height: 1.4; text-align: center; white-space: normal; text-shadow: none; transform: none; }
#caption.story { width: 100%; max-width: 560px; }
#caption.flash { animation: lourdes-caption-in .45s ease; }
@keyframes lourdes-caption-in { from { opacity: 0; } to { opacity: 1; } }
.storybook { background: #e4eddfbc; }
.sb-card { background: #fffdf6f5; border-color: #d2dfcf; box-shadow: 0 20px 80px #203c3233; }
.sb-title, .sb-text { color: #2d483b; }
.sb-btn { color: #2c483c; background: #edf2e6; border-color: #c6d4c1; min-height: 44px; }
.sb-skip { color: #526c57; min-height: 44px; }
.sb-dot { background: #d8e2d1; }
.sb-dot.on { background: #64855a; }
#celebrate { background: #e7efddc9; }
.celebrate-card h2, .celebrate-card p { color: #304b3a; }
@media (max-width: 800px) {
  .scene-header { top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px; gap: 8px; }
  .scene-heading { padding: 12px 16px; border-radius: 14px; }
  .scene-heading h1 { font-size: 24px; }
  .scene-heading small { display: none; }
  .scene-heading p { font-size: 11px; margin-bottom: 5px; }
  .scene-actions { padding: 5px; gap: 5px; border-radius: 12px; }
  .scene-actions a { display: none; }
  .scene-footer { left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); flex-wrap: wrap; justify-content: center; gap: 8px; }
  .scene-waypoints { width: 100%; justify-content: center; padding: 5px; }
  .scene-waypoints button { padding: 8px 12px; flex: 1; font-size: 14px; }
  .scene-tools { padding: 4px; }
  .scene-note { bottom: 148px; width: max-content; padding: 8px 14px; }
  .scene-note p { font-size: 13px; }
  #scene-walk { left: 12px; bottom: 146px; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(2, 44px); gap: 4px; }
  .scene-note { bottom: 146px; left: auto; right: 12px; transform: none; max-width: calc(100vw - 176px); }
  .scene-note p:last-child { display: none; }
}
@media (max-width: 720px) {
  #layout { top: 72px; grid-template-rows: minmax(0, 1fr) minmax(150px, 32%); gap: 8px; padding: 8px 10px max(8px, env(safe-area-inset-bottom)); }
  .side { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 8px; overflow: auto; min-width: 0; align-content: start; }
  .side .panel { padding: 10px; margin: 0; }
  .side .challenge { grid-column: 1 / -1; padding: 7px 12px; }
  .challenge .eyebrow, .challenge-text { display: none; }
  .challenge-count { margin: 4px 0 0; font-size: 13px; }
  .side .actions { gap: 6px; }
  .side .actions .btn { padding: 8px; font-size: 13px; }
  .palette { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .swatch { width: 100%; min-height: 44px; }
  .swatch-name { font-size: 11px; }
  #paint-canvas { max-height: calc(60dvh - 130px); max-width: calc(100vw - 60px); }
  #caption, #caption.story { font-size: 14px; max-width: calc(100vw - 60px); }
  #frame { padding: 9px; }
  .scene-heading h1, body.is-painting .scene-heading h1 { font-size: 20px; }
  .scene-actions .scene-button { font-size: 13px; padding: 8px 12px; }
}
@media (max-width: 390px) {
  .scene-heading { padding: 11px; }
  .scene-heading h1 { font-size: 18px; }
  .scene-heading p { font-size: 10px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .scene-heading { padding: 8px 14px; }
  .scene-heading p, .scene-note { display: none; }
  #scene-walk { bottom: 76px; }
  .scene-footer { flex-wrap: nowrap; }
  .scene-waypoints { width: auto; }
  #layout { top: 62px; grid-template-columns: 220px 1fr; grid-template-rows: 1fr; }
  .side { display: flex; order: 0; flex-direction: column; flex-wrap: nowrap; overflow-y: auto; }
  #paint-canvas { max-height: calc(100dvh - 102px); }
  .palette { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
