/* ===== Block Puzzle Dash — style.css ===== */
:root {
    --bg: #0a0a1a;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.4);
    --surface: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.1);
    --yellow: #fbbf24;
    --green: #22c55e;
    --red: #ef4444;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg);
    color: #fff;
    overflow-x: hidden;
    min-height: 100vh;
}

.game-container {
    padding-top: 0px;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 100%;
}

.game-container>h1 {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.3));
}

#game-ui {
    position: relative;
    width: 420px;
    height: auto;
    min-height: 650px;
    background: #0d0d26;
    border-radius: 20px;
    box-shadow: 0 0 0 1px var(--border), 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px var(--accent-glow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* HUD */
#hud {
    display: grid;
    grid-template-columns: 1fr 1fr 1.5fr;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(5px);
    z-index: 10;
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.hud-item .label {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 1.5px;
    margin-top: 2px;
}

.hud-item .value {
    font-size: 1.6rem;
    font-weight: 900;
}

.timer {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.progress-bar-container {
    width: 80%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-top: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 100%;
    border-radius: 10px;
    transition: width 0.3s linear, background-color 0.5s;
}

.timer .progress-bar {
    background: var(--yellow);
    width: 100%;
}

.score .progress-bar {
    background: var(--accent);
    width: 0%;
}

.value.yellow {
    color: var(--yellow);
}

.value.red {
    color: var(--red);
}

.value.green {
    color: var(--green);
}

/* Canvas Area */
#canvas-container {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-start;   /* move grid upward */
    padding: 10px;                /* remove extra spacing */
}

#game-canvas {
    width: 100%;
    height: auto;
    max-width: 380px;
    aspect-ratio: 1/1;
    display: block;
    cursor: default;
    touch-action: none;
}

#piece-selector {
    height: 140px;
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
}

#piece-canvas {
    width: 100%;
    height: 100%;
    max-width: 400px;
    touch-action: none;
}

/* Overlays */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 26, 0.95);
    backdrop-filter: blur(12px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    text-align: center;
    padding: 30px;
    width: 90%;
    max-width: 340px;
    animation: slideUp 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.stars {
    font-size: 2.5rem;
    margin-bottom: 5px;
    filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.6));
}

.overlay h2 {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #fff, #9ca3af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.final-score-box {
    margin: 20px 0;
}

.final-score {
    display: block;
    font-size: 4rem;
    font-weight: 900;
    color: var(--accent);
    line-height: 1;
}

.best-score {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 2px;
}

.primary-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    border-radius: 50px;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 2px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
    transition: transform 0.2s;
    margin-bottom: 10px;
}

.bonus-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #fbbf24, #d97706);
    border: none;
    border-radius: 50px;
    color: #000;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(251, 191, 36, 0.25);
    transition: transform 0.2s;
}

.primary-btn:active,
.bonus-btn:active {
    transform: scale(0.96);
}

#promo-scroller {
    margin-top: 25px;
    display: flex;
    overflow-x: auto;
    gap: 15px;
    padding: 5px;
    scrollbar-width: none;
}

#promo-scroller::-webkit-scrollbar {
    display: none;
}

/* Description section */
.game-description {
    max-width: 700px;
    padding: 40px 20px 80px;
    opacity: 0.8;
}

.game-description h2 {
    margin-bottom: 15px;
    font-size: 1.4rem;
    color: var(--accent);
}

.game-description ul {
    list-style: none;
}

.game-description li {
    margin-bottom: 10px;
    padding-left: 20px;
    position: relative;
    line-height: 1.6;
}

.game-description li::before {
    content: "◈";
    position: absolute;
    left: 0;
    color: var(--accent);
}

footer {
    text-align: center;
    padding: 30px;
    opacity: 0.5;
}

.footer-links {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 10px;
}

.footer-links a {
    color: #fff;
    text-decoration: none;
}

/* Mobile responsive scaling */
@media (max-width: 450px) {
    #game-ui {
        width: 100vw;
        height: min(750px, 92vh);
        border-radius: 0;
    }

    .game-container>h1 {
        font-size: 1.6rem;
    }
}

#adsterra-banner {
    position: fixed;
    bottom: 5px;
    right: 10px;
    z-index: 9000;
    display: none;
    width: 160px;
    height: 600px;
}

@media (min-width:1024px) {
    #adsterra-banner {
        display: block;
    }
}

#bottom-ad {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    height: 50px;
    z-index: 9999;
}

/* Tutorial Popup */
.tutorial-popup {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.tutorial-popup.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(-10px);
}

.tutorial-box {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 16px 20px;
    max-width: 320px;
    text-align: center;
    box-shadow:
        0 10px 30px rgba(0,0,0,0.6),
        0 0 30px rgba(99,102,241,0.3);
}

.tutorial-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.tutorial-text {
    font-size: 0.9rem;
    line-height: 1.5;
    opacity: 0.9;
}