.wl-page-wrap {
  max-width: 1180px;
  margin: auto;
  padding: 28px 24px 70px;
}

.wl-app {
  display: grid;
  grid-template-columns: minmax(290px, 360px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  margin: 25px 0 24px;
}

.wl-rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 24px;
}
@media (max-width: 720px) {
  .wl-page-wrap { padding: 16px 16px 50px; }
  .wl-rules-grid { grid-template-columns: 1fr; }
}

.wl-config-panel,
.wl-stage-card {
  background: #fff;
  border: 1px solid #d5e2dc;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 12px 28px rgba(17, 45, 42, .05);
}

.wl-config-panel {
  display: grid;
  gap: 16px;
}

.wl-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.wl-legend {
  font-weight: 900;
  font-size: .92rem;
  color: #163b35;
  margin-bottom: 2px;
}

.wl-segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.wl-segmented.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.wl-seg-btn {
  appearance: none;
  border: 1.5px solid #cbdcd5;
  background: #f6faf8;
  color: #1c3d38;
  font: inherit;
  font-size: .9rem;
  font-weight: 800;
  padding: 10px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
  text-align: center;
}

.wl-seg-btn:hover {
  border-color: #176b5c;
  background: #eef6f2;
}

.wl-seg-btn[aria-pressed="true"] {
  background: #176b5c;
  border-color: #176b5c;
  color: #fff;
  box-shadow: 0 6px 14px rgba(23, 107, 92, .2);
}

.wl-rows-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.wl-row-shortcuts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.wl-mini-btn {
  appearance: none;
  border: 1px solid #cbdcd5;
  background: #fff;
  color: #204d45;
  font: inherit;
  font-size: .78rem;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
}

.wl-mini-btn:hover {
  border-color: #176b5c;
  background: #eef7f3;
}

.wl-rows-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.wl-row-chip {
  appearance: none;
  border: 1.5px solid #cbdcd5;
  background: #f8fbf9;
  color: #234740;
  font: inherit;
  font-weight: 900;
  font-size: .92rem;
  padding: 8px 0;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
}

.wl-row-chip[aria-pressed="true"] {
  background: #e3f4ee;
  border-color: #176b5c;
  color: #0f5346;
}

.wl-weak-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  background: #fffaf0;
  border: 1px solid #edd8a1;
  font-size: .88rem;
  color: #493a16;
  cursor: pointer;
}

.wl-weak-toggle input {
  margin-top: 3px;
  accent-color: #176b5c;
  width: 17px;
  height: 17px;
}

.wl-weak-toggle strong {
  display: block;
  color: #2b2108;
  font-weight: 800;
}

.wl-action-stack {
  display: grid;
  gap: 10px;
}

.wl-action-stack .btn {
  width: 100%;
  justify-content: center;
}

.wl-action-stack .btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.wl-action-stack .generator-licence {
  margin: 6px 0 4px;
}

.wl-pdf-status {
  margin: 0;
  font-size: .82rem;
  font-weight: 700;
  color: #365a52;
  text-align: center;
  min-height: 1.2em;
}

.wl-stage-card {
  display: grid;
  gap: 16px;
}

.wl-scoreboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
}

.wl-player-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid #dfe9e4;
  background: #f8fbf9;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

.wl-player-card.active.player-1 {
  border-color: #d95d39;
  background: #fff4ef;
  transform: translateY(-1px);
}

.wl-player-card.active.player-2 {
  border-color: #176b5c;
  background: #eaf7f3;
  transform: translateY(-1px);
}

.wl-player-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.wl-pawn-badge {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.player-1 .wl-pawn-badge {
  background: #ffe3d8;
  color: #b83b18;
  border: 1.5px solid #f2b49f;
}

.player-2 .wl-pawn-badge {
  background: #d8f2ea;
  color: #0e594b;
  border: 1.5px solid #9ad6c5;
}

.wl-player-name {
  font-weight: 900;
  color: #163b35;
  font-size: .95rem;
}

.wl-player-sub {
  font-size: .78rem;
  color: #55706a;
  font-weight: 700;
}

.wl-pos-pill {
  font-size: .86rem;
  font-weight: 900;
  color: #163b35;
  background: #fff;
  border: 1px solid #cfe0da;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.wl-vs-pill {
  font-size: .8rem;
  font-weight: 900;
  color: #58726c;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef5f2;
}

/* Dice Bar */
.wl-dice-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #f3faf7 0%, #fff9eb 100%);
  border: 1.5px solid #cbe0d8;
  flex-wrap: wrap;
}

.wl-dice-bar.win-1 {
  background: #fff2ec;
  border-color: #f0b5a2;
}

.wl-dice-bar.win-2 {
  background: #e6f6f1;
  border-color: #9fd5c8;
}

.wl-dice-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 220px;
}

.wl-die-box {
  min-width: 68px;
  height: 56px;
  padding: 0 10px;
  border-radius: 16px;
  background: #fff;
  border: 2.5px solid #176b5c;
  box-shadow: 0 6px 14px rgba(23, 107, 92, .16);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 1.75rem;
  font-weight: 900;
  color: #153e37;
  flex-shrink: 0;
  transition: transform .2s ease;
}

.wl-choice-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  padding-top: 8px;
  border-top: 1px dashed #c6ddd4;
}

.wl-choice-bar[hidden] {
  display: none;
}

.wl-choice-btn {
  appearance: none;
  border: 1.5px solid #176b5c;
  background: #fff;
  color: #134e42;
  font: inherit;
  font-size: .86rem;
  font-weight: 900;
  padding: 8px 13px;
  border-radius: 11px;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, box-shadow .12s ease;
}

.wl-choice-btn:hover {
  transform: translateY(-2px);
  background: #e7f6f1;
  box-shadow: 0 5px 12px rgba(23, 107, 92, .16);
}

.wl-choice-btn.turbo {
  border-color: #c97a10;
  background: #fff8e3;
  color: #784500;
}

.wl-choice-btn.turbo:hover {
  background: #ffefbd;
  box-shadow: 0 5px 12px rgba(201, 122, 16, .22);
}

.wl-die-box.rolling {
  animation: wlDieShake .42s ease-in-out;
}

@keyframes wlDieShake {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-16deg) scale(1.1); }
  50% { transform: rotate(14deg) scale(1.12); }
  75% { transform: rotate(-10deg) scale(1.06); }
  100% { transform: rotate(0deg) scale(1); }
}

.wl-status-text {
  font-weight: 800;
  color: #173d36;
  font-size: .95rem;
  line-height: 1.35;
}

.wl-roll-btn {
  appearance: none;
  border: 0;
  background: linear-gradient(180deg, #e0633f 0%, #c44723 100%);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 900;
  padding: 12px 20px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(196, 71, 35, .26);
  transition: transform .14s ease, box-shadow .14s ease, opacity .14s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.wl-roll-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(196, 71, 35, .34);
}

.wl-roll-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* Serpentine Board Track */
.wl-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border-radius: 20px;
  background: #eef6f3;
  border: 2px solid #cde0d9;
}

.wl-space {
  position: relative;
  min-height: 92px;
  border-radius: 15px;
  border: 2px solid #c5dbd3;
  background: #fff;
  padding: 8px 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  box-shadow: 0 4px 10px rgba(17, 45, 42, .04);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.wl-space.space-start {
  background: linear-gradient(145deg, #e3f6ee 0%, #cdeee0 100%);
  border-color: #268571;
}

.wl-space.space-goal {
  background: linear-gradient(145deg, #fff6d6 0%, #fde69e 100%);
  border-color: #d89b28;
}

.wl-space.space-bonus {
  background: linear-gradient(180deg, #fffdf6 0%, #fff4d9 100%);
  border-color: #e4b449;
}

.wl-space.space-bridge {
  background: linear-gradient(180deg, #f5faff 0%, #dfeeff 100%);
  border-color: #4f86c6;
}

.wl-space.space-swap {
  background: linear-gradient(180deg, #fbf8ff 0%, #ede4ff 100%);
  border-color: #8262d6;
}

.wl-space.is-candidate {
  cursor: pointer;
  border-color: #176b5c;
  box-shadow: 0 0 0 3px rgba(23, 107, 92, .26), 0 8px 16px rgba(23, 107, 92, .14);
  transform: translateY(-2px);
}

.wl-space.is-candidate.candidate-turbo {
  border-color: #d88b18;
  box-shadow: 0 0 0 3px rgba(216, 139, 24, .32), 0 8px 16px rgba(216, 139, 24, .18);
}

.wl-candidate-tag {
  font-size: .64rem;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 999px;
  background: #176b5c;
  color: #fff;
  white-space: nowrap;
}

.wl-space.candidate-turbo .wl-candidate-tag {
  background: #d88b18;
  color: #fff;
}

.wl-space.is-target {
  border-color: #d95d39;
  box-shadow: 0 0 0 3px rgba(217, 93, 57, .32), 0 8px 18px rgba(217, 93, 57, .18);
  transform: translateY(-2px);
}

.wl-space-head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .7rem;
  font-weight: 900;
  color: #5b7871;
}

.wl-space-arrow {
  font-size: .82rem;
  color: #267867;
  font-weight: 900;
}

.wl-space-task {
  font-size: clamp(.9rem, 1.5vw, 1.12rem);
  font-weight: 900;
  color: #153a34;
  text-align: center;
  line-height: 1.15;
}

.wl-space.space-start .wl-space-task,
.wl-space.space-goal .wl-space-task {
  font-size: 1.04rem;
  letter-spacing: .02em;
}

.wl-bonus-pill {
  font-size: .66rem;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f9e2a4;
  color: #7d4e06;
  white-space: nowrap;
}

.wl-space.space-bridge .wl-bonus-pill {
  background: #c8e1ff;
  color: #164982;
}

.wl-space.space-swap .wl-bonus-pill {
  background: #e1d4ff;
  color: #48289c;
}

.wl-tokens-row {
  min-height: 24px;
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
}

.wl-token {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: .78rem;
  font-weight: 900;
  color: #fff;
  box-shadow: 0 3px 7px rgba(0, 0, 0, .22);
  animation: wlTokenHop .34s cubic-bezier(.22, 1.35, .48, 1);
}

.wl-token.p1 {
  background: radial-gradient(circle at 32% 30%, #ff8c6b, #d95d39 70%, #ab3b1a);
  border: 2px solid #fff;
}

.wl-token.p2 {
  background: radial-gradient(circle at 32% 30%, #3ec7ac, #176b5c 70%, #0d453b);
  border: 2px solid #fff;
}

@keyframes wlTokenHop {
  0% { transform: translateY(-10px) scale(.85); }
  70% { transform: translateY(2px) scale(1.08); }
  100% { transform: translateY(0) scale(1); }
}

.wl-board-hint {
  text-align: center;
  font-size: .86rem;
  color: #4c6761;
  margin: 0;
}

@media (min-width: 641px) {
  .wl-space {
    grid-row: var(--wl-row);
    grid-column: var(--wl-col);
  }
}

/* Modal dialog for solving a board space */
.wl-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 34, 30, .48);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 900;
  backdrop-filter: blur(2px);
}

.wl-modal-backdrop[hidden] {
  display: none;
}

.wl-modal {
  background: #fff;
  border-radius: 22px;
  border: 2px solid #cfe0da;
  padding: 22px;
  width: min(100%, 390px);
  box-shadow: 0 22px 48px rgba(13, 38, 34, .22);
  display: grid;
  gap: 14px;
}

.wl-modal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.wl-modal-turn {
  font-size: .85rem;
  font-weight: 900;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eef6f2;
  color: #175246;
}

.wl-modal-close {
  appearance: none;
  border: 1px solid #cbdcd5;
  background: #fff;
  color: #35524c;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1.1rem;
  font-weight: 900;
  cursor: pointer;
}

.wl-modal-equation {
  text-align: center;
  font-size: 2rem;
  font-weight: 900;
  color: #143731;
  background: #f5faf8;
  border: 1.5px solid #d5e5df;
  border-radius: 16px;
  padding: 16px 12px;
}

.wl-modal-bonus {
  text-align: center;
  font-size: .85rem;
  font-weight: 900;
  color: #8b5606;
  background: #fff4d6;
  border: 1px solid #ecc978;
  border-radius: 10px;
  padding: 6px 10px;
  margin: 0;
}

.wl-answer-input {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  font: inherit;
  font-size: 1.55rem;
  font-weight: 900;
  padding: 10px 14px;
  border-radius: 14px;
  border: 2px solid #bdd2ca;
  color: #143731;
  background: #fff;
}

.wl-answer-input:focus {
  outline: none;
  border-color: #176b5c;
  box-shadow: 0 0 0 3px rgba(23, 107, 92, .16);
}

.wl-numpad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.wl-pad-btn {
  appearance: none;
  border: 1.5px solid #cfe0da;
  background: #f7fbf9;
  color: #173d36;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 900;
  padding: 11px 0;
  border-radius: 12px;
  cursor: pointer;
}

.wl-pad-btn:hover {
  background: #eaf5f0;
  border-color: #176b5c;
}

.wl-pad-btn.submit {
  background: #176b5c;
  border-color: #176b5c;
  color: #fff;
}

.wl-pad-btn.submit:hover {
  background: #125649;
}

.wl-feedback {
  min-height: 1.3em;
  text-align: center;
  font-weight: 800;
  font-size: .9rem;
  color: #b5381a;
  margin: 0;
}

@media (max-width: 860px) {
  .wl-app {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .wl-board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
  }
  .wl-space {
    min-height: 82px;
  }
}
