/* PekGames arena — one presentation layer for every game.
   Engines stay authoritative; this file only styles what they render. */

:root{
  --ink:#2A221B; --muted:#6B5C4C; --faint:#7A6A58;
  --paper:#F7F0E6; --line:#E3D5C0;
  --o:#E2661F; --o-deep:#BE5117; --o-tint:#FCE6D3; --o-ink:#A9460F;
  --card:rgba(255,251,244,.82);
}

/* ---------- page ---------- */
body.arena-playing::before{
  content:""; position:fixed; inset:0; z-index:-1; pointer-events:none;
  background:
    radial-gradient(60% 50% at 18% 6%, #F9E3CC 0, transparent 70%),
    radial-gradient(55% 45% at 88% 92%, #EBDDC7 0, transparent 70%),
    linear-gradient(#F8F2E8,#F2E9DB);
}
body.arena-playing .header-inner{padding-block:14px}
body.arena-playing .site-footer{display:none}
body.arena-playing main{padding-bottom:0}

/* ---------- shell ---------- */
#game{
  --B:min(calc(100svh - 252px),640px,calc(100vw - 40px));
  --P:clamp(10px,2.4vw,18px);
  --panel:300px; --gap:28px;
  max-width:1176px; margin:0 auto; padding:0 0 28px; text-align:left;
  color:var(--ink);
}
.arena-head{
  display:grid; grid-template-columns:1fr auto 1fr; align-items:center;
  gap:16px; margin:2px 0 18px;
}
#back{
  justify-self:start; margin:0; padding:9px 16px; font-size:13px; font-weight:600;
  color:var(--muted); background:rgba(255,255,255,.6); border:1px solid var(--line);
  border-radius:999px; cursor:pointer; display:inline-flex; width:auto;
}
#back:hover{color:var(--ink); border-color:#CDBB9F; background:#fff}
.arena-title{text-align:center}
#game h2{
  margin:0; font-size:clamp(32px,4.2vw,52px); font-weight:800;
  letter-spacing:-.05em; line-height:1.05; color:var(--ink);
}
.arena-tagline{
  display:flex; align-items:center; justify-content:center; gap:14px;
  margin:8px 0 0; font-size:14px; font-weight:500; color:var(--muted);
}
.arena-tagline::before,.arena-tagline::after{
  content:""; width:clamp(24px,5vw,64px); height:2px; border-radius:2px; background:var(--o);
}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

.arena-stage{
  display:grid; grid-template-columns:var(--B) var(--panel);
  grid-auto-rows:minmax(var(--B),auto);
  gap:var(--gap); justify-content:center; align-items:stretch;
}
.arena-board-col{position:relative; width:var(--B); min-width:0}

/* ---------- panel ---------- */
.arena-panel{
  display:flex; flex-direction:column; gap:10px; min-width:0;
  padding:16px; border-radius:26px; border:1px solid rgba(255,255,255,.9);
  background:linear-gradient(160deg,rgba(255,253,248,.92),rgba(246,236,221,.82));
  box-shadow:0 1px 0 #fff inset, 0 22px 50px -24px rgba(90,60,30,.35);
}
.p-block{display:grid; gap:8px}
.p-head{
  display:flex; justify-content:space-between; font-size:11px; font-weight:700;
  letter-spacing:.14em; text-transform:uppercase; color:var(--faint);
}
.p-row{
  display:flex; align-items:center; gap:12px; padding:10px 12px;
  border:1.5px solid var(--line); border-radius:16px; background:rgba(255,255,255,.7);
  font-size:15px; font-weight:600; color:var(--ink);
  transition:border-color .2s, background .2s, box-shadow .2s;
}
.p-row.current{border-color:var(--o); background:#FFF4E8; box-shadow:0 0 0 3px rgba(226,102,31,.14)}
.p-row .nm{flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.p-row .sc{
  min-width:34px; padding:3px 10px; border-radius:999px; text-align:center;
  background:#EFE3D1; color:var(--ink); font-size:14px; font-variant-numeric:tabular-nums;
}
.pc{
  flex:0 0 28px; width:28px; height:28px; background:center/contain no-repeat;
  filter:drop-shadow(0 2px 2px rgba(60,35,15,.35));
}
.pc.charcoal{background-image:url(../../assets/signature/disc-charcoal.png)}
.pc.ivory{background-image:url(../../assets/signature/disc-ivory.png)}
.pc.orange{background-image:url(../../assets/signature/disc-orange.png)}
.pc.x{background-image:url(../../assets/signature/piece-x.png)}
.pc.o{background-image:url(../../assets/signature/piece-o.png)}
.pc.you{background:none; filter:none}
.stat-grid{display:grid; grid-template-columns:1fr 1fr; gap:10px}
.stat{padding:12px; border:1.5px solid var(--line); border-radius:16px; background:rgba(255,255,255,.7)}
.stat b{display:block; font-size:26px; font-weight:800; letter-spacing:-.03em; font-variant-numeric:tabular-nums}
.stat span{font-size:11px; font-weight:700; letter-spacing:.12em; text-transform:uppercase; color:var(--faint)}

.turn-pill{
  display:block; text-align:center; padding:11px 14px; border-radius:999px;
  background:var(--o-deep); color:#fff; font-size:14px; font-weight:700;
  box-shadow:0 3px 0 #8F3C10, 0 8px 14px -6px rgba(190,81,23,.5);
}
.turn-pill:empty{display:none}
.turn-pill.done{background:#2F5A3E; box-shadow:0 3px 0 #1F3F2B, 0 8px 14px -6px rgba(47,90,62,.5)}

.controls{display:none}
#segs{display:grid; gap:12px}
#segs:empty{display:none}
.seg-wrap[hidden]{display:none!important}
.seg-label{display:none; margin-bottom:6px; font-size:11px; font-weight:700; letter-spacing:.14em; text-transform:uppercase; color:var(--faint)}
.seg{display:flex; padding:4px; gap:2px; border-radius:999px; background:#EADDC8}
.seg button{
  flex:1; padding:8px 6px; border:0; border-radius:999px; background:transparent;
  font:inherit; font-size:13px; font-weight:600; color:var(--muted); cursor:pointer;
  transition:background .15s,color .15s,box-shadow .15s;
}
.seg button:hover:not(:disabled){color:var(--ink)}
.seg button[aria-checked="true"]{background:#fff; color:var(--ink); box-shadow:0 1px 3px rgba(60,35,15,.25)}
.seg button:disabled{opacity:.45; cursor:not-allowed}

#diceSlot:empty{display:none}
#diceSlot{border-top:1px solid var(--line); padding-top:6px}
.dice-panel{display:flex; flex-direction:column; gap:10px; padding:0}
.premium-dice-stage{position:relative; width:100%; height:clamp(96px,calc(var(--B) - 405px),170px); flex-shrink:0; isolation:isolate}
.premium-dice-stage canvas{display:block; width:100%; height:100%}
.has-3d-dice .premium-die{position:absolute; width:1px; height:1px; padding:0; overflow:hidden; clip-path:inset(50%); pointer-events:none}
.dice-face{display:none}
.premium-die{
  box-sizing:border-box; display:grid; grid-template-columns:repeat(3,1fr); grid-template-rows:repeat(3,1fr);
  align-items:center; justify-items:center; width:84px; height:84px; margin:8px auto; padding:14px; gap:5px;
  border-radius:20px; background:linear-gradient(145deg,#FFFDF7,#DED0BA);
  box-shadow:inset 0 2px 3px #fff, 4px 6px 0 #CCBBA1, 8px 14px 18px rgba(113,91,65,.3);
}
.die-pip{display:block; width:11px; height:11px; border-radius:50%}
.die-pip.visible{background:#3A332B; box-shadow:inset 1px 2px 2px rgba(0,0,0,.5)}
.dice-roll{
  width:100%; padding:14px 12px; border:0; border-radius:999px; cursor:pointer;
  font:inherit; font-size:16px; font-weight:700; color:#fff;
  background:linear-gradient(150deg,#E2661F,#BE5117);
  box-shadow:0 4px 0 #8F3C10, 0 10px 16px -6px rgba(190,81,23,.5);
  transition:transform .15s, box-shadow .15s;
}
.dice-roll:not(:disabled):hover{transform:translateY(-1px)}
.dice-roll:active:not(:disabled){transform:translateY(3px); box-shadow:0 1px 0 #8F3C10}
.dice-roll:disabled{opacity:.5; cursor:not-allowed}

.p-actions{margin-top:auto; display:flex; flex-wrap:wrap; gap:10px; align-items:center}
#restart{
  flex:1; padding:13px 12px; border:2px solid var(--o-deep); border-radius:999px;
  background:transparent; color:var(--o-deep); font:inherit; font-size:15px; font-weight:700; cursor:pointer;
  transition:background .15s,color .15s;
}
#restart:hover{background:var(--o-deep); color:#fff; border-color:var(--o-deep)}
.how{position:relative}
.how summary{
  list-style:none; width:48px; height:48px; border-radius:50%; display:grid; place-items:center; cursor:pointer;
  border:2px solid var(--line); background:rgba(255,255,255,.7); color:var(--muted); font-size:17px; font-weight:800;
}
.how summary::-webkit-details-marker{display:none}
.how summary:hover{border-color:#CDBB9F; color:var(--ink)}
.how p{
  position:absolute; right:0; bottom:calc(100% + 10px); z-index:20; width:250px; margin:0; padding:12px 14px;
  border-radius:14px; background:#fff; border:1px solid var(--line); box-shadow:0 14px 30px -10px rgba(60,35,15,.35);
  font-size:13px; line-height:1.5; color:var(--muted);
}
.how.inline{order:-1; flex-basis:100%}
.how.inline summary{display:none}
.how.inline p{position:static; width:auto; padding:14px; background:rgba(255,255,255,.7); box-shadow:none}

button:focus-visible{outline:3px solid var(--o-deep); outline-offset:2px}

/* ---------- the slab (shared by every board) ---------- */
#game #board{
  --face:linear-gradient(160deg,#F5EDDF,#E5D7C0);
  --e1:#CDBB9D; --e2:#B7A383;
  position:relative; box-sizing:border-box; width:var(--B); height:var(--B);
  margin:0; padding:var(--P); border:0; border-radius:28px; aspect-ratio:auto;
  background:var(--face);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.7), inset 0 -2px 0 rgba(0,0,0,.08),
    0 6px 0 var(--e1), 0 12px 0 var(--e2),
    0 30px 44px -10px rgba(80,50,20,.42),
    0 46px 90px -26px rgba(226,102,31,.38);
  margin-bottom:12px;
}
#game #board button{font-family:inherit; cursor:pointer; min-width:0}
#game #board button:disabled{cursor:default}
#game #board.extended-board{
  display:flex; flex-direction:column; align-items:center; justify-content:center;
}
.pop{animation:pop .28s cubic-bezier(.3,1.6,.5,1)}
.flip{animation:flip .4s ease}
@keyframes pop{from{transform:scale(.55);opacity:.2}to{transform:none;opacity:1}}
@keyframes flip{40%{transform:scaleX(.1)}}
@media(prefers-reduced-motion:reduce){.pop,.flip{animation:none}}

/* piece art shared by cell ::after layers */
.cell::after,.classic-cell::after{content:""; position:absolute; pointer-events:none; background:center/contain no-repeat}

/* ---------- OMOK ---------- */
#game #board:not([data-classic]):not([data-extended]){
  --face:linear-gradient(150deg,#B88F58,#A9804D); --e1:#7E5B33; --e2:#634523;
  display:grid; grid-template-columns:repeat(15,minmax(0,1fr)); grid-template-rows:repeat(15,minmax(0,1fr));
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 15' preserveAspectRatio='none'%3E%3Cg stroke='%233A2711' stroke-width='.055' stroke-linecap='square'%3E%3Cpath d='M.5.5h14M.5 1.5h14M.5 2.5h14M.5 3.5h14M.5 4.5h14M.5 5.5h14M.5 6.5h14M.5 7.5h14M.5 8.5h14M.5 9.5h14M.5 10.5h14M.5 11.5h14M.5 12.5h14M.5 13.5h14M.5 14.5h14M.5.5v14M1.5.5v14M2.5.5v14M3.5.5v14M4.5.5v14M5.5.5v14M6.5.5v14M7.5.5v14M8.5.5v14M9.5.5v14M10.5.5v14M11.5.5v14M12.5.5v14M13.5.5v14M14.5.5v14'/%3E%3C/g%3E%3Cg fill='%233A2711'%3E%3Ccircle cx='3.5' cy='3.5' r='.13'/%3E%3Ccircle cx='7.5' cy='3.5' r='.13'/%3E%3Ccircle cx='11.5' cy='3.5' r='.13'/%3E%3Ccircle cx='3.5' cy='7.5' r='.13'/%3E%3Ccircle cx='7.5' cy='7.5' r='.13'/%3E%3Ccircle cx='11.5' cy='7.5' r='.13'/%3E%3Ccircle cx='3.5' cy='11.5' r='.13'/%3E%3Ccircle cx='7.5' cy='11.5' r='.13'/%3E%3Ccircle cx='11.5' cy='11.5' r='.13'/%3E%3C/g%3E%3C/svg%3E"),var(--face);
  background-size:100% 100%,auto; background-repeat:no-repeat,no-repeat;
  background-origin:content-box,border-box; background-clip:border-box,border-box;
}
#game .cell{position:relative; padding:0; border:0; border-radius:0; background:none}
#game .cell::after{inset:7%}
#game .cell.black::after{background-image:url(../../assets/signature/disc-charcoal.png)}
#game .cell.white::after{background-image:url(../../assets/signature/disc-ivory.png)}
#game .cell:not(.black):not(.white):not(:disabled):hover::after{background-image:url(../../assets/signature/disc-charcoal.png); opacity:.28}
#game .cell.last::before{
  content:""; position:absolute; inset:41%; border-radius:50%; background:var(--o); z-index:2;
  box-shadow:0 0 0 1.5px #fff;
}
.cell.win::after,.classic-cell.win::after{filter:drop-shadow(0 0 0 transparent) drop-shadow(0 0 6px rgba(226,102,31,.95))}
.cell.win::before{content:""; position:absolute; inset:2%; border-radius:50%; box-shadow:0 0 0 3px var(--o); z-index:1}

/* ---------- classic boards ---------- */
#game #board.classic-board{display:grid; gap:var(--cg,6px); place-content:stretch}
.classic-cell{
  position:relative; padding:0; border:0; display:grid; place-items:center;
  font-size:0; line-height:1;
}
.classic-cell::after{inset:7%}

/* Tic-Tac-Toe */
#game #board[data-classic="Tic-Tac-Toe"]{--cg:clamp(8px,2vw,14px); grid-template-columns:repeat(3,minmax(0,1fr))!important; grid-template-rows:repeat(3,minmax(0,1fr)); --face:linear-gradient(160deg,#EFE4D1,#DCCCB2); --e1:#BFAA88; --e2:#A89270}
#game #board[data-classic="Tic-Tac-Toe"] .classic-cell{
  border-radius:20px; background:linear-gradient(160deg,#FFFCF5,#F0E5D2);
  box-shadow:inset 0 2px 0 #fff, inset 0 -4px 0 rgba(120,90,50,.12), 0 4px 0 #BCA783, 0 8px 12px -4px rgba(70,45,20,.3);
  transition:transform .12s, box-shadow .12s;
}
#game #board[data-classic="Tic-Tac-Toe"] .classic-cell:not(:disabled):hover{transform:translateY(-2px)}
#game #board[data-classic="Tic-Tac-Toe"] .classic-cell.first::after{inset:16%; background-image:url(../../assets/signature/piece-x.png)}
#game #board[data-classic="Tic-Tac-Toe"] .classic-cell.second::after{inset:13%; background-image:url(../../assets/signature/piece-o.png)}
#game #board[data-classic="Tic-Tac-Toe"] .classic-cell.win{box-shadow:inset 0 0 0 3px var(--o), 0 4px 0 #BCA783}

/* Four in a Row — slab is square; the 7×6 rack is centred in it with square cells */
#game #board[data-classic="Four in a Row"]{
  --cg:clamp(4px,1vw,8px); --face:linear-gradient(160deg,#545C69,#434A55); --e1:#2B3038; --e2:#1B1F25;
  --iw:calc(var(--B) - 2*var(--P));
  padding:calc((var(--B) - var(--iw)*6/7)/2) var(--P);
  grid-template-columns:repeat(7,minmax(0,1fr))!important; grid-template-rows:repeat(6,minmax(0,1fr));
}
#game #board[data-classic="Four in a Row"] .classic-cell{
  border-radius:50%; background:radial-gradient(circle at 50% 50%, #12151A 0 66%, rgba(255,255,255,.22) 68% 72%, transparent 74%);
}
#game #board[data-classic="Four in a Row"] .classic-cell::after{inset:5%}
#game #board[data-classic="Four in a Row"] .classic-cell.black::after{background-image:url(../../assets/signature/disc-orange.png)}
#game #board[data-classic="Four in a Row"] .classic-cell.white::after{background-image:url(../../assets/signature/disc-ivory.png)}
#game #board[data-classic="Four in a Row"] .classic-cell:not(:disabled):hover{background:radial-gradient(circle at 50% 50%, #12151A 0 66%, var(--o) 68% 74%, transparent 76%)}
#game #board[data-classic="Four in a Row"] .classic-cell.win::before{content:""; position:absolute; inset:0; border-radius:50%; box-shadow:0 0 0 3px #fff}

/* Reversi */
#game #board[data-classic="Reversi"]{
  --cg:clamp(3px,.7vw,5px); --face:linear-gradient(160deg,#2E6450,#255343); --e1:#173629; --e2:#0F2519;
  grid-template-columns:repeat(8,minmax(0,1fr))!important; grid-template-rows:repeat(8,minmax(0,1fr));
}
#game #board[data-classic="Reversi"] .classic-cell{
  border-radius:7px; background:linear-gradient(160deg,#4A9174,#3C7D62);
  box-shadow:inset 0 2px 0 rgba(255,255,255,.28), inset 0 -3px 0 rgba(0,0,0,.18), 0 2px 0 #1D4635;
}
#game #board[data-classic="Reversi"] .classic-cell.black::after{background-image:url(../../assets/signature/disc-charcoal.png)}
#game #board[data-classic="Reversi"] .classic-cell.white::after{background-image:url(../../assets/signature/disc-ivory.png)}
#game #board[data-classic="Reversi"] .classic-cell.legal-move::before{
  content:""; position:absolute; inset:36%; border-radius:50%; background:#EAF6EF; opacity:.9;
  box-shadow:0 0 0 2px rgba(20,60,45,.35);
}
#game #board[data-classic="Reversi"] .classic-cell.legal-move:hover{box-shadow:inset 0 0 0 3px #EAF6EF, 0 2px 0 #1D4635}

/* ---------- SUDOKU ---------- */
#game #board[data-extended="Sudoku"]{--keys:56px; --face:linear-gradient(160deg,#F5EDDF,#E7DAC4)}
.sudoku-grid{
  display:grid; grid-template-columns:repeat(9,minmax(0,1fr)); gap:1px;
  width:calc(var(--B) - 2*var(--P) - var(--keys)); aspect-ratio:1;
  border:3px solid #3A2F26; background:#3A2F26; border-radius:8px; overflow:hidden;
  box-shadow:0 3px 0 rgba(0,0,0,.12);
}
.sudoku-cell{
  aspect-ratio:auto; padding:0; border:0; border-radius:0; background:#FFFCF6; color:#B2470F;
  font-family:"Inter",system-ui,sans-serif; font-variant-numeric:lining-nums tabular-nums;
  font-feature-settings:"lnum","tnum"; font-size:clamp(14px,2.6vw,24px); font-weight:600;
}
.sudoku-cell:not(:disabled):hover{background:#FFF0E0}
.sudoku-cell.given{background:#EFE5D3; color:var(--ink); font-weight:800}
.sudoku-cell.selected{background:#FBD9BE; box-shadow:inset 0 0 0 3px var(--o); z-index:1}
.sudoku-cell.incorrect{background:#FFE1D8; color:#A4271C}
.sudoku-cell.box-right{border-right:2px solid #3A2F26}
.sudoku-cell.box-bottom{border-bottom:2px solid #3A2F26}
.sudoku-keys{
  display:grid; grid-template-columns:repeat(9,1fr) 1.9fr; gap:5px; margin-top:10px;
  width:calc(var(--B) - 2*var(--P) - var(--keys));
}
.sudoku-keys button{
  padding:9px 0; border:0; border-radius:10px; background:linear-gradient(#FFFDF8,#F0E6D4);
  box-shadow:0 3px 0 #C4B193; font-size:15px; font-weight:700; color:var(--ink);
}
.sudoku-keys button:active{transform:translateY(2px); box-shadow:0 1px 0 #C4B193}

/* ---------- HANOI ---------- */
#game #board[data-extended="Tower of Hanoi"]{--face:linear-gradient(160deg,#F2E8D6,#E2D3B9)}
.hanoi-layout{display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; width:100%; height:100%}
.hanoi-labels{display:none}
.hanoi-peg{
  position:relative; height:100%; padding:0 6px 38px; display:flex; flex-direction:column-reverse;
  align-items:center; justify-content:flex-start; isolation:isolate;
  border:2px solid transparent; border-radius:18px;
  background:linear-gradient(180deg,#F7F0E2,#EADDC6);
  box-shadow:inset 0 2px 0 #fff, inset 0 -6px 0 #CDBB9A;
}
.hanoi-peg::before{
  content:""; position:absolute; bottom:34px; left:calc(50% - 6px); width:12px; height:76%;
  border-radius:8px; background:linear-gradient(90deg,#9C7B58,#BFA07C 45%,#8A6A48); z-index:-1;
}
.hanoi-peg::after{
  position:absolute; bottom:8px; left:0; right:0; text-align:center; font-size:15px; font-weight:800; color:var(--muted);
}
.hanoi-peg:nth-child(1)::after{content:"A"}
.hanoi-peg:nth-child(2)::after{content:"B"}
.hanoi-peg:nth-child(3)::after{content:"C"}
.hanoi-peg:hover:not(:disabled){border-color:#D6B992}
.hanoi-peg.selected{border-color:var(--o); background:linear-gradient(180deg,#FFF1E2,#F8DEC3)}
.hanoi-disc{
  display:block; max-width:100%; height:clamp(20px,4.4vh,30px); margin-bottom:4px; border-radius:999px;
  box-shadow:0 0 0 1px rgba(40,22,8,.55), inset 0 3px 0 rgba(255,255,255,.4), inset 0 -4px 0 rgba(0,0,0,.2), 0 4px 6px rgba(40,22,8,.3);
}
.hanoi-disc[style*="width: 42%"]{background:#E9A23B!important}
.hanoi-disc[style*="width: 54%"]{background:#D2642F!important}
.hanoi-disc[style*="width: 66%"]{background:#A8431F!important}
.hanoi-disc[style*="width: 78%"]{background:#6E3A2A!important}
.hanoi-disc[style*="width: 90%"]{background:#2F2A26!important}

/* ---------- MEMORY ---------- */
#game #board[data-extended="Memory Match"]{--face:linear-gradient(160deg,#F2E8D6,#E2D3B9)}
.memory-grid{display:grid; grid-template-columns:repeat(var(--cols,4),minmax(0,1fr)); gap:clamp(6px,1.4vw,12px); width:100%}
.memory-card{
  position:relative; aspect-ratio:1; padding:0; border:0; border-radius:14px; font-size:0; color:#F2C26B;
  background:linear-gradient(160deg,#3A4B70,#2A3857); box-shadow:inset 0 2px 0 rgba(255,255,255,.18), 0 4px 0 #17203A, 0 8px 10px -4px rgba(20,30,60,.45);
  transition:transform .15s;
}
.memory-card:not(:disabled):hover{transform:translateY(-2px)}
.memory-card::before{content:""; position:absolute; inset:24%; background:currentColor; -webkit-mask:var(--g) center/contain no-repeat; mask:var(--g) center/contain no-repeat}
.memory-card:not(.revealed){--g:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l3 7 7 3-7 3-3 7-3-7-7-3 7-3z'/%3E%3C/svg%3E"); opacity:.8}
.memory-card:not(.revealed)::before{inset:30%}
.memory-card.revealed{background:linear-gradient(160deg,#FFFDF8,#F3E9D6); color:var(--o-deep); box-shadow:inset 0 2px 0 #fff, 0 4px 0 #C9B795, 0 8px 10px -4px rgba(70,45,20,.3)}
.memory-card.matched{background:linear-gradient(160deg,#E6EEDC,#D2DEC6); color:#2F5A3E; box-shadow:0 3px 0 #A5B897}

/* ---------- DOTS & BOXES ---------- */
#game #board[data-extended="Dots and Boxes"]{--face:linear-gradient(160deg,#F5EDDF,#E6D8C1)}
.dots-grid{
  --d:clamp(12px,2.2vw,16px);
  display:grid; grid-template-columns:var(--d) 1fr var(--d) 1fr var(--d) 1fr var(--d);
  grid-template-rows:var(--d) 1fr var(--d) 1fr var(--d) 1fr var(--d);
  width:calc(var(--B) - 2*var(--P)); aspect-ratio:1; gap:4px; padding:10px;
  background:linear-gradient(160deg,#FFFBF2,#F4EAD8); border-radius:20px;
  box-shadow:inset 0 2px 0 #fff, inset 0 0 0 1px #E3D5C0;
}
.dots-dot{width:var(--d); height:var(--d); align-self:center; justify-self:center; border-radius:50%; background:radial-gradient(circle at 35% 30%,#6A5B4B,#2A221B 70%); box-shadow:0 2px 3px rgba(40,25,10,.4)}
.dots-h,.dots-v{padding:0; border:0; border-radius:999px; background:#DCCBB1; box-shadow:inset 0 2px 3px rgba(80,55,25,.35)}
.dots-h:not(:disabled):hover,.dots-v:not(:disabled):hover{background:#F2B07E}
.dots-box{border-radius:10px; background:#FFF8EA; box-shadow:inset 0 0 0 1px #EFE2CC}
.dots-grid .dots-h.owner-1,.dots-grid .dots-v.owner-1{background:linear-gradient(#E2661F,#BE5117); box-shadow:0 2px 0 #8F3C10}
.dots-grid .dots-h.owner-2,.dots-grid .dots-v.owner-2{background:linear-gradient(#4A4036,#2A221B); box-shadow:0 2px 0 #14100C}
.dots-box.owner-1{background:linear-gradient(160deg,#FBC9A2,#F2A972); box-shadow:inset 0 2px 0 rgba(255,255,255,.5)}
.dots-box.owner-2{background:linear-gradient(160deg,#CDBDA6,#B9A68C); box-shadow:inset 0 2px 0 rgba(255,255,255,.4)}

/* ---------- SNAKES & LADDERS ---------- */
#game #board[data-extended="Snakes and Ladders"]{--face:linear-gradient(160deg,#F2E8D6,#E2D3B9)}
.snakes-wrap{position:relative; width:100%; aspect-ratio:1}
.snakes-grid{
  display:grid; grid-template-columns:repeat(10,minmax(0,1fr)); gap:3px; width:100%; height:100%;
  background:#BEAB92; border:0; border-radius:12px; overflow:hidden;
}
.snakes-square{
  position:relative; aspect-ratio:auto; padding:3px 4px; border:0; border-radius:6px; text-align:left;
  background:linear-gradient(145deg,#FFFDF6,#EDE2CE); color:#5E4F40; font-size:clamp(9px,1.3vw,13px); font-weight:700;
  box-shadow:inset 0 2px 1px rgba(255,255,255,.8), inset 0 -3px 1px rgba(120,95,60,.18);
}
.snakes-square:nth-child(even){background:linear-gradient(145deg,#F4EBDD,#E7D6BE)}
.snakes-square.ladder-start{background:linear-gradient(145deg,#E1E8D8,#BFCDB7)}
.snakes-square.snake-start{background:linear-gradient(145deg,#FFDFC5,#EFB89A)}
.arena-art .snakes-grid{background:#e8d6bd url(../../assets/signature/snakes-board.webp) center/100% 100% no-repeat; gap:0; border-radius:10px}
.arena-art .snakes-square{background:transparent!important; box-shadow:none!important; color:transparent!important; border-radius:0}
.arena-art .race-lines{display:none}
.race-lines{position:absolute; inset:0; width:100%; height:100%; pointer-events:none; z-index:2}
.race-token{
  position:absolute; z-index:5; width:46%; aspect-ratio:1; bottom:5%; border:0; border-radius:50%;
  background:center/cover no-repeat; filter:drop-shadow(0 3px 3px rgba(40,25,10,.55));
}
.token-1{left:4%; background-image:url(../../assets/signature/disc-orange.png)}
.token-2{right:4%; background-image:url(../../assets/signature/disc-charcoal.png)}

/* ---------- game-over popup ---------- */
.over-veil{
  position:absolute; inset:0; z-index:30; display:grid; place-items:center; padding:20px;
  border-radius:28px; background:rgba(247,240,230,.35); backdrop-filter:blur(3px); -webkit-backdrop-filter:blur(3px);
  animation:veil .25s ease-out;
}
.over-card{
  position:relative; width:min(100%,300px); padding:26px 22px 20px; text-align:center;
  border-radius:24px; background:#FFFCF6; border:1px solid var(--line);
  box-shadow:0 2px 0 #fff inset, 0 24px 60px -16px rgba(60,35,15,.45);
  animation:card .3s cubic-bezier(.3,1.4,.5,1);
}
.over-x{
  position:absolute; top:10px; right:10px; width:32px; height:32px; border:0; border-radius:50%;
  background:#F1E6D4; color:var(--muted); font-size:18px; line-height:1; cursor:pointer;
}
.over-x:hover{background:#E6D6BD; color:var(--ink)}
.over-trophy{display:block; width:54px; height:54px; margin:0 auto 10px; color:var(--o)}
.over-eyebrow{font-size:11px; font-weight:700; letter-spacing:.2em; color:var(--faint); text-transform:uppercase}
.over-card h3{margin:6px 0 4px; font-size:28px; font-weight:800; letter-spacing:-.04em; color:var(--ink)}
.over-card p{margin:0 0 16px; font-size:14px; line-height:1.45; color:var(--muted)}
.over-new{
  width:100%; padding:13px; border:0; border-radius:999px; cursor:pointer; font:inherit; font-size:15px; font-weight:700; color:#fff;
  background:linear-gradient(150deg,#E2661F,#BE5117); box-shadow:0 4px 0 #8F3C10, 0 10px 16px -6px rgba(190,81,23,.5);
}
.over-lib{margin-top:8px; width:100%; padding:10px; border:0; background:none; font:inherit; font-size:13px; font-weight:600; color:var(--muted); cursor:pointer}
.over-lib:hover{color:var(--ink)}
@keyframes veil{from{opacity:0}to{opacity:1}}
@keyframes card{from{opacity:0; transform:translateY(10px) scale(.96)}to{opacity:1; transform:none}}
@media(prefers-reduced-motion:reduce){.over-veil,.over-card{animation:none}}

/* ---------- responsive ---------- */
@media(max-width:900px){
  #game{--B:min(calc(100vw - 40px),560px); --gap:20px}
  .arena-stage{grid-template-columns:var(--B); grid-auto-rows:auto; justify-content:center}
  .arena-head{grid-template-columns:auto 1fr; }
  .arena-spacer{display:none}
  .arena-title{text-align:right; grid-column:2}
  .arena-panel{width:var(--B)}
  .arena-tagline::before{display:none}
  .arena-tagline{justify-content:flex-end}
  .premium-dice-stage{height:150px}
}
@media(max-width:560px){
  #game #board[data-extended="Sudoku"]{--keys:14px}
  .sudoku-keys{grid-template-columns:repeat(5,1fr)}
  .arena-head{margin-bottom:12px}
  #game #board{border-radius:20px}
  main{padding-inline:16px}
}

/* memory glyphs (mask shapes, so every platform draws the same symbols) */
.memory-card[data-sym="●"].revealed{--g:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3C/svg%3E")}
.memory-card[data-sym="◆"].revealed{--g:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l10 10-10 10L2 12z'/%3E%3C/svg%3E")}
.memory-card[data-sym="▲"].revealed{--g:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3l10 18H2z'/%3E%3C/svg%3E")}
.memory-card[data-sym="■"].revealed{--g:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='3' width='18' height='18' rx='3'/%3E%3C/svg%3E")}
.memory-card[data-sym="★"].revealed{--g:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l3 6.9 7.5.7-5.7 5 1.8 7.4L12 18l-6.6 4 1.8-7.4-5.7-5 7.5-.7z'/%3E%3C/svg%3E")}
.memory-card[data-sym="☀"].revealed{--g:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='5'/%3E%3Cpath d='M11 1h2v4h-2zM11 19h2v4h-2zM1 11h4v2H1zM19 11h4v2h-4zM4.2 2.8l1.4-1.4 2.8 2.8-1.4 1.4zM15.6 19.8l1.4-1.4 2.8 2.8-1.4 1.4zM2.8 19.8l2.8-2.8 1.4 1.4-2.8 2.8zM17 5.6l2.8-2.8 1.4 1.4-2.8 2.8z'/%3E%3C/svg%3E")}
.memory-card[data-sym="☾"].revealed{--g:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M17 2a10 10 0 1 0 5 17A8.5 8.5 0 0 1 17 2z'/%3E%3C/svg%3E")}
.memory-card[data-sym="✿"].revealed{--g:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='5' r='4'/%3E%3Ccircle cx='19' cy='10' r='4'/%3E%3Ccircle cx='16.5' cy='18' r='4'/%3E%3Ccircle cx='7.5' cy='18' r='4'/%3E%3Ccircle cx='5' cy='10' r='4'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E")}
.memory-card[data-sym="♠"].revealed{--g:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C8 8 3 10 3 14.5A4.5 4.5 0 0 0 11 17c0 2-.6 3.500-2 5h6c-1.400-1.500-2-3-2-5a4.500 4.500 0 0 0 8-2.500C21 10 16 8 12 2z'/%3E%3C/svg%3E")}
.memory-card[data-sym="♣"].revealed{--g:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='6.500' r='4.500'/%3E%3Ccircle cx='6' cy='14' r='4.500'/%3E%3Ccircle cx='18' cy='14' r='4.500'/%3E%3Cpath d='M10.500 13h3l1 9h-5z'/%3E%3C/svg%3E")}
.memory-card[data-sym="♥"].revealed{--g:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21C4 15 2 11 2 7.500A5 5 0 0 1 12 6a5 5 0 0 1 10 1.500C22 11 20 15 12 21z'/%3E%3C/svg%3E")}
.memory-card[data-sym="♦"].revealed{--g:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1l8 11-8 11L4 12z'/%3E%3C/svg%3E")}
