/* CRAZY TOWN GAME v3 — premium dark rewards app.
   Palette: obsidian black + town red #C1272D + white type.
   Functional accents only: green = credits/earn, violet = XP. Zero orange. */
:root{
  --bg:#070708; --bg2:#0c0c0e;
  --panel:#131316; --panel2:#1a1a1f; --panel3:#202027;
  --line:#26262e; --line2:#32323c;
  --red:#C1272D; --red2:#E01E26; --reddeep:#7d1419;
  --white:#ffffff; --dim:#a8a8b0; --dim2:#6f6f78;
  --green:#2fd35f; --green2:#1fae4a;
  --violet:#9b5cf5;
  --r:18px;
  --shadow:0 10px 28px rgba(0,0,0,.55);
}
*{box-sizing:border-box; -webkit-tap-highlight-color:transparent;}
html,body{margin:0;padding:0;}
body{
  background:#050505 radial-gradient(120% 60% at 50% -10%, rgba(193,39,45,.28), rgba(0,0,0,0) 60%) no-repeat fixed;
  color:var(--white);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  min-height:100vh;
}
button{font-family:inherit; cursor:pointer; border:none; background:none; color:inherit;}
button:disabled{cursor:default; opacity:.55;}
a{color:inherit; text-decoration:none;}
h1{font-size:24px; font-weight:900; letter-spacing:.01em; margin:14px 0 4px;}
h2{font-size:18px; font-weight:900; margin:20px 0 10px; display:flex; align-items:center; justify-content:space-between;}
h2 .seeall{font-size:13px; font-weight:800; color:var(--red2);}
.sub{color:var(--dim); font-size:13.5px; line-height:1.45; margin:0 0 12px;}
.small{font-size:12.5px; color:var(--dim); line-height:1.45;}

#phone{max-width:430px; margin:0 auto; min-height:100vh; display:flex; flex-direction:column; position:relative;
  background:linear-gradient(180deg,#0a0a0c, #070708 240px);}
@media (min-width:480px){ #phone{border-left:1px solid #1c1c22; border-right:1px solid #1c1c22; box-shadow:0 0 60px rgba(0,0,0,.8);} }

/* ---------- header ---------- */
#topbar{position:sticky; top:0; z-index:40; display:flex; align-items:center; justify-content:space-between;
  padding:10px 14px 8px; background:linear-gradient(180deg, rgba(7,7,8,.97), rgba(7,7,8,.88));
  backdrop-filter:blur(8px); border-bottom:1px solid rgba(255,255,255,.04);}
.iconbtn{position:relative; width:42px; height:42px; border-radius:12px; display:flex; align-items:center; justify-content:center; background:rgba(255,255,255,.03);}
.iconbtn:active{background:rgba(255,255,255,.09);}
.badge[hidden]{display:none;}
.badge{position:absolute; top:2px; right:2px; min-width:19px; height:19px; padding:0 5px; border-radius:10px;
  background:var(--red2); color:#fff; font-size:11px; font-weight:900; display:flex; align-items:center; justify-content:center;
  border:2px solid #0a0a0c;}
.brand{display:flex; align-items:center; gap:9px;}
.wordmark{display:flex; flex-direction:column; line-height:.92; font-style:italic;}
.wm1{font-size:19px; font-weight:900; letter-spacing:.02em; color:#fff;}
.wm2{font-size:19px; font-weight:900; letter-spacing:.02em; color:var(--red2); margin-top:-3px;}
.wm3{font-size:9.5px; font-weight:900; letter-spacing:.52em; color:var(--red2); margin-top:1px;}

/* ---------- sheet (menu / today panels) ---------- */
#sheet{position:fixed; inset:0; z-index:60; background:rgba(0,0,0,.62); display:flex; align-items:flex-start; justify-content:center;}
#sheet[hidden]{display:none;}
#sheet-card{width:min(430px,100%); margin:64px 14px 0; background:var(--panel2); border:1px solid var(--line2);
  border-radius:20px; padding:18px; box-shadow:var(--shadow); max-height:74vh; overflow-y:auto;}
#sheet-card h3{margin:0 0 10px; font-size:17px; font-weight:900;}
.sheetrow{display:flex; align-items:center; justify-content:space-between; gap:10px; padding:11px 0; border-top:1px solid var(--line);}
.sheetrow:first-of-type{border-top:none;}

/* ---------- layout / screens ---------- */
#main{flex:1; overflow-y:auto; padding:0 14px 96px; scroll-behavior:smooth;}
.screen{display:none;}
.screen.active{display:block; animation:fadein .22s ease;}
@keyframes fadein{from{opacity:0; transform:translateY(4px);} to{opacity:1; transform:none;}}

/* ---------- generic cards & buttons ---------- */
.card{background:linear-gradient(180deg,var(--panel2),var(--panel)); border:1px solid var(--line);
  border-radius:var(--r); padding:16px; margin:0 0 14px; box-shadow:var(--shadow); position:relative;}
.card > b.t{font-size:15.5px; font-weight:900; display:flex; align-items:center; gap:8px;}
.btn{display:flex; align-items:center; justify-content:center; gap:8px; width:100%; padding:14px 16px; border-radius:14px;
  background:linear-gradient(180deg,var(--red2),var(--red) 55%,var(--reddeep)); color:#fff; font-size:15.5px; font-weight:900;
  letter-spacing:.02em; box-shadow:0 8px 20px rgba(193,39,45,.38), inset 0 1px 0 rgba(255,255,255,.35); text-align:center;}
.btn:active{transform:translateY(1px);}
.btn.black{background:linear-gradient(180deg,#2b2b32,#141417); box-shadow:0 8px 18px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.14);}
.btn.ghost{background:transparent; border:1.5px solid var(--line2); box-shadow:none; color:var(--white);}
.btn.small{width:auto; padding:9px 14px; font-size:13px; border-radius:11px;}
.btn:disabled{background:linear-gradient(180deg,#26262c,#17171b); color:var(--dim2); box-shadow:none;}
.pill{display:inline-flex; align-items:center; gap:5px; padding:4px 10px; border-radius:999px; font-size:11.5px; font-weight:900; letter-spacing:.04em;}
.pill.red{background:var(--red); color:#fff;}
.pill.gold{background:#26262c; color:#ffd34d; border:1px solid #3d3d47;}
.pill.dark{background:rgba(0,0,0,.45); color:#fff;}
.tagchip{display:inline-flex; align-items:center; gap:4px; font-size:10.5px; font-weight:900; letter-spacing:.06em;
  padding:3px 8px; border-radius:999px; background:rgba(255,255,255,.08); color:#e8e8ec; text-transform:uppercase;}
.tagchip.spon{background:rgba(193,39,45,.22); color:#ff9d9d; border:1px solid rgba(193,39,45,.5);}
.empty{border:1.5px dashed var(--line2); border-radius:var(--r); padding:18px; color:var(--dim); font-size:13.5px; line-height:1.5; text-align:center; margin:0 0 14px;}
table.odds{width:100%; border-collapse:collapse; margin-top:8px; font-size:13.5px;}
table.odds th{text-align:left; color:var(--dim); font-weight:700; padding:6px 4px; border-bottom:1px solid var(--line);}
table.odds td{padding:7px 4px; border-bottom:1px solid rgba(255,255,255,.05); font-weight:700;}
table.odds td:last-child, table.odds th:last-child{text-align:right;}
ol.steps{margin:8px 0 0; padding-left:20px; color:var(--dim); font-size:13.5px; line-height:1.55;}
.backbtn{font-size:15px; font-weight:800; color:var(--white); padding:10px 0 2px;}

/* ---------- player strip ---------- */
.playerstrip{display:flex; align-items:center; gap:12px; padding:12px 2px 14px;}
.avatar{width:52px; height:52px; border-radius:50%; flex:none; display:flex; align-items:center; justify-content:center;
  background:radial-gradient(circle at 32% 28%, #3a3a42, #131316 70%); border:2px solid var(--red); box-shadow:0 0 0 3px rgba(193,39,45,.22), 0 6px 14px rgba(0,0,0,.5);}
.pmeta{flex:1; min-width:0;}
.pname{font-size:13px; color:var(--dim); font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.plvl{font-size:16.5px; font-weight:900; margin:1px 0 5px;}
.minibar{height:7px; border-radius:5px; background:#26262c; overflow:hidden;}
.minibar > div{height:100%; border-radius:5px; background:linear-gradient(90deg,var(--reddeep),var(--red2));}
.balancepill{display:flex; align-items:center; gap:7px; background:linear-gradient(180deg,#17351f,#0e2415);
  border:1.5px solid rgba(47,211,95,.55); color:#fff; border-radius:999px; padding:8px 8px 8px 13px; box-shadow:0 6px 16px rgba(0,0,0,.45);}
.balancepill .coin{width:20px; height:20px; border-radius:50%; background:radial-gradient(circle at 35% 30%, #7dff9e, var(--green2) 75%);
  color:#06330f; font-size:12.5px; font-weight:900; display:flex; align-items:center; justify-content:center;}
.balancepill .amt{font-size:16.5px; font-weight:900; color:var(--green);}
.balancepill .plus{width:26px; height:26px; border-radius:50%; background:var(--green); color:#06330f; font-size:18px; font-weight:900;
  display:flex; align-items:center; justify-content:center; line-height:1;}

/* ---------- hero ---------- */
.hero{border-radius:22px; overflow:hidden; position:relative; margin:0 0 14px; border:1px solid #3a2022;
  box-shadow:0 16px 34px rgba(0,0,0,.6); background:#0d0d10;}
.hero-art{height:172px; position:relative; overflow:hidden;
  background:radial-gradient(90% 130% at 78% 0%, rgba(224,30,38,.5), rgba(0,0,0,0) 55%), radial-gradient(70% 90% at 12% 108%, rgba(193,39,45,.35), rgba(0,0,0,0) 60%), linear-gradient(160deg,#1c1c21,#0a0a0c 70%);}
.hero-art svg{position:absolute; right:-14px; top:-16px; width:212px; height:212px; filter:drop-shadow(0 14px 22px rgba(0,0,0,.6));}
.hero-ribbon{position:absolute; top:14px; left:-34px; transform:rotate(-38deg); background:linear-gradient(180deg,var(--red2),var(--reddeep));
  color:#fff; font-size:11px; font-weight:900; letter-spacing:.14em; padding:5px 40px; box-shadow:0 6px 14px rgba(0,0,0,.5); z-index:3;}
.hero-body{padding:14px 16px 16px; position:relative; z-index:2;}
.hero-kicker{font-size:11px; font-weight:900; letter-spacing:.22em; color:#ff8a8a;}
.hero-title{font-size:27px; font-weight:900; font-style:italic; line-height:1.02; margin:3px 0 5px; text-shadow:0 3px 10px rgba(0,0,0,.6);}
.hero-line{font-size:14.5px; color:#e9e9ed; font-weight:600; line-height:1.4;}
.hero-line .earn{color:var(--green); font-weight:900;}
.hero .btn{margin-top:12px;}

/* ---------- check-in ---------- */
.days{display:flex; justify-content:space-between; margin:14px 0 4px;}
.day{display:flex; flex-direction:column; align-items:center; gap:6px; flex:1;}
.day .circ{width:38px; height:38px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  background:#232329; border:1.5px solid var(--line2); font-size:15px; font-weight:900; color:var(--dim); position:relative;}
.day.done .circ{background:linear-gradient(180deg,#35e065,var(--green2)); border-color:#48e077; color:#06330f;}
.day.today .circ{border-color:var(--red2); color:#fff; box-shadow:0 0 0 3px rgba(224,30,38,.3); animation:pulse 1.6s infinite;}
.day.gift .circ{background:linear-gradient(180deg,#2b2b32,#17171b); border-color:#ffd34d; color:#ffd34d;}
@keyframes pulse{0%,100%{box-shadow:0 0 0 3px rgba(224,30,38,.3);} 50%{box-shadow:0 0 0 6px rgba(224,30,38,.12);}}
.day .dl{font-size:11px; color:var(--dim); font-weight:700;}
.day .dm{font-size:9.5px; color:#ff8a8a; font-weight:900; min-height:11px; text-align:center;}

/* ---------- XP card ---------- */
.xpcard{display:flex; gap:14px; align-items:center;}
.xpstar{width:52px; height:52px; flex:none; border-radius:16px; display:flex; align-items:center; justify-content:center;
  background:radial-gradient(circle at 32% 28%, rgba(155,92,245,.5), rgba(88,42,160,.35) 70%), #1a1426; border:1px solid rgba(155,92,245,.45);}
.xpmeta{flex:1;}
.xprow{display:flex; justify-content:space-between; align-items:baseline;}
.xpbar{height:11px; border-radius:7px; background:#26262c; overflow:hidden; margin:7px 0 5px;}
.xpbar > div{height:100%; border-radius:7px; background:linear-gradient(90deg,#6d28c9,var(--violet)); box-shadow:0 0 12px rgba(155,92,245,.55);}

/* ---------- quests ---------- */
.quest{display:flex; align-items:center; gap:12px; padding:12px 0; border-top:1px solid var(--line);}
.quest:first-of-type{border-top:none;}
.qthumb{width:52px; height:52px; border-radius:14px; flex:none; display:flex; align-items:center; justify-content:center; font-size:25px;
  background:linear-gradient(160deg,#26262e,#121215); border:1px solid var(--line2);}
.qmeta{flex:1; min-width:0;}
.qtitle{font-size:14.5px; font-weight:800;}
.qearn{font-size:12.5px; color:var(--green); font-weight:800;}
.qprog{font-size:12px; color:var(--dim); font-weight:700; text-align:right;}
.qbtn{flex:none; padding:10px 20px; border-radius:12px; background:linear-gradient(180deg,var(--red2),var(--reddeep));
  color:#fff; font-weight:900; font-size:14px; box-shadow:0 6px 14px rgba(193,39,45,.35), inset 0 1px 0 rgba(255,255,255,.3);}
.qbtn.done{background:linear-gradient(180deg,#35e065,var(--green2)); color:#06330f; box-shadow:none;}

/* ---------- game grid (Play) ---------- */
.chips{display:flex; gap:8px; margin:12px 0 12px; overflow-x:auto; padding-bottom:2px;}
.fchip{flex:none; display:inline-flex; align-items:center; gap:7px; padding:10px 16px; border-radius:999px;
  background:#1b1b20; border:1px solid var(--line2); color:#e8e8ec; font-size:13.5px; font-weight:800;}
.fchip.on{background:linear-gradient(180deg,var(--red2),var(--reddeep)); border-color:transparent; color:#fff;
  box-shadow:0 6px 14px rgba(193,39,45,.35);}
.searchrow{display:flex; gap:9px; margin:0 0 14px;}
.searchbox{flex:1; display:flex; align-items:center; gap:9px; background:#17171c; border:1px solid var(--line);
  border-radius:999px; padding:0 16px; height:46px;}
.searchbox input{flex:1; background:none; border:none; outline:none; color:#fff; font-size:14.5px; font-family:inherit; min-width:0;}
.searchbox input::placeholder{color:var(--dim2);}
.grid{display:grid; grid-template-columns:1fr 1fr; gap:12px;}
.gcard{background:linear-gradient(180deg,var(--panel2),var(--panel)); border:1px solid var(--line); border-radius:20px;
  overflow:hidden; text-align:left; padding:0; box-shadow:var(--shadow); display:flex; flex-direction:column;}
.gcard:active{transform:translateY(1px);}
.gart{height:118px; position:relative; overflow:hidden; flex:none;}
.gart svg{position:absolute; inset:0; width:100%; height:100%;}
.gbody{padding:10px 12px 12px; display:flex; flex-direction:column; gap:5px; flex:1;}
.gtitle{font-size:15.5px; font-weight:900; line-height:1.15;}
.gmeta{display:flex; align-items:center; gap:6px; font-size:12px; color:var(--dim); font-weight:700;}
.gearn{color:var(--green); font-weight:900; font-size:13px;}
.gplay{margin-top:auto; padding-top:6px;}
.gplay span{display:flex; align-items:center; justify-content:center; gap:6px; padding:10px; border-radius:11px;
  background:linear-gradient(180deg,var(--red2),var(--reddeep)); color:#fff; font-size:13.5px; font-weight:900;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.3);}
.gribbon{position:absolute; top:9px; left:9px; z-index:2;}

/* ---------- forms ---------- */
.flabel{display:block; font-size:12.5px; font-weight:800; color:var(--dim); letter-spacing:.05em; text-transform:uppercase; margin:16px 0 7px;}
input[type=text]{width:100%; background:#17171c; border:1px solid var(--line2); border-radius:13px; color:#fff;
  font-size:15.5px; padding:13px 14px; font-family:inherit; outline:none;}
input[type=text]:focus{border-color:var(--red);}
.seg{display:flex; background:#17171c; border:1px solid var(--line); border-radius:13px; padding:4px; gap:4px;}
.seg button{flex:1; padding:10px 4px; border-radius:10px; font-weight:800; font-size:13.5px; color:var(--dim);}
.seg button.on{background:linear-gradient(180deg,var(--red2),var(--reddeep)); color:#fff;}
.seg button:disabled{opacity:.45;}
.switchrow{display:flex; align-items:center; justify-content:space-between; padding:14px 0 2px;}
.switchrow .sl{font-size:15px; font-weight:800;}
.toggle{position:relative; width:52px; height:30px; flex:none;}
.toggle input{opacity:0; width:0; height:0;}
.toggle .track{position:absolute; inset:0; border-radius:999px; background:#2c2c33; transition:.2s;}
.toggle .track:before{content:''; position:absolute; width:24px; height:24px; border-radius:50%; background:#fff; top:3px; left:3px; transition:.2s;}
.toggle input:checked + .track{background:var(--green2);}
.toggle input:checked + .track:before{transform:translateX(22px);}

/* ---------- levels map ---------- */
.mapwrap{position:relative; margin-top:6px;}
.mapline{position:absolute; left:26px; top:16px; bottom:16px; width:4px; border-radius:3px; background:#232329;}
.mapline > div{background:linear-gradient(180deg,var(--red2),var(--reddeep)); border-radius:3px; width:100%;}
.lvl{position:relative; display:flex; gap:14px; width:100%; text-align:left; padding:9px 0; align-items:stretch;}
.lvl .node{width:56px; height:56px; flex:none; border-radius:50%; z-index:1; display:flex; align-items:center; justify-content:center;
  font-size:19px; font-weight:900; background:#1d1d22; border:2.5px solid var(--line2); color:var(--dim); box-shadow:0 8px 18px rgba(0,0,0,.5);}
.lvl.done .node{background:linear-gradient(180deg,#35e065,var(--green2)); border-color:#48e077; color:#06330f;}
.lvl.current .node{background:linear-gradient(180deg,var(--red2),var(--reddeep)); border-color:#ff6b6b; color:#fff; animation:pulse 1.8s infinite;}
.lvl .lcard{flex:1; background:linear-gradient(180deg,var(--panel2),var(--panel)); border:1px solid var(--line); border-radius:16px; padding:12px 14px;}
.lvl.current .lcard{border-color:rgba(224,30,38,.55);}
.lvl .lt{font-size:15.5px; font-weight:900;}
.lvl .ld{font-size:12.5px; color:var(--dim); line-height:1.5; margin-top:2px;}

/* ---------- rewards / wallet ---------- */
.wtoggle{display:flex; background:#17171c; border:1px solid var(--line); border-radius:999px; padding:4px; gap:4px; margin:12px 0 14px;}
.wtoggle button{flex:1; padding:11px; border-radius:999px; font-weight:900; font-size:14px; color:var(--dim);}
.wtoggle button.on{background:linear-gradient(180deg,var(--red2),var(--reddeep)); color:#fff; box-shadow:0 6px 14px rgba(193,39,45,.35);}
.walletcard{border-radius:22px; padding:20px 18px; margin:0 0 14px; position:relative; overflow:hidden;
  background:radial-gradient(110% 150% at 88% -10%, rgba(47,211,95,.24), rgba(0,0,0,0) 55%), linear-gradient(160deg,#182118,#0c120c 65%);
  border:1px solid rgba(47,211,95,.35); box-shadow:var(--shadow);}
.walletcard .wlabel{font-size:13.5px; color:#cfe8d4; font-weight:700;}
.walletcard .wbig{font-size:42px; font-weight:900; color:var(--green); line-height:1.05; margin:2px 0;}
.walletcard .wsub{font-size:13px; color:#a9c9b0; font-weight:600;}
.wprog{height:11px; border-radius:7px; background:rgba(255,255,255,.13); overflow:hidden; margin:12px 0 6px;}
.wprog > div{height:100%; background:linear-gradient(90deg,var(--green2),var(--green)); border-radius:7px;}
.wrow{display:flex; justify-content:space-between; font-size:12.5px; color:#cfe8d4; font-weight:700;}
.creditsplit{display:flex; gap:10px; margin:0 0 14px;}
.creditbox{flex:1; background:linear-gradient(180deg,var(--panel2),var(--panel)); border:1px solid var(--line); border-radius:16px; padding:13px 14px;}
.creditbox .cv{font-size:23px; font-weight:900;}
.creditbox .ck{font-size:11.5px; color:var(--dim); font-weight:800; letter-spacing:.05em; text-transform:uppercase; margin-top:2px;}
.spendrow{display:flex; gap:8px; flex-wrap:wrap; margin-top:10px;}
.spendchip{display:inline-flex; align-items:center; gap:6px; padding:9px 13px; border-radius:999px; background:#1b1b20;
  border:1px solid var(--line2); font-size:13px; font-weight:800;}
.spendchip.first{border-color:rgba(224,30,38,.6); background:rgba(193,39,45,.16);}
.reward{display:flex; align-items:center; justify-content:space-between; gap:10px; padding:12px 0; border-top:1px solid var(--line);}
.reward > div:first-child{flex:1; min-width:0;}
.reward > button{flex:none;}
.reward:first-of-type{border-top:none;}
.rcode{font-size:18px; font-weight:900; letter-spacing:.06em;}
.rmeta{font-size:12px; color:var(--dim); font-weight:600; margin-top:1px;}
.statechip{font-size:11px; font-weight:900; padding:4px 9px; border-radius:999px; background:rgba(47,211,95,.16); color:#7dff9e; border:1px solid rgba(47,211,95,.4);}
.statechip.pend{background:rgba(255,255,255,.07); color:var(--dim); border-color:var(--line2);}

/* ---------- game views (scratch / pairs / vault) ---------- */
.scratchbox{position:relative; border-radius:18px; overflow:hidden; border:1px solid var(--line2); box-shadow:var(--shadow);}
.scratchgrid{display:grid; grid-template-columns:repeat(3,1fr); gap:2px; background:#26262c;}
.scratchgrid > div{background:linear-gradient(160deg,#232329,#141417); aspect-ratio:1.35; display:flex; align-items:center; justify-content:center;
  font-size:21px; font-weight:900;}
.scratchgrid > div.win3{background:linear-gradient(160deg,rgba(47,211,95,.3),rgba(47,211,95,.1)); color:#7dff9e;}
#scratchCanvas{position:absolute; inset:0; width:100%; height:100%; touch-action:none;}
.result{border-radius:18px; padding:16px; margin:12px 0; text-align:center; border:1px solid var(--line2);}
.result.win{background:radial-gradient(100% 130% at 50% 0%, rgba(47,211,95,.22), rgba(0,0,0,0) 65%), var(--panel);}
.result.lose{background:var(--panel);}
.bigcode{font-size:29px; font-weight:900; letter-spacing:.1em;}
.hud{display:flex; gap:10px; margin:12px 0;}
.hchip{flex:1; background:var(--panel2); border:1px solid var(--line); border-radius:13px; padding:9px 12px; font-weight:900; font-size:16px; text-align:center;}
.hchip span{display:block; font-size:10.5px; color:var(--dim); font-weight:800; letter-spacing:.07em; text-transform:uppercase; margin-bottom:2px;}
.pairsgrid{display:grid; gap:9px;}
.pairsgrid.g6{grid-template-columns:repeat(4,1fr);}
.pairsgrid.g8{grid-template-columns:repeat(4,1fr);}
.pairsgrid.g10{grid-template-columns:repeat(5,1fr);}
.pcard{aspect-ratio:.82; perspective:600px; padding:0; background:none;}
.pcard .inner{position:relative; display:block; width:100%; height:100%; transform-style:preserve-3d; transition:transform .38s;}
.pcard.flip .inner{transform:rotateY(180deg);}
.pcard .face{position:absolute; inset:0; display:flex; align-items:center; justify-content:center; border-radius:14px;
  backface-visibility:hidden; -webkit-backface-visibility:hidden; font-size:29px;}
.pcard .face.back{background:linear-gradient(160deg,var(--red2),var(--reddeep)); box-shadow:inset 0 1px 0 rgba(255,255,255,.35), 0 6px 14px rgba(0,0,0,.45);}
.pcard .face.front{background:linear-gradient(160deg,#2b2b33,#17171b); border:1px solid var(--line2); transform:rotateY(180deg);}
.pcard.matched .face.front{border-color:rgba(47,211,95,.65); box-shadow:0 0 0 2px rgba(47,211,95,.3);}
.flipwrap{display:flex; justify-content:center; padding:8px 0 4px;}
.flipcard{width:210px; height:250px; position:relative; transform-style:preserve-3d; transition:transform .6s; cursor:pointer;}
.flipcard.flipped{transform:rotateY(180deg);}
.flipface{position:absolute; inset:0; border-radius:20px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px;
  backface-visibility:hidden; -webkit-backface-visibility:hidden; padding:16px; text-align:center;}
.flipface.frontf{background:radial-gradient(100% 120% at 50% 0%, rgba(224,30,38,.4), rgba(0,0,0,0) 60%), linear-gradient(165deg,#232329,#101013); border:1px solid var(--line2);}
.flipface.backf{background:linear-gradient(165deg,#1d2b1d,#0d130d); border:1px solid rgba(47,211,95,.5); transform:rotateY(180deg);}
.statgrid{display:grid; grid-template-columns:repeat(3,1fr); gap:10px;}
.stat{background:linear-gradient(180deg,var(--panel2),var(--panel)); border:1px solid var(--line); border-radius:15px; padding:12px 8px; text-align:center;}
.stat .sv{font-size:21px; font-weight:900;}
.stat .sk{font-size:10.5px; color:var(--dim); font-weight:800; letter-spacing:.04em; text-transform:uppercase; margin-top:2px; line-height:1.3;}

/* ---------- tab bar ---------- */
#tabbar{position:fixed; bottom:0; left:50%; transform:translateX(-50%); width:min(430px,100%); z-index:50;
  display:flex; background:rgba(10,10,12,.96); backdrop-filter:blur(10px); border-top:1px solid var(--line);
  padding:8px 6px calc(8px + env(safe-area-inset-bottom));}
#tabbar .tab{flex:1; display:flex; flex-direction:column; align-items:center; gap:3px; padding:5px 0 2px;
  color:var(--dim2); font-size:11px; font-weight:800; border-radius:12px;}
#tabbar .tab svg{width:24px; height:24px; fill:currentColor;}
#tabbar .tab.active{color:var(--red2);}

/* ---------- toast ---------- */
#toast{position:fixed; left:50%; bottom:104px; transform:translate(-50%,16px); z-index:80; max-width:min(400px,92vw);
  background:#f4f4f6; color:#101013; font-size:14px; font-weight:800; padding:12px 18px; border-radius:999px;
  box-shadow:0 14px 30px rgba(0,0,0,.55); opacity:0; pointer-events:none; transition:.25s; text-align:center;}
#toast.show{opacity:1; transform:translate(-50%,0);}

/* ---------- prize wheel (CSS conic — hero + grid card) ---------- */
.wheelmini{border-radius:50%; position:relative; flex:none;
  background:conic-gradient(from -15deg,
    #C1272D 0deg 30deg, #f4f4f6 30deg 60deg, #17171b 60deg 90deg,
    #C1272D 90deg 120deg, #f4f4f6 120deg 150deg, #17171b 150deg 180deg,
    #C1272D 180deg 210deg, #f4f4f6 210deg 240deg, #17171b 240deg 270deg,
    #C1272D 270deg 300deg, #f4f4f6 300deg 330deg, #17171b 330deg 360deg);
  border:6px solid #26262c;
  box-shadow:0 14px 28px rgba(0,0,0,.6), inset 0 0 0 3px rgba(0,0,0,.35), inset 0 0 34px rgba(0,0,0,.45);}
.wheelmini:before{content:''; position:absolute; inset:0; border-radius:50%;
  background:radial-gradient(circle at 32% 26%, rgba(255,255,255,.34), rgba(255,255,255,0) 46%);}
.wheelhub{position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); width:37%; height:37%;
  border-radius:50%; background:#ffffff; border:4px solid #101013; display:flex; align-items:center; justify-content:center;
  font-size:21px; box-shadow:0 4px 10px rgba(0,0,0,.5); z-index:1;}
.hero-art .wheelmini{position:absolute; right:2px; top:7px; width:158px; height:158px;}
.gart{background:radial-gradient(90% 120% at 50% 0%, #232329, #101013);}
.gart .wheelmini{position:absolute; width:102px; height:102px; left:50%; top:50%; transform:translate(-50%,-50%); border-width:5px;}
.gart .wheelhub{font-size:19px;}

/* ---------- v3: ladder · coins · slots · welcome · lobby rails ---------- */
.tagchip.new{background:rgba(255,211,77,.16); color:#ffd34d; border:1px solid rgba(255,211,77,.55);}
.balancepill.coinpill{background:linear-gradient(180deg,#38310f,#241d07); border-color:rgba(255,211,77,.55); margin-left:2px;}
.balancepill.coinpill .coin{background:none; font-size:15px;}
.balancepill.coinpill .amt{color:#ffd34d;}
.day .dm{line-height:1.3;}
.railhead{justify-content:flex-start; gap:8px; margin:18px 0 8px;}
.rail{display:flex; gap:12px; overflow-x:auto; padding:2px 2px 10px; scroll-snap-type:x mandatory; -webkit-overflow-scrolling:touch;}
.rail .gcard{flex:0 0 172px; scroll-snap-align:start;}
.slotmachine{text-align:center;}
.reels{display:flex; gap:10px; justify-content:center; margin:8px 0 12px;}
.reel{width:76px; height:92px; border-radius:16px; background:linear-gradient(180deg,#f7f7f9,#d8d8e0);
  font-size:44px; display:flex; align-items:center; justify-content:center;
  border:1px solid #3d3d47; box-shadow:inset 0 -10px 16px rgba(0,0,0,.16), 0 10px 20px rgba(0,0,0,.45);}
.slotcoins{font-weight:900; font-size:16.5px; color:#ffd34d; margin:2px 0 4px;}
.slotmachine .seg{margin-bottom:12px;}
.wstep{display:flex; align-items:center; gap:11px; padding:10px 0; border-top:1px solid var(--line);}
.wstep:first-of-type{border-top:none;}
.wmark{width:30px; height:30px; flex:none; border-radius:50%; display:flex; align-items:center; justify-content:center;
  background:#232329; border:1.5px solid var(--line2); font-weight:900; font-size:13.5px; color:var(--dim);}
.wstep.done .wmark{background:linear-gradient(180deg,#35e065,var(--green2)); border-color:#48e077; color:#06330f;}
.wstep.now .wmark{border-color:var(--red2); color:#fff; box-shadow:0 0 0 3px rgba(224,30,38,.3);}
.wlabel{flex:1; font-weight:800; font-size:14px; min-width:0;}
.wstep.todo .wlabel{color:var(--dim);}
.wrew{color:var(--green); font-weight:900; font-size:12.5px; flex:none;}
.meterbar{height:13px; border-radius:8px; background:#26262c; overflow:hidden;}
.meterbar > div{height:100%; border-radius:8px; background:linear-gradient(90deg,var(--reddeep),var(--red2));}
.winrow{display:flex; align-items:center; justify-content:space-between; gap:10px; padding:9px 0; border-top:1px solid var(--line); font-size:13.5px;}
.winrow:first-of-type{border-top:none;}
.wgame{color:var(--dim); font-weight:700; text-align:right;}
