* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: #1b2a41; overflow: hidden; font-family: 'Fredoka', sans-serif; color: #fff; touch-action: none; user-select: none; }
body { display: flex; align-items: center; justify-content: center; }

#stage {
    position: relative; width: min(100vw, calc(100vh * 16 / 9)); aspect-ratio: 16 / 9;
    container-type: size; overflow: hidden; background: #87ceeb;
}
#view { width: 100%; height: 100%; display: block; touch-action: none; }

.back-home, .mute-btn {
    position: fixed; top: 8px; z-index: 50; background: rgba(0,0,0,.45); color: #fff;
    border: 0; border-radius: 20px; padding: 6px 12px; font: 700 14px 'Fredoka', sans-serif; text-decoration: none; cursor: pointer;
}
.back-home { left: 8px; }
.mute-btn { right: 8px; }

.hud { position: absolute; inset: 0; pointer-events: none; display: none; }
.hud.show { display: block; }
.hud-box {
    position: absolute; background: rgba(0,0,0,.45); border-radius: 1.2cqw; padding: .4cqw 1.4cqw;
    text-align: center; font-family: 'Lilita One', sans-serif; line-height: 1.1;
}
.hud-box small { display: block; font-size: 1.2cqw; opacity: .8; }
.hud-box b { font-size: 2.6cqw; font-weight: 400; }
.hud-box:nth-child(1) { left: 1.5cqw; top: 3.5cqw; }
.hud-box.score { left: 50%; transform: translateX(-50%); top: 1.2cqw; min-width: 14cqw; }
.hud-box:nth-child(3) { left: 1.5cqw; top: 9.8cqw; }
.hud-btns { position: absolute; right: 1.5cqw; top: 3.5cqw; display: flex; gap: 1cqw; pointer-events: auto; }
.hud-btns button {
    width: 4.6cqw; height: 4.6cqw; border-radius: 50%; border: 0; background: rgba(0,0,0,.5); color: #fff;
    font-size: 2.4cqw; cursor: pointer;
}
.hud-hint {
    position: absolute; bottom: 2cqw; left: 50%; transform: translateX(-50%); font: 700 2cqw 'Fredoka', sans-serif;
    background: rgba(0,0,0,.45); padding: .4cqw 1.6cqw; border-radius: 2cqw; opacity: 0; transition: opacity .3s; white-space: nowrap;
}
.hud-hint.show { opacity: 1; }

.overlay {
    position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center;
    gap: 1.8cqw; background: radial-gradient(circle at 50% 40%, rgba(135,206,235,.93), rgba(40,90,140,.97));
    text-align: center; padding: 2cqw;
}
.overlay.show { display: flex; }
.logo-small { font: 700 2cqw 'Fredoka', sans-serif; letter-spacing: .3cqw; color: #fffc; }
.logo h1 {
    font: 400 9cqw 'Lilita One', sans-serif; color: #fff; line-height: 1;
    text-shadow: 0 .6cqw 0 #b71c1c, 0 1.2cqw 2cqw rgba(0,0,0,.4); -webkit-text-stroke: .25cqw #7a1010;
}
.logo h1 span { color: #ff4a3d; }
.title-tags { font-size: 5cqw; display: flex; gap: 2cqw; }
.title-tags span { animation: bob 1.6s ease-in-out infinite; }
.title-tags span:nth-child(2) { animation-delay: .2s; } .title-tags span:nth-child(3) { animation-delay: .4s; } .title-tags span:nth-child(4) { animation-delay: .6s; }
@keyframes bob { 50% { transform: translateY(-1.2cqw); } }
.help { font-size: 1.6cqw; opacity: .9; max-width: 80cqw; }
.sel-title { font: 400 5cqw 'Lilita One', sans-serif; text-shadow: 0 .4cqw 0 rgba(0,0,0,.3); }

.big-btn {
    font: 400 4cqw 'Lilita One', sans-serif; color: #fff; background: linear-gradient(#ff6a4d, #d32f2f); border: .35cqw solid #fff;
    border-radius: 3cqw; padding: .8cqw 5cqw; cursor: pointer; box-shadow: 0 .7cqw 0 #8e1b1b; transition: transform .1s;
}
.big-btn:active { transform: translateY(.5cqw); box-shadow: 0 .2cqw 0 #8e1b1b; }
.big-btn.mini { font-size: 2.6cqw; padding: .6cqw 3cqw; }
.big-btn[hidden] { display: none; }
.small-btn {
    font: 700 2.2cqw 'Fredoka', sans-serif; color: #fff; background: rgba(0,0,0,.4); border: .2cqw solid #fff8;
    border-radius: 2cqw; padding: .6cqw 2.6cqw; cursor: pointer;
}

.level-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1.3cqw; }
.lvl {
    width: 9.5cqw; height: 9.5cqw; border-radius: 1.6cqw; border: .25cqw solid #fff; cursor: pointer; color: #fff;
    background: linear-gradient(#ffb84d, #f57c00); font: 400 3.4cqw 'Lilita One', sans-serif; line-height: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 .5cqw 0 #a14f00;
}
.lvl small { font-size: 1.5cqw; letter-spacing: .1cqw; margin-top: .3cqw; }
.lvl.boss { background: linear-gradient(#b968ff, #6a1b9a); box-shadow: 0 .5cqw 0 #3d0f5a; }
.lvl.locked { background: #667; box-shadow: 0 .5cqw 0 #334; cursor: not-allowed; opacity: .75; }

.stars { font-size: 8cqw; letter-spacing: 1cqw; }
.stars .off { filter: grayscale(1) brightness(.5); }
.stars span { display: inline-block; animation: pop .5s both; }
.stars span:nth-child(2) { animation-delay: .25s; } .stars span:nth-child(3) { animation-delay: .5s; }
@keyframes pop { from { transform: scale(0) rotate(-90deg); } }
.end-score { font: 400 3.6cqw 'Lilita One', sans-serif; }
.end-msg { font-size: 2cqw; font-weight: 700; max-width: 70cqw; }
.end-btns { display: flex; gap: 2cqw; align-items: center; }

#rotate-hint {
    display: none; position: fixed; inset: 0; z-index: 100; background: #1b2a41; flex-direction: column;
    align-items: center; justify-content: center; gap: 12px; text-align: center;
}
.rotate-phone { font-size: 64px; animation: rot 1.8s ease-in-out infinite; }
@keyframes rot { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-90deg); } }
@media (orientation: portrait) and (max-width: 700px) { #rotate-hint { display: flex; } }
