/* App shell styles. Theme palettes match web/styles.css so the site and app feel identical. */
:root{--bg:#fafaf7;--ink:#101214;--muted:#777a7b;--card:#fff;--odd:#ff655e;--even:#4ba8f5;--line:#dedfdd;--shadow:#d6d7d4}
body[data-theme=neon]{--bg:#031437;--ink:#eef8ff;--muted:#75aee8;--card:#082b5b;--odd:#ff664b;--even:#00bdff;--line:#175da6;--shadow:#001129}
body[data-theme=candy]{--bg:#ddf6ff;--ink:#143270;--muted:#5d7eae;--card:#fff;--odd:#ff587d;--even:#15cdb7;--line:#a9ddf6;--shadow:#94cce5}

*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--ink);font-family:Inter,"Noto Sans SC",system-ui,sans-serif;
  transition:background .25s,color .25s;overflow:hidden;user-select:none;-webkit-user-select:none;touch-action:manipulation}
button{font:inherit;color:inherit;border:1.5px solid var(--line);background:var(--card);border-radius:14px;
  padding:.78rem 1.15rem;font-weight:750;cursor:pointer;transition:.15s}
button:active{transform:translateY(3px)}
.primary{background:var(--ink);color:var(--bg);border-color:var(--ink)}
.ghost{background:transparent}
.muted{color:var(--muted)}
.center{text-align:center}

.screen{display:none;flex-direction:column;height:100%;height:100dvh;padding:calc(14px + env(safe-area-inset-top)) 18px calc(14px + env(safe-area-inset-bottom));max-width:560px;margin:auto}
.screen.active{display:flex}

/* ---------- Home ---------- */
#screen-home{justify-content:space-between;text-align:center}
.home-top{padding-top:8vh}
.eyebrow{font-size:.82rem;font-weight:850;letter-spacing:.12em;text-transform:uppercase;color:var(--muted);margin:0}
#screen-home h1{font-size:clamp(2.6rem,11vw,3.6rem);letter-spacing:-.05em;line-height:1;margin:14px 0 26px}
.home-stats{display:flex;justify-content:center;gap:14px}
.home-stats div{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:12px 22px;min-width:120px}
.home-stats small{display:block;color:var(--muted)}
.home-stats b{font-size:1.3rem}
.home-menu{display:flex;flex-direction:column;gap:12px;padding-bottom:3vh}
.big{padding:16px;border-radius:18px}
.big span{font-size:1.15rem;display:block}
.big small{display:block;color:inherit;opacity:.65;margin-top:4px;font-weight:550}
.home-row{display:grid;grid-template-columns:1fr 1fr 1fr;gap:10px}
.home-row button{padding:.7rem .4rem;font-size:.9rem}

/* ---------- Bars / subscreens ---------- */
.bar{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px}
.bar h2{margin:0;font-size:1.35rem;letter-spacing:-.02em}
.bar .back{padding:.5rem .9rem}
.bar span{min-width:64px}

/* ---------- Level select ---------- */
.level-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:10px;overflow-y:auto;padding-bottom:10px}
.level-grid button{aspect-ratio:1;padding:0;font-size:1.15rem;font-weight:900;border-radius:16px;position:relative}
.level-grid button:disabled{opacity:.35;cursor:default}
.level-grid button:disabled:active{transform:none}
.level-grid button.done{border-color:var(--even);color:var(--even)}
.level-grid button .best{position:absolute;left:0;right:0;bottom:5px;font-size:.55rem;font-weight:600;color:var(--muted)}

/* ---------- Game ---------- */
#screen-game{padding-left:16px;padding-right:16px}
.game-head{display:flex;align-items:center;gap:12px}
.game-head>div:first-child{min-width:92px}
.game-head b{display:block;font-size:.95rem}
.game-head small{color:var(--muted)}
.meter{flex:1;height:5px;background:var(--line);border-radius:9px}
.meter i{display:block;width:0;height:100%;background:var(--ink);border-radius:9px;transition:width .2s}
.head-right{display:flex;align-items:center;gap:10px}
#score{font-variant-numeric:tabular-nums;font-weight:900}
#btnPause{padding:6px 11px}
.stats-row{display:flex;justify-content:space-between;font-size:.82rem;margin:8px 0 4px}
#lives{color:var(--odd);letter-spacing:.1em}
#combo{color:var(--muted)}
.field{flex:1;position:relative;border-bottom:2px solid var(--ink);overflow:hidden;min-height:0}
.guide{position:absolute;left:50%;top:0;height:100%;border-left:1px solid var(--line)}
.judge{position:absolute;top:84%;left:0;right:0;border-top:2px solid var(--ink)}
.group{position:absolute;left:50%;transform:translate(-50%,-100%);min-width:76px;padding:9px 15px;text-align:center;
  background:var(--card);border:2px solid var(--ink);border-radius:16px;font-size:1.9rem;font-weight:900;
  box-shadow:0 6px 0 var(--shadow);white-space:nowrap;will-change:top}
.group .d.done{opacity:.22}
.group.active .d.next{color:var(--even);text-decoration:underline;text-underline-offset:6px}
body[data-theme=neon] .group{box-shadow:0 0 18px color-mix(in srgb,var(--even) 45%,transparent),0 6px 0 var(--shadow)}
.judgment{position:absolute;left:0;right:0;top:58%;text-align:center;font-size:1.5rem;font-weight:900;opacity:0;pointer-events:none}
.judgment.show{animation:pop .55s ease-out}
@keyframes pop{0%{opacity:0;transform:scale(.6)}25%{opacity:1;transform:scale(1.12)}70%{opacity:1}100%{opacity:0;transform:scale(1)}}
.beat{position:absolute;top:84%;left:0;right:0;border-top:2px solid var(--even);opacity:0;pointer-events:none}
.beat.tick{animation:beat .18s ease-out}
@keyframes beat{0%{opacity:.9}100%{opacity:0}}
.field.flash-bad{animation:shake .3s}
@keyframes shake{25%{transform:translateX(-6px)}75%{transform:translateX(6px)}}
.keys{display:grid;grid-template-columns:1fr 1fr;gap:12px;padding-top:16px}
.keys button{height:104px;color:#fff;border:0;box-shadow:0 7px 0 color-mix(in srgb,currentColor 35%,#000);border-radius:18px}
.keys b{display:block;font-size:1.7rem}
.keys small{display:block;margin-top:6px;opacity:.85}
.odd{background:var(--odd)}
.even{background:var(--even)}

/* ---------- Leaderboard ---------- */
.board-tabs{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:10px}
.board-tabs .tab{padding:.55rem}
.board-tabs .tab.active{background:var(--ink);color:var(--bg);border-color:var(--ink)}
.board-chips{display:flex;gap:8px;overflow-x:auto;padding-bottom:8px;margin-bottom:6px;scrollbar-width:none}
.board-chips button{padding:.4rem .8rem;font-size:.82rem;border-radius:999px;white-space:nowrap;flex:0 0 auto}
.board-chips button.active{background:var(--ink);color:var(--bg);border-color:var(--ink)}
.board{list-style:none;margin:0;padding:0;overflow-y:auto}
.board li{display:flex;align-items:center;gap:12px;background:var(--card);border:1px solid var(--line);border-radius:14px;padding:12px 14px;margin-bottom:8px}
.board .rank{font-weight:900;min-width:26px;text-align:center}
.board .info{flex:1;min-width:0}
.board .info b{display:block}
.board .info small{color:var(--muted)}
.board .pts{font-weight:900;font-variant-numeric:tabular-nums}
.board-empty{color:var(--muted);text-align:center;margin-top:30vh 0}

/* ---------- Shop ---------- */
#screen-shop{overflow-y:auto}
.shop-head{text-align:center}
.shop-horns{font-size:1.6rem;margin:4px 0}
.shop-title{font-weight:800;font-size:1.1rem;margin:6px 0}
.shop-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:14px 0}
.shop-grid button{display:flex;flex-direction:column;gap:6px;padding:16px 10px;align-items:center}
.shop-grid .qty{font-size:1.2rem;font-weight:900}
.shop-grid .price{color:var(--muted);font-weight:600;font-size:.85rem}
#btnRestore{margin-top:6px}
.celebrate{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;font-size:5rem;pointer-events:none;animation:horn 1.2s ease-out forwards}
@keyframes horn{0%{opacity:0;transform:scale(.4)}30%{opacity:1;transform:scale(1.15) rotate(-8deg)}60%{transform:scale(1) rotate(6deg)}100%{opacity:0;transform:scale(1.4)}}

/* ---------- Settings ---------- */
.settings{display:flex;flex-direction:column;gap:14px;overflow-y:auto}
.settings label{display:flex;align-items:center;justify-content:space-between;gap:10px;background:var(--card);border:1px solid var(--line);border-radius:14px;padding:14px 16px;font-weight:700;flex-wrap:wrap}
.settings select{font:inherit;color:inherit;background:var(--bg);border:1.5px solid var(--line);border-radius:10px;padding:8px 10px;max-width:55%}
#cloudBlock{display:flex;flex-direction:column;gap:14px}
.row-inline{display:flex;gap:8px;align-items:center;min-width:0}
.row-inline input{font:inherit;color:inherit;background:var(--bg);border:1.5px solid var(--line);border-radius:10px;padding:8px 10px;width:150px;min-width:0}
.row-inline button{padding:.5rem .8rem;font-size:.85rem}
.row-inline code{font-weight:800;font-size:.9rem;letter-spacing:.03em}
.toggle{min-width:74px}
.about-line{text-align:center;font-size:.82rem}
.legal-links{display:flex;justify-content:center;flex-wrap:wrap;gap:6px 18px;font-size:.85rem;font-weight:700}.legal-links a{color:var(--muted);text-decoration:underline;text-underline-offset:3px}

/* ---------- Overlay ---------- */
.overlay{position:fixed;inset:0;background:color-mix(in srgb,var(--bg) 94%,transparent);display:flex;flex-direction:column;
  align-items:center;justify-content:center;text-align:center;padding:35px;z-index:50}
.overlay.hidden{display:none}
.overlay h2{font-size:2.2rem;margin:0 0 6px}
.overlay .sub{color:var(--muted);margin:0 0 4px}
.overlay .result-score{font-size:2.6rem;font-weight:900;font-variant-numeric:tabular-nums;margin:10px 0}
.overlay .result-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:10px 0 20px;width:100%;max-width:400px}
.overlay .result-stats div{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:12px 6px}
.overlay .result-stats small{display:block;color:var(--muted);font-size:.7rem}
.overlay .result-stats b{font-size:1.05rem}
.overlay .row{display:flex;gap:10px;flex-wrap:wrap;justify-content:center}
.overlay .record{color:var(--even);font-weight:900;margin:0}

[dir=rtl] .bar .back{transform:scaleX(-1)}

/* ---------- accessibility ---------- */
:focus-visible{outline:3px solid var(--even);outline-offset:2px}
@media (prefers-reduced-motion: reduce){
  *{animation-duration:.01ms !important;transition-duration:.01ms !important}
  button:active{transform:none}
}

/* ---------- Candy-cloud visual system: faithful to the approved UI board ---------- */
body[data-theme=candy]{--bg:#c9f1ff;--ink:#08256f;--muted:#526b99;--card:rgba(255,255,255,.9);--odd:#ff3760;--even:#05b9ee;--line:#9dcdf4;--shadow:#81b6df}
body[data-theme=candy]{display:grid;place-items:center;background:linear-gradient(#45c5fa 0%,#b8edff 50%,#ffe5f2 100%);font-family:"Arial Rounded MT Bold","PingFang SC","Microsoft YaHei",system-ui,sans-serif}
body[data-theme=candy]:before,body[data-theme=candy]:after{content:"";position:fixed;z-index:-1;border-radius:50%;filter:blur(1px);opacity:.82}
body[data-theme=candy]:before{left:-12vw;right:48vw;bottom:-10vw;height:38vw;background:radial-gradient(ellipse at 22% 55%,#fff 0 24%,transparent 25%),radial-gradient(ellipse at 55% 62%,#cdf9e5 0 30%,transparent 31%),radial-gradient(ellipse at 85% 58%,#ffcde5 0 26%,transparent 27%)}
body[data-theme=candy]:after{right:-12vw;left:58vw;bottom:-8vw;height:34vw;background:radial-gradient(ellipse at 25% 60%,#fff 0 24%,transparent 25%),radial-gradient(ellipse at 68% 56%,#d0f8e9 0 30%,transparent 31%)}
body[data-theme=candy] button{border:2px solid #fff;background:linear-gradient(#fff,#eef4ff);box-shadow:0 0 0 2px #a8caf1,0 4px 9px #2364a130,inset 0 2px 5px #fff;color:var(--ink);font-weight:900}
body[data-theme=candy] button:active{transform:translateY(2px);filter:brightness(.94)}
body[data-theme=candy] .screen{width:min(390px,100vw);height:min(844px,100dvh);padding:calc(16px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom));position:relative;overflow:hidden;border:4px solid #fff;border-radius:38px;background:linear-gradient(#74d9ff 0%,#caf3ff 42%,#fff 65%,#ffdcec 100%);box-shadow:0 0 0 3px #168ddd,0 20px 45px #004d883d}
body[data-theme=candy] .screen:before{content:"";position:absolute;inset:0;z-index:-2;background:radial-gradient(circle at 14% 24%,#ffffffc9 0 9px,transparent 10px),radial-gradient(circle at 80% 20%,#f3b8ffb8 0 13px,transparent 14px),radial-gradient(circle at 76% 52%,#ffffffbb 0 7px,transparent 8px),linear-gradient(90deg,transparent 48%,#ffffff55 50%,transparent 52%)}
body[data-theme=candy] .screen:after{content:"";position:absolute;left:-25%;right:-25%;bottom:-5%;height:43%;z-index:-1;background:radial-gradient(ellipse at 13% 67%,#fff 0 17%,transparent 18%),radial-gradient(ellipse at 34% 73%,#c5f7df 0 22%,transparent 23%),radial-gradient(ellipse at 60% 67%,#fff 0 19%,transparent 20%),radial-gradient(ellipse at 87% 72%,#ffc8e4 0 22%,transparent 23%),linear-gradient(162deg,transparent 31%,#ffd85c 32% 37%,#ffbbe1 38% 43%,#9ce8ff 44% 49%,#bff5e1 50%)}
body[data-theme=candy] .screen.active{display:flex}

/* home */
body[data-theme=candy] #screen-home{justify-content:flex-start}body[data-theme=candy] .home-top{padding-top:5vh;position:relative}body[data-theme=candy] .eyebrow{margin-top:75px;color:#11317e;letter-spacing:.22em;font-size:.77rem}body[data-theme=candy] .home-top h1,body[data-theme=candy] #screen-home h1{position:relative;margin:5px auto 13px;width:max-content;color:#ffd527;font-size:3.15rem;letter-spacing:0;-webkit-text-stroke:4px #5323a9;paint-order:stroke fill;text-shadow:0 5px 0 #ff5276,0 9px 16px #5524a850}body[data-theme=candy] .home-top h1:before{content:"";position:absolute;z-index:-1;inset:-25px -34px;border-radius:50%;background:radial-gradient(ellipse,#fff 0 58%,#ffffff55 60%,transparent 71%)}body[data-theme=candy] .home-stats{position:absolute;right:0;top:-27px}body[data-theme=candy] .home-stats div:first-child{display:none}body[data-theme=candy] .home-stats div{min-width:112px;padding:8px 12px;border:2px solid #fff;border-radius:18px;background:linear-gradient(#fff,#edf6ff);box-shadow:0 0 0 2px #a9cef4}body[data-theme=candy] .home-stats small{display:none}body[data-theme=candy] .home-stats b{font-size:1rem}body[data-theme=candy] .home-stats b:before{content:"⭐ ";font-size:1.45rem}body[data-theme=candy] .home-menu{gap:12px;margin-top:14px;padding:0 13px}body[data-theme=candy] .big{min-height:64px;border-radius:24px;color:#fff;text-shadow:0 2px 2px #0003;box-shadow:0 0 0 2px currentColor,0 8px 0 color-mix(in srgb,currentColor 55%,#153070),0 12px 20px #164b8e45,inset 0 4px 10px #ffffffb8}body[data-theme=candy] .big span{font-size:1.55rem}body[data-theme=candy] .big small{font-size:.72rem}body[data-theme=candy] .home-menu>.big:nth-child(1){color:#ff4165;background:linear-gradient(#ff8194,#ff2453)}body[data-theme=candy] .home-menu>.big:nth-child(2){color:#08a9f4;background:linear-gradient(#43dfff,#0687e9)}body[data-theme=candy] .home-menu>.big:nth-child(3){color:#9147ec;background:linear-gradient(#c675ff,#7a34df)}body[data-theme=candy] .home-menu>.big:nth-child(4){color:#ff9d00;background:linear-gradient(#ffc94d,#ff8a00)}body[data-theme=candy] .home-row{position:absolute;left:28px;right:28px;bottom:24px;gap:14px}body[data-theme=candy] .home-row button{min-height:70px;border:0;background:#ffffffa8;box-shadow:none;font-size:.84rem}body[data-theme=candy] .home-row button:before{display:block;font-size:29px;margin-bottom:5px}body[data-theme=candy] .home-row button:nth-child(1):before{content:"♛"}body[data-theme=candy] .home-row button:nth-child(2):before{content:"♟"}body[data-theme=candy] .home-row button:nth-child(3):before{content:"⚙"}

/* navigation and levels */
body[data-theme=candy] .bar{position:relative;z-index:3}body[data-theme=candy] .bar h2{min-width:190px;text-align:center;padding:8px 20px;border:2px solid #e9e3ff;border-radius:22px;background:linear-gradient(#fff,#f5f1ff);font-size:1.55rem;box-shadow:0 4px 10px #40317d2b}body[data-theme=candy] .bar .back{width:50px;height:50px;padding:0;border-radius:16px;color:#fff;font-size:0;background:linear-gradient(#64deff,#087ce7);box-shadow:0 0 0 2px #168ee6,0 5px 10px #005ea74d,inset 0 2px 5px #fff}body[data-theme=candy] .bar .back:before{content:"‹";font-size:38px;line-height:1}body[data-theme=candy] .level-grid{gap:10px;padding:4px 2px 16px}body[data-theme=candy] .level-grid button{aspect-ratio:auto;height:59px;border-radius:14px;color:#fff;background:linear-gradient(#73ccff,#3a79d1);box-shadow:0 0 0 2px #55a4e8,inset 0 3px 6px #fff;font-size:1.28rem}body[data-theme=candy] .level-grid button.done{color:#fff;border-color:#fff}body[data-theme=candy] .level-grid button.done:after{content:"★★★";position:absolute;left:0;right:0;bottom:3px;color:#ffeb3b;font-size:.57rem;letter-spacing:-2px}body[data-theme=candy] .level-grid button:disabled{opacity:.78;filter:saturate(.25)}body[data-theme=candy] .level-grid button:disabled:after{content:"🔒";position:absolute;left:0;right:0;bottom:3px;font-size:.7rem}body[data-theme=candy] .level-grid button:nth-child(8){background:linear-gradient(#ffbf26,#ff7e00);box-shadow:0 0 0 3px #ffe34d,0 0 18px #ffb800}

/* gameplay */
body[data-theme=candy] #screen-game{padding:16px}body[data-theme=candy] .game-head{position:relative;z-index:4;display:grid;grid-template-columns:94px 1fr 90px;gap:7px}body[data-theme=candy] .game-head>div:first-child{text-align:center;padding:7px 9px;border-radius:18px;background:#fff;box-shadow:0 0 0 2px #ddd5ff}body[data-theme=candy] .game-head>div:first-child b{font-size:1.05rem}body[data-theme=candy] .meter{position:absolute;top:48px;left:90px;right:90px;height:8px;background:#dce7f2}body[data-theme=candy] .meter i{background:linear-gradient(90deg,#8a54f3,#db64ff)}body[data-theme=candy] .head-right{justify-content:flex-end;flex-direction:row-reverse}body[data-theme=candy] .head-right #score{padding:6px;border-radius:12px;background:#fff}body[data-theme=candy] .head-right #btnPause{position:absolute;left:0;top:0;width:48px;height:48px;border-radius:15px;padding:0;color:#fff;background:linear-gradient(#65dcff,#087ce7)}body[data-theme=candy] .stats-row{position:absolute;left:18px;right:18px;top:78px;z-index:5}body[data-theme=candy] .stats-row #lives{font-size:1.5rem;color:#ff3d5d}body[data-theme=candy] .field{margin-top:20px;border-bottom:0}body[data-theme=candy] .field:before{content:"";position:absolute;inset:0;background:repeating-linear-gradient(90deg,transparent 0 40px,#ffffff4f 41px 43px,transparent 44px 80px)}body[data-theme=candy] .guide{border-color:#ffffff9e}body[data-theme=candy] .judge{top:auto;bottom:12px;border-color:#fff;box-shadow:0 0 16px #fff}body[data-theme=candy] .group{min-width:82px;padding:9px 15px;border:3px solid #fff;border-radius:19px;color:#102567;background:linear-gradient(#fff,#f7f4ff);box-shadow:0 0 0 2px #a758e9,0 0 17px #d56cff,inset 0 3px 8px #fff;font-size:2rem}body[data-theme=candy] .group:nth-child(4n+2){background:#ffdc4e;box-shadow:0 0 0 2px #df9400,0 0 17px #ffd42e}body[data-theme=candy] .group:nth-child(4n+3){background:#4aeca5;box-shadow:0 0 0 2px #00aa72,0 0 17px #34eca0}body[data-theme=candy] .group.active{background:#14d9f5;box-shadow:0 0 0 3px #058fe0,0 0 22px #00c9ff}body[data-theme=candy] .judgment{top:64%;font-size:2rem;color:#fff!important;text-shadow:0 3px 0 #d139db,0 0 10px #fff}body[data-theme=candy] .keys{position:relative;z-index:4;gap:12px;padding-top:12px}body[data-theme=candy] .keys button{height:132px;border:3px solid #fff;border-radius:25px;box-shadow:0 0 0 2px currentColor,0 8px 0 color-mix(in srgb,currentColor 58%,#332052),inset 0 4px 10px #ffffffa8}body[data-theme=candy] .keys .odd{color:#ff3b62;background:linear-gradient(#ff758d,#ed174c)}body[data-theme=candy] .keys .even{color:#06b8ad;background:linear-gradient(#30e9d5,#00a79d)}body[data-theme=candy] .keys b{font-size:2rem;text-shadow:0 3px #0003}body[data-theme=candy] .keys small{font-size:.9rem}

/* boards, shop, settings */
body[data-theme=candy] .board-tabs{margin-top:2px}body[data-theme=candy] .board-tabs .tab.active,body[data-theme=candy] .board-chips button.active{background:linear-gradient(#24dcff,#0688ee);color:#fff;border-color:#fff}body[data-theme=candy] .board li{border:1px solid #cfdcf0;background:#ffffffdc;box-shadow:0 3px 7px #2562a51a}body[data-theme=candy] .board .rank:first-child{color:#ffb000}body[data-theme=candy] .board .pts{color:#073f9f}body[data-theme=candy] .shop-head{padding:12px 0}body[data-theme=candy] .shop-horns{font-size:4.6rem;transform:rotate(-13deg);text-shadow:0 4px 0 #d78800}body[data-theme=candy] .shop-title{font-size:1.65rem}body[data-theme=candy] .shop-grid{grid-template-columns:repeat(3,1fr);gap:7px}body[data-theme=candy] .shop-grid button{padding:13px 5px;border-radius:17px;background:#ffffffdb}body[data-theme=candy] .shop-grid .qty{font-size:1rem}body[data-theme=candy] .shop-grid .qty:before{content:"🎺";display:block;font-size:2.3rem}body[data-theme=candy] .shop-grid .price{width:100%;padding:6px 2px;border-radius:14px;background:linear-gradient(#fff478,#ffc724);color:#8a4700;font-size:1rem}body[data-theme=candy] .settings label{border:2px solid #dce0f2;background:#ffffffd9}body[data-theme=candy] .settings select{background:#fff}

/* pause and result overlay */
body[data-theme=candy] .overlay{background:#08245fbd;backdrop-filter:blur(4px)}body[data-theme=candy] .overlay:before{content:"";position:absolute;width:min(340px,88vw);height:440px;border:4px solid #fff;border-radius:36px;background:linear-gradient(#fff,#f1ecff);box-shadow:0 0 0 3px #d6c6ff,0 20px 45px #00194c66;z-index:-1}body[data-theme=candy] .overlay h2{color:#122f80;font-size:2.2rem}body[data-theme=candy] .overlay .record{color:#ff3d66}body[data-theme=candy] .overlay .result-score{color:#082d85;font-size:3.2rem}body[data-theme=candy] .overlay .result-stats div{border:2px solid #dce2f2;background:#fff}body[data-theme=candy] .overlay .result-stats b{color:#087ce7;font-size:1.35rem}body[data-theme=candy] .overlay .row{width:min(310px,85vw);display:grid;grid-template-columns:1fr 1fr}body[data-theme=candy] .overlay .row button{min-height:50px;border-radius:18px}body[data-theme=candy] .overlay .row .primary{color:#fff;background:linear-gradient(#42dcff,#0787eb);border-color:#fff}body[data-theme=candy] .overlay .row button:last-child{grid-column:1/-1}

@media(min-width:700px){body[data-theme=candy] .screen{height:844px}body[data-theme=candy] .overlay{max-width:390px;left:50%;transform:translateX(-50%)}}
@media(max-height:700px){body[data-theme=candy] .screen{border-radius:24px}body[data-theme=candy] .home-top{padding-top:1vh}body[data-theme=candy] .eyebrow{margin-top:48px}body[data-theme=candy] .home-top h1,body[data-theme=candy] #screen-home h1{font-size:2.5rem}body[data-theme=candy] .home-menu{gap:7px}body[data-theme=candy] .big{min-height:52px}body[data-theme=candy] .home-row{bottom:10px}body[data-theme=candy] .keys button{height:108px}}

/* Keep labels readable on the saturated candy buttons. */
body[data-theme=candy] #screen-home .home-menu>.big span,body[data-theme=candy] #screen-home .home-menu>.big small{color:#fff}
body[data-theme=candy] #screen-home .home-top:before{display:none}
body[data-theme=candy] #screen-home .eyebrow{margin-top:48px}

/* daily challenge */
.daily-refresh{width:78%;margin:2px auto 16px;padding:9px;text-align:center;border:2px solid #d7e2f4;border-radius:18px;background:#ffffffda;font-size:.86rem}.daily-list{display:grid;gap:10px}.daily-list button{display:flex;align-items:center;gap:12px;padding:13px;border-radius:18px;text-align:left;background:#ffffffdf}.daily-list i{font-style:normal;font-size:2rem}.daily-list span{flex:1}.daily-list span b,.daily-list span small{display:block}.daily-list span small{font-size:.72rem;color:var(--muted);margin-top:4px}.daily-list em{font-style:normal;font-size:.8rem}

/* ---------- Candy gameplay v3: clean hierarchy and high contrast ---------- */
body[data-theme=candy] #screen-game{padding:18px 16px 16px;background:linear-gradient(180deg,#72d6fb 0%,#c9f4ff 45%,#fff7fb 76%,#ffe5f1 100%)}
body[data-theme=candy] #screen-game .game-head{height:78px;display:block;position:relative;z-index:6}
body[data-theme=candy] #screen-game .game-head>div:first-child{position:absolute;left:50%;top:0;transform:translateX(-50%);min-width:142px;padding:8px 18px 9px;border:3px solid #fff;border-radius:24px;background:linear-gradient(#fff,#f4f0ff);box-shadow:0 0 0 2px #b9a9ee,0 5px 10px #29549e2e;text-align:center}
body[data-theme=candy] #screen-game .game-head>div:first-child b{font-size:1.18rem;color:#10266e;line-height:1.1}
body[data-theme=candy] #screen-game .game-head>div:first-child small{display:block;margin-top:3px;color:#516594;font-size:.78rem;font-weight:800}
body[data-theme=candy] #screen-game .head-right{position:static;display:block}
body[data-theme=candy] #screen-game .head-right #score{position:absolute;right:0;top:0;display:block;min-width:88px;padding:10px 10px 9px;border:3px solid #fff;border-radius:19px;background:linear-gradient(#fff,#eef6ff);box-shadow:0 0 0 2px #9bc9f0;color:#10266e;font-size:1.05rem;letter-spacing:.04em;text-align:center}
body[data-theme=candy] #screen-game .head-right #btnPause{left:0;top:0;width:54px;height:54px;border:3px solid #fff;border-radius:18px;background:linear-gradient(#65ddff,#087fe5);box-shadow:0 0 0 2px #178edc,0 6px 0 #1265b6,inset 0 3px 8px #ffffffaa;color:#fff;font-size:1.1rem}
body[data-theme=candy] #screen-game .meter{position:absolute;left:68px;right:104px;top:64px;height:9px;border:2px solid #fff;background:#dce9f5;box-shadow:0 0 0 1px #aac8e5}
body[data-theme=candy] #screen-game .meter i{background:linear-gradient(90deg,#7a54ee,#d363ff);box-shadow:0 0 9px #a85dff}
body[data-theme=candy] #screen-game .stats-row{position:absolute;left:22px;right:22px;top:96px;z-index:7;margin:0;align-items:center}
body[data-theme=candy] #screen-game .stats-row #lives{font-size:1.24rem;color:#ff3d61;letter-spacing:.08em;text-shadow:0 2px #fff}
body[data-theme=candy] #screen-game .stats-row #combo{padding:4px 10px;border-radius:12px;background:#ffffff99;color:#315b9d;font-size:.82rem;font-weight:900}
body[data-theme=candy] #screen-game .field{margin:13px 8px 0;border:0;overflow:hidden}
body[data-theme=candy] #screen-game .field:before{background:repeating-linear-gradient(90deg,transparent 0 52px,#ffffff4f 53px 56px,transparent 57px 106px)}
body[data-theme=candy] #screen-game .field:after{content:"";position:absolute;left:50%;bottom:2px;width:176px;height:42px;transform:translateX(-50%);border:4px solid #fff;border-radius:50%;background:radial-gradient(ellipse,#ffffff40 0 34%,#72e3ff66 36% 54%,transparent 57%);box-shadow:0 0 0 3px #8c6af0,0 0 24px #9c72ff,0 8px 22px #245fa13b}
body[data-theme=candy] #screen-game .guide{top:12px;bottom:24px;height:auto;border-left:2px solid #ffffff87}
body[data-theme=candy] #screen-game .judge{left:19%;right:19%;bottom:22px;border-top:4px solid #fff;box-shadow:0 0 13px #7ce9ff,0 0 0 2px #8767e7}
body[data-theme=candy] #screen-game .group{min-width:84px;padding:8px 15px;border:4px solid #fff;border-radius:22px;color:#132b76;background:linear-gradient(#d577ff,#8c35e3);box-shadow:0 0 0 3px #6d2cb3,0 7px 0 #51248c,0 0 20px #b76aff,inset 0 4px 9px #ffffff8f;font-size:2rem;text-shadow:0 2px #fff8}
body[data-theme=candy] #screen-game .group:nth-child(4n+2){color:#744300;background:linear-gradient(#ffe868,#ffc526);box-shadow:0 0 0 3px #dc9200,0 7px 0 #b36a00,0 0 20px #ffd42e,inset 0 4px 9px #fff9}
body[data-theme=candy] #screen-game .group:nth-child(4n+3){color:#045842;background:linear-gradient(#73f0bc,#31d990);box-shadow:0 0 0 3px #00a971,0 7px 0 #087958,0 0 20px #34eca0,inset 0 4px 9px #fff9}
body[data-theme=candy] #screen-game .group.active{color:#fff;background:linear-gradient(#46ddff,#079cde);box-shadow:0 0 0 3px #0877c9,0 7px 0 #075a9d,0 0 23px #00c9ff,inset 0 4px 10px #ffffffa8;text-shadow:0 3px 0 #0872b8}
body[data-theme=candy] #screen-game .group.active .d.next{color:#fff;text-decoration-color:#fff;text-decoration-thickness:3px}
body[data-theme=candy] #screen-game .group .d.done{opacity:.28}
body[data-theme=candy] #screen-game .keys{grid-template-columns:1fr 1fr;grid-template-rows:38px 112px;gap:11px 12px;padding:7px 6px 5px}
body[data-theme=candy] #screen-game .keys:before{content:"✦  " attr(data-hint) "  ✦";grid-column:1/-1;display:grid;place-items:center;border:2px solid #fff;border-radius:18px;background:#ffffffd9;box-shadow:0 3px 10px #366da326;color:#15347e;font-size:.86rem;font-weight:900;letter-spacing:.04em}
body[data-theme=candy] #screen-game .keys button{height:112px;border:4px solid #fff;border-radius:26px;color:#fff!important;box-shadow:0 0 0 3px currentColor,0 9px 0 #9d2850,0 13px 20px #78304f42,inset 0 5px 12px #ffffff9c}
body[data-theme=candy] #screen-game .keys .odd{background:linear-gradient(#ff7892 0%,#ff3d68 55%,#e91e50 100%);box-shadow:0 0 0 3px #ff4169,0 9px 0 #a81e48,0 13px 20px #78304f42,inset 0 5px 12px #ffffff9c}
body[data-theme=candy] #screen-game .keys .even{background:linear-gradient(#48eadc 0%,#13cbbc 55%,#00a99f 100%);box-shadow:0 0 0 3px #08bdb1,0 9px 0 #087f7a,0 13px 20px #176f7340,inset 0 5px 12px #ffffffa8}
body[data-theme=candy] #screen-game .keys b{color:#fff;font-size:2rem;line-height:1;text-shadow:0 3px 0 #0003}
body[data-theme=candy] #screen-game .keys small{margin-top:9px;color:#fff;font-size:.83rem;font-weight:900;text-shadow:0 2px 0 #0002}
@media(max-width:360px){body[data-theme=candy] #screen-game .game-head>div:first-child{min-width:125px}body[data-theme=candy] .head-right #score{min-width:78px}body[data-theme=candy] .keys b{font-size:1.7rem}}

/* Operator announcement / maintenance banner + featured shop item */
.ops-banner{position:relative;z-index:5;margin:0 13px 12px;display:flex;text-align:start;align-items:flex-start;gap:10px;padding:10px 12px 10px 16px;border-radius:16px;background:var(--card);color:var(--ink);border:1px solid var(--line);box-shadow:0 8px 24px #0002;font-size:.88rem;line-height:1.45}
.ops-banner[hidden]{display:none}
.ops-banner span{flex:1;white-space:pre-line;overflow-wrap:anywhere}
.ops-banner button{flex:none;border:0;background:transparent;color:var(--muted);font-size:1.2rem;line-height:1;padding:2px 4px;box-shadow:none;min-height:0}
.ops-banner.maint{background:#fff4e5;color:#8a4b00;border-color:#ffc98a}
.ops-banner.pulse{animation:ops-pulse .5s ease 2}
@keyframes ops-pulse{50%{transform:scale(1.04)}}
.shop-grid button{position:relative}
.shop-grid button.featured{outline:3px solid var(--even);outline-offset:-3px}
.shop-grid .badge{position:absolute;top:6px;inset-inline-end:6px;padding:2px 7px;border-radius:9px;background:var(--even);color:#fff;font-size:.66rem;font-style:normal;font-weight:800}

.daily-list button[hidden]{display:none}.daily-note{margin:18px 8px 0;font-size:.78rem;line-height:1.5}
/* Candy home: bottom row sits in normal flow (was absolute) so four mode buttons plus the
   operator banner can never overlap it on short screens; the screen scrolls instead of clipping. */
body[data-theme=candy] #screen-home{overflow-y:auto}
body[data-theme=candy] #screen-home .home-menu{flex:1 0 auto}
body[data-theme=candy] #screen-home .home-row{position:static;margin:auto 15px 6px;padding-top:12px}
@media(max-height:760px){body[data-theme=candy] #screen-home .home-menu>.big{min-height:0;padding-top:.55rem;padding-bottom:.55rem}body[data-theme=candy] #screen-home .home-menu>.big span{font-size:1.3rem}body[data-theme=candy] #screen-home .home-row button{min-height:58px}body[data-theme=candy] #screen-home .home-row button:before{font-size:24px;margin-bottom:2px}}
/* Global board: report / hide a nickname (UGC policy) */
.board .report{flex:none;min-width:0;min-height:0;width:34px;height:34px;padding:0;margin-inline-start:-4px;border:0;border-radius:10px;background:transparent;box-shadow:none;color:var(--muted);font-size:1rem;line-height:1;opacity:.55}
.board .report:hover,.board .report:focus-visible{opacity:1;background:#0000000d}
.board-toast{margin:0 0 8px;padding:8px;font-size:.82rem}
.nowrap{white-space:nowrap}
