/* (29 Oct 2026) Magic Digu (js/magic.js): a moonlit glow over the table, the spell bar, the marks spells leave on the
   seats, and the spell flying from one player to another. Kept light: only the bar's ready spells and the moon move. */
body.g-magic.in-game .app::before{content:""; position:fixed; inset:0; pointer-events:none; z-index:0;
  background:radial-gradient(ellipse 60% 45% at 50% 40%, rgba(150,110,255,.12), transparent 70%), radial-gradient(ellipse 35% 30% at 82% 12%, rgba(200,220,255,.10), transparent 70%)}
#mgBar{position:fixed; left:calc(12px + var(--safeL)); top:calc(58px + var(--safeT)); z-index:25; display:flex; flex-wrap:wrap; gap:8px; align-items:flex-start; max-width:min(330px,40vw)}
#mgBar[hidden]{display:none}
.mgsp{position:relative; width:46px; height:46px; border-radius:50%; border:2px solid rgba(190,150,255,.75); background:radial-gradient(circle at 35% 30%,#3d2a63,#140b24);
  display:grid; place-items:center; padding:0; cursor:pointer; box-shadow:0 0 12px rgba(150,100,255,.45), 0 3px 8px rgba(0,0,0,.5); transition:transform .15s ease}
.mgsp i{font-style:normal; font-size:22px; line-height:1}
.mgsp small{position:absolute; bottom:-6px; right:-6px; min-width:20px; padding:1px 5px; border-radius:99px; background:#1d1230; border:1px solid rgba(190,150,255,.7); color:#e8dcff; font-size:10px; font-weight:800}
.mgsp:not(.off){animation:mgReady 2.4s ease-in-out infinite}
.mgsp.off{filter:grayscale(.55) brightness(.78); box-shadow:0 3px 8px rgba(0,0,0,.5); cursor:default}
.mgsp.used small{background:#2a2a2a; border-color:#666; color:#aaa}
.mgsp.armed{transform:scale(1.14); border-color:#ffd36a; box-shadow:0 0 18px rgba(255,211,106,.7), 0 3px 8px rgba(0,0,0,.5)}
@keyframes mgReady{0%,100%{box-shadow:0 0 10px rgba(150,100,255,.4), 0 3px 8px rgba(0,0,0,.5)} 50%{box-shadow:0 0 20px rgba(170,120,255,.75), 0 3px 8px rgba(0,0,0,.5)}}
/* the marks on a seat: shields, curses, mist, fish, drums */
.mgst{display:inline-flex; gap:2px; margin-left:4px; padding:1px 5px; border-radius:99px; background:rgba(20,12,36,.8); border:1px solid rgba(190,150,255,.55); font-size:12px; line-height:1.4; vertical-align:middle}
#me .mgst{position:absolute; left:50%; top:-14px; transform:translateX(-50%); margin:0; z-index:5}
/* a spell landing: the seat glows in the spell's colour for a moment */
.mghit{animation:mgHit 1.1s ease-out}
@keyframes mgHit{0%{box-shadow:0 0 0 0 var(--mgc,#b04cff)} 30%{box-shadow:0 0 26px 8px var(--mgc,#b04cff)} 100%{box-shadow:0 0 0 0 transparent}}
.mgorb{position:fixed; z-index:80; pointer-events:none; width:52px; height:52px; display:grid; place-items:center; font-size:28px; border-radius:50%;
  background:radial-gradient(circle,rgba(255,255,255,.35),transparent 70%); filter:drop-shadow(0 0 10px var(--c,#b04cff)) drop-shadow(0 0 4px var(--c,#b04cff))}
@media (prefers-reduced-motion:reduce){ .mgsp:not(.off),.mghit{animation:none} }

/* the setup screen's spells and the store's Magic tab */
.spellgrid{display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px}
@media (max-width:560px){ .spellgrid{grid-template-columns:repeat(2,minmax(0,1fr))} }
.spopt{display:grid; justify-items:center; gap:1px; padding:7px 4px; border-radius:12px; border:1.5px solid rgba(190,150,255,.35); background:rgba(20,12,36,.55); color:#efe6ff; cursor:pointer}
.spopt i{font-style:normal; font-size:20px} .spopt b{font-size:11px; text-align:center; line-height:1.15} .spopt small{font-size:10px; color:#c9b6ff}
.spopt.on{border-color:#ffd36a; background:rgba(80,50,140,.6); box-shadow:0 0 10px rgba(255,211,106,.35)}
.mgseen>span{font-weight:800; background:#fbf7ef; color:#1d1b1a; border-radius:3px; padding:0 2px; margin-left:2px; font-size:11px} .mgseen>span.r{color:#c4262b}
#shopOv .mgcard{width:186px; display:grid; gap:4px; justify-items:center; align-content:start; text-align:center; padding:10px 8px !important}
#shopOv .mgcard b{font-size:13px} #shopOv .mgcard small{font-size:10.5px; color:#d6cce8; line-height:1.3} #shopOv .mgcard em{font-style:normal; font-size:11px; color:#ffe7a8; font-weight:700}
#shopOv .mgintro{width:200px; align-content:center} #shopOv .mgintro b{font-size:15px; color:#e8dcff}
.mgico{font-style:normal; font-size:24px; width:42px; height:42px; display:grid; place-items:center; border-radius:50%; background:radial-gradient(circle at 35% 30%,#3d2a63,#140b24); box-shadow:0 0 10px rgba(150,100,255,.4)}
.mgbuy{display:flex; flex-wrap:wrap; justify-content:center; gap:4px; margin-top:2px} .mgbuy .mini-btn{display:inline-flex; align-items:center; gap:3px; white-space:nowrap; padding:4px 8px}

/* (29 Oct 2026) the user's spell icons in place of the emoji */
.spic{display:block; width:100%; height:100%; object-fit:contain; pointer-events:none; filter:drop-shadow(0 2px 3px rgba(0,0,0,.5))}
.mgsp .spic{width:40px; height:40px}
.mgsp{width:52px; height:52px}
.mgst .spic{display:inline-block; width:18px; height:18px; vertical-align:middle; filter:none}
.mgorb{width:64px; height:64px} .mgorb .spic{width:58px; height:58px}
.spopt .spic{width:36px; height:36px}
.mgico{background:none !important; box-shadow:none !important; width:64px !important; height:64px !important} .mgico .spic{width:64px; height:64px}

/* the Digu menu's magic table button: its spell icon in place of the robot */
#homeMagic>i .spic{width:100%; height:100%}
#setupOv.mgsetup :is(#modeOpts,#targetWrap,#slotsWrap),#setupOv.mgsetup .gpanel>h3:first-of-type{display:none !important}

/* (31 Oct, user: "Find a Magic Table button is positioned too low") on the magic table's setup the button stays pinned to
   the bottom of the panel, so it is always in view without scrolling; the spells scroll above it */
#setupOv.mgsetup #dealBtn{position:sticky; bottom:0; z-index:3; margin-top:8px !important; box-shadow:0 -12px 14px 6px rgba(22,14,8,.92), 0 4px 10px rgba(0,0,0,.4)}

/* (31 Oct 2026, the user's brief #3 #14) the spell picker: spells on the left, the tapped spell's details and demo on the right */
#spellPick:not([hidden]){display:grid; grid-template-columns:minmax(0,1.25fr) minmax(0,1fr); gap:12px; align-items:start}
@media (orientation:portrait) and (max-width:560px){ #spellPick:not([hidden]){grid-template-columns:1fr} }
.spopt.none{opacity:.42; filter:grayscale(.8); border-style:dashed}
.spopt.seen{outline:2px solid rgba(255,231,168,.55); outline-offset:1px}
.spinfo{min-height:150px; padding:10px 12px; border-radius:14px; border:1.5px solid rgba(190,150,255,.35); background:rgba(20,12,36,.55); color:#efe6ff; font-size:12px; line-height:1.35}
.spinfo p{margin:4px 0} .spinfo ul{margin:4px 0; padding-left:16px; color:#d6cce8; font-size:11px} .spinfo li{margin:1px 0}
.spi-head{display:flex; align-items:center; gap:8px} .spi-head .spic{width:34px; height:34px} .spi-head b{font-size:14px; color:#ffe7a8} .spi-head em{margin-left:auto; font-style:normal; font-size:11px; color:#c9b6ff}
.spi-when b{color:#ffe7a8}
.spi-state{display:block; margin-top:4px; color:#ffe7a8; font-weight:700}
.spi-demo{margin:6px 0 4px; padding:6px; border-radius:10px; background:radial-gradient(ellipse at 50% 40%,#1d4a48,#0d2726 80%); display:grid; justify-items:center; gap:2px}
.spi-demo small{font-size:10px; color:#cfe3df}
.mgd{--w:30px; position:relative; display:flex; gap:6px; align-items:center; justify-content:center; height:52px}
.mgd .card{--w:30px; flex:none} .mgd .card::after{display:none}
.mgd .spic{width:22px; height:22px}
/* curse: one card of their hand turns purple and is locked for 3 turns */
.mgd-cursed{position:relative; animation:mgdCurse 2.4s ease-in-out infinite}
.mgd-cursed i{position:absolute; right:-8px; top:-8px; display:flex; align-items:center; font-style:normal} .mgd-cursed i b{font-size:10px; color:#e9c8ff}
@keyframes mgdCurse{0%,25%{filter:none} 45%,100%{filter:drop-shadow(0 0 6px #b04cff) saturate(.6) hue-rotate(250deg)}}
/* mist: fog rolls over the pile */
.mgd-pile,.mgd-stock{position:relative}
.mgd-fog{position:absolute; inset:-6px; border-radius:8px; background:radial-gradient(circle,#e8eef6 0 45%,rgba(232,238,246,.7) 65%,transparent 75%); filter:blur(3px); animation:mgdFog 2.6s ease-in-out infinite}
@keyframes mgdFog{0%,15%{opacity:0; transform:translateX(-14px)} 45%,85%{opacity:1; transform:none} 100%{opacity:0}}
/* flying fish: the fish leap over the pile; the stock is the only way */
.mgd-fish{position:absolute; left:-10px; top:-6px; animation:mgdFish 2.2s ease-in-out infinite}
@keyframes mgdFish{0%{transform:translate(-20px,10px) rotate(-20deg); opacity:0} 25%{opacity:1} 50%{transform:translate(12px,-10px) rotate(10deg)} 75%{opacity:1} 100%{transform:translate(40px,8px) rotate(30deg); opacity:0}}
.pilerow .mgd-stock{animation:mgdGlow 2.2s ease-in-out infinite} @keyframes mgdGlow{50%{filter:drop-shadow(0 0 6px #4fc3f7)}}
/* drums: the turn timer drops from 30 to 12 */
.mgd-ring{position:relative; width:40px; height:40px; border-radius:50%; border:3px solid #e8a33a; display:grid; place-items:center; animation:mgdRing 2.4s ease-in-out infinite}
.mgd-ring b{grid-area:1/1; font-size:14px; color:#ffe7a8} .mgd-t12{opacity:0; animation:mgdShow 2.4s steps(1) infinite} .mgd-t30{animation:mgdHide 2.4s steps(1) infinite}
@keyframes mgdShow{0%{opacity:0} 50%{opacity:1}} @keyframes mgdHide{0%{opacity:1} 50%{opacity:0}}
@keyframes mgdRing{0%,40%{border-color:#e8a33a; transform:none} 55%{transform:scale(1.15)} 60%,100%{border-color:#ff6a4a}}
/* lake mirror: three of their cards turn over for you */
.mgd-fl{position:relative; width:30px; height:42px; perspective:300px}
.mgd-fl>span{position:absolute; inset:0; backface-visibility:hidden; animation:mgdFlipB 3s ease-in-out var(--d) infinite} .mgd-fl .f{animation-name:mgdFlipF}
@keyframes mgdFlipB{0%,20%{transform:rotateY(0)} 40%,85%{transform:rotateY(180deg)} 100%{transform:rotateY(360deg)}}
@keyframes mgdFlipF{0%,20%{transform:rotateY(-180deg)} 40%,85%{transform:rotateY(0)} 100%{transform:rotateY(180deg)}}
/* reef spirit: your card slides under the stock and its top card comes to you */
.swap{gap:40px} .mgd-out,.mgd-in{position:absolute; left:calc(50% + 4px)}
.mgd-out{animation:mgdOut 2.8s ease-in-out infinite} .mgd-in{opacity:0; animation:mgdIn 2.8s ease-in-out infinite}
.swap .mgd-stock{position:relative; left:-26px}
@keyframes mgdOut{0%,15%{transform:none; opacity:1} 45%{transform:translateX(-56px); opacity:0} 100%{opacity:0}}
@keyframes mgdIn{0%,40%{transform:translateX(-56px); opacity:0} 50%{opacity:1} 75%,100%{transform:none; opacity:1}}
/* shield and shell: a spell flies in and is stopped, or sent back */
.guard{gap:70px} .mgd-me,.mgd-them{display:grid; place-items:center} .mgd-me .spic{width:28px; height:28px}
.mgd-orb{position:absolute; left:8%; filter:drop-shadow(0 0 6px #b04cff); animation:mgdOrb 2.2s ease-in infinite}
@keyframes mgdOrb{0%{transform:translateX(0); opacity:0} 15%{opacity:1} 60%{transform:translateX(70px); opacity:1} 70%,100%{transform:translateX(70px) scale(1.6); opacity:0}}
.guard.back .mgd-orb{animation-name:mgdBack}
@keyframes mgdBack{0%{transform:translateX(30px); opacity:0} 10%{opacity:1} 45%{transform:translateX(90px)} 90%{transform:translateX(0); opacity:1} 100%{transform:translateX(0); opacity:0}}
.guard .mgd-me{animation:mgdGuard 2.2s ease-in-out infinite} @keyframes mgdGuard{55%,65%{filter:drop-shadow(0 0 8px #ffd36a); transform:scale(1.15)}}
@media (prefers-reduced-motion:reduce){ .spi-demo *{animation:none !important} .mgd-t30,.mgd-out{display:none} .mgd-t12,.mgd-in{opacity:1} }
/* the setup panel is two columns on a sideways phone: at the magic table the spells and their details use the full width */
#setupOv.mgsetup #magicWrap{grid-column:1/-1}
#setupOv.mgsetup #dealBtn{grid-column:1/-1; justify-self:start; width:calc(55% - 8px)}   /* under the spells, clear of the details */
@media (orientation:portrait) and (max-width:560px){ #setupOv.mgsetup #dealBtn{width:100%} }
#setupOv.mgsetup #setupCancel{grid-column:1/-1}
#setupOv.mgsetup .spopt{padding:4px 3px} #setupOv.mgsetup .spopt .spic{width:30px; height:30px}
#setupOv.mgsetup .spellgrid{gap:5px}

/* (31 Oct) a Magic Digu room's lobby: the mode is clearly marked and each player picks their spells */
.lobspells{margin-top:8px; padding:8px 10px; border-radius:14px; border:1.5px solid rgba(190,150,255,.4); background:rgba(20,12,36,.5)}
.lobspells .mgroom{margin:0 0 6px; color:#e8dcff; font-size:12px} .lobspells .mgroom b{color:#ffe7a8}
.lobspells .spopt{padding:4px 3px} .lobspells .spopt .spic{width:28px; height:28px} .lobspells .spopt[disabled]{cursor:default}
.lobspells .note{margin:6px 0 0; font-size:11px}

/* (31 Oct 2026) choosing who a harmful spell hits */
#mgPick{position:fixed; inset:0; z-index:80; display:grid; place-items:center; background:rgba(6,4,12,.55)}
#mgPick .mgpk{display:flex; flex-direction:column; align-items:center; gap:8px; padding:14px 18px; min-width:220px; border-radius:16px;
  background:radial-gradient(circle at 50% 0,#3d2a63,#140b24); border:2px solid rgba(190,150,255,.75); color:#efe6ff; box-shadow:0 10px 30px rgba(0,0,0,.5)}
#mgPick .mgpk b{display:flex; align-items:center; gap:8px; font-size:17px}
#mgPick .mgpk b .spic{width:30px; height:30px}
#mgPick .mgpk small{color:#cdbdf0}
#mgPick .mgpk-list{display:flex; flex-wrap:wrap; justify-content:center; gap:8px}

/* (31 Oct, #13) spell landings on the table (mgLand in magic.js): short-lived, transform/opacity only */
.mgbit{position:fixed; z-index:79; pointer-events:none; left:0; top:0; transform:translate(-50%,-50%); will-change:transform,opacity}
.mgring{border-radius:50%; border:2px solid var(--c,#fff); box-shadow:0 0 14px var(--c,#fff), inset 0 0 10px var(--c,#fff)}
.mgspark{width:6px; height:6px; border-radius:50%; background:#fff; box-shadow:0 0 6px 2px var(--c,#fff)}
.mgfog{border-radius:50%; background:radial-gradient(ellipse at 50% 55%, rgba(206,216,228,.95), rgba(190,202,218,.7) 40%, rgba(180,195,212,.3) 58%, transparent 72%); filter:blur(7px)}
.mgfish{display:grid; place-items:center; filter:drop-shadow(0 3px 4px rgba(0,0,0,.45))} .mgfish .spic{width:100%; height:100%}
.mgsmoke{border-radius:50%; background:radial-gradient(circle, rgba(186,96,255,.95), rgba(130,50,210,.55) 45%, transparent 70%); filter:blur(4px)}
.mgsheen{border-radius:12px; background:linear-gradient(105deg, transparent 35%, rgba(255,255,255,0) 40%, rgba(220,248,255,.95) 50%, rgba(255,255,255,0) 60%, transparent 65%) no-repeat; background-size:60% 100%; mix-blend-mode:screen}
.mgdome{border-radius:50%; background:radial-gradient(circle, rgba(255,226,150,.08) 40%, rgba(255,211,106,.3) 62%, rgba(255,232,165,.9) 69%, transparent 73%); box-shadow:0 0 26px rgba(255,211,106,.55)}
.mgdome.shell{background:radial-gradient(circle, rgba(255,200,225,.08) 40%, rgba(255,176,208,.3) 62%, rgba(255,210,230,.9) 69%, transparent 73%); box-shadow:0 0 22px rgba(255,176,208,.45)}
/* (31 Oct) Reef Spirit armed: the hand lights up so you know to tap a card */
body.mg-pickcard.in-game #hand .card{box-shadow:0 0 0 2px #7affd1, 0 0 14px 3px rgba(122,255,209,.6); cursor:pointer; animation:mgPickCard 1.2s ease-in-out infinite}
@keyframes mgPickCard{50%{box-shadow:0 0 0 2px #7affd1, 0 0 22px 6px rgba(122,255,209,.85)}}
@media (prefers-reduced-motion:reduce){ body.mg-pickcard.in-game #hand .card{animation:none} }
#hand .card.mgcursein{animation:mgCurseIn 1.2s ease-out}
@keyframes mgCurseIn{0%{filter:none} 25%{filter:saturate(.5) brightness(1.25) drop-shadow(0 0 10px #b04cff); translate:0 -6px} 45%{rotate:-3deg} 60%{rotate:3deg} 100%{filter:saturate(.6) brightness(.85); translate:0 0; rotate:0deg}}
@media (prefers-reduced-motion:reduce){ .mgbit{display:none} #hand .card.mgcursein{animation:none} }
/* (1 Nov 2026, user: "on the web page I can't see the buttons on the home screen, it's far too low now") Digu's menu has four
   buttons since the magic table got its own: on short screens (a phone browser held sideways) they are made slimmer so the menu
   and "How to play" fit without scrolling */
@media (max-height:520px){
  #homeOv .hactions:has(#homeMagic:not([hidden])){gap:6px !important}
  #homeOv .hactions:has(#homeMagic:not([hidden])) .hbtn{padding-top:5px !important; padding-bottom:5px !important; min-height:0 !important}
  #homeOv .hactions:has(#homeMagic:not([hidden])) .hbtn i{width:34px !important; height:34px !important}
  #homeOv .hactions:has(#homeMagic:not([hidden])) .hbtn b{font-size:15.5px}
}
@media (max-height:340px){
  #homeOv .hactions:has(#homeMagic:not([hidden])) .hbtn small{display:none}
  #homeOv .hactions:has(#homeMagic:not([hidden])) .hbtn i{width:28px !important; height:28px !important}
  #homeOv .hactions:has(#homeMagic:not([hidden])) .hlink{padding-top:2px !important; padding-bottom:2px !important}
}
/* a phone held upright with the browser's bars: the same slimmer buttons */
@media (orientation:portrait) and (max-height:760px){
  #homeOv .hactions:has(#homeMagic:not([hidden])){gap:6px !important}
  #homeOv .hactions:has(#homeMagic:not([hidden])) .hbtn{padding-top:5px !important; padding-bottom:5px !important; min-height:0 !important}
  #homeOv .hactions:has(#homeMagic:not([hidden])) .hbtn i{width:34px !important; height:34px !important}
}
@media (orientation:portrait) and (max-height:700px){
  #homeOv .panel:has(#homeMagic:not([hidden])) .hfan{transform:scale(.72); transform-origin:50% 100%; margin-top:-30px}
  #homeOv .hactions:has(#homeMagic:not([hidden])) .hbtn small{display:none}
}
/* very short screens: every game's menu uses the slim buttons */
@media (max-height:340px){
  #homeOv .hactions{gap:6px !important}
  #homeOv .hactions .hbtn{padding-top:5px !important; padding-bottom:5px !important; min-height:0 !important}
  #homeOv .hactions .hbtn small{display:none}
  #homeOv .hactions .hbtn i{width:28px !important; height:28px !important}
  #homeOv .hactions .hlink{padding-top:2px !important; padding-bottom:2px !important}
}

/* (14 Nov 2026, Fix Round 2 E10) Store: the tab bar sits at the same place on every tab (the row of boxes has ONE fixed height, the bar no longer
   moves when a tab has fewer or taller boxes) and every box on every tab is the same size. Magic boxes: icon, name, count, 3 prices; a tap on the box shows its text. */
html body #shopOv{ --sbw:150px; --sbh:clamp(156px,45vh,200px) }
@media (max-height:430px){ html body #shopOv{ --sbw:136px } }
html body #shopOv .gpanel{align-content:start !important}
html body #shopOv .ctabs{align-self:start}
html body #shopOv .shopgrid{align-self:start; align-items:start; height:calc(var(--sbh) + 18px); box-sizing:border-box}
html body #shopOv .shopgrid>.sitem,html body #shopOv .shopgrid>.mgcard{width:var(--sbw) !important; height:var(--sbh) !important; box-sizing:border-box; align-content:center; justify-content:center; overflow:hidden}
html body #shopOv .mgcard{gap:3px; padding:6px 4px !important; cursor:pointer}
html body #shopOv .mgcard.seen{border-color:#ffd36a !important}
html body #shopOv .mgcard .mgbuy{display:grid; grid-template-columns:repeat(3,auto); gap:3px; justify-content:center}
html body #shopOv .mgcard .mgbuy .mini-btn{padding:3px 5px; font-size:10.5px; gap:2px; min-height:0}
html body #shopOv .mgcard .mgbuy .mini-btn i{width:11px; height:11px}
html body #shopOv #shopErr.mgsay{color:#ece3ff; font-size:12.5px; line-height:1.3; max-width:min(640px,90%); justify-self:center}
html body #shopOv .shopgrid>.shopentry{width:min(760px,80vw) !important; height:auto !important; align-self:start}
html body #shopOv .ctabs{max-width:100%; box-sizing:border-box; overflow-x:auto}
@media (max-width:720px){ html body #shopOv .ctabs{gap:0} html body #shopOv .ctabs button{padding-left:9px !important; padding-right:9px !important; font-size:12px !important} }

/* FIX ROUND 3 item 7 (14 Nov 2026): Store boxes (the 4 frames, the Get Endheri box, every tab) sit in the middle of the window, not on the left;
   a longer row still scrolls sideways from its first box */
html body #shopOv .shopgrid{ justify-self:stretch; width:100%; justify-content:center; justify-content:safe center }
html body #shopOv .shopgrid>.shopentry{ margin-left:auto; margin-right:auto }
