/* ladder: styles for this game only (loaded after /css/core.css). */
.ladder {
  --tile: clamp(42px, 12vw, 56px);
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 14px 0;
}
.ladder::before, .ladder::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 10px; border-radius: 6px; background: var(--rail);
  left: calc(50% - (var(--len) * (var(--tile) + 6px)) / 2 - 22px);
  box-shadow: inset -2px 0 0 rgba(0, 0, 0, .12);
}
.ladder::after { left: auto; right: calc(50% - (var(--len) * (var(--tile) + 6px)) / 2 - 22px); }
.rung { position: relative; display: flex; align-items: center; z-index: 1; }
.rung::before { /* the wooden rung behind the tiles */
  content: ''; position: absolute; left: -18px; right: -18px; top: 50%; height: 8px; margin-top: -4px;
  background: var(--rail); border-radius: 4px; z-index: -1; opacity: .85;
}
.tiles { display: flex; gap: 6px; }
.tile {
  width: var(--tile); height: var(--tile); border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 800; font-size: calc(var(--tile) * .5);
  background: var(--surface); color: var(--text); border: 2px solid var(--line);
  box-shadow: 0 3px 0 var(--line); position: relative; padding: 0;
}
.tile.match { background: var(--match-bg); color: var(--match-ink); border-color: var(--match-bg); box-shadow: 0 3px 0 rgba(0, 0, 0, .2); }
.tile.changed::after { content: ''; position: absolute; left: 50%; bottom: 5px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: currentColor; opacity: .6; }
.tile.blank { background: transparent; border-style: dashed; box-shadow: none; }
.rung.fixed .tile:not(.match) { background: var(--surface-2); }
.rung.goal:not(.reached) .tile { border-color: var(--text); }
.rung.hinted .tile:not(.match) { border-style: dashed; }
.tile.edit { cursor: pointer; font: inherit; font-family: var(--display); font-weight: 800; font-size: calc(var(--tile) * .5); color: var(--muted); transition: transform .12s ease; }
.tile.edit.match { color: var(--match-ink); opacity: .75; }
.tile.edit:hover { border-color: var(--select); }
.tile.edit.sel { color: var(--text); border-color: var(--select); box-shadow: 0 0 0 3px var(--select); transform: translateY(-4px); background: var(--surface); opacity: 1; }
.tile.edit.sel.match { color: var(--text); }
.rung.active .tiles { animation: none; }
.rung.pop .tile { animation: tilepop .35s cubic-bezier(.3, 1.6, .5, 1) both; }
.rung.pop .tile:nth-child(2) { animation-delay: .04s; }
.rung.pop .tile:nth-child(3) { animation-delay: .08s; }
.rung.pop .tile:nth-child(4) { animation-delay: .12s; }
.rung.pop .tile:nth-child(5) { animation-delay: .16s; }
.rung.goal.reached.pop .tile { animation-name: goalpop; }
.rung.shake { animation: shake .4s ease-in-out; }
.best-path { font-weight: 700; letter-spacing: .03em; }
@media (max-width: 520px) {
  .ladder::before { left: calc(50% - (var(--len) * (var(--tile) + 6px)) / 2 - 16px); }
  .ladder::after { right: calc(50% - (var(--len) * (var(--tile) + 6px)) / 2 - 16px); }
  .rung::before { left: -12px; right: -12px; }
}
@media (prefers-reduced-motion: reduce) {
  .rung.pop .tile, .rung.shake, .tile.edit { animation: none; transition: none; }
}
.tile { background: var(--tile-top); color: var(--tile-ink); border: 0; box-shadow: 0 4px 0 var(--tile-edge), 0 8px 14px rgba(20, 33, 58, .12); border-radius: 12px; }
.tile.match { background: linear-gradient(180deg, #2AA374, #1B8A5E); color: #fff; box-shadow: 0 4px 0 #0F5E3F, 0 8px 14px rgba(27, 138, 94, .3); }
.tile.blank { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.rung.fixed .tile:not(.match) { background: var(--tile-top); }
.rung.goal:not(.reached) .tile { box-shadow: 0 4px 0 var(--tile-edge), inset 0 0 0 2px var(--tile-ink), 0 8px 14px rgba(20, 33, 58, .12); }
.tile.edit.sel { box-shadow: 0 6px 0 var(--tile-edge), 0 0 0 3px var(--select), 0 14px 22px rgba(20, 33, 58, .2); transform: translateY(-6px) scale(1.04); }
.ladder::before, .ladder::after { background: linear-gradient(90deg, #A9824A, #D8B47A 45%, #A9824A); }
.rung::before { background: linear-gradient(180deg, #E2C18C, #B58C52); box-shadow: 0 3px 4px rgba(0, 0, 0, .18); }
