:root{--yellow:#e8d600;--red:#e31616;--green:#18a84c;--blue:#2537d5;--panel:#fff;--muted:#64748b}
*{box-sizing:border-box}
body{margin:0;font-family:Tahoma,Arial,sans-serif;background:linear-gradient(180deg,#f7f7f7,#e9eef5);color:#111}
header{padding:14px 18px;background:#111827;color:#fff;display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap}
h1{font-size:21px;margin:0}.top-actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
button,select,input{font-family:inherit;font-size:15px}
button{border:none;background:#2563eb;color:#fff;padding:10px 14px;border-radius:10px;cursor:pointer;font-weight:700;transition:.12s}
button:hover{box-shadow:0 8px 20px #0002}button:active{transform:scale(.98)}button:disabled{opacity:.45;cursor:not-allowed;box-shadow:none}
.secondary{background:#4b5563}.good{background:#16a34a}.danger{background:#dc2626}
select,input{border:1px solid #cbd5e1;border-radius:10px;padding:9px 12px;background:#fff}
.layout{display:grid;grid-template-columns:minmax(320px,1fr) 410px;gap:16px;padding:16px;max-width:1300px;margin:0 auto;direction:ltr}
.board-wrap,.side{direction:rtl}.board-card,.panel{background:var(--panel);border-radius:18px;box-shadow:0 12px 28px #0001,0 2px 8px #0001;border:1px solid #e5e7eb}
.board-card{padding:10px;display:flex;justify-content:center;align-items:center;min-height:auto}
#board{width:min(96vw,760px);height:auto;display:block;touch-action:manipulation}
.cell{fill:#fff;stroke:#000;stroke-width:2.3;shape-rendering:crispEdges}.outer{fill:none;stroke:#000;stroke-width:4;shape-rendering:crispEdges}
.cell.home-yellow{fill:#fff8a8}.cell.home-red{fill:#ffd1d1}.cell.home-green{fill:#c8f7d8}.cell.home-blue{fill:#d8ddff}
.cell.start-yellow{fill:#fff8a8}.cell.start-red{fill:#ffd1d1}.cell.start-green{fill:#c8f7d8}.cell.start-blue{fill:#d8ddff}
.center-square{fill:#fff;stroke:#000;stroke-width:4;shape-rendering:crispEdges}.center-x{stroke:#000;stroke-width:4;stroke-linecap:round}.start-x{stroke-width:5;stroke-linecap:round}
.start-grid-line{stroke-width:2.4;stroke-linecap:round;opacity:.95}.start-grid-border{fill:none;stroke-width:2.8;opacity:.95}.finish-arrow{stroke-width:4.5;stroke-linecap:round;stroke-linejoin:round;fill:none;filter:drop-shadow(0 0 4px #0002)}.finish-arrow-head{stroke-width:4.5;stroke-linecap:round;stroke-linejoin:round;fill:none}.home-glow{opacity:.16;pointer-events:none}
.piece{stroke:#111;stroke-width:2.2;cursor:pointer;filter:drop-shadow(0 2px 2px #0005)}.piece-text{font:700 6px Arial,sans-serif;fill:#fff;text-anchor:middle;dominant-baseline:central;pointer-events:none}
.movable .piece{stroke:#fff;stroke-width:4;filter:drop-shadow(0 0 7px #facc15) drop-shadow(0 2px 2px #0006)}
.hint-cell{fill:#fde68a;opacity:.45;pointer-events:none}
.preview-cell{fill:#38bdf8;opacity:.42;stroke:#0369a1;stroke-width:4;pointer-events:none}
.preview-ring{fill:none;stroke:#0ea5e9;stroke-width:5;stroke-linecap:round;pointer-events:none;filter:drop-shadow(0 0 5px #0ea5e9)}
.preview-text{font:700 10px Tahoma,Arial,sans-serif;fill:#075985;text-anchor:middle;dominant-baseline:central;pointer-events:none}
.panel{padding:14px;margin-bottom:14px}.turn-row{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.turn-badge{display:inline-flex;align-items:center;gap:7px;font-weight:800;padding:8px 12px;border-radius:999px;color:#fff}
.dot{width:14px;height:14px;border-radius:50%;display:inline-block;border:1px solid #0006}
.dice-row{display:flex;justify-content:center;align-items:center;gap:12px;margin:12px 0;flex-wrap:wrap}
.die{width:62px;height:62px;border-radius:15px;border:2px solid #111;background:#fff;color:#111;display:grid;place-items:center;font-size:38px;line-height:1;box-shadow:inset 0 0 0 3px #fff,0 3px 10px #0002;direction:ltr;transform-style:preserve-3d}
.die.rolling{animation:diceShake .12s linear infinite;background:#fff7ed}
@keyframes diceShake{0%{transform:rotate(0deg) translate(0,0) scale(1)}25%{transform:rotate(10deg) translate(2px,-2px) scale(1.04)}50%{transform:rotate(-12deg) translate(-2px,2px) scale(.98)}75%{transform:rotate(8deg) translate(2px,2px) scale(1.03)}100%{transform:rotate(0deg) translate(0,0) scale(1)}}
.status{padding:10px 12px;border-radius:12px;background:#f8fafc;border:1px solid #e5e7eb;line-height:1.7}
.actions-panel{display:grid;gap:8px;margin-top:10px}.action-btn{width:100%;text-align:right;background:#facc15;color:#111;border:1px solid #ca8a04;border-radius:12px;padding:10px 12px}
.action-btn.sum{background:#bbf7d0;border-color:#22c55e}.action-btn.entry{background:#dbeafe;border-color:#2563eb}.action-btn.single{background:#fef3c7;border-color:#d97706}
.remaining-dice{margin-top:8px;color:#334155;font-size:14px}.choice-title{padding:9px 10px;border-radius:12px;background:#eef2ff;border:1px solid #c7d2fe;color:#1e293b;line-height:1.6;font-size:14px}
.choice-list{display:grid;gap:8px;margin-top:8px}
.choice-btn{width:100%;text-align:right;border-radius:12px;padding:11px 12px;color:#111;border:1px solid #cbd5e1;background:#fff;font-weight:800}
.choice-btn.sum{background:#bbf7d0;border-color:#22c55e}.choice-btn.single{background:#fef3c7;border-color:#d97706}.choice-btn.entry{background:#dbeafe;border-color:#2563eb}
.choice-cancel{background:#64748b}
.piece-btn.selected{outline:3px solid #2563eb;background:#dbeafe}
.selected-piece .piece{stroke:#2563eb;stroke-width:5;filter:drop-shadow(0 0 9px #2563eb) drop-shadow(0 2px 2px #0006)}
.players{display:grid;grid-template-columns:1fr;gap:10px}
.player-card{border:1px solid #e5e7eb;border-radius:14px;padding:10px;background:#fafafa}.player-card.active{outline:3px solid #facc15;background:#fffdf2}
.player-title{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px;font-weight:800}.piece-buttons{display:flex;gap:7px;flex-wrap:wrap}
.piece-btn{background:#fff;color:#111;border:1px solid #d1d5db;padding:7px 10px;border-radius:10px}.piece-btn.movable{background:#facc15;border-color:#ca8a04}
.log{max-height:190px;overflow:auto;background:#0f172a;color:#e5e7eb;border-radius:14px;padding:10px;font-size:11px;line-height:1.6}.log div{border-bottom:1px solid #334155;padding:4px 0}
.rules{font-size:14px;line-height:1.8;color:#334155}.rules ul{padding-right:18px;margin:8px 0 0}.small{color:var(--muted);font-size:13px}
.mode-note{font-size:11px;color:#475569;line-height:1.7;margin-top:8px}.lan-box{display:none;margin-top:10px;padding:10px;border:1px dashed #94a3b8;border-radius:12px;background:#f8fafc}.lan-row{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}.lan-row input{flex:1;min-width:140px}

/* v8 mobile and board floating controls */
.board-card{position:relative;overflow:visible}
.piece-popup,.reserve-popup{
  position:absolute;
  z-index:20;
  display:none;
  background:#ffffff;
  border:1px solid #cbd5e1;
  border-radius:14px;
  box-shadow:0 12px 28px #0003;
  padding:8px;
  direction:rtl;
}
.piece-popup{min-width:170px;max-width:230px;transform:translate(-50%,-100%)}
.reserve-popup{
  left:8px;
  top:50%;
  transform:translateY(-50%);
  width:170px;
  max-width:42%;
}
.popup-title{
  font-size:11px;
  color:#334155;
  line-height:1.5;
  margin:0 0 7px;
  font-weight:800;
}
.popup-list{display:grid;gap:6px}
.popup-btn{
  width:100%;
  text-align:right;
  border-radius:11px;
  padding:9px 10px;
  color:#111;
  border:1px solid #cbd5e1;
  background:#fff;
  font-weight:800;
  font-size:11px;
}
.popup-btn.sum{background:#bbf7d0;border-color:#22c55e}
.popup-btn.single{background:#fef3c7;border-color:#d97706}
.popup-btn.entry{background:#dbeafe;border-color:#2563eb}
.popup-btn.finish{background:#dcfce7;border-color:#16a34a;color:#14532d}
.popup-btn.cancel{background:#64748b;color:#fff;border-color:#475569}
.mobile-hint{font-size:11px;color:#475569;line-height:1.6}

@media(max-width:980px){.layout{grid-template-columns:1fr}.board-card{min-height:auto}}
@media(max-width:700px){
  header{padding:8px 10px;gap:8px}
  h1{font-size:16px}
  .top-actions{gap:5px}
  button,select,input{font-size:13px}
  button{padding:8px 10px;border-radius:9px}
  select,input{padding:7px 9px}
  .layout{padding:6px;gap:8px}
  .board-card{padding:5px;border-radius:12px}
  #board{width:min(96vw,520px)}
  .panel{padding:9px;margin-bottom:8px;border-radius:12px}
  .die{width:48px;height:48px;font-size:30px;border-radius:12px}
  .dice-row{gap:8px;margin:8px 0}
  .status{font-size:11px;padding:8px}
  .players{gap:6px}
  .player-card{padding:7px;border-radius:11px}
  .piece-buttons{gap:5px}
  .piece-btn{font-size:12px;padding:6px 8px}
  .log{max-height:120px;font-size:12px}
  .rules{font-size:12px}
  .piece-popup{min-width:150px;max-width:180px;padding:7px}
  .reserve-popup{left:4px;width:148px;max-width:46%;padding:7px}
  .popup-title,.popup-btn{font-size:12px}
  .popup-btn{padding:7px 8px}
  .arcade-card{padding:20px 14px;border-radius:20px}
  .arcade-card h2{font-size:25px}
  .toast-layer{top:58px}

  .reserve-zone{width:74px;min-height:58px;padding:4px 3px 4px;border-radius:11px}
  .reserve-zone.zone-yellow{top:3px}
  .reserve-zone.zone-red{right:3px}
  .reserve-zone.zone-green{bottom:3px}
  .reserve-zone.zone-blue{left:3px}
  .reserve-panel-title{font-size:10px}
  .reserve-token{width:22px;height:22px;font-size:10px;border-width:2px}
  .reserve-help,.reserve-empty{font-size:9px}
}

/* v13 flash/arcade style */
body::before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  background:
    radial-gradient(circle at 12% 18%, rgba(255,255,255,.45) 0 2px, transparent 3px),
    radial-gradient(circle at 88% 22%, rgba(255,255,255,.35) 0 2px, transparent 3px),
    radial-gradient(circle at 34% 84%, rgba(255,255,255,.4) 0 2px, transparent 3px);
  animation:bgSpark 4s linear infinite;
  opacity:.55;
  z-index:0;
}
@keyframes bgSpark{0%{filter:hue-rotate(0deg);transform:translateY(0)}50%{transform:translateY(-4px)}100%{filter:hue-rotate(360deg);transform:translateY(0)}}
header,.layout{position:relative;z-index:1}
header{
  background:linear-gradient(135deg,#111827,#1d4ed8 45%,#7c3aed);
  border-bottom:3px solid #facc15;
  box-shadow:0 8px 24px #0003;
}
h1{text-shadow:0 2px 0 #0006,0 0 12px #facc15}
.board-card{
  background:linear-gradient(145deg,#ffffff,#f8fafc);
  border:3px solid #111827;
  box-shadow:0 18px 34px #0002, inset 0 0 0 3px #fff, 0 0 28px #60a5fa55;
}
.panel{
  border:2px solid #dbeafe;
  box-shadow:0 12px 24px #0001, inset 0 0 0 2px #fff;
}
button,.popup-btn,.piece-btn,.action-btn{
  box-shadow:0 4px 0 #0002;
}
button:hover,.popup-btn:hover,.piece-btn:hover{
  transform:translateY(-1px);
}
.die{
  background:linear-gradient(145deg,#fff,#fef3c7);
  border:3px solid #111827;
  color:#0f172a;
  text-shadow:0 2px 0 #fff;
}
.die.rolling{
  animation:diceShake .08s linear infinite, diceGlow .35s ease-in-out infinite alternate;
}
@keyframes diceGlow{from{box-shadow:0 0 0 #facc15,inset 0 0 0 3px #fff}to{box-shadow:0 0 24px #facc15,inset 0 0 0 3px #fff}}
.turn-badge{box-shadow:0 4px 0 #0003,0 0 18px #fff5}
.arcade-overlay{
  position:fixed;
  inset:0;
  z-index:1000;
  display:grid;
  place-items:center;
  background:
    radial-gradient(circle at 50% 28%, rgba(250,204,21,.35), transparent 22%),
    linear-gradient(135deg,#020617,#172554 50%,#581c87);
  color:white;
  padding:18px;
}
.arcade-card{
  width:min(92vw,520px);
  text-align:center;
  padding:28px 22px;
  border-radius:26px;
  border:4px solid #facc15;
  background:linear-gradient(145deg,rgba(15,23,42,.96),rgba(30,64,175,.9));
  box-shadow:0 20px 60px #0008,inset 0 0 0 3px #ffffff22,0 0 36px #facc1588;
  animation:popIn .45s ease both;
}
@keyframes popIn{from{transform:scale(.86);opacity:0}to{transform:scale(1);opacity:1}}
.arcade-stars{font-size:32px;color:#facc15;text-shadow:0 0 14px #facc15;animation:pulseStar 1s ease-in-out infinite alternate}
@keyframes pulseStar{from{transform:scale(.95)}to{transform:scale(1.08)}}
.arcade-card h2{
  margin:8px 0 10px;
  font-size:34px;
  color:#fff;
  text-shadow:0 4px 0 #0008,0 0 18px #60a5fa;
}
.arcade-card p{line-height:1.8;color:#dbeafe}
.arcade-start{
  background:linear-gradient(180deg,#22c55e,#15803d);
  border:2px solid #bbf7d0;
  box-shadow:0 6px 0 #14532d,0 0 24px #22c55e88;
  margin:8px;
}
.arcade-mini{
  background:linear-gradient(180deg,#f59e0b,#b45309);
  border:2px solid #fde68a;
  box-shadow:0 6px 0 #78350f;
  margin:8px;
}
.quick-rules{
  display:none;
  margin-top:12px;
  padding:12px;
  border-radius:14px;
  background:#0005;
  line-height:1.7;
  color:#f8fafc;
}
.toast-layer{
  position:fixed;
  top:76px;
  left:50%;
  transform:translateX(-50%);
  z-index:950;
  display:grid;
  gap:8px;
  pointer-events:none;
  width:min(92vw,460px);
}
.toast{
  background:linear-gradient(135deg,#111827,#1e40af);
  color:white;
  border:2px solid #facc15;
  border-radius:16px;
  padding:11px 14px;
  box-shadow:0 10px 28px #0005;
  text-align:center;
  font-weight:800;
  animation:toastIn .25s ease, toastOut .35s ease 2.2s forwards;
}
.toast.good{background:linear-gradient(135deg,#14532d,#16a34a)}
.toast.hit{background:linear-gradient(135deg,#7f1d1d,#dc2626)}
.toast.info{background:linear-gradient(135deg,#0f172a,#2563eb)}
@keyframes toastIn{from{opacity:0;transform:translateY(-14px) scale(.96)}to{opacity:1;transform:translateY(0) scale(1)}}
@keyframes toastOut{to{opacity:0;transform:translateY(-14px) scale(.96)}}
.winner-modal{
  position:fixed;
  inset:0;
  display:none;
  place-items:center;
  z-index:1100;
  background:#0008;
  padding:18px;
}
.winner-box{
  width:min(90vw,440px);
  text-align:center;
  color:white;
  border-radius:26px;
  border:4px solid #facc15;
  background:linear-gradient(145deg,#172554,#7e22ce);
  box-shadow:0 24px 70px #0009,0 0 40px #facc1599;
  padding:26px 20px;
  animation:popIn .35s ease both;
}
.winner-title{font-size:40px;font-weight:900;text-shadow:0 4px 0 #0008}
.winner-text{font-size:20px;line-height:1.8;margin:12px 0}
.board-flash{animation:boardFlash .38s ease}
@keyframes boardFlash{50%{filter:brightness(1.2) saturate(1.4);transform:scale(1.01)}}
.board-hit{animation:boardHit .28s ease}
@keyframes boardHit{0%,100%{transform:translateX(0)}25%{transform:translateX(-4px)}50%{transform:translateX(4px)}75%{transform:translateX(-3px)}}


/* v14 professional colored starts/end lanes and visible reserve soldiers */

/* v16 reserve soldiers placed in each player's outer area */
.reserve-side-panel{
  position:absolute;
  inset:0;
  z-index:22;
  pointer-events:none;
  background:transparent;
  border:none;
  box-shadow:none;
  width:auto;
  min-height:0;
  transform:none;
  padding:0;
}
.reserve-zone{
  position:absolute;
  width:96px;
  min-height:76px;
  padding:6px 5px 5px;
  border-radius:16px;
  border:2px solid #facc15;
  background:linear-gradient(145deg,rgba(255,255,255,.96),rgba(239,246,255,.97));
  box-shadow:0 10px 22px #0002,inset 0 0 0 2px #fff,0 0 14px #facc1555;
  display:grid;
  gap:6px;
  align-content:start;
  direction:rtl;
  pointer-events:auto;
}
.reserve-zone.zone-yellow{top:6px; left:50%; transform:translateX(-50%)}
.reserve-zone.zone-red{right:6px; top:50%; transform:translateY(-50%)}
.reserve-zone.zone-green{bottom:6px; left:50%; transform:translateX(-50%)}
.reserve-zone.zone-blue{left:6px; top:50%; transform:translateY(-50%)}
.reserve-zone.current-turn{box-shadow:0 10px 22px #0002,inset 0 0 0 2px #fff,0 0 20px #22c55eaa}
.reserve-panel-title{
  text-align:center;
  font-weight:900;
  color:#0f172a;
  font-size:10px;
  line-height:1.2;
  padding-bottom:4px;
  border-bottom:1px solid #cbd5e1;
}
.reserve-soldiers{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:6px;
}
.reserve-token{
  width:28px;
  height:28px;
  border-radius:50%;
  display:grid;
  place-items:center;
  color:#fff;
  font-weight:900;
  font-size:11px;
  border:2px solid #111827;
  box-shadow:0 4px 0 #0003,0 0 8px #0002;
  cursor:pointer;
  user-select:none;
  transition:.12s;
}
.reserve-token:hover{transform:translateY(-2px) scale(1.05)}
.reserve-token.available{
  outline:3px solid #22c55e;
  box-shadow:0 4px 0 #0003,0 0 14px #22c55eaa;
  animation:reservePulse .75s ease-in-out infinite alternate;
}
.reserve-token.disabled{
  opacity:.55;
  filter:grayscale(.25);
}
.reserve-empty{
  text-align:center;
  color:#475569;
  font-size:11px;
  line-height:1.45;
}
.reserve-help{
  font-size:9px;
  line-height:1.25;
  color:#334155;
  text-align:center;
}

.reserve-empty{
  text-align:center;
  color:#475569;
  font-size:12px;
  line-height:1.6;
}
.reserve-help{
  font-size:11px;
  line-height:1.45;
  color:#334155;
  text-align:center;
}


/* v18: smaller board, reserves in empty outside areas, not above the board design */
.board-card{
  position:relative;
  padding:8px;
  min-height:auto;
}
.board-stage{
  display:grid;
  grid-template-columns:82px auto 82px;
  grid-template-rows:68px auto 68px;
  grid-template-areas:
    ". top ."
    "left board right"
    ". bottom .";
  gap:6px;
  align-items:center;
  justify-content:center;
  width:max-content;
  max-width:100%;
  margin:auto;
}
.board-surface{
  grid-area:board;
  position:relative;
  display:grid;
  place-items:center;
}
#board{
  width:min(100%,420px);
  max-width:760px;
  height:auto;
}
.reserve-side-panel{
  display:contents;
}
.reserve-zone{
  position:static;
  transform:none !important;
  width:78px;
  min-height:62px;
  padding:5px 4px;
  border-radius:12px;
  border:2px solid #facc15;
  background:linear-gradient(145deg,rgba(255,255,255,.96),rgba(239,246,255,.97));
  box-shadow:0 6px 14px #0002,inset 0 0 0 2px #fff,0 0 10px #facc1555;
  display:grid;
  gap:4px;
  align-content:start;
  direction:rtl;
  pointer-events:auto;
}
.reserve-zone.zone-yellow{grid-area:top; justify-self:center}
.reserve-zone.zone-red{grid-area:right; justify-self:center}
.reserve-zone.zone-green{grid-area:bottom; justify-self:center}
.reserve-zone.zone-blue{grid-area:left; justify-self:center}
.reserve-zone.current-turn{
  box-shadow:0 8px 18px #0002,inset 0 0 0 2px #fff,0 0 16px #22c55eaa;
}
.reserve-panel-title{
  text-align:center;
  font-weight:900;
  color:#0f172a;
  font-size:9px;
  line-height:1.15;
  padding-bottom:2px;
  border-bottom:1px solid #cbd5e1;
}
.reserve-soldiers{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:4px;
}
.reserve-token{
  width:22px;
  height:22px;
  border-radius:50%;
  display:grid;
  place-items:center;
  color:#fff;
  font-weight:900;
  font-size:10px;
  border:2px solid #111827;
  box-shadow:0 3px 0 #0003,0 0 6px #0002;
  cursor:pointer;
  user-select:none;
  transition:.12s;
}
.reserve-token:hover{transform:translateY(-1px) scale(1.05)}
.reserve-token.available{
  outline:2px solid #22c55e;
  box-shadow:0 3px 0 #0003,0 0 12px #22c55eaa;
  animation:reservePulse .75s ease-in-out infinite alternate;
}
.reserve-token.disabled{
  opacity:.55;
  filter:grayscale(.25);
}
.reserve-empty{
  text-align:center;
  color:#475569;
  font-size:9px;
  line-height:1.3;
}
.reserve-help{
  font-size:8px;
  line-height:1.2;
  color:#334155;
  text-align:center;
}
.piece-popup{
  position:absolute;
  z-index:30;
}
.reserve-popup{display:none !important}
@media(max-width:700px){
  .board-card{padding:4px}
  .board-stage{
    grid-template-columns:62px auto 62px;
    grid-template-rows:52px auto 52px;
    gap:3px;
  }
  #board{width:min(96vw,520px);max-width:520px}
  .reserve-zone{
    width:58px;
    min-height:46px;
    padding:3px 2px;
    border-radius:10px;
    gap:2px;
  }
  .reserve-panel-title{font-size:8px;line-height:1.05}
  .reserve-token{width:18px;height:18px;font-size:8px;border-width:1.5px}
  .reserve-help,.reserve-empty{font-size:7px}
}


/* v19: option 1 - reserve soldiers inside empty spaces between arms */
.board-stage{
  display:grid !important;
  grid-template-columns:auto !important;
  grid-template-rows:auto !important;
  grid-template-areas:"board" !important;
  gap:0 !important;
  align-items:center !important;
  justify-content:center !important;
  width:max-content;
  max-width:100%;
  margin:auto;
}
.board-surface{
  grid-area:board;
  position:relative;
  display:grid;
  place-items:center;
}
.reserve-side-panel{
  position:absolute !important;
  inset:0 !important;
  z-index:24 !important;
  pointer-events:none !important;
  display:block !important;
  background:transparent !important;
  border:none !important;
  box-shadow:none !important;
  width:auto !important;
  min-height:0 !important;
  transform:none !important;
  padding:0 !important;
}
.reserve-zone{
  position:absolute !important;
  transform:translate(-50%,-50%) !important;
  width:52px !important;
  min-height:38px !important;
  padding:4px 4px !important;
  border-radius:14px !important;
  border:2px solid #facc15 !important;
  background:linear-gradient(145deg,rgba(255,255,255,.94),rgba(239,246,255,.95)) !important;
  box-shadow:0 6px 16px #0002,inset 0 0 0 2px #fff,0 0 12px #facc1555 !important;
  display:grid !important;
  gap:3px !important;
  align-content:center !important;
  direction:rtl !important;
  pointer-events:auto !important;
}
.reserve-zone.zone-yellow{left:22% !important; top:12% !important}
.reserve-zone.zone-red{left:78% !important; top:12% !important}
.reserve-zone.zone-blue{left:22% !important; top:88% !important}
.reserve-zone.zone-green{left:78% !important; top:88% !important}
.reserve-zone.current-turn{
  box-shadow:0 7px 18px #0003,inset 0 0 0 2px #fff,0 0 18px #22c55eaa !important;
}
.reserve-panel-title{
  text-align:center !important;
  font-weight:900 !important;
  color:#0f172a !important;
  font-size:6px !important;
  line-height:1.0 !important;
  padding-bottom:1px !important;
  border-bottom:1px solid #cbd5e1 !important;
}
.reserve-soldiers{
  display:flex !important;
  flex-wrap:wrap !important;
  justify-content:center !important;
  gap:3px !important;
}
.reserve-token{
  width:11px !important;
  height:11px !important;
  border-radius:50% !important;
  display:grid !important;
  place-items:center !important;
  color:#fff !important;
  font-weight:900 !important;
  font-size:6px !important;
  border:1px solid #111827 !important;
  box-shadow:0 2px 0 #0003,0 0 6px #0002 !important;
  cursor:pointer !important;
  user-select:none !important;
  transition:.12s !important;
}
.reserve-token.available{
  outline:2px solid #22c55e !important;
  box-shadow:0 2px 0 #0003,0 0 10px #22c55eaa !important;
  animation:reservePulse .75s ease-in-out infinite alternate !important;
}
.reserve-token.disabled{opacity:.55;filter:grayscale(.25)}
.reserve-empty,.reserve-help{display:none !important}
@media(max-width:700px){
  #board{width:min(96vw,520px) !important; max-width:520px !important}
  .reserve-zone{
    width:38px !important;
    min-height:30px !important;
    padding:2px !important;
    border-radius:10px !important;
  }
  .reserve-panel-title{font-size:7px !important}
  .reserve-token{width:9px !important;height:9px !important;font-size:5px !important;border-width:1px !important}
}


/* v22 final layout: bigger centered board, tiny reserve, smaller action text */
.layout{
  grid-template-columns:minmax(420px, auto) 340px !important;
  justify-items:center !important;
  align-items:start !important;
  max-width:100vw !important;
  padding:10px !important;
}
.board-wrap{
  width:100% !important;
  display:flex !important;
  justify-content:center !important;
  align-items:center !important;
}
.board-card{
  margin:0 auto !important;
  width:max-content !important;
  max-width:100% !important;
  display:flex !important;
  justify-content:center !important;
  align-items:center !important;
  padding:10px !important;
}
.board-stage{
  width:max-content !important;
  max-width:100% !important;
  margin:auto !important;
}
#board{
  width:min(96vw,760px) !important;
  max-width:760px !important;
  height:auto !important;
}
.side{
  width:min(100%,980px) !important;
  display:grid !important;
  grid-template-columns:repeat(auto-fit,minmax(280px,1fr)) !important;
  gap:10px !important;
  align-items:start !important;
}
.piece-popup{
  min-width:118px !important;
  max-width:150px !important;
  padding:5px !important;
  border-radius:10px !important;
}
.popup-title{
  font-size:9px !important;
  line-height:1.15 !important;
  margin:0 0 4px !important;
}
.popup-list{gap:4px !important}
.popup-btn{
  font-size:9px !important;
  line-height:1.15 !important;
  padding:5px 6px !important;
  border-radius:8px !important;
}
.choice-title{
  font-size:11px !important;
  line-height:1.35 !important;
  padding:6px 8px !important;
}
.reserve-zone{
  width:46px !important;
  min-height:30px !important;
  padding:2px !important;
  border-radius:8px !important;
  gap:1px !important;
}
.reserve-panel-title{
  font-size:5px !important;
  line-height:1 !important;
  padding-bottom:0 !important;
}
.reserve-soldiers{gap:2px !important}
.reserve-token{
  width:8px !important;
  height:8px !important;
  font-size:0 !important;
  border-width:1px !important;
  box-shadow:0 1px 0 #0003,0 0 4px #0002 !important;
}
.reserve-token.available{
  outline:1px solid #22c55e !important;
  box-shadow:0 1px 0 #0003,0 0 8px #22c55eaa !important;
}
.reserve-zone.zone-yellow{left:20% !important; top:10% !important}
.reserve-zone.zone-red{left:80% !important; top:10% !important}
.reserve-zone.zone-blue{left:20% !important; top:90% !important}
.reserve-zone.zone-green{left:80% !important; top:90% !important}
@media(max-width:700px){
  .layout{padding:4px !important}
  #board{width:min(96vw,520px) !important;max-width:520px !important}
  .side{grid-template-columns:1fr !important;gap:6px !important}
  .piece-popup{min-width:104px !important;max-width:132px !important}
  .popup-title,.popup-btn{font-size:8px !important}
  .popup-btn{padding:4px 5px !important}
  .reserve-zone{
    width:36px !important;
    min-height:24px !important;
    padding:1px !important;
  }
  .reserve-token{
    width:7px !important;
    height:7px !important;
  }
  .reserve-panel-title{font-size:4px !important}
}


/* v23: slightly smaller board, right-side turn panel, collapsible details */
.layout{
  display:grid !important;
  grid-template-columns:minmax(420px, auto) 340px !important;
  justify-content:center !important;
  align-items:start !important;
  gap:14px !important;
  max-width:1220px !important;
  margin:0 auto !important;
  padding:10px !important;
  direction:ltr !important;
}
.board-wrap{
  width:auto !important;
  display:flex !important;
  justify-content:center !important;
  align-items:flex-start !important;
}
.board-card{
  margin:0 auto !important;
  width:max-content !important;
  max-width:100% !important;
  padding:8px !important;
}
#board{
  width:min(68vw,690px) !important;
  max-width:690px !important;
  height:auto !important;
}
.side{
  width:340px !important;
  display:flex !important;
  flex-direction:column !important;
  gap:10px !important;
  direction:rtl !important;
}
.side .panel{margin-bottom:0 !important}
.details-panel{
  display:none !important;
}
body.show-details .details-panel{
  display:block !important;
}
body.show-details .side{
  width:380px !important;
}
.piece-popup{
  min-width:110px !important;
  max-width:140px !important;
}
.popup-title{
  font-size:8px !important;
}
.popup-btn{
  font-size:8px !important;
  padding:4px 5px !important;
}
.choice-title{
  font-size:10px !important;
}
.reserve-token{
  width:7px !important;
  height:7px !important;
  font-size:0 !important;
}
.reserve-zone{
  width:42px !important;
  min-height:28px !important;
}
@media(max-width:900px){
  .layout{
    grid-template-columns:1fr !important;
    justify-items:center !important;
    padding:5px !important;
  }
  .side{
    width:min(100%,680px) !important;
    display:grid !important;
    grid-template-columns:1fr !important;
  }
  #board{
    width:min(96vw,620px) !important;
    max-width:620px !important;
  }
}
@media(max-width:700px){
  #board{
    width:min(96vw,500px) !important;
    max-width:500px !important;
  }
  .side{width:100% !important}
}



/* v24: خيارات الحركة تظهر على اللوحة بدل المربع المنبثق */
.piece-popup{display:none !important}

/* v24: realistic soldier pieces + silent move execution */
.soldier-piece{cursor:pointer;filter:drop-shadow(0 2px 2px #0006)}
.soldier-piece .soldier-shadow{fill:#000;opacity:.18}
.soldier-piece .soldier-body{stroke:#111827;stroke-width:1.5}
.soldier-piece .soldier-head{fill:#f8d7b5;stroke:#111827;stroke-width:1.1}
.soldier-piece .soldier-helmet{stroke:#111827;stroke-width:1.1}
.soldier-piece .soldier-arm,.soldier-piece .soldier-leg{stroke:#111827;stroke-width:2.2;stroke-linecap:round}
.soldier-piece .soldier-badge{fill:#fff;stroke:#111827;stroke-width:.6}
.soldier-piece .soldier-num{font:900 5px Tahoma,Arial,sans-serif;fill:#111827;text-anchor:middle;dominant-baseline:central;pointer-events:none}
.movable .soldier-piece{filter:drop-shadow(0 0 7px #facc15) drop-shadow(0 2px 2px #0006)}
.movable .soldier-piece .soldier-body,.movable .soldier-piece .soldier-helmet{stroke:#fff;stroke-width:2}
.selected-piece .soldier-piece{filter:drop-shadow(0 0 9px #2563eb) drop-shadow(0 2px 2px #0006)}
.selected-piece .soldier-piece .soldier-body,.selected-piece .soldier-piece .soldier-helmet{stroke:#2563eb;stroke-width:2.4}
.board-move-option{cursor:pointer;filter:drop-shadow(0 3px 4px #0005)}
.board-move-option .option-fill{stroke:#111827;stroke-width:2.6;opacity:.94}
.board-move-option .option-text{font:900 8px Tahoma,Arial,sans-serif;fill:#111827;text-anchor:middle;dominant-baseline:central;pointer-events:none}
.board-move-option .option-subtext{font:800 6px Tahoma,Arial,sans-serif;fill:#111827;text-anchor:middle;dominant-baseline:central;pointer-events:none}
.board-move-option .option-line{stroke:#0f172a;stroke-width:3;stroke-dasharray:8 6;opacity:.42;pointer-events:none}
.board-move-option.sum .option-fill{fill:#bbf7d0;stroke:#16a34a}
.board-move-option.single .option-fill{fill:#fef3c7;stroke:#d97706}
.board-move-option.finish .option-fill{fill:#dcfce7;stroke:#15803d}
.board-move-option:hover .option-fill{stroke-width:4;opacity:1}
@media(max-width:700px){
  .board-move-option .option-text{font-size:7px}
  .board-move-option .option-subtext{font-size:5px}
}


/* v25: إلغاء مربعات/نصوص حوار الحركة وجعل الاختيار بصريًا فقط */
.actions-panel .choice-title{display:none !important}
.board-move-option .option-fill{opacity:.88}
.board-move-option .option-icon{font:900 14px Tahoma,Arial,sans-serif;fill:#111827;text-anchor:middle;dominant-baseline:central;pointer-events:none}
.board-move-option .option-text,.board-move-option .option-subtext{display:none !important}
.reserve-help{display:none !important}
@media(max-width:700px){.board-move-option .option-icon{font-size:12px}}



/* v24 requested cleanup: smaller board, no finish arrows, colored finish triangles, horizontal reserve soldiers, active-player bottom view */
#board{
  width:min(64vw,620px) !important;
  max-width:620px !important;
}
.finish-arrow,.finish-arrow-head{display:none !important}
.finish-triangle{opacity:.32;stroke:#111827;stroke-width:1.6;pointer-events:none}
.finish-center{fill:#ffffff;stroke:#111827;stroke-width:2.2;pointer-events:none;opacity:.9}
.reserve-zone{
  width:82px !important;
  min-height:24px !important;
  padding:2px 3px !important;
  border-radius:9px !important;
}
.reserve-panel-title{display:none !important}
.reserve-soldiers{
  display:flex !important;
  flex-direction:row !important;
  flex-wrap:nowrap !important;
  justify-content:center !important;
  align-items:end !important;
  gap:4px !important;
}
.reserve-token.soldier-reserve{
  position:relative !important;
  width:20px !important;
  height:25px !important;
  min-width:20px !important;
  padding:0 !important;
  border:0 !important;
  background:transparent !important;
  box-shadow:none !important;
  border-radius:0 !important;
  overflow:visible !important;
}
.reserve-token.soldier-reserve .r-head{
  position:absolute;left:7px;top:0;width:7px;height:7px;border-radius:50%;background:#f3d2a2;border:1px solid #111827;
}
.reserve-token.soldier-reserve .r-head::before{
  content:"";position:absolute;left:-2px;top:-4px;width:10px;height:6px;border-radius:8px 8px 2px 2px;background:var(--pcolor);border:1px solid #111827;
}
.reserve-token.soldier-reserve .r-body{
  position:absolute;left:4px;top:8px;width:13px;height:11px;border-radius:7px 7px 4px 4px;background:var(--pcolor);border:1px solid #111827;
}
.reserve-token.soldier-reserve .r-legs::before,
.reserve-token.soldier-reserve .r-legs::after{
  content:"";position:absolute;top:18px;width:4px;height:7px;background:var(--pcolor);border:1px solid #111827;border-radius:3px;
}
.reserve-token.soldier-reserve .r-legs::before{left:5px;transform:rotate(8deg)}
.reserve-token.soldier-reserve .r-legs::after{right:5px;transform:rotate(-8deg)}
.reserve-token.soldier-reserve .r-num{
  position:absolute;left:0;right:0;top:10px;text-align:center;font-size:7px;font-weight:900;color:#fff;line-height:1;text-shadow:0 1px 1px #000;
}
.reserve-token.soldier-reserve.available{outline:0 !important;filter:drop-shadow(0 0 5px #22c55e)}
.reserve-token.soldier-reserve.disabled{opacity:.52;filter:grayscale(.25)}
.board-surface{transition:transform .28s ease;transform-origin:center center}
body.view-green .board-surface{transform:rotate(0deg)}
body.view-yellow .board-surface{transform:rotate(180deg)}
body.view-red .board-surface{transform:rotate(90deg)}
body.view-blue .board-surface{transform:rotate(-90deg)}
body.view-yellow .side,body.view-red .side,body.view-green .side,body.view-blue .side{transform:none}
@media(max-width:900px){#board{width:min(94vw,560px) !important;max-width:560px !important}}
@media(max-width:700px){#board{width:min(94vw,470px) !important;max-width:470px !important}.reserve-zone{width:66px !important}.reserve-token.soldier-reserve{width:17px !important;min-width:17px !important;height:22px !important}}


/* staged start flow */
body:not(.game-started) header,
body:not(.game-started) main.layout{display:none !important}
.stage-actions{display:flex;gap:10px;justify-content:center;flex-wrap:wrap;margin-top:14px}
.setup-stage{display:none}
.stage-selects{display:grid;gap:12px;margin:14px auto 4px;max-width:340px;text-align:right}
.stage-selects label{display:grid;gap:6px;color:#dbeafe;font-weight:800}
.stage-selects select{width:100%;font-weight:800}
.auto-warning{position:fixed;left:50%;bottom:18px;transform:translateX(-50%);z-index:1200;display:none;min-width:min(92vw,360px);text-align:center;background:linear-gradient(135deg,#7f1d1d,#dc2626);color:#fff;border:2px solid #fecaca;border-radius:16px;padding:12px 16px;box-shadow:0 12px 30px #0005;font-weight:900;line-height:1.7}
.auto-warning b{font-size:22px;color:#fef08a}


/* drag soldier experiment */
#board{touch-action:none}
.soldier-piece{cursor:grab}
.movable .soldier-piece{cursor:grab}
.dragging-source{opacity:.35}
.drag-ghost{pointer-events:none;filter:drop-shadow(0 8px 10px rgba(0,0,0,.35));opacity:.92}
.board-move-option.drag-target .option-fill{filter:drop-shadow(0 0 10px rgba(34,197,94,.95));stroke:#22c55e;stroke-width:4}
.drag-hint-ring{fill:none;stroke:#22c55e;stroke-width:4;stroke-dasharray:6 5;pointer-events:none;filter:drop-shadow(0 0 6px rgba(34,197,94,.9))}
