:root { color-scheme: light; font-family: system-ui, sans-serif; background: #f6f1e7; color: #504939; }
* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: radial-gradient(ellipse at 50% 40%, #fffcf5, #f3eddf); }
.journey { position: relative; width: 100%; min-height: 100svh; height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(5px, 1.3vh, 12px); padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
.journey-tools { width: min(100%, 820px); min-height: 44px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: 0 0 auto; }
.journey-tool { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 7px 12px; border: 1px solid #c9beaa; border-radius: 24px; color: #4c493f; background: #fffaf0; box-shadow: 0 3px 12px #70572a0b; font: inherit; font-size: 14px; line-height: 1; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.journey-tool:focus-visible, .continue-button:focus-visible, .collection-item:focus-visible { outline: 3px solid #49644e; outline-offset: 2px; }
.undo-button { width: 44px; height: 44px; flex: 0 0 44px; padding: 0; font-size: 22px; }
.undo-button:disabled { color: #777064; background: #f3eddf; cursor: not-allowed; box-shadow: none; }
.collection-button { padding-inline: 8px 12px; }
.collection-thumb { width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 28px; overflow: hidden; border-radius: 50%; background: #f2ead9; }
.collection-thumb svg { width: 100%; height: 100%; display: block; }
.collection-count { min-width: 21px; height: 21px; display: grid; place-items: center; padding-inline: 5px; border-radius: 11px; color: #fffdf8; background: #526c55; font-size: 12px; font-weight: 650; }
.sound-toggle[aria-pressed="false"] { color: #59564d; background: #f3eddf; }
.play-area { width: 100%; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(7px, 1.8vh, 12px); }
.picture { width: min(100%, 820px, calc(100svh - 182px)); aspect-ratio: 1; position: relative; z-index: 0; flex: 0 0 auto; transform: translate3d(0, 0, 0) scale(1); transform-origin: center center; }
.picture svg { position: relative; z-index: 2; width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 12px 15px #78623a16); transition: opacity 120ms ease-out; }
.sculpture-canvas { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; pointer-events: none; transition: opacity 120ms ease-out; }
.picture[data-phase="emergence"] svg, .picture[data-phase="rotation"] svg, .picture[data-phase="flight"] svg, .picture[data-phase="collected"] svg { opacity: 0; }
.picture[data-phase="emergence"] .sculpture-canvas, .picture[data-phase="rotation"] .sculpture-canvas, .picture[data-phase="flight"] .sculpture-canvas, .picture[data-phase="collected"] .sculpture-canvas { opacity: 1; }
.picture[data-phase="emergence"] .sculpture-canvas, .picture[data-phase="rotation"] .sculpture-canvas { filter: drop-shadow(0 13px 13px #59472b1c); }
.picture[data-phase="flight"] { z-index: 5; transition: transform 900ms cubic-bezier(.18,.65,.18,1), opacity 900ms ease; transform: translate3d(var(--flight-x, 0px), var(--flight-y, 0px), 0) scale(.23); opacity: .96; }
.picture[data-landed="true"] { z-index: 5; transform: translate3d(var(--flight-x, 0px), var(--flight-y, 0px), 0) scale(.23); opacity: .08; transition: opacity 180ms ease-out; }
.celebration-layer { position: absolute; z-index: 3; inset: 4%; border: 1px solid #d4ba7a; border-radius: 50%; opacity: 0; pointer-events: none; transform: scale(.96); }
.picture[data-phase="admiration"] .celebration-layer { animation: admiration-ring 740ms ease-out both; }
.picture[data-phase="collected"] .celebration-layer { opacity: .5; transform: scale(1); }
.colors { display: flex; align-items: center; justify-content: center; gap: clamp(14px, 5vw, 28px); flex: 0 0 auto; padding: 8px 14px; border-radius: 50px; background: #fffaf0b8; box-shadow: 0 6px 24px #70572a0b; }
.swatch { width: 54px; height: 54px; padding: 5px; border: 2px solid transparent; border-radius: 50%; background: none; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: transform 160ms, border-color 160ms; }
.swatch > span { width: 100%; height: 100%; display: grid; place-items: center; border-radius: 50%; background: var(--pigment); box-shadow: inset 0 0 0 1px #4f392420, inset 0 2px 3px #ffffff35; color: #28221b; font-size: 14px; }
.swatch[aria-pressed="true"] { border-color: #615544; transform: translateY(-3px); }
.swatch:focus-visible { outline: 3px solid #615544; outline-offset: 3px; }
.region { outline: none; stroke: #675b48; stroke-width: 2.1; stroke-linejoin: round; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: fill 140ms ease; }
.region:focus-visible { outline: none; stroke: #201d18; stroke-width: 5; stroke-dasharray: 7 4; }
.engraving { fill: none; stroke: #554b39; stroke-opacity: .43; stroke-width: 1.05; stroke-linecap: round; pointer-events: none; }
.feedback { pointer-events: none; }
.attempt { fill: var(--attempt-color); opacity: .65; transform-box: fill-box; transform-origin: center; animation: retreat 1100ms ease-out forwards; }
.neighbor-cue { fill: none; stroke: #302c26; stroke-width: 3.5; stroke-dasharray: 5 4; animation: neighbor-pulse 1100ms ease-out; }
.border-halo { fill: none; stroke: #fffcf0; stroke-width: 11; stroke-linecap: round; }
.border-cue { fill: none; stroke: #302c26; stroke-width: 4; stroke-dasharray: 7 5; stroke-linecap: round; animation: border-pulse 1100ms ease-out; }
.collision-mark { stroke: #302c26; stroke-width: 3; stroke-linecap: round; }
.fill-bloom { animation: fill-bloom 300ms ease-out; }
.picture.arriving { animation: arrive 600ms ease-out; }
.continue-button { min-width: 44px; min-height: 44px; padding: 9px 15px; border: 1px solid #526c55; border-radius: 24px; color: #fffdf8; background: #526c55; font: inherit; font-size: 14px; cursor: pointer; touch-action: manipulation; }
.continue-button[hidden] { display: none; }
.collection-dialog { width: min(520px, calc(100vw - 20px)); max-width: calc(100vw - 20px); max-height: min(88dvh, 760px); padding: 0; overflow: hidden; border: 1px solid #c8bfaf; border-radius: 18px; color: #504939; background: #fffdf8; box-shadow: 0 18px 70px #352c1c3d; }
.collection-dialog::backdrop { background: #29261f66; backdrop-filter: blur(2px); }
.collection-dialog-content { max-height: min(88dvh, 760px); display: flex; flex-direction: column; gap: 12px; padding: 16px; overflow: auto; }
.collection-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.collection-heading h1 { margin: 0; color: #343a33; font: 400 22px/1.15 Georgia, "Times New Roman", serif; }
.collection-close { flex: 0 0 auto; }
.collection-empty { margin: 0; color: #57574f; font-size: 14px; }
.collection-items { display: grid; grid-template-columns: repeat(auto-fit, minmax(126px, 1fr)); gap: 8px; max-height: min(34dvh, 280px); overflow: auto; overscroll-behavior: contain; }
.collection-item { min-width: 0; min-height: 60px; display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 8px; padding: 5px 8px 5px 5px; border: 1px solid #d1c8b8; border-radius: 11px; color: #403e36; background: #fffaf0; cursor: pointer; text-align: left; }
.collection-item[aria-pressed="true"] { border-color: #49644e; box-shadow: inset 0 0 0 1px #49644e; }
.collection-item-art { width: 48px; height: 48px; display: block; overflow: hidden; border-radius: 7px; background: #f2ead9; }
.collection-item-art svg { width: 100%; height: 100%; display: block; }
.collection-item-label { min-width: 0; font-size: 13px; line-height: 1.2; }
.collection-load-more { grid-column: 1 / -1; min-height: 44px; border: 1px solid #c8bfaf; border-radius: 10px; color: #403e36; background: #f8f3e9; font: inherit; cursor: pointer; }
.collection-preview { display: grid; grid-template-columns: minmax(90px, 150px) minmax(0, 1fr); align-items: center; gap: 10px; padding-top: 10px; border-top: 1px solid #d8d2c7; }
.collection-preview[hidden] { display: none; }
.collection-preview-art { width: 100%; aspect-ratio: 1; }
.collection-preview-art svg { width: 100%; height: 100%; display: block; }
.collection-preview strong { color: #343a33; font-size: 15px; }
.collection-preview p { margin: 3px 0 0; color: #555950; font-size: 14px; line-height: 1.25; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@keyframes retreat { 0%,35% { opacity: .65; transform: scale(1); } 100% { opacity: 0; transform: scale(.7); } }
@keyframes neighbor-pulse { 0%,65% { stroke-width: 3.5; } 35% { stroke-width: 6; } }
@keyframes border-pulse { 0%,65% { stroke-width: 4; } 35% { stroke-width: 7; } }
@keyframes fill-bloom { from { fill-opacity: .4; } to { fill-opacity: 1; } }
@keyframes arrive { from { opacity: .75; transform: scale(.98); } to { opacity: 1; transform: scale(1); } }
@keyframes admiration-ring { from { opacity: 0; transform: scale(.96); } 25% { opacity: .38; } to { opacity: .02; transform: scale(1.02); } }
@media (max-width: 360px) { .colors { gap: 12px; padding-inline: 9px; } }
@media (orientation: landscape) and (max-height: 550px) {
  .journey { justify-content: center; gap: 5px; padding-block: max(3px, env(safe-area-inset-top)) max(3px, env(safe-area-inset-bottom)); }
  .journey-tools { min-height: 44px; justify-content: center; }
  .play-area { flex-direction: row; gap: 8px; }
  .picture { width: min(68vw, calc(100dvh - 80px)); }
  .colors { flex-direction: column; gap: 4px; padding: 4px; }
  .swatch { width: 44px; height: 44px; padding: 4px; }
  .swatch[aria-pressed="true"] { transform: translateX(-2px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .attempt { opacity: .35; }
  .celebration-layer { opacity: .4; transform: none; }
}
