@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&display=swap');

:root {
    --bg1: #0754ed;
    --bg2: #0878ff;
    --ink: #fff;
    --gold: #ffd52f;
    --cyan: #42d9ff;
    --blue: #0878ff;
    --deep: #0638b5;
    --green: #14df45;
    --purple: #9747ff;
    box-sizing: border-box
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none
}

html,
body {
    height: 100%;
    width: 100%;
    margin: 0;
    overflow: hidden;
    font-family: Fredoka, 'Trebuchet MS', system-ui, sans-serif;
    color: var(--ink);
    background: #0754ed
}

body {
    background: radial-gradient(ellipse at 25% 10%, #168cff 0%, transparent 42%), radial-gradient(ellipse at 80% 80%, #1637bf 0%, transparent 50%), linear-gradient(145deg, #0879ff, #0640cc 70%, #082d9b);
    padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0)
}

body:before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .16;
    background-image: linear-gradient(135deg, transparent 48%, #66dfff 49%, transparent 51%), radial-gradient(circle at 15% 30%, #fff 0 2px, transparent 3px), radial-gradient(circle at 85% 20%, #fff 0 2px, transparent 3px);
    background-size: 180px 180px, 110px 110px, 150px 150px
}

button {
    font: inherit;
    color: inherit;
    border: 0;
    cursor: pointer;
    touch-action: manipulation
}

.scr {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 14px 14px 12px;
    padding-top: calc(14px + env(safe-area-inset-top, 0px));
    isolation: isolate
}

.scr.on {
    display: flex
}

.btn {
    background: linear-gradient(180deg, #ffe65c 0%, #ffb900 100%);
    color: #593300;
    font-weight: 700;
    font-size: 21px;
    padding: 11px 26px;
    border: 2px solid #fff8;
    border-radius: 18px;
    box-shadow: inset 0 2px 0 #fff9, 0 5px 0 #b56b00, 0 9px 16px #001d6a66;
    transition: transform .08s, filter .15s;
    min-width: 180px;
    text-shadow: 0 1px #fff6
}

.btn:active {
    transform: translateY(4px);
    box-shadow: inset 0 2px 0 #fff9, 0 1px 0 #b56b00
}

.btn.b {
    background: linear-gradient(180deg, #55cfff, #0876ff 75%);
    color: #fff;
    border-color: #8eeaff;
    box-shadow: inset 0 2px 0 #fff8, 0 5px 0 #0645ba, 0 9px 16px #001d6a66;
    text-shadow: 0 2px 2px #00358b
}

.btn.b:active {
    box-shadow: inset 0 2px 0 #fff8, 0 1px 0 #0645ba
}

.btn.g {
    background: linear-gradient(180deg, #68ff71, #08c735);
    color: #fff;
    border-color: #b9ffc0;
    box-shadow: inset 0 2px 0 #fff9, 0 5px 0 #078b29, 0 9px 16px #001d6a66;
    text-shadow: 0 2px 2px #087c25
}

.sm {
    min-width: 0;
    font-size: 16px;
    padding: 8px 14px;
    border-radius: 15px;
    white-space: nowrap
}

#load {
    justify-content: center;
    gap: 22px;
    background: radial-gradient(circle at 50% 35%, #168fff, #0750d9 60%, #062d9d)
}

#load>div[style*="font-size:30px"] {
    font-size: clamp(32px, 6vw, 56px) !important;
    font-weight: 700;
    letter-spacing: .5px;
    text-shadow: 0 4px 0 #06349a, 0 8px 18px #001c75aa
}

.logo {
    display: grid;
    grid-template-columns: repeat(3, 42px);
    gap: 5px
}

.logo i {
    height: 42px;
    border-radius: 10px;
    background: linear-gradient(145deg, #fff, #d9eaff);
    box-shadow: inset 0 -5px 0 #8eaee8, inset 0 3px 0 #fff, 0 5px 0 #0644bb;
    animation: drop 1.2s infinite both
}

.logo i:nth-child(3n+1) {
    background: linear-gradient(145deg, #fff, #dce6ff)
}

.logo i:nth-child(3n+2) {
    background: linear-gradient(145deg, #d4a5ff, #803cff)
}

.logo i:nth-child(3n) {
    background: linear-gradient(145deg, #6bf2ff, #00a9ed)
}

@keyframes drop {
    0% {
        transform: translateY(-70px) scale(.6);
        opacity: 0
    }

    40%,
    100% {
        transform: translateY(0);
        opacity: 1
    }
}

.bar {
    width: min(280px, 72vw);
    height: 16px;
    border-radius: 12px;
    background: #002a9d;
    padding: 3px;
    box-shadow: inset 0 2px 4px #00185c
}

.bar b {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 9px;
    background: linear-gradient(90deg, #53f4ff, #61ff74, #ffe34d);
    transition: width .2s
}

#home {
    justify-content: center;
    gap: 14px
}

h1 {
    font-size: clamp(46px, 8vw, 72px);
    line-height: .98;
    margin: 0 0 14px;
    text-align: center;
    font-weight: 700;
    letter-spacing: -1px;
    color: #ffe333;
    -webkit-text-stroke: 1px #fff6;
    text-shadow: 0 4px 0 #ff8a00, 0 8px 0 #063cba, 0 12px 18px #001c78aa
}

h1 span {
    display: inline-block;
    animation: bob 2.4s ease-in-out infinite
}

@keyframes bob {
    50% {
        transform: translateY(-7px) rotate(-2deg)
    }
}

.float {
    position: absolute;
    border-radius: 12px;
    opacity: .22;
    animation: fl linear infinite;
    pointer-events: none;
    box-shadow: inset 0 3px 0 #fff8, inset 0 -5px 0 #001c6a55
}

@keyframes fl {
    from {
        transform: translateY(110vh) rotate(0)
    }

    to {
        transform: translateY(-20vh) rotate(360deg)
    }
}

.pill {
    background: linear-gradient(180deg, #143b9c, #082976);
    border: 2px solid #3c8dff;
    border-radius: 22px;
    padding: 5px 13px;
    font-size: 17px;
    font-weight: 700;
    display: flex;
    gap: 7px;
    align-items: center;
    box-shadow: inset 0 2px 0 #fff2, 0 3px 8px #001e7066;
    white-space: nowrap
}

.pill.low {
    animation: pulse .5s infinite alternate;
    background: #a02a2a;
    border-color: #ff7a7a
}

@keyframes pulse {
    to {
        transform: scale(1.06)
    }
}

.hud {
    display: flex;
    width: 100%;
    max-width: 650px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0
}

.ib {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffe45a, #ffb600);
    border: 2px solid #fff8;
    box-shadow: inset 0 2px 0 #fff9, 0 4px 0 #b56b00, 0 5px 10px #001d6a66;
    font-size: 20px;
    color: #593300;
    font-weight: 700
}

.coin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 25%, #fff17e, #ffbd00 65%, #f08a00);
    border: 2px solid #ffec80;
    text-align: center;
    line-height: 18px;
    font-size: 13px;
    color: #8a4b00;
    box-shadow: 0 2px 0 #a95e00
}

.info {
    margin-top: 10px;
    width: 100%;
    max-width: 650px;
    display: flex;
    border-radius: 17px;
    overflow: hidden;
    border: 3px solid #78ff9a;
    background: linear-gradient(120deg, #19d94c, #08ad32);
    box-shadow: inset 0 2px 0 #fff8, 0 7px 14px #001d6c88;
    flex-shrink: 0
}

.info.Easy {
    background: linear-gradient(120deg, #1fe451, #079d2c);
    border-color: #8dff9d
}

.info.Hard {
    background: linear-gradient(120deg, #ff6e62, #d72c46);
    border-color: #ffaaa4
}

.info.Super {
    background: linear-gradient(120deg, #b568ff, #6b2be7);
    border-color: #d8b3ff
}

.lv {
    width: 100px;
    flex-shrink: 0;
    padding: 9px 7px;
    text-align: center;
    font-weight: 700;
    font-size: 19px;
    line-height: 1.1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center
}

.lv small {
    background: #006d25aa;
    border-radius: 10px;
    padding: 4px 9px;
    font-size: 12px;
    opacity: .98
}

.tg {
    flex: 1;
    min-width: 0;
    padding: 5px 8px
}

.tg>b {
    display: block;
    text-align: center;
    font-size: 19px;
    line-height: 1.1;
    text-shadow: 0 2px 0 #007326
}

.tl {
    background: #00621fa8;
    border: 1px solid #ffffff22;
    border-radius: 12px;
    min-height: 48px;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    padding: 5px;
    flex-wrap: wrap
}

.ts {
    position: relative;
    display: grid;
    gap: 2px;
    transition: .3s
}

.ts i {
    background: linear-gradient(145deg, #6df6ff, #00b8ec);
    border: 1px solid #8bf6ff;
    border-radius: 3px;
    box-shadow: inset 0 -2px 0 #007ebd66, 0 1px 2px #003d6b66
}

.ts.done {
    opacity: .28;
    transform: scale(.85)
}

.ts em {
    position: absolute;
    right: -12px;
    top: -9px;
    font-style: normal;
    background: var(--gold);
    color: #5a3500;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 700;
    padding: 0 5px
}

#stage {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: hidden
}

#board {
    position: relative;
    touch-action: none;
    filter: drop-shadow(0 7px 5px #001b5a55)
}

.u {
    position: absolute;
    background: linear-gradient(145deg, #d4c9ff, #a9a0f4);
    border-radius: 9px;
    box-shadow: inset 0 2px 0 #fff9, 0 2px 0 #5d50ba
}

.c {
    position: absolute;
    border-radius: 9px;
    background: linear-gradient(145deg, #fff 0%, #f3f6ff 55%, #dce4f7 100%);
    border: 2px solid #d6e5ff;
    box-shadow: inset 0 2px 0 #fff, inset 0 -4px 0 #b6c8eb, 0 2px 0 #4770bf, 0 4px 6px #001b5a55;
    transition: filter .15s, transform .15s
}

.c.sel {
    outline: 3px solid #62ff78;
    outline-offset: -3px;
    background: linear-gradient(145deg, #edfff0, #a6ffb4)
}

.c.d {
    background: linear-gradient(145deg, color-mix(in srgb, var(--c) 55%, #fff), var(--c));
    border-color: #d8c6ff;
    box-shadow: inset 0 2px 0 #fff9, inset 0 -5px 0 #32107855, 0 2px 0 #4e2bb0, 0 4px 6px #001b5a55
}

.c.pop {
    animation: pop .45s cubic-bezier(.3, 1.6, .5, 1) both
}

@keyframes pop {
    0% {
        transform: scale(.3);
        filter: brightness(2)
    }

    100% {
        transform: scale(1)
    }
}

#board.shake {
    animation: shake .35s
}

@keyframes shake {
    25% {
        transform: translateX(-8px)
    }

    75% {
        transform: translateX(8px)
    }
}

.tools {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 4px;
    flex-shrink: 0
}

.tools .btn {
    font-size: 14px;
    padding: 8px 13px;
    border-radius: 15px
}

.need {
    animation: pulse .5s infinite alternate;
    outline: 3px solid #ffd75e
}

.tip {
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    opacity: 1;
    text-shadow: 0 2px 2px #002d91;
    margin: 7px 0 0;
    min-height: 22px;
    flex-shrink: 0
}

#toast {
    color: #ffe56b !important
}

#lvls h2 {
    font-size: 36px;
    margin: 6px 0 14px;
    text-shadow: 0 3px 0 #063cba
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 420px;
    overflow: auto;
    padding: 6px
}

.lb {
    aspect-ratio: 1;
    border-radius: 16px;
    background: linear-gradient(180deg, #55cfff, #0876ff);
    border: 2px solid #8eeaff;
    box-shadow: inset 0 2px 0 #fff8, 0 5px 0 #0645ba;
    font-size: 26px;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0
}

.lb.lock {
    background: #536aab;
    box-shadow: 0 5px 0 #34457a;
    opacity: .75
}

.lb small {
    font-size: 13px;
    letter-spacing: 1px;
    color: var(--gold);
    min-height: 16px
}

.m {
    position: absolute;
    inset: 0;
    background: #00164dcc;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9;
    padding: 20px;
    backdrop-filter: blur(5px)
}

.m.on {
    display: flex
}

.card {
    background: linear-gradient(145deg, #168bff, #0640c5 75%);
    border: 3px solid #6fe7ff;
    border-radius: 26px;
    padding: 22px 20px;
    width: 100%;
    max-width: 390px;
    text-align: center;
    box-shadow: inset 0 2px 0 #fff7, 0 14px 40px #00113e99;
    animation: in .35s cubic-bezier(.3, 1.5, .5, 1)
}

@keyframes in {
    from {
        transform: scale(.75);
        opacity: 0
    }

    to {
        transform: scale(1);
        opacity: 1
    }
}

.card h3 {
    font-size: 32px;
    margin: 0 0 10px;
    color: #ffe24a;
    text-shadow: 0 3px 0 #0742b0
}

.card p {
    font-size: 17px;
    margin: 7px 0;
    line-height: 1.35;
    text-align: left
}

.card .row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    margin-top: 16px
}

.stars {
    font-size: 50px;
    letter-spacing: 4px
}

.stars s {
    text-decoration: none;
    display: inline-block;
    filter: grayscale(1) brightness(.6)
}

.stars s.y {
    filter: none;
    animation: st .6s both
}

@keyframes st {
    0% {
        transform: scale(0) rotate(-90deg)
    }

    70% {
        transform: scale(1.3) rotate(10deg)
    }

    100% {
        transform: scale(1)
    }
}

.demo {
    display: grid;
    grid-template-columns: repeat(4, 34px);
    gap: 4px;
    justify-content: center;
    margin: 10px 0
}

.demo i {
    height: 34px;
    border-radius: 8px;
    background: linear-gradient(145deg, #fff, #dce6ff);
    box-shadow: inset 0 -3px 0 #9db9e7;
    animation: dm 3s infinite
}

.demo i.b {
    background: linear-gradient(145deg, #d7a4ff, #853cff)
}

.demo i.c2 {
    background: linear-gradient(145deg, #72f4ff, #00a8e5)
}

.demo i.d2 {
    background: linear-gradient(145deg, #c5ff7d, #5bcf1a)
}

@keyframes dm {

    25%,
    70% {
        filter: brightness(1.2);
        transform: scale(1.06)
    }

    85%,
    100% {
        transform: none
    }
}

#fx {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 20
}

@media(min-width:700px) {
    .scr#game {
        padding: 16px 24px 14px
    }

    .hud,
    .info {
        max-width: 680px
    }

    .info {
        margin-top: 12px
    }

    .lv {
        width: 115px
    }

    .tl {
        min-height: 54px
    }

    .tip {
        font-size: 16px
    }

    .tools {
        gap: 14px
    }

    .tools .btn {
        font-size: 16px;
        padding: 9px 18px
    }
}

@media(max-height:620px) {
    .scr {
        padding-top: calc(7px + env(safe-area-inset-top, 0px));
        padding-bottom: 5px
    }

    .info {
        margin-top: 5px
    }

    .lv {
        padding: 5px
    }

    .tl {
        min-height: 38px
    }

    .tools .btn {
        padding: 6px 10px;
        font-size: 13px
    }

    .tip {
        font-size: 13px;
        margin-top: 3px;
        min-height: 18px
    }

    .ib {
        width: 36px;
        height: 36px
    }

    .pill {
        font-size: 15px;
        padding: 4px 10px
    }
}

@media(max-width:380px) {
    .scr {
        padding-left: 9px;
        padding-right: 9px
    }

    .lv {
        width: 78px;
        font-size: 16px
    }

    .tg>b {
        font-size: 17px
    }

    .tl {
        gap: 6px;
        padding: 4px
    }

    .tools {
        gap: 6px
    }

    .tools .btn {
        font-size: 12px;
        padding: 7px 9px
    }

    .pill {
        font-size: 14px;
        padding: 4px 8px
    }

    .ib {
        width: 36px;
        height: 36px
    }
}

@media(prefers-reduced-motion:reduce) {

    *,
    *:before,
    *:after {
        animation-duration: .01s !important;
        transition-duration: .01s !important
    }
}