/* Layout: one-screen arcade puzzle. Deep navy game world; the board is a dark frame filled with bright,
   chunky region blocks; cream dominoes sit in a rack below the board on phones and beside it on laptops/TVs.
   One deliberate look for every device, so the palette is single-theme (dark). */
:root{
  color-scheme:dark;
  --bg:#13203a; --bg2:#0c1528; --panel:#1e293b; --panel2:#26354d; --line:#33445f;
  --ink:#fff8e1; --muted:#9fb0c8; --navy:#1e293b;
  --plate:#0f172a; --slot:#22304a; --slot-edge:#4a5d7d;
  --cream:#fff3d6; --cream2:#ecd9ac; --cream-ink:#2a2416;
  --green:#3dbe4f; --green-lo:#23893a; --yellow:#ffb300; --yellow-lo:#c77f00; --red-lo:#c43636;
  --blue:#4fc3f7; --blue-lo:#1e88c7; --purple:#a78bfa;
  --accent:#3dbe4f; --accent-ink:#ffffff; --good:#3dbe4f; --bad:#ff5a5a; --ring:#ffd23f; --coach:#4fc3f7;
  --bone:#fff8e1; --bone2:#f3e2b3; --bone-edge:#cdb27a; --pip:#1e293b; --pip-hi:#4a5874;
  --brass:#c39535; --brass-hi:#f4d98f; --brass-lo:#7f601d;
  --coin:#ffc22e; --coin-hi:#fff2b0; --coin-lo:#c8840f; --coin-ring:#e09a12; --coin-pip:#7a4a06;
  --shadow:rgba(0,0,0,.45); --scrim:rgba(6,12,26,.72);
  /* region blocks (r,g,b) */
  --g0:255,179,0; --g1:255,107,107; --g2:79,195,247; --g3:129,199,132;
  --g4:167,139,250; --g5:255,181,142; --g6:244,114,182; --g7:45,212,191;
  --f-logo:'Lilita One','Fredoka','Arial Rounded MT Bold','Trebuchet MS',sans-serif;
  --f-display:'Fredoka','Arial Rounded MT Bold','Trebuchet MS','Segoe UI',sans-serif;
  --f-body:'Nunito','Segoe UI',Roboto,Helvetica,Arial,sans-serif;
  --u:56px; --t:30px;
}

[hidden]{display:none!important}
html{box-sizing:border-box;height:100%;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px);background:var(--bg2)}
*,*::before,*::after{box-sizing:border-box}
body{height:100%;margin:0;background:var(--bg2);color:var(--ink);font-family:var(--f-body);
  -webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none;overflow:hidden}
#app{position:relative;height:100%;overflow:hidden;
  background:radial-gradient(ellipse at 20% -10%,#2b4a86 0%,rgba(43,74,134,0) 55%),
             radial-gradient(ellipse at 100% 110%,#3a2a6e 0%,rgba(58,42,110,0) 50%),
             linear-gradient(180deg,var(--bg) 0%,var(--bg2) 100%)}
button{font:inherit;color:inherit;border:0;background:none;cursor:pointer;padding:0}
.screen{position:absolute;top:0;left:0;right:0;bottom:0;display:none;
  padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px))}
.screen.active{display:flex}

/* ---------- chunky 3D buttons ---------- */
.btn3d,.btn,.tool,.pbtn,.shopbtn,.cbtn,.tab{
  border-radius:14px;font-family:var(--f-display);font-weight:600;
  background:var(--cream);color:var(--cream-ink);border:2px solid var(--cream2);
  box-shadow:0 4px 0 var(--cream2),0 8px 14px -6px var(--shadow);transition:transform .08s,box-shadow .08s}
.btn:active,.tool:active,.pbtn:active,.shopbtn:active,.cbtn:active,.tab:active,.icon:active,.dcard:active{transform:translateY(3px);box-shadow:0 1px 0 var(--cream2)}
.primary,.btn.primary,.cbtn.primary{background:var(--green);color:#fff;border-color:#5fd46f;box-shadow:0 4px 0 var(--green-lo),0 8px 14px -6px var(--shadow);
  text-shadow:0 1px 0 rgba(0,0,0,.25)}
.icon{width:44px;height:44px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex:0 0 auto;margin-left:8px;position:relative;
  background:var(--cream);border:2px solid var(--cream2);box-shadow:0 3px 0 var(--cream2),0 6px 12px -6px var(--shadow)}
.icon:first-child{margin-left:0}
.icon svg{width:22px;height:22px;fill:none;stroke:var(--navy);stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round}
.icon.on{background:var(--blue);border-color:#8ad8fb;box-shadow:0 3px 0 var(--blue-lo)}
.icon.on svg{stroke:#fff}
.icon .chip{position:absolute;right:-9px;bottom:-9px;display:flex;align-items:center;padding:1px 5px 1px 3px;border-radius:999px;
  background:var(--navy);color:var(--ink);font-size:11px;font-weight:800;font-family:var(--f-body);border:2px solid var(--line)}
.icon .chip .coin{font-size:11px;margin-right:2px}

/* ---------- dominoes ---------- */
.dom{--s:var(--u);position:relative;display:flex;width:calc(var(--s)*2);height:var(--s);
  border-radius:calc(var(--s)*.2);background:linear-gradient(180deg,var(--bone) 0%,var(--bone) 55%,var(--bone2) 100%);
  box-shadow:inset 0 calc(var(--s)*-.07) 0 var(--bone-edge),inset 0 2px 0 rgba(255,255,255,.8),0 0 0 1.5px rgba(30,41,59,.35),0 calc(var(--s)*.06) calc(var(--s)*.14) var(--shadow);
  transform:rotate(var(--rot,0deg));transition:transform .24s cubic-bezier(.3,1.5,.5,1)}
.dom::after{content:"";position:absolute;left:50%;top:14%;bottom:18%;width:3px;margin-left:-1.5px;background:var(--pip);opacity:.55;border-radius:2px}
.dom .half{position:relative;width:50%;height:100%}
.dom .pin{position:absolute;left:50%;top:50%;z-index:1;width:calc(var(--s)*.09);height:calc(var(--s)*.09);
  margin:calc(var(--s)*-.045) 0 0 calc(var(--s)*-.045);border-radius:50%;
  background:radial-gradient(circle at 35% 35%,var(--brass-hi),var(--brass) 55%,var(--brass-lo))}
.dom .pip{position:absolute;width:calc(var(--s)*.14);height:calc(var(--s)*.14);
  margin:calc(var(--s)*-.07) 0 0 calc(var(--s)*-.07);border-radius:50%;
  background:radial-gradient(circle at 40% 35%,var(--pip-hi),var(--pip) 60%);
  box-shadow:inset 0 1px 2px rgba(0,0,0,.5)}

/* ---------- coin ---------- */
.coin{display:inline-block;position:relative;width:1.05em;height:1.05em;border-radius:50%;vertical-align:-.17em;flex:0 0 auto;
  background:radial-gradient(circle at 35% 30%,var(--coin-hi),var(--coin) 52%,var(--coin-lo));box-shadow:inset 0 0 0 .1em var(--coin-ring)}
.coin::after{content:"";position:absolute;left:50%;top:50%;width:.26em;height:.26em;margin:-.13em 0 0 -.13em;border-radius:50%;background:var(--coin-pip)}
.coins{display:inline-flex;align-items:center;padding:6px 12px 6px 8px;border-radius:999px;background:var(--panel);border:2px solid var(--line);
  font-family:var(--f-display);font-weight:600;font-size:18px;font-variant-numeric:tabular-nums;position:relative;color:var(--ink)}
.coins .coin{font-size:20px;margin-right:6px}
.coins.small{font-size:15px;padding:4px 10px 4px 6px}
.coins.small .coin{font-size:17px}
.coins.bump{animation:bump .5s cubic-bezier(.3,1.6,.5,1)}
@keyframes bump{40%{transform:scale(1.18)}}
.coins .plus{position:absolute;right:6px;top:-8px;font-size:14px;color:var(--green);font-weight:700;animation:floatUp 1.1s ease-out forwards;pointer-events:none}
@keyframes floatUp{to{transform:translateY(-22px);opacity:0}}

/* ---------- logo ---------- */
.logo-word{font-family:var(--f-logo);font-weight:400;line-height:.9;letter-spacing:.01em;margin:0;text-align:center;
  font-size:clamp(58px,17vw,104px)}
.logo-word span{display:inline-block;padding:0 .04em}
.logo-word .w1{color:var(--yellow);transform:rotate(-4deg);
  text-shadow:0 .04em 0 #8a4b00,.03em .03em 0 #3b2200,-.03em .03em 0 #3b2200,.03em -.03em 0 #3b2200,-.03em -.03em 0 #3b2200,0 .1em .08em rgba(0,0,0,.45)}
.logo-word .w2{color:var(--blue);transform:rotate(3deg);
  text-shadow:0 .04em 0 #0b4f8a,.03em .03em 0 #06213b,-.03em .03em 0 #06213b,.03em -.03em 0 #06213b,-.03em -.03em 0 #06213b,0 .1em .08em rgba(0,0,0,.45)}
.ribbon{display:inline-block;margin-top:10px;padding:7px 18px;border-radius:10px;font-family:var(--f-display);font-weight:700;font-size:13px;
  letter-spacing:.06em;text-transform:uppercase;color:#fff3d6;background:linear-gradient(180deg,#9a5a2c,#6e3b18);border:2px solid #4a2610;
  box-shadow:0 3px 0 #3a1d0a,inset 0 1px 0 rgba(255,255,255,.25);text-shadow:0 1px 0 rgba(0,0,0,.4)}

/* ---------- home ---------- */
#home{flex-direction:column;align-items:center;justify-content:center;overflow-y:auto;padding-top:20px;padding-bottom:24px}
.home-inner{width:100%;max-width:560px;display:flex;flex-direction:column;align-items:stretch}
.homebar{display:flex;align-items:center;margin-bottom:10px}
.streak{flex:1;min-width:0;margin-left:10px;font-size:13px;font-weight:800;color:var(--yellow)}
.shopbtn{display:flex;align-items:center;padding:8px 14px;font-size:15px}
.shop-ico{width:30px;height:19px;margin-right:8px;flex:0 0 auto;color:var(--navy);filter:drop-shadow(0 1px 0 rgba(0,0,0,.2))}
.brand{display:flex;flex-direction:column;align-items:center;text-align:center;margin-bottom:18px}
.logo{position:relative;height:84px;width:170px;margin-bottom:-6px}
.logo .dom{position:absolute;--s:40px}
.logo .d1{left:6px;top:28px}
.logo .d2{left:72px;top:6px}
.label{font-family:var(--f-display);font-size:13px;font-weight:600;letter-spacing:.12em;text-transform:uppercase;color:var(--muted);margin:16px 2px 10px}
.cards{display:flex;flex-direction:column}
.dcard{display:flex;align-items:center;text-align:left;width:100%;margin-bottom:12px;padding:12px 14px;border-radius:18px;color:#fff;
  border:2px solid rgba(255,255,255,.35);transition:transform .08s,box-shadow .08s}
.dcard[data-daily="easy"]{background:linear-gradient(180deg,#56d36a,#33a947);box-shadow:0 5px 0 #217a33,0 10px 18px -8px var(--shadow)}
.dcard[data-daily="medium"]{background:linear-gradient(180deg,#ffc93a,#f2a300);box-shadow:0 5px 0 #b57400,0 10px 18px -8px var(--shadow);color:#3b2600}
.dcard[data-daily="hard"]{background:linear-gradient(180deg,#ff7676,#e94848);box-shadow:0 5px 0 #a82a2a,0 10px 18px -8px var(--shadow)}
.dcard .dots{display:flex;align-items:center;justify-content:center;width:62px;height:52px;margin-right:12px;border-radius:12px;background:rgba(255,255,255,.22);flex:0 0 auto}
.dcard .dots i{width:16px;height:16px;margin:0 1px;background:rgba(0,0,0,.18);
  clip-path:polygon(50% 0%,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%)}
.dcard .dots i.on{background:#fff6c2;filter:drop-shadow(0 1px 0 rgba(0,0,0,.35))}
.dcard .dtext{flex:1;min-width:0}
.dname{display:block;font-family:var(--f-logo);font-size:26px;line-height:1.05;text-shadow:0 2px 0 rgba(0,0,0,.22)}
.dmeta{display:block;font-size:13px;font-weight:800;opacity:.9;margin-top:2px}
.dmeta .coin{font-size:12px}
.dstat{font-size:12px;font-weight:800;padding:6px 10px;border-radius:999px;background:rgba(0,0,0,.2);white-space:nowrap;font-variant-numeric:tabular-nums}
.dstat.done{background:#fff;color:var(--green-lo)}
.dstat.prog{background:var(--navy);color:var(--ink)}
.prow{display:flex;margin:0 -5px}
.pbtn{flex:1;margin:0 5px;padding:11px 6px;font-size:16px}
.howbtn{margin-top:20px;align-self:center;padding:10px 20px;border-radius:999px;font-weight:800;color:var(--ink);border:2px solid var(--line);background:var(--panel)}

/* ---------- game ---------- */
#game{flex-direction:column;padding-top:8px;padding-bottom:10px}
.gbar{display:flex;align-items:center;flex:0 0 auto;height:54px}
.gtitle{flex:1;min-width:0;margin-left:10px;display:flex;flex-direction:column}
.gdiff{font-family:var(--f-logo);font-size:22px;line-height:1.05;color:var(--ink)}
.gsub{font-size:12px;font-weight:800;color:var(--muted);font-variant-numeric:tabular-nums}
.gdiff,.gsub{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tabs{display:flex;flex:0 0 auto;margin:8px 0 2px;padding:4px;border-radius:16px;background:var(--plate);border:2px solid var(--line)}
.tab{flex:1;margin:0 3px;padding:7px 4px;font-size:15px;box-shadow:0 3px 0 var(--cream2)}
.tab.active{background:var(--green);color:#fff;border-color:#5fd46f;box-shadow:0 3px 0 var(--green-lo);text-shadow:0 1px 0 rgba(0,0,0,.25)}
.gbody{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}
.boardWrap{flex:1 1 auto;min-height:0;display:flex;align-items:center;justify-content:center;position:relative}
.side{flex:0 0 auto;height:36%;display:flex;flex-direction:column;min-height:0}
.tools{display:flex;justify-content:center;flex:0 0 auto;margin:10px 0 2px}
.tool{display:flex;align-items:center;justify-content:center;padding:9px 14px;margin:0 5px;font-size:15px}
.tool svg{width:18px;height:18px;margin-right:6px;fill:none;stroke:currentColor;stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round}
.tool[disabled]{opacity:.5}
.trayWrap{flex:1 1 auto;min-height:0;display:flex;justify-content:center;border-radius:20px;
  background:var(--panel);border:2px solid var(--line);box-shadow:inset 0 3px 10px rgba(0,0,0,.35)}
.tray{flex:1 1 auto;min-height:0;display:flex;flex-wrap:wrap;align-content:center;justify-content:center;padding:6px;touch-action:none}
.slot{position:relative;width:calc(var(--t)*2.3);height:calc(var(--t)*2.3);display:flex;align-items:center;justify-content:center;border-radius:14px}
.slot .dom{--s:var(--t)}
.slot.used .dom{opacity:0;transform:rotate(var(--rot,0deg)) scale(.6)}
.slot.used::before{content:"";position:absolute;width:calc(var(--t)*2);height:var(--t);border-radius:calc(var(--t)*.2);border:2px dashed var(--slot-edge)}
.slot.sel .dom{box-shadow:inset 0 calc(var(--s)*-.07) 0 var(--bone-edge),0 0 0 3px var(--yellow),0 0 18px rgba(255,179,0,.55);
  transform:rotate(var(--rot,0deg)) translateY(-3px)}
.slot.dragging .dom{opacity:.25}

#board{position:relative;touch-action:none}
#board .plate,#board .well,#board .rg,#board .cell,#board .piece,#board .badge{position:absolute}
.plate{background:var(--plate)}
.well{background:var(--slot);border:2px dashed var(--slot-edge);border-radius:calc(var(--u)*.16)}
.rg{background:linear-gradient(rgba(255,255,255,.14),rgba(255,255,255,.14)),rgb(var(--rc));border:0 solid rgba(0,0,0,.35)}
.rg::after{content:"";position:absolute;top:14%;left:14%;right:14%;bottom:14%;border:2px dashed rgba(255,255,255,.55);border-radius:calc(var(--u)*.12)}
.cell{pointer-events:none;border-radius:calc(var(--u)*.16);z-index:6}
.cell.drop{box-shadow:inset 0 0 0 3px var(--green),0 0 12px var(--green);background:rgba(61,190,79,.25)}
.cell.nodrop{box-shadow:inset 0 0 0 3px var(--bad);background:rgba(255,90,90,.25)}
.piece{z-index:4;display:flex;align-items:center;justify-content:center}
.piece.pop .dom{animation:pop .32s cubic-bezier(.3,1.6,.5,1)}
@keyframes pop{0%{transform:rotate(var(--rot)) scale(1.18)}100%{transform:rotate(var(--rot)) scale(1)}}
.piece.preview{z-index:5;opacity:.92}
.piece.preview .dom{box-shadow:0 0 0 3px var(--blue),0 10px 22px -6px var(--shadow)}
.badge{z-index:7;height:calc(var(--u)*.32);min-height:18px;min-width:calc(var(--u)*.36);padding:0 calc(var(--u)*.06);display:flex;align-items:center;justify-content:center;pointer-events:none;
  border-radius:calc(var(--u)*.12);background:rgb(var(--rc));border:2px solid rgba(0,0,0,.38);box-shadow:0 3px 0 rgba(0,0,0,.35),inset 0 2px 0 rgba(255,255,255,.35);transition:background .2s}
.badge b{position:relative;font-family:var(--f-logo);font-weight:400;color:#fff;font-size:calc(var(--u)*.2);line-height:1;letter-spacing:.01em;
  text-shadow:1px 1px 0 rgba(0,0,0,.45),-1px 1px 0 rgba(0,0,0,.45),1px -1px 0 rgba(0,0,0,.45),-1px -1px 0 rgba(0,0,0,.45);font-variant-numeric:tabular-nums}
.badge.ne b::after{content:"";position:absolute;left:50%;top:-12%;bottom:-12%;width:2px;margin-left:-1px;background:#fff;transform:rotate(28deg);box-shadow:0 0 0 1px rgba(0,0,0,.35)}
.badge.good{background:var(--green)}
.badge.good::after{content:"";position:absolute;right:-5px;top:-5px;width:10px;height:10px;border-radius:50%;background:#fff;border:2px solid var(--green-lo)}
@keyframes shake{25%{transform:translateX(-3px)}75%{transform:translateX(3px)}}
#board.solved .piece .dom{animation:glow 1s ease-out}
@keyframes glow{40%{box-shadow:0 0 0 3px var(--green),0 0 24px var(--green)}}
#ghost{position:fixed;left:0;top:0;z-index:50;pointer-events:none;display:none}
#ghost .dom{box-shadow:0 18px 30px -8px var(--shadow),inset 0 calc(var(--s)*-.07) 0 var(--bone-edge)}

/* ---------- overlays ---------- */
.ov{position:absolute;top:0;left:0;right:0;bottom:0;z-index:40;display:flex;align-items:center;justify-content:center;
  background:var(--scrim);padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px))}
.card{width:100%;max-width:420px;max-height:92%;overflow-y:auto;background:var(--panel);border:2px solid var(--line);border-radius:24px;padding:24px 22px;
  box-shadow:0 30px 60px -20px rgba(0,0,0,.7);text-align:center;animation:rise .28s cubic-bezier(.3,1.4,.5,1)}
@keyframes rise{from{transform:translateY(16px) scale(.97);opacity:.6}}
.card h2{font-family:var(--f-logo);font-weight:400;font-size:34px;margin:0 0 6px;color:var(--yellow);text-shadow:0 3px 0 rgba(0,0,0,.35);text-wrap:balance}
.card p{color:var(--muted);font-weight:700;margin:0 0 16px;line-height:1.45}
.big{display:flex;justify-content:center;margin:4px 0 14px}
.stat{margin:0 14px}
.stat b{display:block;font-family:var(--f-display);font-size:32px;font-weight:600;font-variant-numeric:tabular-nums;color:var(--ink)}
.stat span{font-size:12px;font-weight:800;letter-spacing:.12em;text-transform:uppercase;color:var(--muted)}
.btn{display:block;width:100%;padding:13px;font-size:18px;margin-top:12px}
.trophy{width:96px;height:96px;margin:-6px auto 0;display:block;filter:drop-shadow(0 6px 10px rgba(0,0,0,.4))}
.solved-ribbon{display:inline-block;margin:4px 0 8px;padding:8px 22px;border-radius:12px;font-family:var(--f-logo);font-size:26px;color:#fff3d6;
  background:linear-gradient(180deg,#9a5a2c,#6e3b18);border:2px solid #4a2610;box-shadow:0 4px 0 #3a1d0a;text-shadow:0 2px 0 rgba(0,0,0,.4)}
.how{text-align:left;max-width:520px}
.how h2{text-align:center}
.how h3{font-family:var(--f-display);font-size:13px;font-weight:600;letter-spacing:.12em;text-transform:uppercase;color:var(--blue);margin:18px 0 8px}
.rule{display:flex;align-items:center;margin-bottom:10px;font-weight:700;line-height:1.35}
.rule .badge{position:relative;flex:0 0 auto;margin-right:16px;--u:72px}
.how ul{margin:0;padding-left:18px;line-height:1.5;font-weight:700}
.how li{margin-bottom:4px}
.earn{list-style:none;margin:0 0 6px;padding:0;text-align:left}
.earn li{display:flex;justify-content:space-between;padding:7px 2px;border-bottom:1px dashed var(--line);font-weight:700;color:var(--muted);animation:rise .3s both}
.earn li b{color:var(--ink);font-variant-numeric:tabular-nums}
.earnTotal{display:flex;align-items:center;justify-content:center;font-family:var(--f-logo);font-size:32px;margin:8px 0 2px;color:var(--yellow);font-variant-numeric:tabular-nums}
.earnTotal .coin{margin-right:8px}

/* ---------- coach ---------- */
.coach{flex:0 0 auto;margin:8px 0;padding:10px 12px;border-radius:16px;background:var(--panel);border:2px solid var(--blue);
  box-shadow:0 0 0 3px rgba(79,195,247,.15);height:132px;display:flex;flex-direction:column}
.cTop{display:flex;align-items:center;margin-bottom:4px}
.cBadge{width:26px;height:26px;border-radius:50%;background:var(--blue);display:flex;align-items:center;justify-content:center;margin-right:8px;flex:0 0 auto}
.cBadge svg{width:16px;height:16px;fill:none;stroke:#fff;stroke-width:2.4;stroke-linejoin:round;stroke-linecap:round}
.cTop b{flex:1;min-width:0;font-family:var(--f-display);font-weight:600;font-size:16px;color:var(--blue);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cStep{font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);white-space:nowrap}
.coach p{flex:1 1 auto;min-height:0;overflow-y:auto;margin:0;font-weight:700;font-size:14px;line-height:1.4;color:var(--ink)}
.cBtns{display:flex;justify-content:flex-end;margin-top:6px}
.cbtn{padding:6px 14px;margin-left:8px;font-size:14px;box-shadow:0 3px 0 var(--cream2)}
.cbtn.primary{box-shadow:0 3px 0 var(--green-lo)}
.cell.coachHi{box-shadow:inset 0 0 0 4px var(--blue),0 0 16px var(--blue);animation:breathe 1.4s ease-in-out infinite}
@keyframes breathe{50%{opacity:.45}}
html.coach-on .side{height:50%}

/* ---------- shop ---------- */
#shop{flex-direction:column;align-items:center;overflow-y:auto;padding-top:8px;padding-bottom:24px}
.shop-inner{width:100%;max-width:900px}
.skins{display:flex;flex-wrap:wrap;margin:12px -6px 0}
.skin{flex:1 1 150px;margin:6px;padding:16px 12px 12px;border-radius:20px;background:var(--panel);border:2px solid var(--line);
  display:flex;flex-direction:column;align-items:center;text-align:center}
.skin .show{height:74px;display:flex;align-items:center;justify-content:center}
.skin .dom{--s:30px}
.skin .dom + .dom{margin-left:8px}
.skin h4{font-family:var(--f-logo);font-weight:400;font-size:22px;margin:8px 0 2px;color:var(--ink)}
.skin .sdesc{font-size:12px;font-weight:700;color:var(--muted);margin-bottom:12px;min-height:2.6em}
.skin .buy{width:100%;padding:9px;font-size:15px;display:flex;align-items:center;justify-content:center}
.skin .buy:not(.owned):not(.on):not(.poor){background:var(--green);color:#fff;border-color:#5fd46f;box-shadow:0 4px 0 var(--green-lo)}
.skin .buy .coin{margin-right:6px}
.skin .buy.on{background:var(--blue);color:#fff;border-color:#8ad8fb;box-shadow:0 4px 0 var(--blue-lo)}
.skin .buy.poor{opacity:.6}
.skin.equipped{border-color:var(--blue);box-shadow:0 0 0 3px rgba(79,195,247,.25)}
.shopnote{color:var(--muted);font-weight:700;font-size:14px;line-height:1.5;margin:16px 6px 0;max-width:65ch}

/* tile sets */
.skin-ivory{--bone:#fff8e1;--bone2:#f3e2b3;--bone-edge:#cdb27a;--pip:#1e293b;--pip-hi:#4a5874}
html.skin-ebony,.skin-ebony{--bone:#3a4046;--bone2:#1f2327;--bone-edge:#0b0d0f;--pip:#f6f1e4;--pip-hi:#ffffff}
html.skin-jade,.skin-jade{--bone:#dcf4e8;--bone2:#a6dac2;--bone-edge:#64a688;--pip:#0f3d2e;--pip-hi:#2f6e57}
html.skin-coral,.skin-coral{--bone:#ffe6de;--bone2:#f4b4a1;--bone-edge:#cf7c66;--pip:#5a1a10;--pip-hi:#8e3a2c}
html.skin-midnight,.skin-midnight{--bone:#2c3a68;--bone2:#18213f;--bone-edge:#0a0f25;--pip:#ffd36b;--pip-hi:#fff0b8}
html.skin-gold,.skin-gold{--bone:#fff2c4;--bone2:#e7c060;--bone-edge:#b2841d;--pip:#4a3205;--pip-hi:#7a5a12}

/* ---------- keyboard / remote focus ---------- */
.kf{outline:none}
html.kbd .kf{box-shadow:0 0 0 3px var(--navy),0 0 0 7px var(--ring),0 0 24px var(--ring)!important}
html.kbd .cell.kf{box-shadow:inset 0 0 0 4px var(--ring),0 0 18px var(--ring)!important}
*:focus{outline:none}
.hintbar{position:absolute;left:0;right:0;bottom:0;z-index:60;display:none;justify-content:center;flex-wrap:wrap;
  padding:8px max(16px,env(safe-area-inset-right,0px)) calc(8px + env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px));
  font-weight:800;font-size:13px;color:var(--muted)}
html.kbd .hintbar{display:flex}
.hintbar span{margin:0 10px;white-space:nowrap}
.key{display:inline-block;min-width:24px;padding:2px 6px;margin-right:4px;border-radius:7px;border:2px solid var(--muted);
  text-align:center;color:var(--ink);font-size:11px;line-height:14px;vertical-align:middle}
.tri{display:inline-block;width:0;height:0;border:5px solid transparent;vertical-align:middle;margin:0 1px}
.tri.l{border-right:7px solid var(--ink);border-left-width:0}
.tri.r{border-left:7px solid var(--ink);border-right-width:0}
.tri.u{border-bottom:7px solid var(--ink);border-top-width:0}
.tri.d{border-top:7px solid var(--ink);border-bottom-width:0}
html.kbd #game{padding-bottom:34px}

#toast{position:absolute;left:50%;top:70px;z-index:70;transform:translateX(-50%) translateY(-10px);opacity:0;pointer-events:none;
  background:var(--cream);color:var(--cream-ink);font-weight:800;font-size:14px;padding:10px 16px;border-radius:999px;border:2px solid var(--cream2);
  box-shadow:0 6px 16px var(--shadow);transition:opacity .2s,transform .2s;white-space:nowrap;max-width:92%;overflow:hidden;text-overflow:ellipsis}
#toast.on{opacity:1;transform:translateX(-50%) translateY(0)}
#fx{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:45}
#loading{position:absolute;top:0;left:0;right:0;bottom:0;z-index:80;display:flex;flex-direction:column;align-items:center;justify-content:center;
  background:var(--bg2);font-family:var(--f-display);font-weight:600;color:var(--muted)}
#loading .dom{--s:34px;animation:spin 1s cubic-bezier(.5,0,.5,1) infinite;margin-bottom:22px}
@keyframes spin{to{transform:rotate(360deg)}}

/* ---------- narrow phones ---------- */
@media (max-width:400px){
  .icon{width:40px;height:40px;margin-left:6px}
  .gtitle{margin-left:8px}
  .gdiff{font-size:19px}
  .coins.small{padding:3px 8px 3px 5px;font-size:14px}
  .tool{padding:9px 11px;margin:0 4px}
}

/* ---------- landscape: laptop, tablet sideways, TV ---------- */
html.land #game .gbody{flex-direction:row}
html.land .side{height:auto;width:38%;max-width:460px;margin-left:18px}
html.land.coach-on .side{height:auto}
html.land .coach{height:auto;min-height:150px;margin:0 0 12px}
html.land .tools{margin:14px 0 4px}
html.land .tabs{max-width:420px}
html.land .cards{flex-direction:row;margin:0 -6px}
html.land .dcard{flex:1;margin:0 6px 12px;flex-direction:column;align-items:flex-start}
html.land .dcard .dots{margin:0 0 10px}
html.land .dcard .dstat{margin-top:12px}
html.land .home-inner{max-width:760px}

/* ---------- TV ---------- */
html.tv-mode .screen{padding:4vh 4vw}
html.tv-mode #game{padding-bottom:calc(4vh + 40px)}
html.tv-mode .hintbar{font-size:20px;padding-bottom:3vh}
html.tv-mode .key{font-size:16px;line-height:20px;min-width:36px;border-width:3px}
html.tv-mode .tri{border-width:8px}
html.tv-mode .tri.l{border-right-width:11px;border-left-width:0}
html.tv-mode .tri.r{border-left-width:11px;border-right-width:0}
html.tv-mode .tri.u{border-bottom-width:11px;border-top-width:0}
html.tv-mode .tri.d{border-top-width:11px;border-bottom-width:0}
html.tv-mode .gbar{height:74px}
html.tv-mode .icon{width:62px;height:62px}
html.tv-mode .icon svg{width:30px;height:30px}
html.tv-mode .icon .chip{font-size:15px}
html.tv-mode .gdiff{font-size:32px}
html.tv-mode .gsub{font-size:18px}
html.tv-mode .tab{font-size:22px;padding:10px}
html.tv-mode .tool{font-size:22px;padding:12px 22px}
html.tv-mode .logo-word{font-size:120px}
html.tv-mode .ribbon{font-size:18px}
html.tv-mode .label{font-size:18px}
html.tv-mode .home-inner{max-width:1100px}
html.tv-mode .dname{font-size:38px}
html.tv-mode .dmeta,html.tv-mode .dstat{font-size:18px}
html.tv-mode .pbtn,html.tv-mode .howbtn{font-size:22px;padding:16px}
html.tv-mode .card{max-width:640px;padding:36px}
html.tv-mode .card h2{font-size:48px}
html.tv-mode .card p,html.tv-mode .how ul,html.tv-mode .rule{font-size:22px}
html.tv-mode .rule .badge{--u:96px}
html.tv-mode .btn{font-size:26px;padding:18px}
html.tv-mode #toast{font-size:22px;top:110px}
html.tv-mode .coins{font-size:26px}
html.tv-mode .coins .coin{font-size:28px}
html.tv-mode .shopbtn{font-size:22px;padding:12px 20px}
html.tv-mode .streak{font-size:18px}
html.tv-mode .skin h4{font-size:30px}
html.tv-mode .skin .sdesc,html.tv-mode .skin .buy{font-size:20px}
html.tv-mode .skin .dom{--s:44px}
html.tv-mode .skin .show{height:110px}
html.tv-mode .earn li{font-size:22px}
html.tv-mode .coach{min-height:220px;padding:18px 22px}
html.tv-mode .cTop b{font-size:26px}
html.tv-mode .cBadge{width:36px;height:36px}
html.tv-mode .cBadge svg{width:22px;height:22px}
html.tv-mode .cStep{font-size:16px}
html.tv-mode .coach p{font-size:22px}
html.tv-mode .cbtn{font-size:20px;padding:12px 22px}
html.tv-mode .trophy{width:140px;height:140px}
html.tv-mode .solved-ribbon{font-size:36px}

@media (prefers-reduced-motion: reduce){*{animation:none!important;transition:none!important}}
.btn svg{width:20px;height:20px;vertical-align:-4px;margin-right:8px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
.slot.shake .dom{animation:shake .4s}

/* ---------- no scrolling: home and shop always fit the first screen ---------- */
#home{overflow:hidden;padding-top:max(8px,2vh);padding-bottom:max(8px,2vh)}
.home-inner{max-height:100%;min-height:0}
.logo-word{font-size:clamp(40px,min(17vw,12vh),104px)}
@media (max-height:760px){
  .logo{display:none}
  .brand{margin-bottom:1.4vh}
  .label{margin:1.4vh 2px .9vh}
  .dcard{padding:1.2vh 14px;margin-bottom:1.2vh}
  .dcard .dots{height:min(52px,6.5vh);width:min(62px,8vh)}
  .dname{font-size:min(26px,3.6vh)}
  .dmeta{font-size:min(13px,1.9vh)}
  .pbtn{padding:1.2vh 6px}
  .howbtn{margin-top:1.4vh;padding:.9vh 20px}
  .ribbon{margin-top:.8vh;padding:.6vh 16px}
}
@media (max-height:560px){ .ribbon{display:none} }
html.tv-mode .logo-word{font-size:clamp(60px,min(17vw,13vh),120px)}

#shop{overflow:hidden;padding-top:max(8px,1.5vh);padding-bottom:max(8px,2vh)}
.shop-inner{display:flex;flex-direction:column;height:100%;min-height:0}
.skins{flex:1 1 auto;min-height:0;display:grid;grid-template-columns:repeat(2,1fr);grid-auto-rows:1fr;gap:10px;margin:10px 0 0}
html.land .skins{grid-template-columns:repeat(3,1fr)}
.skin{margin:0;min-height:0;padding:1.4vh 10px;justify-content:space-between}
.skin .show{height:auto;flex:1 1 auto;min-height:0}
.skin h4{margin:.6vh 0 .2vh}
@media (max-height:760px){ .shopnote{display:none} .skin .sdesc{display:none} }

/* ---------- popups never scroll: they compact on short windows and the script shrinks them if needed ---------- */
.card{overflow:hidden;max-height:none}
.hdots{display:flex;justify-content:center;margin:12px 0 0}
.hdots i{width:8px;height:8px;border-radius:50%;background:var(--line);margin:0 4px}
.hdots i.on{background:var(--yellow)}
.hnav{display:flex;margin:0 -6px}
.hnav .btn{margin:10px 6px 0}
.hnav .btn:first-child{flex:0 0 34%}
.hintro{text-align:center}
.hnote{font-size:13px;margin:6px 0 0!important}
@media (max-height:760px){
  .card{padding:2vh 20px}
  .card h2{font-size:min(34px,5vh);margin-bottom:.6vh}
  .card p{margin-bottom:1.2vh}
  .trophy{width:min(96px,12vh);height:min(96px,12vh);margin-top:0}
  .solved-ribbon{font-size:min(26px,4.2vh);padding:.6vh 20px;margin:0 0 .6vh}
  #winMsg{display:none}
  .stat b{font-size:min(32px,4.6vh)}
  .big{margin:.4vh 0 1vh}
  .earn li{padding:.55vh 2px;font-size:min(15px,2.2vh)}
  .earnTotal{font-size:min(32px,4.4vh);margin:.8vh 0}
  .btn{padding:1.3vh;font-size:min(18px,2.6vh);margin-top:1vh}
  .how h3{margin:1.4vh 0 .6vh}
  .rule{margin-bottom:1vh}
  .rule .badge{--u:min(72px,9vh)}
  .how ul,.how .rule{line-height:1.35}
  .hnav .btn{margin-top:1vh}
}
html.tv-mode .shop-ico{width:40px;height:25px}

/* ---------- pip pattern: faint dominoes and pips behind every screen ---------- */
#app::before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;opacity:.07;
  background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22140%22%20height%3D%22140%22%20viewBox%3D%220%200%20140%20140%22%3E%3Cg%20transform%3D%22rotate(-16%2036%2028)%22%3E%3Crect%20x%3D%2212%22%20y%3D%2216%22%20width%3D%2248%22%20height%3D%2224%22%20rx%3D%226%22%20stroke%3D%22%23ffd36b%22%20stroke-width%3D%221.6%22%20fill%3D%22none%22%20stroke-linecap%3D%22round%22%2F%3E%3Cpath%20d%3D%22M36%2020v16%22%20stroke%3D%22%23ffd36b%22%20stroke-width%3D%221.6%22%20fill%3D%22none%22%20stroke-linecap%3D%22round%22%2F%3E%3Ccircle%20cx%3D%2224%22%20cy%3D%2228%22%20r%3D%222.6%22%20fill%3D%22%23ffd36b%22%2F%3E%3Ccircle%20cx%3D%2246%22%20cy%3D%2223%22%20r%3D%222.6%22%20fill%3D%22%23ffd36b%22%2F%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2233%22%20r%3D%222.6%22%20fill%3D%22%23ffd36b%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate(14%20106%2098)%22%3E%3Crect%20x%3D%2294%22%20y%3D%2274%22%20width%3D%2224%22%20height%3D%2248%22%20rx%3D%226%22%20stroke%3D%22%23ffd36b%22%20stroke-width%3D%221.6%22%20fill%3D%22none%22%20stroke-linecap%3D%22round%22%2F%3E%3Cpath%20d%3D%22M98%2098h16%22%20stroke%3D%22%23ffd36b%22%20stroke-width%3D%221.6%22%20fill%3D%22none%22%20stroke-linecap%3D%22round%22%2F%3E%3Ccircle%20cx%3D%22106%22%20cy%3D%2286%22%20r%3D%222.6%22%20fill%3D%22%23ffd36b%22%2F%3E%3Ccircle%20cx%3D%22101%22%20cy%3D%22110%22%20r%3D%222.6%22%20fill%3D%22%23ffd36b%22%2F%3E%3Ccircle%20cx%3D%22111%22%20cy%3D%22110%22%20r%3D%222.6%22%20fill%3D%22%23ffd36b%22%2F%3E%3Ccircle%20cx%3D%22101%22%20cy%3D%22117%22%20r%3D%220%22%20fill%3D%22%23ffd36b%22%2F%3E%3C%2Fg%3E%3Ccircle%20cx%3D%22104%22%20cy%3D%2224%22%20r%3D%222.2%22%20fill%3D%22%23ffd36b%22%2F%3E%3Ccircle%20cx%3D%22120%22%20cy%3D%2234%22%20r%3D%222.2%22%20fill%3D%22%23ffd36b%22%2F%3E%3Ccircle%20cx%3D%22112%22%20cy%3D%2244%22%20r%3D%222.2%22%20fill%3D%22%23ffd36b%22%2F%3E%3Ccircle%20cx%3D%2224%22%20cy%3D%2292%22%20r%3D%222.2%22%20fill%3D%22%23ffd36b%22%2F%3E%3Ccircle%20cx%3D%2240%22%20cy%3D%22104%22%20r%3D%222.2%22%20fill%3D%22%23ffd36b%22%2F%3E%3Ccircle%20cx%3D%2224%22%20cy%3D%22116%22%20r%3D%222.2%22%20fill%3D%22%23ffd36b%22%2F%3E%3Ccircle%20cx%3D%2256%22%20cy%3D%2270%22%20r%3D%222%22%20fill%3D%22%23ffd36b%22%2F%3E%3Ccircle%20cx%3D%2270%22%20cy%3D%22126%22%20r%3D%222%22%20fill%3D%22%23ffd36b%22%2F%3E%3C%2Fsvg%3E");background-size:140px 140px}
html.tv-mode #app::before{background-size:190px 190px}

/* real H1 text for search engines and screen readers; the logo letters are the visual version */
.vh{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
