/* Base Styles */
@media (max-width: 600px) {
    header, footer {
        flex-direction: column;
        text-align: center;
    }
}

body {
    margin: 0;
    font-family: 'Segoe UI', sans-serif;
    background-color: #cad2c5;
    color: #000000;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overscroll-behavior: contain;
}

.header {
    background-color: #eab464;
    padding: 0.5rem 1rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    margin: 0 auto 1rem;
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
}

.logo {
    width: 28px;
    height: 28px;
    margin-right: 0.5rem;
}

.game-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2f3e46;
}

.header-right {
    display: flex;
    gap: 0.5rem;
}

.header-button {
    background-color: #52796f;
    color: white;
    padding: 0.4rem 0.8rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
}

.header-button:hover {
    background-color: #354f52;
}

.home-button {
    color: #ff6b6b;
    text-decoration: none;
    font-weight: bold;
}

.game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    touch-action: none;
    overscroll-behavior: contain;
}

h1 {
    text-align: center;
    color: #2f3e46;
    margin-bottom: 20px;
}

/* Score Display - Matches your HTML structure */
.score {
    background-color: #52796f; /* Score board background */
    color: #cad2c5; /* Score text color */
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-around;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    font-size: 18px;
}

.score span {
    font-weight: bold;
    color: #ffffff;
}

/* Board Styles */
.board {
    position: relative;
    width: calc((70px + 8px) * 4 - 8px); /* Adjust if you changed tile size */
    height: calc((70px + 8px) * 4 - 8px);
    background-color: #eab464;
    border-radius: 8px;
    border: 4px solid  #eab464; /* ✅ Add this line for the border */
    box-shadow: inset 0 0 5px rgba(0,0,0,0.1), 0 4px 10px rgba(0,0,0,0.1);
    padding: 0;
    margin: 0 auto;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}


/* Tile Styles */
.tile {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    font-weight: bold;
    border-radius: 5px;
    background-color: #cad2c5;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    color: #2f3e46;
    will-change: transform;
    transition: transform 0.2s ease-in-out;
}



/* Empty Tiles - No zeros displayed */
.tile:empty {
    background-color: rgba(202, 210, 197, 0.5);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}

/* New Tile Animation */
@keyframes newTileAppear {
    0% {
        background-color: #52796f;
        transform: scale(0.5);
        opacity: 0;
    }
    100% {
        background-color: #cad2c5;
        transform: scale(1);
        opacity: 1;
    }
}

.tile-new {
    animation: newTileAppear 0.4s ease-out forwards;
    z-index: 10;
}

/* Tile movement animation */
.tile-moved {
    transition: transform 0.15s ease-out;
}

/* Merged Tile Animation */
@keyframes mergedTilePop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.tile-merged {
    animation: mergedTilePop 0.4s ease-out;
    z-index: 5;
}

/* Progress Bar - Only include if you're using it */
.progress {
    background-color: #eab464; /* Progress bar background */
    height: 20px;
    border-radius: 10px;
    margin: 15px 0;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    height: 100%;
    background-color: #52796f; /* Progress bar color */
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
}

.progress-text {
    position: absolute;
    width: 100%;
    text-align: center;
    line-height: 20px;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Controls - Matches your reset button */
.controls {
    margin-bottom: 1rem;
}

.controls button {
    padding: 0.5rem 1rem;
    background-color: #84a98c;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
}

.controls button:hover {
    background-color: #52796f;
}

/* Game Over Message */
.game-over-message {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    margin: 20px 0;
    color: #66101f;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

#combo-flash {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 28px;
    font-weight: bold;
    color: #ff4500;
    background-color: rgba(255,255,255,0.8);
    padding: 6px 12px;
    border-radius: 8px;
    animation: comboPop 0.6s ease-out forwards;
    pointer-events: none;
    z-index: 100;
}

@keyframes comboPop {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(10px) scale(0.8);
    }
    40% {
        opacity: 1;
        transform: translateX(-50%) translateY(0px) scale(1.1);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px) scale(1);
    }
}

.rules-box {
    background-color: #eab464;
    color: #2f3e46;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem auto;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    font-size: 0.95rem;
}

.rules-box h2 {
    margin-top: 0;
    font-size: 1.2rem;
    color: #000000;
}

.rules-box ul {
    list-style-type: disc;
    margin-left: 1.2rem;
    padding: 0;
}

.rules-box li {
    margin-bottom: 0.5rem;
}


/* Footer */
.footer {
    background-color: #52796f;
    color: #cad2c5;
    text-align: center;
    padding: 0.75rem;
    font-size: 0.9rem;
}

.footer a {
    color: #ffffff;
    text-decoration: none;
}
