/* Candy $UP - Responsive Styles */

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Montserrat', sans-serif;
    background: linear-gradient(135deg, #1a0a25 0%, #2d1b3d 50%, #1a0a25 100%);
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 10px;
}

/* Mode Selection Styling */
#modeSelection {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a0a25 0%, #2d1b3d 100%);
    z-index: 100;
}

#modeSelection h2 {
    font-size: clamp(16px, 5vw, 24px);
    color: #fff;
    margin-bottom: 30px;
    text-shadow: 0 0 10px #ff6b00;
}

#modeSelection button {
    margin: 10px;
    padding: 15px 30px;
    font-size: clamp(12px, 3vw, 16px);
    font-family: inherit;
    cursor: pointer;
    background: linear-gradient(135deg, #ff6b00, #ffdd00);
    border: 3px solid #fff;
    border-radius: 10px;
    color: #000;
    font-weight: bold;
    transition: all 0.2s;
    touch-action: manipulation;
}

#modeSelection button:active {
    transform: scale(0.95);
    box-shadow: 0 0 20px #ffdd00;
}

/* Game Layout */
.game-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 10px;
}

/* Scoreboard Styling - Horizontal layout */
.scoreBoard {
    display: none;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.7);
    border: 3px solid #ff6b00;
    border-radius: 10px;
    padding: 8px 15px;
    margin-bottom: 10px;
    text-align: center;
    color: #fff;
    box-shadow: 0 0 20px rgba(255, 107, 0, 0.3);
    flex-wrap: wrap;
}

.scoreBoard h3 {
    font-size: clamp(9px, 2vw, 12px);
    text-transform: uppercase;
    color: #aaa;
    margin: 0;
}

.scoreBoard h1 {
    font-size: clamp(18px, 4vw, 24px);
    color: #ffdd00;
    text-shadow: 0 0 10px #ffdd00;
    margin: 0;
    line-height: 1;
}

#timer {
    font-size: clamp(10px, 2.5vw, 14px);
    color: #ff6b00;
}

#changeMode {
    padding: 6px 12px;
    background: #ff3333;
    color: white;
    border: 2px solid #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: clamp(8px, 1.8vw, 10px);
    font-family: inherit;
    touch-action: manipulation;
    white-space: nowrap;
}

#changeMode:active {
    transform: scale(0.95);
}

/* Game Grid */
.grid {
    display: none;
    flex-wrap: wrap;
    background: rgba(0, 0, 0, 0.6);
    border: 3px solid #39ff14;
    border-radius: 10px;
    padding: 5px;
    box-shadow:
        0 0 30px rgba(57, 255, 20, 0.3),
        inset 0 0 20px rgba(0, 0, 0, 0.5);
    touch-action: none;
    overflow: hidden;
    margin: 0 auto;
}

.grid div {
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 8px;
    transition: transform 0.15s ease;
    cursor: pointer;
}

.grid div:active {
    transform: scale(0.9);
}

/* Candy colors as fallback backgrounds */
.grid div[style*="red"] { background-color: rgba(255, 0, 0, 0.3); }
.grid div[style*="yellow"] { background-color: rgba(255, 255, 0, 0.3); }
.grid div[style*="orange"] { background-color: rgba(255, 165, 0, 0.3); }
.grid div[style*="purple"] { background-color: rgba(128, 0, 128, 0.3); }
.grid div[style*="green"] { background-color: rgba(0, 128, 0, 0.3); }
.grid div[style*="blue"] { background-color: rgba(0, 0, 255, 0.3); }

/* Portrait mode */
@media (orientation: portrait) {
    .game-wrapper {
        padding: 15px;
    }

    .scoreBoard {
        width: 90%;
        max-width: 400px;
    }
}

/* Landscape mode */
@media (orientation: landscape) {
    .game-wrapper {
        flex-direction: row;
        gap: 20px;
    }

    .scoreBoard {
        width: auto;
        min-width: 120px;
    }
}
