/* Base Template Styles - Clean minimal version */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Additional focus state removal for all interactive elements */
*:focus,
*:active,
*:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Specif#give-up-no:hover {
    filter: brightness(1.1);
}

/* Level Complete popup overlay */
:root {
    --completion-badge-url: url('https://firebasestorage.googleapis.com/v0/b/sticky-20bca.appspot.com/o/sgm-asset%2F7505a149-36ab-40fc-a4f3-2f30edcfbd06%2F9e2c5c07-3559-4edc-acaa-0210a39d3ae8.png?alt=media&token=a0fb4917-c4e3-4257-a943-0ed37c003e56');
    --star-url: url('https://firebasestorage.googleapis.com/v0/b/sticky-20bca.appspot.com/o/sgm-asset%2F2b39debf-53cd-41b0-825d-39cb982922ed%2F9932fec2-a7ac-4241-9a02-c9524474ec1f.png?alt=media&token=63ee0f25-f8f1-4d79-986c-2597935279e2');
}

#level-complete-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    /* Higher than loading overlay */
}

#level-complete-overlay.hidden {
    display: none !important;
    pointer-events: none !important;
}

#level-complete-popup {
    padding: 20px;
    min-width: 280px;
    max-width: 400px;
    text-align: center;
}

.level-complete-info {
    margin: 20px 0;
}

.level-complete-badge-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.completion-badge {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
    width: 100px;
    height: 100px;
    background-image: var(--completion-badge-url);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.completion-badge img {
    display: none;
    /* Hide the img tag since we're using CSS background */
}

.badge-level-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
}

.badge-level-number span {
    font-family: 'Montserrat', sans-serif;
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

@keyframes floatStar {
    0% {
        transform: translateX(-50%) translateY(0px) rotate(0deg);
    }

    100% {
        transform: translateX(-50%) translateY(-8px) rotate(10deg);
    }
}

.star-2 {
    animation-name: floatStarRight;
}

.star-3 {
    animation-name: floatStarLeft;
}

@keyframes floatStarRight {
    0% {
        transform: translateY(0px) rotate(0deg);
    }

    100% {
        transform: translateY(-8px) rotate(-10deg);
    }
}

@keyframes floatStarLeft {
    0% {
        transform: translateY(0px) rotate(0deg);
    }

    100% {
        transform: translateY(-8px) rotate(10deg);
    }
}

.level-complete-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.level-complete-stats p {
    font-family: 'Montserrat', sans-serif;
    font-size: 18px;
    color: #fff;
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.level-complete-stats span {
    color: #4ecdc4;
    font-weight: bold;
}

lly target buttons to remove default focus states */ button,
input,
select,
textarea,
[role="button"],
[tabindex] {
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

button:focus,
button:active,
button:focus-visible,
input:focus,
input:active,
select:focus,
select:active,
textarea:focus,
textarea:active {
    outline: none !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

body {
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
    background-image: url('https://firebasestorage.googleapis.com/v0/b/sticky-20bca.appspot.com/o/OueJnwGQijXcBhU1hiuy41wPBg93%2Fcustom-assets%2FSky%20background.png%2Fa6e21752-3764-495b-b525-58c4e67af889.jpeg?alt=media&token=5f0982ef-6e9a-4281-8cea-bfe1a71588c8');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: #f0e6d2;
    overflow: hidden;
    touch-action: manipulation;
    position: fixed;
    width: 100%;
    height: 100%;
}

button {
    font-family: 'Montserrat', sans-serif;
}

#gameContainer {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    /* Transparent to show HTML elements below */
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    z-index: 50;
    /* Above UI containers but below back button */
    pointer-events: auto;
    /* Canvas needs to capture game events */
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    /* Same as canvas */
    pointer-events: none;
    /* Let clicks pass through to canvas, except for UI buttons which have higher z-index */
    display: flex;
    justify-content: center;
    align-items: center;
}

#canvas-container canvas {
    pointer-events: auto;
    /* Canvas itself should capture events */
}

/* Mute button */
#mute-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #fff;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    font-size: 20px;
}

#mute-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

#mute-icon {
    font-size: 20px;
}

/* Loading Screens */
#loadingScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('https://firebasestorage.googleapis.com/v0/b/sticky-20bca.appspot.com/o/OueJnwGQijXcBhU1hiuy41wPBg93%2Fcustom-assets%2FSky%20background.png%2Fa6e21752-3764-495b-b525-58c4e67af889.jpeg?alt=media&token=5f0982ef-6e9a-4281-8cea-bfe1a71588c8');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: #fff;
}

#titleScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('https://firebasestorage.googleapis.com/v0/b/sticky-20bca.appspot.com/o/OueJnwGQijXcBhU1hiuy41wPBg93%2Fcustom-assets%2FSky%20background.png%2Fa6e21752-3764-495b-b525-58c4e67af889.jpeg?alt=media&token=5f0982ef-6e9a-4281-8cea-bfe1a71588c8');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    color: #fff;
}

/* Dark overlay on top of background image for better readability */
#loadingScreen::before,
#titleScreen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: -1;
}

#loadingScreen.hidden,
#titleScreen.hidden {
    display: none !important;
    pointer-events: none !important;
}

.loading-progress-container,
.title-content {
    text-align: center;
}

.loading-progress-bar {
    position: relative;
    width: 300px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    border: 2px solid #fff;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.loading-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
}

.loading-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    z-index: 1;
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Title Screen Styles */
.title-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    pointer-events: auto;
}

.title-content h1 {
    font-size: 4rem;
    margin-bottom: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    color: #ffffff;
    text-align: center;
}

#start-game-btn {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem;
    padding: 1rem 2rem;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    user-select: none;
    margin-top: 2rem;
}

#start-game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
    background: linear-gradient(45deg, #44a08d, #4ecdc4);
}

/* Play button with 50% screen width */
.play-button-wide {
    width: 50vw !important;
    max-width: 400px;
    /* Maximum width for larger screens */
    min-width: 200px;
    /* Minimum width for smaller screens */
}

/* Add your custom game styles below this line */

/* Container padrão com gradiente azul */
.gradient-container {
    --match-3: linear-gradient(225deg, #b6d1e5 0%, #6FC1FF 50%, #49B1FF 100%);

    border-radius: 12px;
    border: 4px solid #FFF;
    background: var(--match-3);
    padding: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Variação com padding maior para containers maiores */
.gradient-container-lg {
    --match-3: linear-gradient(225deg, #b6d1e5 0%, #6FC1FF 50%, #49B1FF 100%);

    border-radius: 12px;
    border: 4px solid #FFF;
    background: var(--match-3);
    padding: 24px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Variação com padding menor para containers compactos */
.gradient-container-sm {
    --match-3: linear-gradient(225deg, #b6d1e5 0%, #6FC1FF 50%, #49B1FF 100%);

    border-radius: 12px;
    border: 4px solid #FFF;
    background: var(--match-3);
    padding: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Red gradient for give-up yes button */
.gradient-red {
    --match-3: linear-gradient(225deg, #ffd8d8 0%, #FF6F6F 50%, #FF4949 100%) !important;
    background: var(--match-3) !important;
}

/* Red gradient for give-up yes button */
.gradient-blue {
    --match-3: linear-gradient(225deg, #c3cbff 0%, #7386ff 50%, #546bff 100%) !important;
    background: var(--match-3) !important;
}

/* Game UI Styles */
#game-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Allow clicks to pass through to canvas */
    z-index: 10;
}

#ui-containers {
    position: absolute;
    top: calc(50% - var(--grid-container-half-height, 200px) - 10px);
    left: 50%;
    transform: translate(-50%, -100%);
    display: flex;
    gap: 8px;
    pointer-events: none;
    z-index: 15;
}

.ui-container {
    min-width: 80px;
    text-align: center;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ui-content {
    color: #FFF;
    text-align: center;
    text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.25);
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-style: normal;
    font-weight: 700;
    line-height: 100%;
    /* 14px */
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
    background-color: rgba(0, 0, 0, 0);
}

.ui-value {
    color: #0065B9;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-style: normal;
    font-weight: 700;
    line-height: 100%;
}

#grid-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 5;
    /* Set explicit dimensions to match the game grid (8 × 60px = 480px) */
    width: 480px;
    height: 480px;
    /* Container visual styling */
    border-radius: 12px;
    border: 4px solid #FFF;
    background: var(--match-3);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#progress-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% - 280px));
    /* Position above the grid */
    pointer-events: none;
    z-index: 15;
}

#progress-bar {
    position: relative;
    width: 200px;
    height: 20px;
    background: #333;
    border: 2px solid #fff;
    border-radius: 4px;
    overflow: hidden;
}

#progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #4ecdc4;
    transition: width 0.3s ease;
    width: 0%;
}

#game-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #4ecdc4;
    transition: width 0.3s ease;
    width: 0%;
}

#progress-text,
#game-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    color: #ffffff;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    z-index: 1;
}

#combo-container {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 15;
}

#combo-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 18px;
    color: #ffaa00;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    text-align: center;
}

/* Back button */
#back-btn {
    position: fixed;
    /* Fixed position to ensure it's independent of canvas */
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    cursor: pointer;
    z-index: 99999;
    /* Maximum z-index to ensure it's above everything */
    padding: 0;
    display: none;
    /* Hidden by default, shown only in game scene */
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    pointer-events: auto !important;
    color: white;
    font-size: 30px;
    font-weight: bold;
    font-family: 'Montserrat', sans-serif;
    border-style: none;
}

#back-btn:hover {
    transform: scale(1.1);
}

/* Large font size class */
.large-font {
    font-size: 30px !important;
}

/* Give up popup overlay */
#give-up-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    /* Higher than loading overlay */
}

#give-up-overlay.hidden {
    display: none !important;
    pointer-events: none !important;
}

#give-up-popup {
    padding: 10px;
    min-width: 200px;
    max-width: 400px;
    text-align: center;
}

.popup-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.popup-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.popup-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.popup-button {
    width: 100px;
    height: 50px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    pointer-events: auto;
    /* Ensure buttons can receive clicks */
    position: relative;
    /* Ensure proper positioning */
    z-index: 1;
    /* Ensure buttons are above container */
}

.popup-button:hover {
    transform: scale(1.05);
}

#give-up-yes:hover {
    filter: brightness(1.2);
}

#give-up-no:hover {
    filter: brightness(1.2);
}

#continue-btn {
    width: auto;
    padding-left: 40px;
    padding-right: 40px;
}

/* Text pool for match explosions */
#text-pool {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 60;
    /* Above canvas but below UI */
}

.match-text {
    position: absolute;
    font-family: "Avenir Next World", 'Montserrat', sans-serif;
    font-size: 32px;
    font-style: normal;
    font-weight: 950;
    line-height: 28px;
    /* 87.5% */
    color: #FF3B3B;
    /* Default color, will be overridden by JavaScript */
    text-align: center;
    text-shadow:
        /* White outline - 8 directions for smooth outline */
        -1px -1px 0 #FFF,
        1px -1px 0 #FFF,
        -1px 1px 0 #FFF,
        1px 1px 0 #FFF,
        -1px 0 0 #FFF,
        1px 0 0 #FFF,
        0 -1px 0 #FFF,
        0 1px 0 #FFF,
        /* Drop shadow below the white outline */
        0px 5px 0px #B00003;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.5) translate(-50%, -50%);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
    z-index: 60;
    white-space: nowrap;
    display: block;
    /* Always visible but transparent */
    visibility: hidden;
    /* Use visibility instead of display */
}

.match-text.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1.2) translate(-50%, -50%);
}

.match-text.fade-out {
    opacity: 0;
    visibility: hidden;
    transform: scale(1.5) translate(-50%, -50%) translateY(-50px);
}
