@font-face{font-family:Manrope;src:url(assets/fonts/manrope-400.ttf);font-weight:400;font-display:swap}
@font-face{font-family:Manrope;src:url(assets/fonts/manrope-600.ttf);font-weight:600;font-display:swap}
@font-face{font-family:Manrope;src:url(assets/fonts/manrope-700.ttf);font-weight:700;font-display:swap}
:root{color-scheme:dark;--bg:#171727;--panel:#242437;--muted:#a6a5bb;--accent:#a691fa;--nav:78px;font-family:Manrope,system-ui,sans-serif}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
body{background:radial-gradient(ellipse at 50% 5%,#34304d 0%,#1c1c30 37%,#141421 100%);margin:0;min-height:100vh;color:#f4f3fc;font-size:16px}
[hidden]{display:none!important}button{font:inherit;color:inherit;border:none;cursor:pointer;background:none;padding:0;touch-action:manipulation}button:focus-visible{outline:2px solid #c6b8ff;outline-offset:2px}button:disabled{opacity:.35;cursor:default}
svg{width:24px;height:24px;display:block;stroke:currentColor;fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
h1,h2,p{margin:0}small{font-size:11px;letter-spacing:1.3px;font-weight:700;color:#b7b2d1}strong{font-variant-numeric:tabular-nums}
#app{width:min(100%,520px);min-height:100vh;margin:auto;padding:18px 18px calc(var(--nav) + 22px + env(safe-area-inset-bottom,0px))}
header{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px;padding:2px 3px}
.brand{font-size:10px;letter-spacing:2px;color:#b8abfd;font-weight:700}.logo h1{font-size:40px;line-height:1;letter-spacing:-2.6px;font-weight:700}.logo h1 span{color:#b5a1ff}.icon-btn{display:grid;place-items:center;background:#302f45;width:45px;height:45px;border-radius:15px;color:#d9d0ff}
.stage-label{display:flex;align-items:center;justify-content:space-between;margin:12px 3px 14px}.stage-label h2{font-size:25px;letter-spacing:-.8px;line-height:1.3}.stars{color:#ffd37a;font-size:29px;letter-spacing:2px}
.stats{display:grid;grid-template-columns:1fr 1.4fr 1fr;border-radius:20px;background:#25253a;padding:15px 6px 13px;text-align:center}.stats>div{display:flex;flex-direction:column;justify-content:center;gap:3px}.stats strong{font-size:27px;letter-spacing:-1px}.stats .score strong{font-size:30px;color:#d3c7ff}.stats small{font-size:10px;letter-spacing:1.2px}
.goalbar{height:7px;margin:9px 4px 13px;border-radius:20px;overflow:hidden;background:#34324a}.goalbar span{display:block;height:100%;background:linear-gradient(90deg,#8479ff,#a98cfb,#e0c4ff);border-radius:20px;transition:width .3s;width:0}.collect{display:flex;align-items:center;gap:8px;font-size:13px;color:#d9d3ef;margin:0 5px 9px}.collect img{width:29px;height:29px;object-fit:contain}
.board-wrap{position:relative;margin-top:9px;padding:7px;background:#222136;border-radius:23px;box-shadow:0 14px 38px #0d0c1c80}
.board{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:3px;touch-action:none;user-select:none;-webkit-user-select:none}
.tile{aspect-ratio:1;position:relative;display:grid;place-items:center;border-radius:8px;background:#2b2a40;touch-action:none;overflow:visible}
.tile:nth-child(odd){background:#2e2d43}
.tile img{display:block;width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 3px 2px #0e0e2070);pointer-events:none;transition:transform .12s,opacity .12s;will-change:transform}
.tile.selected{background:#58507c;box-shadow:inset 0 0 0 2px #b9a9ff}
.tile.hinted{background:#5e5279;animation:pulse .8s ease infinite alternate}
.tile.cleared img{transform:scale(1.4);opacity:0}.tile.dropped img{animation:drop .20s ease-out}
@keyframes drop{from{transform:translateY(-45%) scale(.85);opacity:.4}to{transform:translateY(0) scale(1);opacity:1}}
@keyframes pulse{to{background:#786b9b}}
#combo{position:absolute;left:50%;top:43%;transform:translate(-50%,-50%);pointer-events:none;white-space:nowrap;font-size:30px;font-weight:700;text-shadow:0 3px 7px #171328;color:#ffe3a0;opacity:0;z-index:2}
#combo.show{animation:combo .7s ease-out}@keyframes combo{0%{opacity:0;transform:translate(-50%,-34%) scale(.85)}30%{opacity:1;transform:translate(-50%,-50%) scale(1.1)}75%{opacity:1}100%{opacity:0;transform:translate(-50%,-68%)}}
.controls{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin:17px 0 12px}.control{display:flex;gap:7px;align-items:center;justify-content:center;background:#2a293d;padding:13px 9px;border-radius:15px;font-size:12px;font-weight:700;color:#e5e0fa;min-height:45px}.control svg{width:19px;height:19px;color:#b7aafc}.control b{display:inline-grid;place-items:center;background:#433d60;color:#e0d7ff;border-radius:7px;min-width:16px;padding:2px}.instruction{text-align:center;color:var(--muted);font-size:12px}
nav{position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:min(100%,520px);display:grid;grid-template-columns:repeat(3,1fr);background:#1e1d2d;padding:8px 12px calc(8px + env(safe-area-inset-bottom,0px));height:calc(var(--nav) + env(safe-area-inset-bottom,0px));z-index:10;border-radius:23px 23px 0 0}nav button{display:flex;align-items:center;flex-direction:column;justify-content:center;gap:5px;color:#9b99b1;font-size:12px;font-weight:700;border-radius:15px}nav button.active{color:#d7caff;background:#302c46}nav button svg{width:23px;height:23px}
.level-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:9px;margin:16px 0}.level-tile{display:grid;place-items:center;align-content:center;gap:3px;aspect-ratio:1;background:#33304a;border-radius:14px;font-size:20px;font-weight:700}.level-tile small{font-size:12px;color:#f8d58b;letter-spacing:0}.level-tile.current{background:#7161c6}.level-tile:disabled{background:#25253a;opacity:.55}.page-controls{display:flex;justify-content:space-between;align-items:center;gap:8px;font-size:12px;color:var(--muted);margin:12px 0}
.period{display:flex;gap:5px;background:#232237;border-radius:15px;padding:5px;margin:18px 0}.period button{flex:1;padding:11px 3px;border-radius:11px;font-size:11px;font-weight:700;color:#b7b4ca}.period button.active{background:#5a4d91;color:#fff}
.trophy{color:#ffd37a}.trophy svg{width:34px;height:34px}.leader{display:grid;grid-template-columns:28px 46px 1fr auto;align-items:center;gap:10px;padding:12px;margin:6px 0;background:#25243a;border-radius:15px}.leader.me{background:#413863}.avatar{display:grid;place-items:center;border-radius:14px;width:42px;height:42px;background:#494263;color:#f4ecff;font-size:17px;font-weight:700}.leader .name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:700}.leader small{display:block;letter-spacing:0;font-weight:400;color:var(--muted);margin-top:3px}.my-rank{font-size:13px;padding:15px 5px;color:#d2c8fa}.podium{display:flex;align-items:end;gap:8px;margin:15px 0}.podium-person{flex:1;min-width:0;border-radius:18px;background:#36314e;padding:15px 5px;text-align:center;display:grid;justify-items:center;gap:5px}.podium-person:first-child{background:linear-gradient(#645087,#413755);padding:23px 5px}.podium-person b{font-size:13px;max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.podium-person strong{font-size:16px;color:#ffe6a9}.podium-person .avatar{width:46px;height:46px}.empty{padding:22px;text-align:center;color:#aca9c1;font-size:14px}
.gate{display:grid;place-items:center;align-content:center;min-height:100vh;padding:30px;text-align:center;gap:12px}.gate h1{font-size:65px;letter-spacing:-4px}.gate p{color:#bfbad4;max-width:300px;line-height:1.5}.gate-art{display:flex;align-items:center;justify-content:center}.gate-art img{width:104px;max-width:30vw;margin:-8px;filter:drop-shadow(0 11px 15px #100e1b)}.gate-art img:nth-child(2){width:135px;max-width:35vw}
#notice{position:fixed;left:50%;bottom:calc(var(--nav) + 14px);transform:translateX(-50%);padding:12px 18px;background:#43405c;color:white;border-radius:14px;z-index:40;max-width:90%;width:max-content;font-size:14px;box-shadow:0 10px 20px #11112570}
.modal{position:fixed;inset:0;background:#101020bb;display:grid;place-items:center;z-index:50;padding:20px}.modal-card{width:min(100%,380px);background:#2b2940;padding:26px;border-radius:26px;text-align:center;box-shadow:0 20px 80px #0b0b17}.modal-card h2{font-size:27px;margin:8px 0}.modal-card p{color:#c2bed2;line-height:1.5;margin:10px 0 20px}.modal-card img{width:95px;height:95px;object-fit:contain}.modal-card .primary{background:#a08af3;color:#161324;padding:14px 18px;border-radius:14px;font-weight:700;width:100%;margin:4px 0}.modal-card .secondary{padding:12px;width:100%;color:#c9c3e1;font-size:14px}
@media(max-width:370px){#app{padding:12px 10px calc(var(--nav) + 16px)}header{margin-bottom:12px}.logo h1{font-size:35px}.board-wrap{padding:5px}.board{gap:2px}.control{font-size:11px;padding:10px 5px}}
@media(min-width:600px){#app{padding-top:28px}.board-wrap{max-width:460px;margin-inline:auto}}
@media(prefers-reduced-motion:reduce){.tile img,.tile.hinted,.tile.dropped img,#combo.show{animation:none;transition:none}}

/* Keep controls visible in compact QIUT WebView windows. */
.tile{aspect-ratio:auto;min-width:0;min-height:0}
.tile::before{content:"";display:block;padding-top:100%;width:100%}
.tile img{position:absolute;inset:0}
.level-tile small svg{width:15px;height:15px}
@media(max-height:850px){
  #app{padding-top:12px;padding-bottom:calc(var(--nav) + 12px + env(safe-area-inset-bottom,0px))}
  header{margin-bottom:9px}
  .logo h1{font-size:34px}
  .stage-label{margin:8px 3px 9px}
  .stats{padding:9px 6px}
  .stats strong{font-size:24px}
  .stats .score strong{font-size:26px}
  .goalbar{margin:7px 4px 8px}
  .controls{margin:11px 0 7px}
  .control{min-height:42px;padding:10px 6px}
}
@media(max-height:710px){
  .board-wrap{max-width:calc(100vh - 310px);min-width:min(100%,270px);margin-inline:auto}
  .stage-label h2{font-size:22px}
  .instruction{display:none}
}
