* { box-sizing: border-box; }
:root { color-scheme: dark; font: 16px system-ui, sans-serif; background: #101e1c; color: #fff5df; }
body { margin: 0; }
main { width: min(100%, 490px); min-height: 100svh; margin: auto; display: flex; flex-direction: column; background: #282720; box-shadow: 0 0 70px #0008; }
header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; background: #172522; }
small { color: #f5c47e; letter-spacing: .19em; font-weight: 800; }
h1 { font: 700 clamp(1.5rem,6vw,2rem) Georgia,serif; margin: 3px 0 0; }
button { font: inherit; color: inherit; background: #24332e; border: 1px solid #9c835c; border-radius: 12px; min-height: 44px; cursor: pointer; padding: 8px 12px; }
button:focus-visible { outline: 3px solid #ffcf75; outline-offset: 3px; }
#stage { position: relative; isolation: isolate; flex: 1; height: clamp(350px,62svh,650px); min-height: clamp(350px,62svh,650px); overflow: hidden; background: #27312a url(workshop.png) center / cover; box-shadow: inset 0 0 75px #000a; }
#chain { --step: clamp(68px,11.8svh,126px); position: absolute; left: 51%; top: calc(72% - 3 * var(--step)); width: 0; translate: 0 calc(var(--level,0) * var(--step)); transition: translate .72s cubic-bezier(.22,.71,.25,1); }
#chain::before { content: ''; position: absolute; z-index: -1; top: -700px; bottom: calc(-3 * var(--step) - 20px); left: -5px; width: 10px; border-radius: 7px; background: repeating-linear-gradient(36deg,#79512e 0 2px,#be9157 3px 5px,#e1b97c 6px 7px); box-shadow: 2px 3px 4px #000a; }
.gift,.box { position: absolute; left: 0; transform: translate(-50%,-50%); filter: drop-shadow(4px 8px 7px #0009); }
.gift { top: 0; width: 112px; }
.box { top: calc(var(--slot) * var(--step)); width: var(--width); text-align: center; }
.box img { display: block; width: 100%; }
.box strong { position: absolute; bottom: 12%; left: 50%; translate: -50%; border-radius: 6px; padding: 3px 8px; background: #1c211de8; color: #fff; white-space: nowrap; font-size: .875rem; }
.box.active strong { background: #ffcd7b; color: #26190c; }
#guide { position: absolute; inset: 72% 6% auto; border-top: 2px dashed #ffdb9680; pointer-events: none; }
#target { position: absolute; left: 50%; top: calc(72% + 48px); translate: -50%; background: #ffe0a6; color: #2e1d0f; font-weight: 800; min-width: 125px; }
.tray { padding: 8px 14px max(14px, env(safe-area-inset-bottom)); background: linear-gradient(#362b20,#211d18); }
#feedback { margin: 5px 0 10px; text-align: center; min-height: 2.6em; display: grid; place-items: center; }
#stones { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
#stones button { display: flex; flex-direction: column; align-items: center; justify-content: end; gap: 4px; min-height: 78px; background: #292822; }
#stones button[aria-pressed=true] { background: #493824; border-color: #ffd087; box-shadow: inset 0 0 0 1px #ffd087; }
#stones img { width: var(--size); height: 43px; object-fit: contain; object-position: bottom; }
#win { position: absolute; inset: auto 8% 6%; border: 1px solid #dbad62; border-radius: 16px; background: #142b25f5; padding: 15px; text-align: center; }
#win strong { display: block; font: bold 1.4rem Georgia,serif; margin-bottom: 10px; }
.flight { position: absolute; top: 0; left: 0; width: var(--size); z-index: 2; pointer-events: none; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { #chain { transition: none; } }
