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

:root {
    --bg-warm: #fdf1e7;
    --bg-soft: #fef8f3;
    --card-bg: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.62);
    --glass-border: rgba(255, 255, 255, 0.75);
    --ui-dark: #3d3a37;
    --ui-darker: #211f1d;
    --accent-gold: #f5a623;
    --accent-gold-2: #ffcb6b;
    --accent-coral: #ff6b6b;
    --accent-teal: #2fb8a6;
    --accent-indigo: #6c7ae0;
    --shadow-sm: 0 2px 8px rgba(61, 46, 20, 0.08);
    --shadow-md: 0 10px 26px rgba(61, 46, 20, 0.12);
    --shadow-lg: 0 20px 50px rgba(61, 46, 20, 0.18);
    --radius-sm: 14px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --radius-xl: 36px;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body,
html {
    width: 100%;
    height: 100%;

    background:
        linear-gradient(rgba(28, 19, 82, 0.25), rgba(28, 19, 82, 0.25)),
        url('bg.png') center center / cover no-repeat;

    font-family: 'Outfit', 'Nunito', sans-serif;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* Subtle animated background orbs */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.4;
    filter: blur(80px);
    animation: orbFloat 12s ease-in-out infinite;
}

body::before {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #ffd4b8, #ffb37a 70%);
    top: -80px;
    left: -60px;
}

body::after {
    width: 260px;
    height: 260px;
    background: radial-gradient(circle, #c8daf8, #93b3ec 70%);
    bottom: -70px;
    right: -50px;
    animation-delay: -6s;
}

@keyframes orbFloat {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(30px, -25px) scale(1.15);
    }

    50% {
        transform: translate(-15px, 20px) scale(0.9);
    }

    75% {
        transform: translate(-25px, -15px) scale(1.1);
    }
}

/* Extra floating sparkle layer */
.bg-sparkle {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle, rgba(245, 166, 35, 0.35) 1.5px, transparent 1.5px),
        radial-gradient(circle, rgba(108, 122, 224, 0.25) 1.5px, transparent 1.5px);
    background-size: 90px 90px, 130px 130px;
    background-position: 0 0, 40px 60px;
    opacity: 0.5;
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 520px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 16px;
    z-index: 1;
    gap: 12px;
}

/* ── HUD ──────────────────────────── */
#hud {
    display: flex;
    align-items: center;
    gap: 14px;
    z-index: 5;
    flex-shrink: 0;
}

.pill {
    background: linear-gradient(145deg, #4a453f, var(--ui-darker));
    color: #fff;
    padding: 9px 22px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.4px;
    font-family: 'Outfit', sans-serif;
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 -2px 4px rgba(0, 0, 0, 0.25);
    transition: var(--transition-fast);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 7px;
}

#level-display {
    background: linear-gradient(145deg, #6c7ae0, #4d5ac9);
}

#level-display::before {
    content: '🎮';
    font-size: 0.95em;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}

#timer {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.15rem;
    padding: 10px 22px;
    min-width: 90px;
    text-align: center;
    justify-content: center;
    background: linear-gradient(145deg, #4a4540, #211f1d);
    transition: background 0.3s, transform 0.3s, box-shadow 0.3s;
}

#timer::before {
    content: '⏱️';
    font-size: 0.85em;
}

#timer.warning {
    background: linear-gradient(145deg, #ff7b6b, #c0392b);
    animation: pulseWarning 0.6s ease-in-out infinite;
    box-shadow: 0 0 22px rgba(231, 76, 60, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

@keyframes pulseWarning {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.07);
    }
}

/* ── Board wrapper ────────────────── */
.board-wrapper {
    background: linear-gradient(160deg, #f8e7d5, #efd3b6);
    padding: 12px 12px 16px 12px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), 0 2px 0 #e8ccb0 inset, 0 0 0 1px rgba(255, 255, 255, 0.4) inset;
    flex-shrink: 0;
    transition: transform 0.15s;
    position: relative;
}

.board-wrapper.shake {
    animation: boardShake 0.35s ease-out;
}

@keyframes boardShake {

    0%,
    100% {
        transform: translateX(0);
    }

    15% {
        transform: translateX(-5px);
    }

    30% {
        transform: translateX(5px);
    }

    45% {
        transform: translateX(-4px);
    }

    60% {
        transform: translateX(3px);
    }

    75% {
        transform: translateX(-2px);
    }

    90% {
        transform: translateX(1px);
    }
}

canvas {
    display: block;
    background: radial-gradient(circle at 30% 20%, #a3b6dd, #8ca1cc 55%, #7a90bf 100%);
    border-radius: var(--radius-sm);
    border-bottom: 4px solid #6c7fac;
    box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.12), inset 0 -2px 0 rgba(255, 255, 255, 0.15);
}

/* ── Overlays ─────────────────────── */
.overlay {
    position: absolute;
    inset: 0;
    background: rgba(251, 237, 222, 0.85);
    backdrop-filter: blur(10px) saturate(1.2);
    -webkit-backdrop-filter: blur(10px) saturate(1.2);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    border-radius: var(--radius-xl);
}

.hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.title-badge {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    margin: 0 auto 10px;
    background: linear-gradient(145deg, var(--accent-gold-2), var(--accent-gold));
    box-shadow: var(--shadow-md), inset 0 2px 4px rgba(255, 255, 255, 0.5), inset 0 -4px 6px rgba(196, 125, 21, 0.4);
    animation: badgeFloat 3.2s ease-in-out infinite;
}

@keyframes badgeFloat {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-6px) rotate(-4deg);
    }
}

h1 {
    color: var(--ui-dark);
    font-family: 'Orbitron', sans-serif;
    font-size: 2.3rem;
    font-weight: 900;
    margin-bottom: 18px;
    text-align: center;
    letter-spacing: -0.5px;
    text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.7);
    line-height: 1.2;
    background: linear-gradient(135deg, var(--ui-dark), #5c554d);
    -webkit-background-clip: text;
    background-clip: text;
}

h1 .emoji {
    display: block;
    font-size: 2.8rem;
    margin-bottom: 6px;
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.15));
}

h1 .sub {
    display: block;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--accent-gold);
    margin-top: 6px;
    -webkit-text-fill-color: var(--accent-gold);
}

.btn {
    background: linear-gradient(145deg, #4a4540, var(--ui-darker));
    color: #fff;
    border: none;
    padding: 14px 34px;
    font-size: 1.08rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    border-radius: 30px;
    cursor: pointer;
    margin: 8px;
    box-shadow: 0 5px 0 #17150f, var(--shadow-md);
    transition: var(--transition-fast);
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
    min-width: 150px;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, transparent 60%);
    border-radius: 30px;
    pointer-events: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 0 #17150f, var(--shadow-lg);
    background: linear-gradient(145deg, #57514a, #322f2b);
}

.btn:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 #17150f, var(--shadow-sm);
    transition: 0.08s;
}

.btn.accent {
    background: linear-gradient(145deg, var(--accent-gold-2), var(--accent-gold));
    box-shadow: 0 5px 0 #c47d15, var(--shadow-md);
    color: #3a2600;
}

.btn.accent:hover {
    background: linear-gradient(145deg, #ffd684, #f7b84c);
    box-shadow: 0 7px 0 #c47d15, var(--shadow-lg);
}

.btn.accent:active {
    box-shadow: 0 1px 0 #c47d15, var(--shadow-sm);
}

.modal-box {
    background: var(--glass-bg);
    backdrop-filter: blur(18px) saturate(1.3);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    padding: 30px 26px;
    border-radius: var(--radius-lg);
    text-align: center;
    max-width: 88%;
    color: var(--ui-dark);
    box-shadow: var(--shadow-lg);
    border: 1.5px solid var(--glass-border);
}

.modal-box h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.45rem;
    font-weight: 900;
    margin-bottom: 16px;
    letter-spacing: -0.3px;
}

.how-to-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 6px;
}

.how-to-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    text-align: left;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    box-shadow: var(--shadow-sm);
}

.how-to-item .icon-bullet {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    background: linear-gradient(145deg, #fff, #f3e6d4);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

.how-to-item p {
    font-size: 0.95rem;
    line-height: 1.55;
    margin: 0;
}

/* ── Stars ────────────────────────── */
.stars-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 16px 0;
    font-size: 2.6rem;
}

.stars-row .star {
    transition: var(--transition-bounce);
    display: inline-block;
    filter: drop-shadow(0 3px 5px rgba(196, 125, 21, 0.35));
}

.stars-row .star.earned {
    animation: starPop 0.5s ease-out forwards;
}

.stars-row .star.empty {
    opacity: 0.25;
    filter: grayscale(1);
}

@keyframes starPop {
    0% {
        transform: scale(0) rotate(-30deg);
        opacity: 0;
    }

    60% {
        transform: scale(1.4) rotate(8deg);
        opacity: 1;
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* ── Loader ───────────────────────── */
.loader-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.loader-dots {
    display: flex;
    gap: 10px;
}

.loader-dots span {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--accent-gold-2), var(--accent-gold));
    box-shadow: var(--shadow-sm);
    animation: dotBounce 1.2s ease-in-out infinite;
}

.loader-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.loader-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes dotBounce {

    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    40% {
        transform: translateY(-22px);
        opacity: 1;
    }
}

.loader-wrap h2 {
    font-family: 'Outfit', sans-serif;
    color: var(--ui-dark);
    font-weight: 800;
    letter-spacing: 0.5px;
}

/* ── Responsive ──────────────────── */
@media (max-width: 420px) {
    h1 {
        font-size: 1.8rem;
    }

    .title-badge {
        width: 62px;
        height: 62px;
        font-size: 2rem;
    }

    .btn {
        padding: 12px 26px;
        font-size: 1rem;
        min-width: 130px;
    }

    .pill {
        padding: 7px 16px;
        font-size: 0.88rem;
    }

    #timer {
        font-size: 0.95rem;
        padding: 8px 16px;
        min-width: 74px;
    }

    .board-wrapper {
        padding: 8px 8px 12px 8px;
        border-radius: var(--radius-md);
    }
}
.logo{height: 150px;border-radius: 30px;margin-bottom: 20px; box-shadow:
        0 3px 0 #c9c9c9,
        0 6px 0 #999,
        0 9px 0 #666,
        0 14px 22px rgba(0, 0, 0, 0.45);

    transition: transform 0.2s ease, box-shadow 0.2s ease;}