.creek-page {
  width: min(100%, 1300px, 148dvh);
  container-type: inline-size;
  margin: 10px auto 12px;
}
.creek-scene {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  aspect-ratio: 1672 / 941;
  border-radius: clamp(14px, 2cqw, 23px);
  background: #dfbd82 url(./images/bridge/creek.webp) center / cover no-repeat;
  /* Positions are measured on the same illustration as the approved close-up. */
  --tray-height: 22%;
  --deck-left: 36.3%;
  --span: 32.9cqw;
  --unit: calc(var(--span) / var(--length));
  --deck-y: 56.3%;
  --deck-height: clamp(20px, 3cqw, 46px);
  --dog-left: 3.5%;
  --dog-width: 33.7%;
  --arrival-left: 45%;
  --lamp-x: 8.8%;
  --lamp-y: 11.8%;
  --lamp-size: 6.4cqw;
  --ring-x: 8.8%;
  --ring-y: 10.8%;
  --hook-tip: polygon(8.52% 10.6%,9.02% 10.6%,9% 12.05%,8.81% 12.25%,8.55% 12.05%);
}
.creek-heading {
  position: absolute;
  top: 2.2%; left: 1.6%;
  display: flex; align-items: center; gap: clamp(4px, .55cqw, 10px);
}
.creek-scene .creek-heading button:not(.menu-item) {
  min-height: 44px; height: clamp(44px, 3.8cqw, 56px);
  font-size: clamp(14px, 1.7cqw, 23px);
  border: 1.5px solid #a16a45; background: #fff3d8; color: #4d2c34;
  box-shadow: inset 0 0 0 2px #fff8e4, 0 2px 0 #72472f5c;
}
.creek-heading :is(.square,.creek-undo) {
  display: grid; place-items: center; width: clamp(44px, 3.8cqw, 56px);
  min-width: 0; padding: 0; border-radius: 50%;
}
.creek-heading .creek-level { border-radius: 18px; white-space: nowrap; padding: 0 .7em; }
.creek-counter {
  position: absolute; top: 6%; left: 50%;
  transform: translateX(-50%) rotate(-1deg); pointer-events: none;
  padding: .45em 1.25em .6em;
  text-align: center; white-space: nowrap;
}
.creek-counter small { display: block; font-size: clamp(12px, 1.45cqw, 22px); line-height: 1.12; font-weight: 850; }
.creek-page .creek-counter h2 { font-size: clamp(28px, 4.3cqw, 56px); line-height: 1.12; }
.creek-crossing { position: absolute; inset: 0; clip-path: inset(0 0 23% 0); }
.creek-deck {
  position: absolute; left: var(--deck-left); top: var(--deck-y);
  width: var(--span); height: var(--deck-height);
  display: flex; border-radius: 5px;
  box-shadow: 0 3px #79583b, 0 5px 7px #49372352;
}
.creek-empty {
  flex: 1 1 0; min-width: 0;
  background: linear-gradient(#fff7dfe8,#f9e7c6e6);
  border-radius: 3px; box-shadow: inset 0 0 0 1px #8a7157;
}
.creek-delivery {
  position: absolute; width: var(--dog-width); left: var(--dog-left);
  bottom: calc(100% - var(--deck-y) - .5%); transform-origin: bottom left;
  filter: drop-shadow(0 2px 1px #694a3159); pointer-events: none;
}
.creek-delivery.arrived { left: var(--arrival-left); }
@media (prefers-reduced-motion: no-preference) {
  .creek-delivery.crossing { animation: creek-cross 1.7s ease-in-out both; }
}
@keyframes creek-cross {
  from { left: var(--dog-left); }
  to { left: var(--arrival-left); }
}
.creek-hook {
  position: absolute; left: var(--lamp-x); top: var(--lamp-y); transform: translateX(-50%);
  width: max(44px,var(--lamp-size)); min-height: 44px; padding: 0;
  display: grid; justify-items: center; align-content: start;
  background: transparent; border: 0;
}
.bridge-lantern {
  display: block; width: 100%; aspect-ratio: 108 / 154;
  background: url(./images/bridge/lantern.webp) center / contain no-repeat;
  clip-path: polygon(49% 0,56% 0,57% 6%,73% 8%,74% 14%,88% 22%,99% 34%,94% 40%,86% 40%,92% 53%,88% 69%,81% 77%,90% 79%,89% 85%,77% 87%,74% 90%,55% 92%,53% 99%,48% 99%,46% 93%,27% 90%,25% 87%,13% 86%,10% 81%,12% 78%,18% 76%,12% 65%,10% 53%,14% 40%,5% 40%,1% 36%,7% 29%,14% 23%,28% 15%,31% 10%,46% 7%);
}
.creek-hook .bridge-lantern { width: var(--lamp-size); }
.map-bridge-light { position: absolute; top: 19%; left: 40.2%; width: clamp(11px,1.9vw,24px); pointer-events: none; }
.creek-tray {
  position: absolute; inset: 79% 4% 1%;
  display: flex; justify-content: center; align-content: center; align-items: center;
  gap: .4cqw 2.5cqw; flex-wrap: wrap;
}
.creek-slot { display: grid; place-items: center; min-width: 44px; }
.creek-choice, .creek-piece {
  position: relative; flex: none; width: calc(var(--unit) * var(--cells));
  background: transparent; border: 0; margin: 0; padding: 0;
}
.creek-choice { display: grid; align-items: center; height: clamp(44px, 4.6cqw, 68px); }
.creek-choice::before { content: ""; position: absolute; inset: 0; min-width: 44px; left: 50%; transform: translateX(-50%); }
.creek-deck > .creek-board { flex: none; width: calc(var(--unit) * var(--cells)); }
.creek-board {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; place-items: center; width: 100%; height: 100%;
  color: #452c31; font: 950 clamp(15px, 2.45cqw, 35px)/1 ParkRounded, ui-rounded, sans-serif;
  border-radius: clamp(3px,.5cqw,8px);
  background-color: var(--tint);
  background-image: linear-gradient(90deg, transparent calc(100% - 1px), #7f5b44a6 0);
  background-size: calc(100% / var(--cells)) 100%;
  box-shadow: inset 0 0 0 1.4px #79543d, inset 0 4px #fff5d87d, inset 0 -4px #6343273b;
}
.creek-board::before {
  content: ""; position: absolute; z-index: -1; inset: 0; opacity: .22; mix-blend-mode: multiply;
  background: url(./images/bakery-room/counter.webp) center 98% / 150% 850%;
}
.creek-board.fixed { --tint: #cca87e; }
.creek-choice .creek-board { height: clamp(26px, 4.2cqw, 62px); box-shadow: inset 0 0 0 1.4px #84593e, inset 0 4px #fff3d78a, inset 0 -5px #70432138, 0 3px #855333, 0 5px 5px #66411d65; }
.creek-piece:disabled { opacity: 1; }
.creek-guide {
  position: absolute; bottom: 24%; left: 50%; transform: translateX(-50%);
  width: max-content; max-width: 86%; border-radius: 15px; padding: 3px 12px;
  color: #492e35; background: #fff5dcf5; text-align: center;
  font-size: clamp(13px,1.45cqw,19px); font-weight: 800; pointer-events: none;
}
@media (max-width: 600px) and (orientation: portrait) {
  .creek-page { width: 100%; margin-top: 6px; }
  .creek-scene {
    --tray-height: 29%;
    aspect-ratio: 3 / 4;
    background-image: url(./images/bridge/creek-portrait.webp);
    --deck-y: 51.6%; --deck-left: 22.3%; --span: 47.7cqw;
    --deck-height: clamp(21px,5.5cqw,31px);
    --dog-left: .2%; --dog-width: 27%; --arrival-left: 50%;
    --ring-x: 10.35%; --ring-y: 23.45%;
    --hook-tip: polygon(9.05% 23.2%,9.55% 23.1%,9.66% 23.58%,10.05% 23.81%,10.57% 23.89%,10.57% 24.25%,9.95% 24.18%,9.36% 23.91%,9.03% 23.55%);
    --lamp-x: 10.4%; --lamp-y: 23.8%; --lamp-size: 7.2cqw;
  }
  .creek-heading { top: 2%; left: 2.2%; }
  .creek-counter { top: 14.4%; padding: .35em 1em .45em; }
  .creek-tray { inset: 75% 3.5% 2%; gap: 0 2.5cqw; }
  .creek-tray:has(> :nth-child(4)) { display: grid; grid-template-columns: auto auto; grid-auto-flow: column; grid-template-rows: 44px 44px; }
  .creek-guide { bottom: 29%; }
}
@media (orientation: landscape) and (max-height: 540px) {
  .creek-scroll .town-mast { display: none; }
  .creek-page { margin: 2px auto; width: min(100%, 175dvh); }
  .creek-counter { top: 3.5%; padding: 3px 12px; }
}
.creek-picker {
  position: absolute; inset: auto 9% 0; height: var(--tray-height);
  display: flex; align-items: center; justify-content: center; gap: clamp(3px, 1cqw, 15px);
}
.creek-route {
  flex: 1; min-width: 0; max-width: 205px; padding: .15em 0;
  min-height: 44px;
  color: #44283a; border: 2px solid #997454; background: #fff1d7;
  border-radius: 14px; box-shadow: 0 3px #875a3d; line-height: 1.14;
}
.creek-route[aria-pressed="true"] { border-color: #5c394f; background: #f0dce9; box-shadow: inset 0 0 0 2px #a67b94,0 3px #654355; }
.creek-route b, .creek-reward :is(b,small) { display: block; }
.creek-route b { font-size: clamp(15px,2cqw,26px); }
.creek-start, .creek-result {
  position: absolute; left: 50%; bottom: calc(var(--tray-height) + 1.5%);
  transform: translateX(-50%); width: max-content; max-width: 96%; margin: 0;
  display: flex; align-items: center; justify-content: center; gap: 4px 8px;
}
.creek-result p { margin: 0; }
.creek-scene:has(.creek-picker) .creek-guide { bottom: 37%; }
.creek-reward { margin-top: .2em; }
.creek-reward b { font-size: clamp(18px,2.6cqw,34px); }
@media (max-width:600px) and (orientation:portrait) {
  .creek-scene :is(.creek-start, .creek-result) button {
    min-height: 44px; font-size: clamp(16px, 4.4cqw, 22px); padding-inline: .65em;
  }
  .creek-scene:has(.creek-picker) .creek-guide { bottom: 40%; }
}


.bridge-lantern.illustrated-lamp { background: none; clip-path: none; aspect-ratio: auto; }
/* Anchor the copper ring, independently of the button's tap-target width. */
.creek-hook:has(.illustrated-lamp) {
  left: var(--ring-x); top: var(--ring-y); grid-template-columns: minmax(0,1fr);
}
.creek-hook .illustrated-lamp { height: calc(var(--lamp-size) * 1.988); width: auto; max-width: none; }
.creek-hook :is(.paw-lamp,.moon-lamp,.mushroom-lamp) { transform: translateX(-3%); }
/* Paint the near edge of the illustrated hook in front of the hanging ring. */
.creek-scene:has(.creek-hook .illustrated-lamp)::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: inherit; clip-path: var(--hook-tip);
}

.creek-ticket:has(.creek-equation) { width: max-content; max-width: 95%; white-space: normal; }
.creek-page .creek-ticket h2.creek-equation {
  font-size: clamp(30px, 7.4cqw, 88px); line-height: 1.08;
  font-variant-numeric: tabular-nums;
}

.creek-counter.creek-ticket {
  min-width: 0; padding: 9px 15px; box-sizing: border-box;
  transform: translateX(-50%);
}
.creek-page .creek-ticket h2 {
  margin: 0; font-size: clamp(24px, 7.5cqw, 44px); line-height: 1.12;
}
@media (orientation: landscape) and (max-height: 540px) {
  .creek-page .creek-ticket h2 { font-size: 25px; }
}

.creek-guide.creek-board-cue {
  bottom: 22%; margin: 0; padding: .22em .65em;
  display: flex; align-items: center; gap: .4em;
  font-size: clamp(24px, 4.2cqw, 44px); line-height: 1.1;
  background: #fff3ce; border: 2px solid #936133; box-shadow: 0 3px #74482d55;
}
.creek-board-cue span { color: #854025; font-family: system-ui, sans-serif; }
@media (max-width:600px) and (orientation:portrait) {
  .creek-guide.creek-board-cue { bottom: 28%; }
}

.creek-swap-target { z-index: 1; }
.creek-swap-target .creek-board {
  outline: 3px solid #fff5a8;
  box-shadow: 0 0 0 5px #aa681e, inset 0 0 0 2px #93613d;
}
.creek-swap-label {
  position: absolute; bottom: calc(100% + 18px); left: 50%;
  transform: translateX(-50%); white-space: nowrap;
  padding: .22em .56em; border: 2px solid #925d38; border-radius: 14px;
  color: #492e35; background: #fff2cd;
  font: 800 clamp(22px,3.4cqw,38px)/1.1 ParkRounded, ui-rounded, sans-serif;
}
.creek-swap-label span {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  font-size: clamp(20px,2.2cqw,28px); line-height: 1;
}
@media (prefers-reduced-motion: no-preference) {
  .creek-swap-target .creek-board { animation: creek-swap-wiggle .55s ease-in-out 2; }
  @keyframes creek-swap-wiggle {
    25% { transform: rotate(-3deg); }
    75% { transform: rotate(3deg); }
  }
}

.creek-shop-preview { container-type: inline-size; }

.creek-sample-span {
  background: repeating-linear-gradient(90deg,#f0c08a 0 calc(16.666% - 2px),#986941 calc(16.666% - 2px) 16.666%);
  border: 1px solid #976b42;
}

.creek-tray-skin {
  position: absolute; inset: auto 0 0; width: 100%; height: var(--tray-height);
  pointer-events: none; object-fit: fill;
}
.creek-shop-preview .creek-scene { --length: 10; }
.creek-tray-sample > .creek-board {
  flex: none; width: calc(var(--unit) * var(--cells)); height: 4.2cqw;
  font-size: 2.45cqw;
}
.creek-tray-swatch {
  width: 94%; height: 75%;
  border-image-slice: 0 160 fill; border-image-width: 0 20%;
}
@media (max-width:600px) and (orientation:portrait) {
  .creek-tray-sample > .creek-board { justify-self: center; height: 6cqw; font-size: 4cqw; }
}

.bridge-finish-art { position: relative; }
.bridge-thanks {
  position: absolute; top: 12%; right: 20%; margin: 0; padding: .32em .78em;
  color: #44203c; background: #fff8e9; border: 2px solid #614435; border-radius: 1em;
  font: 900 clamp(19px, 2vw, 32px)/1.15 ParkRounded, ui-rounded, sans-serif;
}
.bridge-thanks::after {
  content: ""; position: absolute; right: 14%; top: 100%; width: .48em; height: .48em;
  background: #fff8e9; border: solid #614435; border-width: 0 2px 2px 0;
  transform: translateY(-45%) rotate(45deg);
}
