/* Word Ladder: bamboo scaffolding, each rung a word */
.wl-col { justify-content: flex-start; gap: 6px; padding: 4px 8px 8px; direction: ltr; }
.wl-scroll { position: relative; flex: 1 1 auto; min-height: 0; width: 100%; max-width: 340px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; scroll-padding-top: 56px; }
.wl-scroll::-webkit-scrollbar { display: none; }
.wl-rungs { position: relative; display: flex; flex-direction: column; padding: 18px 0 10px; min-height: 100%; justify-content: flex-end; box-sizing: border-box; }
.wl-rungs::before, .wl-rungs::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 10px; width: 14px; border-radius: 7px;
  background: repeating-linear-gradient(to bottom, transparent 0 58px, rgba(60, 36, 8, 0.55) 58px 61px, rgba(255, 240, 180, 0.35) 61px 63px, transparent 63px 92px),
    linear-gradient(90deg, #7E6020, #D9B85A 35%, #F0D27A 50%, #B8933A 75%, #6E521A);
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.35);
}
.wl-rungs::after { left: auto; right: 10px; }
.wl-rung { position: relative; z-index: 1; height: 52px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 6px; }
.wl-rung::before {
  content: ""; position: absolute; z-index: -1; left: 6px; right: 6px; top: 50%; height: 10px; margin-top: -5px; border-radius: 5px;
  background: linear-gradient(#F0D27A, #C9A24A 45%, #8A6A22); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
}
.wl-lash { position: absolute; left: 8px; top: 50%; width: 18px; height: 16px; margin-top: -8px; border-radius: 3px;
  background: repeating-linear-gradient(45deg, #E9D9B4 0 2px, #9C7B4A 2px 4px); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.wl-lash--r { left: auto; right: 8px; background: repeating-linear-gradient(-45deg, #E9D9B4 0 2px, #9C7B4A 2px 4px); }
.wl-tile {
  width: 42px; height: 42px; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; border: 0; padding: 0; font: 800 23px/1 var(--font-body, system-ui, sans-serif); color: #3A0E1E;
  background: linear-gradient(#FFF9EC, #F3E2C2); box-shadow: 0 3px 0 #B98E5A, 0 4px 8px rgba(0, 0, 0, 0.35);
}
.wl-tile.is-new { background: linear-gradient(#FFC870, #FF9933); }
.wl-rung--top .wl-tile { background: linear-gradient(#FFE27A, #F4C430); box-shadow: 0 3px 0 #A97A12, 0 0 0 2px rgba(255, 244, 224, 0.6), 0 4px 10px rgba(0, 0, 0, 0.35); }
.wl-rung--base .wl-tile { background: linear-gradient(#63D3D6, #1FA2A6); color: #FFF4E0; box-shadow: 0 3px 0 #0E6467, 0 4px 8px rgba(0, 0, 0, 0.35); }
.wl-rung--open .wl-tile { cursor: pointer; background: linear-gradient(#FFFDF6, #FFF1D6); outline: 2px dashed rgba(255, 177, 59, 0.75); outline-offset: 2px; transition: transform 0.12s; }
.wl-rung--open .wl-tile.is-new { background: linear-gradient(#FFC870, #FF9933); }
.wl-rung--open .wl-tile.is-sel { outline: 3px solid #D81B78; outline-offset: 2px; transform: translateY(-4px); }
.wl-rung--empty i { display: block; width: 186px; height: 30px; border-radius: 9px; border: 2px dashed rgba(255, 213, 146, 0.45); background: rgba(38, 8, 19, 0.55); }
.wl-garland { position: absolute; left: 30px; right: 30px; top: -14px; height: 16px; opacity: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 55%, #FFD34D 0 3px, #FF8C1A 3.5px 6px, transparent 6.5px) 0 0 / 15px 16px repeat-x; }
.wl-rung--top { position: sticky; top: 0; z-index: 3; }
.wl-scroll.is-scrolled .wl-rung--top { background: radial-gradient(60% 70% at 50% 50%, rgba(38, 8, 19, 0.95) 55%, rgba(38, 8, 19, 0) 100%); }
.wl-rungs.is-lit .wl-rung { animation: wl-lit 0.6s ease-out both; }
.wl-rungs.is-lit .wl-garland { animation: wl-drop 0.6s 0.4s ease-out forwards; }
@keyframes wl-lit { 0% { filter: none; } 45% { filter: brightness(1.3) drop-shadow(0 0 10px #FF9933); transform: scale(1.04); } 100% { filter: none; } }
@keyframes wl-drop { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
.wl-rung--open.is-shake { animation: wl-shake 0.35s; }
@keyframes wl-shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
.wl-sub { min-height: 1.3em; margin: 0; text-align: center; }
.wl-sub.is-warn { color: #FF9CC4; }
.wl-kbd { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 6px; }
.wl-krow { display: flex; justify-content: center; gap: 5px; }
.wl-key {
  flex: 1 1 0; min-width: 0; max-width: 44px; height: 46px; border: 0; border-radius: 8px; padding: 0; cursor: pointer;
  font: 700 18px/1 var(--font-body, system-ui, sans-serif); color: var(--parchment); background: var(--lapis-raise);
  box-shadow: 0 2px 0 var(--lapis-deep), inset 0 0 0 1px var(--hairline); -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.wl-key:active { transform: translateY(2px); box-shadow: inset 0 0 0 1px var(--hairline); }
.wl-key svg { width: 22px; height: 22px; }
.wl-key--wide { flex: 1.6 1 0; max-width: 74px; display: inline-flex; align-items: center; justify-content: center; font-size: clamp(12px, 3.6vw, 16px); }
.wl-key--go { background: linear-gradient(#FFC45C, #FF9933); color: #3A0E1E; box-shadow: 0 2px 0 #A85A10; }
.wl-key--go:disabled { opacity: 0.5; }
@media (max-height: 640px) {
  .wl-rung { height: 44px; } .wl-tile { width: 36px; height: 36px; font-size: 20px; } .wl-rung--empty i { height: 24px; width: 162px; }
  .wl-key { height: 40px; } .wl-key:not(.wl-key--wide) { font-size: 16px; } .wl-kbd { gap: 5px; } .wl-scroll { scroll-padding-top: 48px; }
}
@media (min-width: 900px) { .wl-scroll { max-width: 380px; } .wl-tile { width: 48px; height: 48px; font-size: 26px; } .wl-rung { height: 58px; } }
@media (prefers-reduced-motion: reduce) { .wl-rungs.is-lit .wl-rung, .wl-rung--open.is-shake { animation: none; } .wl-rungs.is-lit .wl-garland { animation: none; opacity: 1; } }
