/* Snakes and Ladders — Playnesta original (MIT). */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: #0b1e2c;
  color: #eaf4ff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 10px;
}

.topbar { display: flex; flex-direction: column; gap: 6px; }
.brand { font-size: 20px; font-weight: 700; letter-spacing: 0.5px; }
.brand small { font-weight: 400; opacity: 0.55; margin-left: 6px; font-size: 13px; }
.meta { font-size: 15px; min-height: 20px; color: #bfe0ff; }
.scoreboard { display: flex; gap: 14px; font-size: 14px; }
.score { display: inline-flex; align-items: center; gap: 6px; opacity: 0.9; }
.score b { font-size: 16px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.blue { background: #4da3ff; }
.dot.red { background: #ff6b5e; }

.boardwrap { flex: 1; display: flex; justify-content: center; }

.board {
  position: relative;
  width: min(94vw, 60vh, 520px);
  aspect-ratio: 1 / 1;
  display: grid;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid #27506e;
}

.cells {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(10, 1fr);
  width: 100%;
  height: 100%;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(8px, 2.2vw, 14px);
  color: #9cc4e4;
  border: 1px solid #16354d;
  background: #10314b;
}
.cell:nth-child(even) { background: #123a58; }

.cell.ladder-base { color: #9fe6a0; font-weight: 700; }
.cell.snake-head { color: #ffb08c; font-weight: 700; }

.overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.ld { stroke: #7ddc7d; stroke-width: 1.1; stroke-linecap: round; }
.ld-dot { fill: #a5f0a5; }
.sn { stroke: #ff9d6b; stroke-width: 1.1; fill: none; stroke-linecap: round; }
.sn-dot { fill: #ffb08c; }

.pawn {
  position: absolute;
  width: 10%;
  height: 10%;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  transform: translate(18%, 18%);
  transition: left 0.16s ease, top 0.16s ease;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.pawn-you { background: #4da3ff; }
.pawn-cpu { background: #ff6b5e; transform: translate(44%, 44%); }

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
}

.btn {
  font: inherit;
  font-weight: 600;
  min-height: 48px;
  min-width: 44px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid #2c5c82;
  background: #17405f;
  color: #eaf4ff;
  cursor: pointer;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: #1f7ae0; border-color: #3a93f5; }
.btn:disabled { opacity: 0.45; cursor: default; }

.die {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: #f6f9ff;
  color: #0b1e2c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  border: 2px solid #c9d9ec;
}
.die.rolling { animation: shake 0.12s linear infinite; }
@keyframes shake {
  0% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
  100% { transform: rotate(-8deg); }
}

@media (max-height: 780px) {
  .brand { font-size: 17px; }
  .meta { font-size: 13px; }
}
