/* قعدة: the games page. A diwaniya table under a Sadu band; every game sits on it
   as its own object: a newspaper with a board, a notebook page, a school answer sheet. */
:root {
  --ink: #241c14; --cream: #f4ecda; --muted: #6d6150; --wood: #3a2416; --wood2: #2a1a10;
  --sadu-red: #9c1f16; --sadu-black: #1c1310; --sadu-cream: #efe2c4;
  --red: #b3261e; --blue: #2a5d8f; --green: #2f7a52; --rose: #b03a52;
  --hand: 'Aref Ruqaa', serif; --serif: 'Amiri', serif; --body: 'Markazi Text', serif; --kufi: 'Noto Kufi Arabic', sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font: 400 19px/1.55 var(--body);
  background:
    repeating-linear-gradient(92deg, rgba(255, 255, 255, .025) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(88deg, rgba(0, 0, 0, .12) 0 1px, transparent 1px 23px),
    radial-gradient(ellipse at 50% 0%, #5a3a24, var(--wood) 45%, var(--wood2));
  background-attachment: fixed;
}

/* ---- the sign: a Sadu band above and below ---- */
.mast { padding-top: env(safe-area-inset-top); }
.sadu {
  height: 30px;
  background:
    linear-gradient(135deg, var(--sadu-red) 25%, transparent 25%) -15px 0 / 30px 30px,
    linear-gradient(225deg, var(--sadu-red) 25%, transparent 25%) -15px 0 / 30px 30px,
    linear-gradient(315deg, var(--sadu-black) 25%, transparent 25%) 0 0 / 30px 30px,
    linear-gradient(45deg, var(--sadu-black) 25%, var(--sadu-cream) 25%) 0 0 / 30px 30px;
  border-block: 4px solid var(--sadu-cream);
  box-shadow: inset 0 3px 0 var(--sadu-red), inset 0 -3px 0 var(--sadu-red);
}
.sign { text-align: center; padding: 14px max(16px, env(safe-area-inset-right)) 18px max(16px, env(safe-area-inset-left)); background: linear-gradient(#1f140d, #2a1b12); color: var(--sadu-cream); }
.kicker { display: flex; justify-content: space-between; max-width: 1040px; margin: 0 auto; font: 800 12px/1.6 var(--kufi); opacity: .75; }
.sign h1 { margin: 4px 0 0; font: 700 clamp(58px, 15vw, 112px)/1.05 var(--hand); color: #f7ead0; text-shadow: 0 3px 0 var(--sadu-red), 0 10px 30px rgba(0, 0, 0, .6); }
.dek { margin: 2px 0 0; font: 700 21px/1.4 var(--serif); color: #e6d2ad; }

/* ---- the table ---- */
.table { max-width: 1080px; margin: 0 auto; padding: 26px max(16px, env(safe-area-inset-right)) max(30px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.games { display: grid; gap: 22px; grid-template-columns: 1fr; }
@media (min-width: 720px) {
  .games { grid-template-columns: 1fr 1fr; gap: 28px; }
  .game:last-child:nth-child(odd) { grid-column: 1 / -1; }   /* an odd last game takes the whole row */
}
/* a real desktop: a wider table and bigger games, two by two */
@media (min-width: 900px) {
  .table { max-width: 1180px; }
  .games { gap: 34px 38px; }
  .game { min-height: 370px; }
  .art { height: 206px; }
}

.games { perspective: 1400px; }
.game {
  --r: 0deg; --rx: 0deg; --ry: 0deg; --lift: 0px; --up: 0px; --mx: 0; --my: 0; --press: 1;
  position: relative; display: flex; flex-direction: column; min-height: 330px; color: inherit; text-decoration: none;
  border-radius: 4px; box-shadow: calc(var(--mx) * -16px) calc(22px + var(--my) * -8px) 30px -18px rgba(0, 0, 0, .8), 0 2px 0 rgba(0, 0, 0, .25);
  transform: translateY(var(--up)) rotate(var(--r)) rotateX(var(--rx)) rotateY(var(--ry)) translateZ(var(--lift)) scale(var(--press));
  transition: transform .55s cubic-bezier(.2, .9, .3, 1.15), box-shadow .3s; -webkit-tap-highlight-color: transparent;
  animation: deal .9s cubic-bezier(.2, 1.05, .3, 1) backwards; animation-delay: calc(var(--n, 0) * .11s + .08s);
}
.game:nth-child(1) { --r: -1.2deg; --n: 0; }
.game:nth-child(2) { --r: 1deg; --n: 1; }
.game:nth-child(3) { --r: .8deg; --n: 2; }
.game:nth-child(4) { --r: -1deg; --n: 3; }
.game:hover, .game:focus-visible, .game.tilting { --up: -6px; --lift: 26px; --r: 0deg; box-shadow: calc(var(--mx) * -22px) calc(34px + var(--my) * -12px) 44px -22px rgba(0, 0, 0, .85), 0 2px 0 rgba(0, 0, 0, .25); }
.game.tilting { transition: transform .1s linear, box-shadow .2s; }
.game:focus-visible { outline: 3px solid #f2c94c; outline-offset: 4px; }
.game:active { --press: .98; }
/* a lamp's glare that follows the finger or the mouse */
.game::after { content: ''; position: absolute; inset: 0; z-index: 3; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .35s;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 30%), rgba(255, 246, 220, .38), transparent 58%); }
.game.tilting::after { opacity: 1; }
@keyframes deal { from { opacity: 0; transform: translateY(-50px) rotate(var(--r)) rotateX(-60deg) translateZ(140px); } }
.art { position: relative; display: block; height: 180px; overflow: hidden; border-radius: 4px 4px 0 0; }
.label { display: flex; flex-direction: column; gap: 4px; padding: 14px 18px 18px; flex: 1; }
.label b { font: 700 34px/1.15 var(--hand); }
.label .what { font-size: 17px; line-height: 1.5; color: var(--muted); }
.go { margin-top: auto; align-self: flex-start; font: 800 14px/1 var(--kufi); padding: 10px 16px; border-radius: 99px; background: var(--ink); color: #fff; }

/* الدامة: a newspaper front page with a little board tipped back in 3D */
.dama { background: #f3ecdb; }
.dama .art { background: #efe6d1; border-bottom: 3px double var(--ink); perspective: 600px; }
.np-head { position: absolute; top: 10px; inset-inline: 0; text-align: center; font: 700 26px/1 var(--serif); border-bottom: 1px solid var(--ink); padding-bottom: 6px; margin: 0 14px; }
.np-cols { position: absolute; top: 52px; bottom: 12px; inset-inline: 14px; display: grid; grid-template-columns: 1fr 1.6fr 1fr; gap: 12px; }
.np-cols i { background: repeating-linear-gradient(to bottom, rgba(36, 28, 20, .28) 0 2px, transparent 2px 9px); }
.np-cols i:nth-child(2) { background: none; }
.board {
  position: absolute; left: 50%; top: 48px; width: 140px; height: 140px; margin-left: -70px;
  background: repeating-conic-gradient(#d8c59b 0 25%, #f6eedb 0 50%) 0 0 / 50% 50%;
  border: 4px solid var(--ink); transform: rotateX(52deg) rotateZ(-10deg); transform-style: preserve-3d;
  box-shadow: 0 30px 30px -10px rgba(0, 0, 0, .35); transition: transform .4s ease;
}
.dama:hover .board, .dama:focus-visible .board { transform: rotateX(40deg) rotateZ(-4deg); }
.board { translate: calc(var(--mx) * 14px) calc(var(--my) * 10px); }
.dama.tilting .board { transform: rotateX(calc(42deg + var(--my) * 10deg)) rotateZ(calc(-5deg + var(--mx) * 8deg)); transition-duration: .1s; }
.np-head, .np-cols { translate: calc(var(--mx) * -4px) calc(var(--my) * -3px); }
.board i { position: absolute; width: 22%; height: 22%; border-radius: 50%; transform: translateZ(6px); box-shadow: 0 5px 0 rgba(0, 0, 0, .45); }
.board i:nth-child(-n+3) { background: radial-gradient(circle at 40% 35%, #e3463b, #8d1912 70%); }
.board i:nth-child(n+4) { background: radial-gradient(circle at 40% 35%, #5a4a40, #120c09 70%); }
.board i:nth-child(1) { left: 1.5%; top: 1.5%; } .board i:nth-child(2) { left: 51.5%; top: 1.5%; } .board i:nth-child(3) { left: 26.5%; top: 26.5%; }
.board i:nth-child(4) { left: 51.5%; top: 51.5%; } .board i:nth-child(5) { left: 1.5%; top: 76.5%; } .board i:nth-child(6) { left: 76.5%; top: 76.5%; }
.dama .label b { font-family: var(--serif); font-size: 36px; }

/* «جاوبها!»: a notebook page with the board as sticky notes */
.sj { background: #fffdf6; }
.sj .art { background: #fffdf6 repeating-linear-gradient(to bottom, transparent 0 25px, #cddbef 25px 26px); border-inline-start: 3px solid #e4a3a3; }
.sj .art::before { content: ''; position: absolute; top: 8px; inset-inline: 18px; height: 12px; background: radial-gradient(circle, #3a332a 4px, transparent 5px) 0 0 / 26px 12px repeat-x; }
.cells { position: absolute; top: 34px; right: 22px; display: grid; grid-template-columns: repeat(3, 58px); gap: 8px; }
.cells i { font: 800 15px/34px var(--kufi); font-style: normal; text-align: center; height: 34px; box-shadow: 0 6px 8px -6px rgba(60, 40, 10, .6); }
.cells i:nth-child(3n+1) { background: #ffe58f; transform: rotate(-3deg); }
.cells i:nth-child(3n+2) { background: #b9e4c9; transform: rotate(2deg); }
.cells i:nth-child(3n) { background: #f9c0cf; transform: rotate(-1deg); }
.sj .q { position: absolute; left: 26px; top: 26px; font: 700 110px/1 var(--hand); color: var(--red); transform: rotate(-14deg); transition: transform .3s; }
.sj:hover .q, .sj:focus-visible .q { transform: rotate(4deg) scale(1.08); }
.cells { translate: calc(var(--mx) * 7px) calc(var(--my) * 6px); }
.sj .q { translate: calc(var(--mx) * 18px) calc(var(--my) * 14px); }
.sj .label b { color: var(--blue); }

/* باص كومبليت: the school answer sheet, a big letter and the «ستوب!» stamp */
.bus { background: #fbfaf6; }
.bus .art { background: #fbfaf6; border-bottom: 1px solid var(--ink); }
.sheet { position: absolute; top: 40px; inset-inline: 14px; border: 1.5px solid var(--ink); background: #fff; }
.sheet .row { display: grid; grid-template-columns: repeat(6, 1fr); }
.sheet .row i { font-style: normal; text-align: center; padding: 6px 2px; border-inline-start: 1px solid var(--ink); white-space: nowrap; overflow: hidden; }
.sheet .row i:first-child { border-inline-start: 0; }
.sheet .head i { font: 800 11px/1.4 var(--kufi); background: #efece3; border-bottom: 1.5px solid var(--ink); }
.sheet .hand i { font: 700 17px/1.6 var(--hand); color: var(--blue); }
.bus .letter { position: absolute; top: 6px; right: 14px; width: 30px; height: 30px; display: grid; place-items: center; background: var(--green); color: #fff; font: 800 17px/1 var(--kufi); }
.bus .stamp {
  position: absolute; left: 18px; bottom: 16px; font: 800 26px/1 var(--kufi); color: var(--red); border: 3px solid var(--red); border-radius: 6px;
  padding: 6px 12px; transform: rotate(-12deg); opacity: .85; transition: transform .25s cubic-bezier(.2, .9, .3, 1.4);
}
.bus:hover .stamp, .bus:focus-visible .stamp { transform: rotate(-4deg) scale(1.12); }
.sheet { translate: calc(var(--mx) * 5px) calc(var(--my) * 4px); }
.bus .letter { translate: calc(var(--mx) * 11px) calc(var(--my) * 9px); }
.bus .stamp { translate: calc(var(--mx) * 20px) calc(var(--my) * 15px); }
.bus .label b { font-family: var(--serif); }

/* ---- «ارسمها!»: a spiral sketchbook with a palm half-drawn, a wrong guess and a crayon lying on it ---- */
.draw { background: #fbf6e8; }
.draw .art { background: linear-gradient(172deg, #fbf6e8, #f3ead2); border-bottom: 1px dashed #c9b994; perspective: 700px; }
.draw .rings { position: absolute; top: 8px; inset-inline: 22px; height: 14px; background: radial-gradient(circle, #4a4038 0 3.4px, transparent 4.4px) 0 0 / 22px 14px repeat-x; }
.draw .dpage {
  position: absolute; top: 28px; left: 50%; width: 148px; height: 138px; margin-left: -96px; background: #fffdf7;
  box-shadow: 0 12px 18px -10px rgba(60, 40, 20, .6), 0 0 0 1px #e6dcc4; transform: rotateX(16deg) rotateZ(-3deg); transition: transform .4s ease;
}
.draw .dpage::before { content: ''; position: absolute; top: -9px; left: 50%; width: 56px; height: 18px; margin-left: -28px; transform: rotate(-4deg); background: repeating-linear-gradient(-45deg, rgba(255, 138, 160, .62) 0 7px, rgba(255, 182, 196, .62) 7px 14px); }
.draw .dpage svg { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); }
.draw .dpage path { fill: none; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.draw .dpage .n { stroke: #8a5528; } .draw .dpage .g { stroke: #2e9e4c; } .draw .dpage .y { stroke: #f5b700; }
.draw:hover .dpage, .draw:focus-visible .dpage { transform: rotateX(4deg) rotateZ(-1deg); }
.draw:hover .dpage path, .draw:focus-visible .dpage path { animation: draw-in 1.1s ease-out both; }
@keyframes draw-in { from { stroke-dashoffset: 1; } }
.draw .guess {
  position: absolute; top: 34px; right: 14px; padding: 6px 12px; background: #fff; font: 800 14px/1.3 var(--kufi); white-space: nowrap;
  border-radius: 14px 14px 4px 14px; box-shadow: inset 0 0 0 2px #2b2a33, 0 3px 0 #cdbf9f; transform: rotate(4deg);
}
.draw .guess::after { content: ''; position: absolute; inset-inline: 10px; top: 52%; height: 2.4px; background: #d8342c; border-radius: 2px; transform: rotate(-4deg); }
.draw .crayon { position: absolute; left: 30px; bottom: 26px; width: 20px; height: 96px; transform: rotateZ(-58deg) rotateY(28deg); transform-style: preserve-3d; transition: transform .35s cubic-bezier(.2, .9, .3, 1.3); }
.draw .crayon i { position: absolute; inset: 22px 0 0; background: #e23b3b; border-radius: 2px 2px 3px 3px; box-shadow: inset 5px 0 0 rgba(255, 255, 255, .3), inset -4px 0 0 rgba(0, 0, 0, .18), 6px 10px 10px rgba(60, 40, 20, .35); }
.draw .crayon i::before { content: ''; position: absolute; inset: 14px 0 auto; height: 30px; border-block: 2px solid rgba(0, 0, 0, .3); background: repeating-linear-gradient(0deg, transparent 0 5px, rgba(0, 0, 0, .2) 5px 6px); }
.draw .crayon::before { content: ''; position: absolute; top: 2px; left: 0; right: 0; height: 22px; background: #e23b3b; clip-path: polygon(38% 0, 62% 0, 100% 100%, 0 100%); }
.draw:hover .crayon, .draw:focus-visible .crayon { transform: rotateZ(-40deg) rotateY(12deg) translateY(-6px); }
.draw .label b { color: #d8342c; }
@media (prefers-reduced-motion: reduce) { .draw .dpage, .draw .crayon { transition: none; } .draw:hover .dpage path { animation: none; } }
/* ---- end «ارسمها!» ---- */

/* ---- the shelf: games still in their boxes ---- */
.soon-title { margin: 34px 0 12px; text-align: center; font: 700 24px/1.3 var(--hand); color: #e6d2ad; }
.shelf { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); padding-bottom: 14px; border-bottom: 12px solid #1c110a; box-shadow: 0 10px 0 -4px rgba(0, 0, 0, .35); }
.box { position: relative; text-align: center; padding: 22px 8px 14px; background: #c9a475 repeating-linear-gradient(90deg, rgba(0, 0, 0, .04) 0 2px, transparent 2px 7px); border-radius: 3px; color: #3d2a17; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .12); }
.box .tape { position: absolute; top: 0; left: 50%; width: 46px; height: 100%; margin-left: -23px; background: rgba(240, 225, 190, .55); }
.box .ico { position: relative; display: block; font-size: 30px; filter: grayscale(.6); }
.box b { position: relative; display: block; font: 700 22px/1.3 var(--hand); }
.box .what { position: relative; display: block; font-size: 14px; line-height: 1.4; opacity: .8; }
@media (min-width: 720px) { .shelf { grid-template-columns: repeat(4, 1fr); } }
/* the boxes on the shelf tip like the games, but stay shut */
.shelf { perspective: 900px; }
.box { transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transform-style: preserve-3d; transition: transform .45s cubic-bezier(.2, .9, .3, 1.2);
  animation: slideIn .7s cubic-bezier(.2, 1.1, .3, 1) backwards; animation-delay: calc(.45s + var(--n, 0) * .08s); }
.box:nth-child(2) { --n: 1; } .box:nth-child(3) { --n: 2; } .box:nth-child(4) { --n: 3; }
.box:hover, .box.tilting { --rx: 8deg; }
.box.tilting { transition-duration: .1s; }
@keyframes slideIn { from { opacity: 0; transform: translateY(24px) rotateX(-40deg); } }

.foot { margin-top: 26px; text-align: center; font: 800 12px/1.6 var(--kufi); color: #cdb894; opacity: .8; }

@media (max-width: 420px) {
  .cells { grid-template-columns: repeat(3, 50px); right: 14px; }
  .sj .q { font-size: 90px; left: 16px; }
  .sheet .hand i { font-size: 15px; }
  .box b { font-size: 19px; }
  .box .what { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .game, .board, .sj .q, .bus .stamp, .box { transition: none; animation: none; }
  .game:hover, .game:focus-visible, .game.tilting { --up: 0px; --lift: 0px; --rx: 0deg; --ry: 0deg; --mx: 0; --my: 0; }
  .game::after { display: none; }
}

/* ---- «سجل المواجهات»: a scorekeeper's card on the table ---- */
.duo { margin: 30px auto 0; max-width: 640px; padding: 18px 18px 14px; background: var(--cream); color: var(--ink); border-radius: 4px;
  box-shadow: 0 14px 26px -12px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(0, 0, 0, .06);
  background-image: repeating-linear-gradient(180deg, transparent 0 31px, rgba(42, 93, 143, .14) 31px 32px); }
.duo:empty { display: none; }
.duo-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; border-bottom: 2px solid var(--ink); padding-bottom: 6px; margin-bottom: 10px; }
.duo-head h2 { margin: 0; font: 700 26px/1.3 var(--hand); }
.duo-sub { font: 800 12px var(--kufi); color: var(--muted); }
.duo-dek, .duo-note { margin: 6px 0; font-size: 17px; color: var(--muted); }
.duo-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.duo-row[hidden] { display: none; }
.duo-in { flex: 1; min-width: 0; font: 600 16px var(--kufi); padding: 10px 12px; border: 1.5px solid var(--ink); border-radius: 3px; background: #fff; color: var(--ink); }
.duo-in.code { text-align: center; letter-spacing: 2px; }
.duo-seg { display: flex; }
.duo-seg button, .duo-tabs button { font: 700 15px var(--kufi); padding: 8px 14px; border: 1.5px solid var(--ink); background: #fff; color: var(--ink); cursor: pointer; }
.duo-seg button + button, .duo-tabs button + button { border-inline-start: 0; }
.duo-seg button.on, .duo-tabs button.on { background: var(--ink); color: var(--cream); }
.duo-btn { flex: 1; min-height: 44px; font: 700 16px var(--kufi); border: 1.5px solid var(--ink); border-radius: 3px; background: #fff; color: var(--ink); cursor: pointer; }
.duo-btn.primary { background: var(--sadu-red); border-color: var(--sadu-red); color: #fff; }
.duo-link { border: 0; background: none; padding: 0; font: 600 13px var(--kufi); color: var(--muted); text-decoration: underline; cursor: pointer; }
.duo-code { margin: 6px 0; text-align: center; font: 700 40px/1.2 var(--serif); letter-spacing: 3px; color: var(--sadu-red); }
.duo-tabs { display: flex; justify-content: center; margin-bottom: 12px; }
.duo-score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; text-align: center; }
.duo-score .side span { display: block; font: 700 18px var(--kufi); }
.duo-score .side b { display: block; font: 700 54px/1 var(--serif); color: var(--muted); }
.duo-score .side.ahead b { color: var(--sadu-red); }
.duo-score .vs { font: 700 18px var(--hand); color: var(--muted); }
.duo-lead { margin: 8px 0 12px; text-align: center; font: 700 22px/1.4 var(--hand); }
.duo-games { display: grid; gap: 4px; border-top: 1px dashed rgba(0, 0, 0, .2); padding-top: 8px; }
.duo-game { display: grid; grid-template-columns: 28px 1fr auto auto auto; align-items: center; gap: 8px; font-size: 17px; }
.duo-game .gi { text-align: center; }
.duo-game .gs { font: 700 20px var(--serif); min-width: 22px; text-align: center; }
.duo-game .gs.lead-a, .duo-game .gs.lead-b { color: var(--sadu-red); }
.duo-game i { font-style: normal; color: var(--muted); }
.duo-game small { grid-column: 2 / -1; margin-top: -4px; font-size: 13px; color: var(--muted); }
.duo-streak { margin: 10px 0 0; text-align: center; font: 700 18px var(--kufi); color: var(--sadu-red); }
.duo-titles { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.duo-titles .lbl { font: 800 12px var(--kufi); color: var(--muted); }
.duo-titles .chip { font: 700 14px var(--kufi); padding: 4px 10px; border-radius: 999px; background: #fff; border: 1.5px solid var(--sadu-red); color: var(--sadu-red); }
.duo-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 14px; padding-top: 8px; border-top: 1px dashed rgba(0, 0, 0, .2); font: 600 13px var(--kufi); color: var(--muted); }
.devnotes { display: block; width: max-content; margin: 8px auto 0; padding: 2px 10px; font: 700 11px/1.8 var(--kufi); color: #cdb894; opacity: .7; text-decoration: none; border: 1px solid rgba(205, 184, 148, .35); border-radius: 999px; }
.devnotes:hover, .devnotes:focus-visible { opacity: 1; }

/* ---- opening a game: the object lifts off the table and the room fades into the game's own colour ---- */
body.leaving .games > :not(.opening), body.leaving .duo, body.leaving .soon-title, body.leaving .shelf > :not(.opening), body.leaving .foot { opacity: 0; transition: opacity .3s; }
.game.opening { z-index: 5; animation: openUp .62s cubic-bezier(.45, 0, .2, 1) forwards; }
@keyframes openUp {
  0% { transform: translateY(-6px) rotate(0) rotateX(var(--rx)) rotateY(var(--ry)) translateZ(26px); }
  35% { transform: translateY(-18px) rotate(0) rotateX(14deg) rotateY(0deg) translateZ(90px) scale(1.03); }
  100% { transform: translateY(-10px) rotate(0) rotateX(0deg) rotateY(0deg) translateZ(520px) scale(1.1); opacity: 0; }
}
.dama.opening .board { animation: boardFlat .55s cubic-bezier(.3, 1.3, .5, 1) forwards; }
@keyframes boardFlat { to { transform: rotateX(0deg) rotateZ(0deg) scale(1.25); } }
.sj.opening .q { animation: qPop .5s cubic-bezier(.3, 1.6, .5, 1) forwards; }
@keyframes qPop { to { transform: rotate(370deg) scale(1.5); } }
.sj.opening .cells i { animation: cellFlip .45s ease-out both; }
.sj.opening .cells i:nth-child(3n+2) { animation-delay: .06s; } .sj.opening .cells i:nth-child(3n) { animation-delay: .12s; }
@keyframes cellFlip { to { transform: rotateX(180deg); opacity: .3; } }
.bus.opening .stamp { animation: slam .4s cubic-bezier(.3, 1.5, .5, 1) forwards; }
@keyframes slam { 0% { transform: rotate(-12deg) scale(2.4); opacity: 0; } 100% { transform: rotate(-6deg) scale(1.15); opacity: 1; } }
.box.opening { animation: boxOpen .55s cubic-bezier(.45, 0, .2, 1) forwards; }
@keyframes boxOpen { 40% { transform: translateY(-8px) rotateX(16deg) scale(1.05); } 100% { transform: translateY(-14px) rotateX(0deg) translateZ(300px) scale(1.15); opacity: 0; } }
.curtain { position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: 0; background: var(--to, var(--wood2)); }
body.leaving .curtain { animation: curtain .3s .32s forwards; }
@keyframes curtain { to { opacity: 1; } }

/* ---- bigger tap targets (44px) without changing how small things look ---- */
.duo-seg button, .duo-tabs button { min-height: 44px; }
.duo-link, .devnotes { position: relative; }
.duo-link::before, .devnotes::before { content: ''; position: absolute; inset: -12px -6px; }

/* «ارسمها!» on the table: its page, guess and crayon move in layers too, and opening it lifts the crayon */
.draw .dpage { translate: calc(var(--mx) * 9px) calc(var(--my) * 7px); }
.draw .guess { translate: calc(var(--mx) * 16px) calc(var(--my) * 12px); }
.draw .crayon { translate: calc(var(--mx) * 22px) calc(var(--my) * 16px); }
.draw.opening .dpage { animation: pageFlat .5s cubic-bezier(.3, 1.3, .5, 1) forwards; }
@keyframes pageFlat { to { transform: rotateX(0deg) rotateZ(0deg) scale(1.15); } }
.draw.opening .crayon { animation: crayonUp .5s cubic-bezier(.3, 1.4, .5, 1) forwards; }
@keyframes crayonUp { to { transform: rotateZ(-20deg) rotateY(0deg) translateY(-30px); } }
