/* ============================================================
   TikTikGames: Brain Puzzle Games — styles
   ============================================================ */

:root {
  --bg: #fdf6ec;
  --bg-soft: #f7ecd9;
  --card: #ffffff;
  --ink: #3d2f23;
  --ink-soft: #8a7459;
  --brand: #f28b30;
  --brand-dark: #d96f17;
  --accent: #ff9e9e;
  --line: rgba(93, 64, 32, 0.14);
  --shadow: 0 10px 30px rgba(93, 64, 32, 0.12);
  --radius: 18px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}

.app { min-height: 100dvh; display: flex; flex-direction: column; }

button {
  font-family: inherit;
  cursor: pointer;
}
button:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

/* ============================================================
   Hub page
   ============================================================ */

.hub { flex: 1; padding: 28px 18px 48px; }

.hero {
  position: relative;
  text-align: center;
  padding: 34px 12px 26px;
}

.hero-paws { color: var(--brand); opacity: 0.85; display: inline-flex; gap: 6px; }

.brand {
  margin: 6px 0 0;
  font-size: clamp(40px, 9vw, 64px);
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(120deg, var(--brand) 20%, #ff6b81 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  margin: 0;
  font-size: clamp(15px, 3.6vw, 19px);
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.hero-desc {
  max-width: 620px;
  margin: 14px auto 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.6;
}

.hero-sound { position: absolute; top: 8px; right: 8px; }

.section-title {
  font-size: 20px;
  margin: 34px 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  max-width: 1120px;
  margin: 0 auto;
}

.game-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.game-card:hover { transform: translateY(-3px); box-shadow: 0 14px 36px rgba(93, 64, 32, 0.16); }

.game-card-icon { font-size: 40px; line-height: 1; }

.game-card-title { margin: 4px 0 0; font-size: 21px; }

.game-card-tag { margin: 0; color: var(--ink-soft); font-size: 14px; min-height: 2.6em; }

.game-card-best {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-dark);
  background: #fff3e0;
  border-radius: 999px;
  padding: 5px 12px;
  align-self: flex-start;
}

.game-card-actions { display: flex; gap: 10px; margin-top: 12px; }

.how-btn {
  margin-top: 10px;
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 13px;
  padding: 2px;
}
.how-btn:hover { color: var(--brand-dark); }

.coming-soon { opacity: 0.55; filter: grayscale(0.2); }
.coming-soon:hover { transform: none; box-shadow: var(--shadow); }
.badge {
  margin-top: 10px;
  align-self: flex-start;
  font-size: 12px;
  font-weight: 700;
  color: #7a6a55;
  background: #efe6d8;
  border-radius: 999px;
  padding: 5px 12px;
}

.footer {
  margin-top: 44px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 700;
  transition: transform 0.1s ease, filter 0.1s ease;
}
.btn:active { transform: scale(0.96); }

.btn.primary {
  background: linear-gradient(135deg, var(--brand), #ffb35c);
  color: #fff;
  box-shadow: 0 4px 14px rgba(242, 139, 48, 0.4);
}
.btn.primary:hover { filter: brightness(1.05); }

.btn.secondary {
  background: #fff;
  color: var(--ink);
  border: 1.5px solid var(--line);
}
.btn.secondary:hover { border-color: var(--brand); color: var(--brand-dark); }

.btn.ghost {
  background: none;
  color: var(--ink-soft);
  border: 1.5px solid var(--line);
}
.btn.ghost:hover { color: var(--ink); border-color: var(--ink-soft); }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease, background 0.1s ease;
}
.icon-btn:hover { background: var(--bg-soft); }
.icon-btn:active { transform: scale(0.92); }

/* ============================================================
   Game screen
   ============================================================ */

.game-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 14px 16px 26px;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}

.game-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.game-title {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
  margin-right: auto;
}
.game-title strong { font-size: 17px; }
.game-subtitle {
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}

.chip {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.hearts { display: inline-flex; gap: 2px; }
.heart { color: #e02424; transition: transform 0.25s ease, opacity 0.25s ease; display: inline-flex; }
.heart-lost { opacity: 0.28; transform: scale(0.7) rotate(-14deg); }

/* ---- Size pills -------------------------------------------------- */

.size-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.pill {
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.pill:hover { border-color: var(--brand); color: var(--brand-dark); }
.pill.active {
  background: linear-gradient(135deg, var(--brand), #ffb35c);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 10px rgba(242, 139, 48, 0.35);
}

/* ---- Action + stats rows ----------------------------------------- */

.action-row {
  display: flex;
  gap: 10px;
  width: 100%;
  justify-content: center;
}
.action-row .btn { flex: 1; max-width: 140px; padding: 9px 12px; }

.stats-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
}
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* ---- Board ---------------------------------------------------- */

.board-wrap {
  width: min(94vw, calc(100dvh - 250px), 480px);
  max-width: 480px;
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  aspect-ratio: 1; /* square, exactly like the board — no layout shift when the grid appears */
  border-radius: 16px;
  border: 3px solid #6b4f2e;
  background: var(--card);
  color: var(--ink-soft);
  font-weight: 600;
  box-shadow: var(--shadow);
}

.loading-paw {
  font-size: 40px;
  animation: paw-bounce 1s ease-in-out infinite;
  display: inline-block;
}

@keyframes paw-bounce {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  50% { transform: translateY(-8px) rotate(8deg); }
}

@media (prefers-reduced-motion: reduce) {
  .loading-paw { animation: none; }
}

.board {
  display: grid;
  gap: 0;
  border-radius: 16px;
  overflow: hidden;
  border: 3px solid #6b4f2e;
  background: #6b4f2e;
  box-shadow: var(--shadow);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.cell {
  position: relative;
  border: 0;
  margin: 0;
  padding: 0;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  transition: filter 0.1s ease;
}
.cell:hover { filter: brightness(0.95); }
.cell:active { filter: brightness(0.9); }

/* Region boundaries (drawn between different regions) */
.cell.b-r { box-shadow: inset -3px 0 0 rgba(83, 52, 21, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.35); }
.cell.b-b { box-shadow: inset 0 -3px 0 rgba(83, 52, 21, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.35); }
.cell.b-r.b-b {
  box-shadow: inset -3px 0 0 rgba(83, 52, 21, 0.55), inset 0 -3px 0 rgba(83, 52, 21, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.cell .kitten-svg { width: 76%; height: 76%; }

/* Animations */
.cell-pop svg { animation: pop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes pop {
  0% { transform: scale(0); }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.cell-shake { animation: shake 0.35s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.cell-wrong { animation: wrongFlash 0.5s ease; }
@keyframes wrongFlash {
  0% { background: #ffb3ba !important; }
  100% { background: inherit; }
}

/* ✗ marks (tap once) */
.x-mark {
  font-size: clamp(15px, 4.5vw, 26px);
  font-weight: 800;
  color: rgba(61, 47, 35, 0.5);
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

/* Hint highlight (pulsing ring around a correct cell) */
.cell-hint::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 7px;
  border: 3px solid var(--brand);
  animation: hintPulse 1.1s ease-in-out infinite;
  pointer-events: none;
}
@keyframes hintPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.hint {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.5;
}

.fatal { color: #b00020; padding: 20px; text-align: center; }

/* ============================================================
   Overlays (win / lose / pickers)
   ============================================================ */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(61, 47, 35, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 50;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } }

.overlay-card {
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px 24px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  animation: cardIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes cardIn {
  from { transform: translateY(18px) scale(0.94); opacity: 0; }
}

.overlay-emoji { font-size: 48px; line-height: 1; }
.overlay-title { margin: 10px 0 4px; font-size: 24px; }
.overlay-line { margin: 6px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.5; }
.overlay-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }

.level-list { display: flex; flex-direction: column; gap: 14px; margin: 16px 0; }
.picker-card { max-height: 84dvh; overflow-y: auto; }

.level-cat { display: flex; flex-direction: column; gap: 8px; }

.level-cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-soft);
  border: 1.5px solid transparent;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
}
.level-cat-head .level-label { font-size: 15px; }

.level-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 0 2px;
}

.level-chip {
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: 8px 0;
  font-size: 13.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease, transform 0.1s ease;
}
.level-chip:hover { border-color: var(--brand); color: var(--brand-dark); }
.level-chip:active { transform: scale(0.94); }
.level-chip.solved { background: #fff6ea; border-color: rgba(242, 139, 48, 0.5); color: var(--brand-dark); }
.level-chip.locked {
  background: #f3f3f3;
  border-color: #e4e4e4;
  color: #bcbcbc;
  cursor: not-allowed;
}
.level-chip.locked:hover { border-color: #e4e4e4; color: #bcbcbc; }
.level-chip.locked .lock-tag { font-size: 10px; opacity: 0.8; }
.level-chip.next {
  border-color: var(--brand);
  color: var(--brand-dark);
  background: #fff3e0;
  box-shadow: 0 0 0 2px rgba(242, 139, 48, 0.22);
}
.level-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-soft);
  border: 1.5px solid transparent;
  border-radius: 14px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.level-row:hover { border-color: var(--brand); background: #fff6ea; }
.level-best { font-size: 12.5px; font-weight: 600; color: var(--brand-dark); }

.rules-list {
  text-align: left;
  margin: 14px 0 18px;
  padding-left: 20px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.7;
}
.rules-list li::marker { color: var(--brand); }

/* ============================================================
   Confetti
   ============================================================ */

.confetti {
  position: fixed;
  top: -12px;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  z-index: 60;
  pointer-events: none;
  animation: fall linear forwards;
}
@keyframes fall {
  to {
    transform: translate(var(--drift, 0px), 105vh) rotate(720deg);
    opacity: 0.7;
  }
}

/* ============================================================
   Sudoku
   ============================================================ */

.sd-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.sd-board-wrap {
  width: min(94vw, calc(100dvh - 320px), 460px);
  max-width: 460px;
}

.sd-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  aspect-ratio: 1; /* square, exactly like the board — no layout shift */
  border-radius: 18px;
  border: 3px solid #6b4f2e;
  background: var(--card);
  color: var(--ink-soft);
  font-weight: 600;
  box-shadow: var(--shadow);
}

.sd-spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 5px solid #ede3d2;
  border-top-color: #2f7df6;
  animation: sd-spin 0.9s linear infinite;
}
@keyframes sd-spin { to { transform: rotate(360deg); } }

.sd-loading-text { margin: 0; font-size: 13.5px; }

.sd-board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 1px; /* the thin grid lines are the board background showing through */
  background: #6b4f2e;
  border: 3px solid #6b4f2e;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(93, 64, 32, 0.18);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.sd-cell {
  position: relative;
  border: 0;
  margin: 0;
  padding: 0;
  aspect-ratio: 1;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease, filter 0.1s ease;
}
.sd-cell:hover { filter: brightness(0.97); }
.sd-cell:active { filter: brightness(0.93); }

/* alternate 3×3 boxes get a whisper of blue */
.sd-tint { background: #f3f8fd; }

/* thick 3×3 box dividers (inset shadow overlaps the 1px gap) */
.sd-rb { box-shadow: inset -3px 0 0 #6b4f2e; }
.sd-bb { box-shadow: inset 0 -3px 0 #6b4f2e; }
.sd-rb.sd-bb {
  box-shadow: inset -3px 0 0 #6b4f2e, inset 0 -3px 0 #6b4f2e;
}

/* digits: given clues in dark ink, player entries in classic Sudoku blue */
.sd-num {
  font-size: clamp(17px, 5vw, 27px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}
.sd-num.given { color: #2e2620; }
.sd-num.user {
  color: #1a6ed8;
  animation: sd-num-pop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes sd-num-pop {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* wrong entries: red digit + one red flash */
.sd-cell.sd-wrong { animation: wrongFlash 0.5s ease; }
.sd-cell.sd-wrong .sd-num.user { color: #e03a3a; }

/* pencil notes: 3×3 mini grid, `.on` shows the digit */
.sd-notes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  padding: 2px;
}
.sd-note {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(8px, 2.4vw, 11.5px);
  font-weight: 600;
  color: #7b8ea8;
  line-height: 1;
  visibility: hidden;
  font-variant-numeric: tabular-nums;
}
.sd-note.on { visibility: visible; }

/* selection highlights (later rules win over .sd-tint) */
.sd-cell.sd-same { background: #fff3d6; }  /* same value: warm amber */
.sd-cell.sd-peer { background: #eef4fd; }  /* peer cells: pale blue   */
.sd-cell.sd-selected {
  background: #dcebfe;
  outline: 2px solid #2f7df6;
  outline-offset: -2px;
}

/* status line + tools */
.sd-status {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.5;
  min-height: 18px;
  width: 100%;
}

.sd-tools {
  display: flex;
  gap: 8px;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.sd-tool {
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
  flex: 1;
  max-width: 130px;
  white-space: nowrap;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease, transform 0.1s ease, box-shadow 0.12s ease;
}
.sd-tool:hover { border-color: #2f7df6; color: #1a5fb4; }
.sd-tool:active { transform: scale(0.95); }
.sd-tool.on {
  background: linear-gradient(135deg, #2f7df6, #5aa2ff);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 10px rgba(47, 125, 246, 0.35);
}

/* number pad: tactile 3D keys with remaining-count chips */
.sd-pad {
  display: flex;
  gap: 6px;
  width: 100%;
  justify-content: center;
}

.sd-pad-num {
  position: relative;
  flex: 1 1 0;
  min-width: 34px;
  max-width: 54px;
  aspect-ratio: 1;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-size: clamp(16px, 4.8vw, 21px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 rgba(93, 64, 32, 0.14);
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.1s ease, box-shadow 0.1s ease, opacity 0.12s ease;
}
.sd-pad-num:hover {
  border-color: #2f7df6;
  color: #1a6ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 0 rgba(93, 64, 32, 0.14);
}
.sd-pad-num:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(93, 64, 32, 0.14); }
.sd-pad-num.done { opacity: 0.35; }

.sd-count {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-size: 8.5px;
  font-weight: 700;
  color: #fff;
  background: var(--ink-soft);
  border-radius: 999px;
  min-width: 11px;
  height: 11px;
  line-height: 11px;
  text-align: center;
  padding: 0 2px;
  font-variant-numeric: tabular-nums;
}
.sd-pad-num.done .sd-count { background: #b9d6fb; }

/* effects: hint ring, deny shake, clue reveal, win cascade */
.sd-hint-cell::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 9px;
  border: 3px solid #2f7df6;
  animation: hintPulse 1.1s ease-in-out infinite;
  pointer-events: none;
}

.sd-deny { animation: shake 0.35s ease; }

.sd-cell.sd-in { animation: sd-reveal 0.3s ease both; }
@keyframes sd-reveal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sd-cell.sd-win-pop { animation: sd-win 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes sd-win {
  0% { transform: scale(0.5); background: #dcebfe; }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* ============================================================
   Arrow Puzzle
   ============================================================ */

.ap-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.ap-board-wrap {
  width: min(92vw, calc(100dvh - 300px), 430px);
  max-width: 430px;
}

.ap-board {
  display: grid;
  gap: 5px;
  padding: 9px;
  background: #f0e6d2;
  border: 3px solid #e4d5b8;
  border-radius: 18px;
  box-shadow: var(--shadow);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.ap-tile {
  position: relative;
  border: 0;
  margin: 0;
  padding: 0;
  aspect-ratio: 1;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: filter 0.1s ease, transform 0.1s ease, box-shadow 0.12s ease;
  color: var(--ink);
}
.ap-tile:hover { filter: brightness(0.98); transform: translateY(-1px); }
.ap-tile:active { transform: scale(0.95); }

/* pastel tiles, one soft hue per direction */
.ap-up    { background: #d7f2e2; color: #2e8f63; }
.ap-right { background: #dbeafc; color: #2f74c8; }
.ap-down  { background: #ffe2d5; color: #cf7a45; }
.ap-left  { background: #e8dcf9; color: #7d54c4; }

.ap-arrow-svg {
  width: 66%;
  height: 66%;
  pointer-events: none;
  user-select: none;
}
.ap-right .ap-arrow-svg { transform: rotate(90deg); }
.ap-down  .ap-arrow-svg { transform: rotate(180deg); }
.ap-left  .ap-arrow-svg { transform: rotate(270deg); }

/* empty tile left behind by an escaped arrow */
.ap-tile.ap-empty {
  background: rgba(93, 64, 32, 0.05);
  cursor: default;
  box-shadow: inset 0 0 0 1px rgba(93, 64, 32, 0.07);
}
.ap-tile.ap-empty:hover { filter: none; transform: none; }
.ap-tile.ap-empty:active { transform: none; }

/* keyboard cursor ring */
.ap-tile.ap-selected {
  outline: 3px solid var(--brand);
  outline-offset: -3px;
}

/* blocked tap: shake + red flash */
.ap-tile.ap-deny { animation: ap-shake 0.36s ease; }
.ap-tile.ap-deny .ap-arrow-svg { color: #e03a3a; }
@keyframes ap-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* hint highlight: pulsing ring around a safely removable arrow */
.ap-tile.ap-hint::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 8px;
  border: 3px solid var(--brand);
  animation: hintPulse 1.1s ease-in-out infinite;
  pointer-events: none;
}

/* fly-out: the arrow slides off the board in its direction.
   Animated on the TILE (not the glyph) so the direction rotation of the
   SVG inside is preserved during the flight. */
.ap-tile.ap-fly {
  animation: ap-fly-out 0.46s ease-in forwards;
}
@keyframes ap-fly-out {
  to {
    transform: translate(var(--flyx, 0px), var(--flyy, 0px)) scale(0.86);
    opacity: 0;
  }
}

.ap-status {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.5;
  min-height: 18px;
  width: 100%;
}

.ap-tools {
  display: flex;
  gap: 8px;
  width: 100%;
  justify-content: center;
}

.ap-tool {
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
  flex: 1;
  max-width: 130px;
  white-space: nowrap;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease, transform 0.1s ease, box-shadow 0.12s ease;
}
.ap-tool:hover { border-color: var(--brand); color: var(--brand-dark); }
.ap-tool:active { transform: scale(0.95); }

/* ============================================================
   Responsive tweaks
   ============================================================ */

@media (max-width: 420px) {
  .hub { padding: 18px 12px 40px; }
  .game-screen { padding: 10px 12px 20px; }
  .chip { padding: 6px 10px; font-size: 12px; }
  .game-title strong { font-size: 15px; }
  .game-subtitle { max-width: 130px; }
  .hint { font-size: 11.5px; }
  .sd-tools { gap: 6px; }
  .sd-tool { padding: 7px 8px; font-size: 12px; max-width: 110px; }
  .sd-pad { gap: 4px; }
  .sd-pad-num { min-width: 28px; }
  .ap-board { gap: 4px; padding: 7px; }
  .ap-tool { padding: 7px 8px; font-size: 12px; max-width: 110px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* =====================================================================
   Ludo Master — self-contained stylesheet (game #4).
   Every class is namespaced .ludo-* so nothing leaks into the other
   games. High-graphics look: glossy neon board, 3D pieces, animated
   dice, glow effects, capture bursts, win confetti — all CSS only.
   ===================================================================== */

:root {
  --ludo-red: #ff4d5e;
  --ludo-red-deep: #c81e3a;
  --ludo-green: #31d97c;
  --ludo-green-deep: #0f9d4f;
  --ludo-yellow: #ffcf3f;
  --ludo-yellow-deep: #e8921c;
  --ludo-blue: #45a8ff;
  --ludo-blue-deep: #1766c9;
  --ludo-felt: #f6efdf;
  --ludo-felt-2: #fffaf0;
  --ludo-cream: #ffffff;
  --ludo-cream-deep: #f0e8d6;
  --ludo-ink: #2a2f45;
  --ludo-board-line: #c9b98f;
}

/* ------------------------------------------------------------ layout */

.ludo-screen { display: flex; flex-direction: column; gap: 10px; }
.ludo-layout {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
}
.ludo-board-wrap { flex: 0 0 auto; }

.ludo-side {
  flex: 1 1 230px;
  min-width: 210px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ------------------------------------------------------------ board */

.ludo-board {
  position: relative;
  width: min(88vw, 540px);
  aspect-ratio: 1 / 1;
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  grid-template-rows: repeat(15, 1fr);
  border-radius: 18px;
  padding: 6px;
  gap: 2px;
  background:
    radial-gradient(120% 120% at 15% 12%, rgba(255, 255, 255, 0.85), transparent 45%),
    linear-gradient(145deg, var(--ludo-felt-2), var(--ludo-felt) 70%);
  border: 1px solid var(--ludo-board-line);
  box-shadow:
    0 14px 30px rgba(90, 70, 30, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -6px 14px rgba(120, 90, 30, 0.12);
  user-select: none;
}

.ludo-cell {
  position: relative;
  border-radius: 4px;
  display: grid;
  place-items: center;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.95), inset 0 -1px 2px rgba(90, 60, 20, 0.15);
}

/* bases: four corner yards — a deep colored frame around a light dock ---- */
.ludo-base {
  border-radius: 10px;
  box-shadow: inset 0 2px 10px rgba(255, 255, 255, 0.35), inset 0 -8px 16px rgba(0, 0, 0, 0.22);
  position: relative;
}
/* outer ring of each yard: vivid saturated color */
.ludo-base-ring.red    { background-image: radial-gradient(90% 90% at 30% 20%, rgba(255,255,255,.4), transparent 55%), linear-gradient(145deg, var(--ludo-red), var(--ludo-red-deep)); }
.ludo-base-ring.green  { background-image: radial-gradient(90% 90% at 30% 20%, rgba(255,255,255,.38), transparent 55%), linear-gradient(145deg, var(--ludo-green), var(--ludo-green-deep)); }
.ludo-base-ring.yellow { background-image: radial-gradient(90% 90% at 30% 20%, rgba(255,255,255,.38), transparent 55%), linear-gradient(145deg, var(--ludo-yellow), var(--ludo-yellow-deep)); }
.ludo-base-ring.blue   { background-image: radial-gradient(90% 90% at 30% 20%, rgba(255,255,255,.38), transparent 55%), linear-gradient(145deg, var(--ludo-blue), var(--ludo-blue-deep)); }
/* inner dock: light felt tinted with the owner's color, subtle stripes */
.ludo-base-inner.red    { background-image: repeating-linear-gradient(45deg, rgba(255,110,90,.10) 0 2px, transparent 2px 7px), linear-gradient(160deg, #fff6f1, #ffe7de); }
.ludo-base-inner.green  { background-image: repeating-linear-gradient(45deg, rgba(50,190,115,.10) 0 2px, transparent 2px 7px), linear-gradient(160deg, #f2fff7, #d9fbe7); }
.ludo-base-inner.yellow { background-image: repeating-linear-gradient(45deg, rgba(225,170,35,.12) 0 2px, transparent 2px 7px), linear-gradient(160deg, #fffbe9, #ffefc2); }
.ludo-base-inner.blue   { background-image: repeating-linear-gradient(45deg, rgba(80,145,235,.10) 0 2px, transparent 2px 7px), linear-gradient(160deg, #f2f8ff, #dcebff); }
/* docks: ivory circles with a colored ring where the pieces wait */
.ludo-base-spot {
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff, #ece4d5 88%);
  box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.95), inset 0 -4px 8px rgba(0, 0, 0, 0.16), 0 1px 3px rgba(0, 0, 0, 0.3);
  position: relative;
}
.ludo-base-spot.red    { background: radial-gradient(circle at 35% 30%, #ffffff, #ffe6dd 88%); box-shadow: inset 0 2px 5px rgba(255,255,255,.95), inset 0 -4px 8px rgba(0,0,0,.16), 0 0 0 2.5px var(--ludo-red), 0 1px 3px rgba(0,0,0,.3); }
.ludo-base-spot.green  { background: radial-gradient(circle at 35% 30%, #ffffff, #d8f8e4 88%); box-shadow: inset 0 2px 5px rgba(255,255,255,.95), inset 0 -4px 8px rgba(0,0,0,.16), 0 0 0 2.5px var(--ludo-green), 0 1px 3px rgba(0,0,0,.3); }
.ludo-base-spot.yellow { background: radial-gradient(circle at 35% 30%, #ffffff, #fdf0cd 88%); box-shadow: inset 0 2px 5px rgba(255,255,255,.95), inset 0 -4px 8px rgba(0,0,0,.16), 0 0 0 2.5px var(--ludo-yellow), 0 1px 3px rgba(0,0,0,.3); }
.ludo-base-spot.blue   { background: radial-gradient(circle at 35% 30%, #ffffff, #dcecff 88%); box-shadow: inset 0 2px 5px rgba(255,255,255,.95), inset 0 -4px 8px rgba(0,0,0,.16), 0 0 0 2.5px var(--ludo-blue), 0 1px 3px rgba(0,0,0,.3); }

/* track cells --------------------------------------------------------- */
.ludo-track-cell {
  background: linear-gradient(160deg, #ffffff, #f7f1e4);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.95), inset 0 -1px 2px rgba(90, 60, 20, 0.12);
}
/* each of the 4 quadrants (13 cells) is tinted with its player's color */
.ludo-track-red    { background: linear-gradient(160deg, #fff3f0, #ffe3de); }
.ludo-track-green  { background: linear-gradient(160deg, #effff5, #d9fbe7); }
.ludo-track-yellow { background: linear-gradient(160deg, #fff8e4, #ffefc2); }
.ludo-track-blue   { background: linear-gradient(160deg, #eff6ff, #dcebff); }

/* star (safe / stop) cells: white with a big star in the owner's color */
.ludo-star-cell {
  background: radial-gradient(circle at 35% 30%, #ffffff, #fff3d6 85%);
  box-shadow: inset 0 0 0 2px rgba(212, 150, 20, 0.6), 0 0 10px rgba(255, 196, 60, 0.65);
  animation: ludo-star-glow 2.6s ease-in-out infinite;
}
.ludo-star-mark {
  font-size: min(3.6vw, 24px);
  line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}
.ludo-star-cell.red .ludo-star-mark { color: var(--ludo-red); }
.ludo-star-cell.green .ludo-star-mark { color: var(--ludo-green-deep); }
.ludo-star-cell.yellow .ludo-star-mark { color: var(--ludo-yellow-deep); }
.ludo-star-cell.blue .ludo-star-mark { color: var(--ludo-blue-deep); }
@keyframes ludo-star-glow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.18); }
}

/* home-column entry cells: colored chevron toward the center */
.ludo-entry-cell.red { background: linear-gradient(90deg, var(--ludo-red), var(--ludo-red-deep)); }
.ludo-entry-cell.green { background: linear-gradient(180deg, var(--ludo-green), var(--ludo-green-deep)); }
.ludo-entry-cell.yellow { background: linear-gradient(270deg, var(--ludo-yellow), var(--ludo-yellow-deep)); }
.ludo-entry-cell.blue { background: linear-gradient(0deg, var(--ludo-blue), var(--ludo-blue-deep)); }
.ludo-entry-cell::before {
  content: '';
  width: 34%;
  height: 34%;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.85);
  transform: rotate(45deg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* home column cells */
.ludo-home-cell {
  background-image: radial-gradient(80% 80% at 30% 25%, rgba(255, 255, 255, 0.5), transparent 60%);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.55), inset 0 -2px 4px rgba(0, 0, 0, 0.2);
}
.ludo-home-cell.red { background-color: var(--ludo-red); }
.ludo-home-cell.green { background-color: var(--ludo-green); }
.ludo-home-cell.yellow { background-color: var(--ludo-yellow); }
.ludo-home-cell.blue { background-color: var(--ludo-blue); }
.ludo-home-cell .ludo-dot { width: 30%; height: 30%; border-radius: 50%; background: rgba(255, 255, 255, 0.6); }

/* the final home cell (just before the center) is drawn bigger */
.ludo-finish-cell {
  transform: scale(1.24);
  border-radius: 9px;
  z-index: 2;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.85), inset 0 1px 2px rgba(255, 255, 255, 0.6), inset 0 -3px 6px rgba(0, 0, 0, 0.25), 0 0 12px rgba(255, 255, 255, 0.5);
}

/* central 3×3: white corner cells + colored home ends + gold trophy */
.ludo-center-diag {
  background: linear-gradient(160deg, #ffffff, var(--ludo-cream-deep));
}
.ludo-center-diag .ludo-dot { width: 30%; height: 30%; border-radius: 50%; background: rgba(120, 90, 30, 0.22); }
.ludo-goal {
  background: radial-gradient(circle at 35% 30%, #ffd166, #ff9f1c 70%);
  box-shadow: 0 0 16px rgba(255, 170, 40, 0.85), inset 0 2px 6px rgba(255, 255, 255, 0.7), 0 2px 6px rgba(120, 80, 10, 0.4);
  border-radius: 50%;
  font-size: min(3.2vw, 22px);
  display: grid;
  place-items: center;
  animation: ludo-goal-glow 2.2s ease-in-out infinite;
}
@keyframes ludo-goal-glow {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.07); filter: brightness(1.22); }
}
.ludo-goal.finish-flash { animation: ludo-goal-pop 0.7s ease-out; }
@keyframes ludo-goal-pop {
  0% { transform: scale(0.7); filter: brightness(2.2); }
  60% { transform: scale(1.12); filter: brightness(1.4); }
  100% { transform: scale(1); filter: brightness(1); }
}

/* last-move landing glow */
.ludo-last-land {
  box-shadow: 0 0 0 2px #ffd23f, 0 0 16px rgba(255, 210, 63, 0.95);
  z-index: 3;
}

/* ------------------------------------------------------------ pieces */

.ludo-piece {
  position: absolute;
  width: 6.1%;
  height: 6.1%;
  border-radius: 50%;
  pointer-events: auto;
  cursor: pointer;
  z-index: 5;
  transition: left 0.13s ease-out, top 0.13s ease-out;
  background-image:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.25) 38%, transparent 60%),
    radial-gradient(circle at 50% 55%, var(--ludo-red), var(--ludo-red-deep) 78%);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4), inset 0 -3px 6px rgba(0, 0, 0, 0.3), inset 0 2px 3px rgba(255, 255, 255, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.9);
}
.ludo-piece.green  { background-image: radial-gradient(circle at 32% 28%, rgba(255,255,255,.95), rgba(255,255,255,.25) 38%, transparent 60%), radial-gradient(circle at 50% 55%, var(--ludo-green), var(--ludo-green-deep) 78%); }
.ludo-piece.yellow { background-image: radial-gradient(circle at 32% 28%, rgba(255,255,255,.95), rgba(255,255,255,.25) 38%, transparent 60%), radial-gradient(circle at 50% 55%, var(--ludo-yellow), var(--ludo-yellow-deep) 78%); }
.ludo-piece.blue   { background-image: radial-gradient(circle at 32% 28%, rgba(255,255,255,.95), rgba(255,255,255,.25) 38%, transparent 60%), radial-gradient(circle at 50% 55%, var(--ludo-blue), var(--ludo-blue-deep) 78%); }

/* hopping along the track — a little jump on every cell it passes */
.ludo-piece.hopping { animation: ludo-hop 0.3s ease-out; }
@keyframes ludo-hop {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-42%) scale(1.16); }
  100% { transform: translateY(0) scale(1); }
}
/* on the final home cell the piece renders a little bigger */
.ludo-piece.big { transform: scale(1.18); }

.ludo-piece.sel {
  box-shadow: 0 0 0 3px #ffd23f, 0 0 18px rgba(255, 210, 63, 0.9), 0 3px 6px rgba(0, 0, 0, 0.45);
  animation: ludo-pulse 0.9s ease-in-out infinite;
}
@keyframes ludo-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.14); }
}
.ludo-piece.captured { animation: ludo-capture-away 0.55s ease-in forwards; }
@keyframes ludo-capture-away {
  0% { transform: scale(1); opacity: 1; }
  40% { transform: scale(1.6); opacity: 0.6; }
  100% { transform: scale(0.2); opacity: 0; }
}
.ludo-piece.arrive { animation: ludo-arrive 0.45s ease-out; }
@keyframes ludo-arrive {
  0% { transform: scale(0.2); }
  70% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* capture burst effect */
.ludo-burst {
  position: absolute;
  width: 10%;
  height: 10%;
  border-radius: 50%;
  pointer-events: none;
  z-index: 20;
  animation: ludo-burst 0.7s ease-out forwards;
}
@keyframes ludo-burst {
  0% { transform: scale(0.2); opacity: 1; box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.9); }
  100% { transform: scale(2.6); opacity: 0; box-shadow: 0 0 0 26px rgba(255, 255, 255, 0); }
}

/* ------------------------------------------------------------ dice */

.ludo-dice-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}
.ludo-die {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: linear-gradient(145deg, #fffdf4, #f1e6cf);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35), inset 0 -3px 6px rgba(120, 90, 30, 0.25), inset 0 2px 3px #fff;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 9px;
  gap: 3px;
  transition: transform 0.18s ease;
}
.ludo-die .pip {
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #5b4a2e, #2f2410 80%);
  box-shadow: inset 0 -1px 2px rgba(255, 255, 255, 0.25);
}
.ludo-die .pip.empty { visibility: hidden; }
.ludo-die.shake { animation: ludo-shake 0.5s linear; }
@keyframes ludo-shake {
  0% { transform: rotate(0) translateY(0); }
  20% { transform: rotate(-14deg) translateY(-6px); }
  40% { transform: rotate(12deg) translateY(0); }
  60% { transform: rotate(-8deg) translateY(-4px); }
  80% { transform: rotate(6deg) translateY(0); }
  100% { transform: rotate(0) translateY(0); }
}
.ludo-die.pop { animation: ludo-pop 0.4s ease-out; }
@keyframes ludo-pop {
  0% { transform: scale(0.4); }
  65% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.ludo-roll-btn {
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: #fff;
  padding: 12px 26px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background-image: linear-gradient(160deg, #ffd166, #ff8c1a 55%, #f2571f);
  box-shadow: 0 6px 16px rgba(242, 87, 31, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.2s;
}
.ludo-roll-btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 9px 20px rgba(242, 87, 31, 0.55), inset 0 1px 0 rgba(255,255,255,.5); }
.ludo-roll-btn:active:not(:disabled) { transform: translateY(1px) scale(0.98); }
.ludo-roll-btn:disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.4); }
.ludo-roll-btn.ai-turn { animation: ludo-btn-ai 1.2s ease-in-out infinite; }
@keyframes ludo-btn-ai {
  0%, 100% { box-shadow: 0 6px 16px rgba(242, 87, 31, 0.45), inset 0 1px 0 rgba(255,255,255,.5); }
  50% { box-shadow: 0 6px 26px rgba(255, 210, 63, 0.85), inset 0 1px 0 rgba(255,255,255,.5); }
}

/* ------------------------------------------------------------ status + feed */

.ludo-status {
  margin: 2px 0 0;
  text-align: center;
  font-weight: 700;
  color: var(--ludo-ink);
  min-height: 1.4em;
}
.ludo-status.waiting { color: #8a6d1a; }
.ludo-status.warn { color: #c81e3a; }

.ludo-feed {
  max-height: 150px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  background: rgba(23, 31, 61, 0.06);
  border-radius: 12px;
  font-size: 0.82rem;
  color: #444;
}
.ludo-feed-item { display: flex; gap: 6px; align-items: center; line-height: 1.35; }
.ludo-feed-item .dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.ludo-feed-item .dot.red { background: var(--ludo-red); }
.ludo-feed-item .dot.green { background: var(--ludo-green); }
.ludo-feed-item .dot.yellow { background: var(--ludo-yellow); }
.ludo-feed-item .dot.blue { background: var(--ludo-blue); }

/* ------------------------------------------------------------ players panel */

.ludo-players { display: flex; flex-direction: column; gap: 8px; }
.ludo-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(40, 30, 10, 0.12);
  border: 2px solid transparent;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.ludo-player.active {
  border-color: var(--ludo-active, #ffb400);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ludo-active, #ffb400) 35%, transparent), 0 3px 10px rgba(0, 0, 0, 0.15);
}
.ludo-player.red { --ludo-active: var(--ludo-red); }
.ludo-player.green { --ludo-active: var(--ludo-green); }
.ludo-player.yellow { --ludo-active: var(--ludo-yellow); }
.ludo-player.blue { --ludo-active: var(--ludo-blue); }

.ludo-player-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.7), transparent 55%), var(--ludo-active, #888);
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.3);
}
.ludo-player-name { font-weight: 800; font-size: 0.9rem; }
.ludo-player-meta { font-size: 0.78rem; color: #777; }
.ludo-player-home { margin-left: auto; display: flex; gap: 3px; }
.ludo-player-home .mini {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ludo-active, #888);
  opacity: 0.22;
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.3);
}
.ludo-player-home .mini.done { opacity: 1; }

/* ------------------------------------------------------------ lobby */

.ludo-lobby {
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.85), rgba(255, 246, 226, 0.9));
  box-shadow: 0 10px 26px rgba(40, 30, 10, 0.18);
}
.ludo-lobby h3 { margin: 0; font-size: 1.05rem; }
.ludo-opt-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ludo-opt {
  padding: 9px 16px;
  border-radius: 999px;
  border: 2px solid #e5d9bf;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
  color: #555;
  transition: all 0.15s;
}
.ludo-opt:hover { border-color: #c9b88f; }
.ludo-opt.on {
  border-color: #ff8c1a;
  color: #b24c00;
  background: #fff2df;
  box-shadow: 0 0 0 3px rgba(255, 140, 26, 0.25);
}
.ludo-start {
  align-self: center;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  padding: 13px 34px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background-image: linear-gradient(160deg, #ffd166, #ff8c1a 55%, #f2571f);
  box-shadow: 0 6px 16px rgba(242, 87, 31, 0.4);
}
.ludo-start:hover { filter: brightness(1.06); transform: translateY(-1px); }
.ludo-start:disabled { opacity: 0.5; cursor: not-allowed; }

/* online lobby */
.ludo-online-status {
  padding: 10px 14px;
  border-radius: 10px;
  background: #fff8e8;
  border: 1px solid #eed9a8;
  font-size: 0.88rem;
  line-height: 1.5;
}
.ludo-code {
  font-weight: 900;
  letter-spacing: 2px;
  color: #b24c00;
  background: #ffe9c8;
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 1.1rem;
}
.ludo-sdp {
  width: 100%;
  min-height: 86px;
  border-radius: 10px;
  border: 1px solid #d8c9a8;
  padding: 8px 10px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.72rem;
  resize: vertical;
  background: #fffdf6;
}
.ludo-sdp-label { font-size: 0.78rem; font-weight: 700; color: #77684a; margin: 4px 0 2px; }

/* ------------------------------------------------------------ effects / misc */

.ludo-turn-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  background: #7c86b0;
  vertical-align: middle;
}
.ludo-link-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  background: #e8ecff;
  color: #4a58c9;
  border: 1px solid #c3ccf5;
}

/* narrow screens: board first, side panel below */
@media (max-width: 760px) {
  .ludo-side { max-width: 92vw; flex-basis: auto; }
  .ludo-board { width: min(94vw, 480px); }
}
