body {
    margin: 0;
    background: #001133;
    font-family: 'Orbitron', sans-serif;
    min-height: 100vh;
    overflow-y: auto;
}

.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    opacity: 1;
    transition: opacity 0.8s ease;
    z-index: 1000;
}

.container {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 50px);
    position: relative;
    padding-bottom: 60px;
    box-sizing: border-box;
}

.sidebar-top, .sidebar-bottom {
    width: 100%;
    background: rgba(255, 255, 255, 0.15);
    padding: 10px;
    box-sizing: border-box;
    backdrop-filter: blur(12px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.sidebar-top {
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
}

.sidebar-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    margin-bottom: 20px;
}

#waterCanvas {
    flex: 1;
    cursor: crosshair;
    background: transparent;
    z-index: 0;
    width: 100%;
    height: 100%;
}

.color-gradient {
    width: 100%;
    max-width: 500px;
    height: 40px;
    margin: 20px 0 0 0;
    background: linear-gradient(to right, white, #ff4081, #ffeb3b, #00e676, #3f51b5, #e91e63);
    border-radius: 15px;
    cursor: pointer;
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.4);
}

.controls {
    color: #fff;
    display: flex;
    flex-direction: row;
    gap: 15px;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}

.control {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 1 auto;
}

label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 5px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.7);
}

input[type="range"] {
    width: 100px;
    accent-color: #ff4081;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    padding: 2px;
    transition: background 0.3s ease;
}

input[type="range"]:hover {
    background: rgba(255, 255, 255, 0.45);
}

button {
    padding: 8px 15px;
    background: #ff4081;
    border: none;
    border-radius: 20px;
    color: white;
    cursor: pointer;
    font-size: 24px;
    text-transform: uppercase;
    line-height: 1.5;
    box-shadow: 0 0 15px rgba(255, 64, 129, 0.7);
    transition: background 0.3s ease, transform 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

button:hover {
    background: #e91e63;
    transform: scale(1.05);
}

button:disabled {
    background: #666;
    cursor: not-allowed;
    box-shadow: none;
}

#coffeeButton {
    background: #ff5722;
}

#coffeeButton:hover {
    background: #e64a19;
}

#downloadStats {
    background: #00e676;
}

#downloadStats:hover {
    background: #00c853;
}

#screenshotButton {
    background: #3f51b5;
}

#screenshotButton:hover {
    background: #303f9f;
}

#muteButton {
    background: #9c27b0;
}

#muteButton:hover {
    background: #7b1fa2;
}

#fullscreenButton {
    background: #0288d1;
}

#fullscreenButton:hover {
    background: #0277bd;
}

#watchAdButton {
    background: #ffeb3b;
    color: #000;
    width: auto;
    padding: 10px 20px;
    box-shadow: 0 0 15px rgba(255, 235, 59, 0.7);
}

#watchAdButton:hover {
    background: #fdd835;
}

#challengeButton {
    background: #9e9e9e;
    color: #fff;
    width: auto;
    padding: 10px 20px;
    box-shadow: none;
    cursor: not-allowed;
}

#challengeButton:disabled:hover {
    background: #9e9e9e;
    transform: none;
}

#shareButton {
    background: #2196f3;
}

#shareButton:hover {
    background: #1976d2;
}

#translateButton {
    background: #4caf50;
}

#translateButton:hover {
    background: #388e3c;
}

#infoText {
    position: absolute;
    top: 10px;
    left: 10px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 11px;
    font-family: 'Orbitron', monospace;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
    z-index: 2;
    letter-spacing: 1px;
    line-height: 1.5;
}

#colorBox {
    width: 15px;
    height: 15px;
    border-radius: 4px;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.bottom-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px 0;
}

.back-button {
    padding: 10px 20px;
    background: #ff4081;
    border: none;
    border-radius: 20px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    box-shadow: 0 0 15px rgba(255, 64, 129, 0.7);
    transition: background 0.3s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-button:hover {
    background: #e91e63;
    transform: scale(1.05);
}

.share-button {
    background: #2196f3;
}

.share-button:hover {
    background: #1976d2;
}

footer {
    width: 100%;
    padding: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    font-size: 12px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    z-index: 2;
    letter-spacing: 1px;
    line-height: 1.5;
}

footer.fixed-footer {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    padding: 8px 20px;
    border-radius: 10px 10px 0 0;
}

footer a {
    color: #ff4081;
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #e91e63;
}

.preloader {
    background: #001133;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loader {
    font-size: 24px;
    color: #fff;
    letter-spacing: 4px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.7);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 0.5; transform: scale(1); }
}

.welcome-screen {
    background: rgba(0, 17, 51, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    text-align: center;
}

.welcome-screen .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 600px;
    width: 100%;
    margin: auto;
}

.welcome-screen h1 {
    font-size: 32px;
    color: #fff;
    letter-spacing: 6px;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
    margin: 0;
}

.welcome-screen p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    max-width: 500px;
    letter-spacing: 1px;
    line-height: 1.6;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
    margin: 0;
}

#colorPicker {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.color-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: #ff4081;
    transform: scale(1.15);
}

.welcome-screen form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.welcome-screen button {
    padding: 10px 25px;
    box-shadow: 0 0 20px rgba(255, 64, 129, 0.7);
    width: auto;
}

#introScreen {
    background: #001133;
    display: flex;
    justify-content: center;
    align-items: center;
}

#introScreen h1 {
    font-size: 36px;
    color: #fff;
    letter-spacing: 8px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.7);
    animation: pulse 1.5s infinite;
}

#statsScreen {
    background: rgba(0, 17, 51, 0.95);
    justify-content: center;
    align-items: center;
}

#statsScreen .container {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
}

#statsScreen h2 {
    font-size: 24px;
    color: #fff;
    letter-spacing: 4px;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
    margin: 0 0 20px 0;
    text-align: center;
}

#statsTable {
    width: 100%;
    color: #fff;
    font-size: 14px;
    border-collapse: collapse;
    margin-bottom: 20px;
}

#statsTable td {
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

#statsTable td:first-child {
    font-weight: 700;
    text-align: right;
}

.stats-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

#statsScreen button {
    width: auto;
    padding: 10px 20px;
}

#gameOverScreen {
    background: rgba(0, 17, 51, 0.95);
    justify-content: center;
    align-items: center;
}

#gameOverScreen .container {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    text-align: center;
}

#gameOverScreen h2 {
    font-size: 24px;
    color: #fff;
    letter-spacing: 4px;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
    margin: 0 0 15px 0;
}

#gameOverScreen p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 1px;
    line-height: 1.6;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
    margin: 0 0 20px 0;
}

.game-over-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    margin-top: 20px;
}

#gameOverScreen button {
    width: auto;
    padding: 10px 20px;
    font-size: 16px;
}

#translateScreen {
    background: rgba(0, 17, 51, 0.95);
    justify-content: center;
    align-items: center;
}

#translateScreen .container {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    text-align: center;
    position: relative;
}

#translateScreen h2 {
    font-size: 24px;
    color: #fff;
    letter-spacing: 4px;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
    margin: 0 0 20px 0;
}

#translateScreen ul {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

#translateScreen li {
    padding: 10px;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s ease;
}

#translateScreen li:hover {
    background: rgba(255, 255, 255, 0.2);
}

#translateScreen .close-x {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    color: #fff;
    cursor: pointer;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

#translateScreen button {
    width: auto;
    padding: 10px 20px;
}

@media (max-width: 600px) {
    .controls {
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }

    input[type="range"] {
        width: 80px;
    }

    #game-container .controls button {
        width: 32px;
        height: 32px;
        font-size: 20px;
        padding: 6px;
    }

    .bottom-controls {
        flex-direction: row;
        gap: 10px;
        padding: 10px 0;
        flex-wrap: wrap;
        justify-content: center;
    }

    .bottom-controls .back-button,
    .bottom-controls .share-button,
    .bottom-controls #coffeeButton,
    .bottom-controls #translateButton {
        width: 32px;
        height: 32px;
        font-size: 20px;
        padding: 6px;
        max-width: 32px;
        min-width: 32px;
        box-shadow: 0 0 10px rgba(255, 64, 129, 0.7);
    }

    .back-button {
        font-size: 20px;
        padding: 6px;
        text-align: center;
    }

    .sidebar-top {
        padding: 5px;
    }

    .sidebar-bottom {
        padding: 5px;
        margin-bottom: 10px;
    }

    .color-gradient {
        height: 25px;
        margin: 5px 0 0 0;
    }

    #infoText {
        font-size: 9px;
        top: 5px;
        left: 5px;
        gap: 8px;
    }

    #colorBox {
        width: 12px;
        height: 12px;
    }

    footer {
        padding: 5px;
        font-size: 10px;
    }

    .welcome-screen h1 {
        font-size: 24px;
    }

    .welcome-screen p {
        font-size: 12px;
    }

    .welcome-screen .container {
        padding: 10px;
    }

    footer.fixed-footer {
        width: 90%;
        padding: 8px 10px;
    }

    /* Ajustes para #statsScreen */
    #statsScreen .container {
        padding: 10px; /* Reducido de 20px */
        width: 95%; /* Aumentado de 90% para aprovechar más el ancho */
    }

    #statsScreen h2 {
        font-size: 20px; /* Reducido de 24px */
        margin: 0 0 10px 0; /* Reducido de 20px */
    }

    #statsTable {
        font-size: 12px; /* Reducido de 14px */
        margin-bottom: 10px; /* Reducido de 20px */
    }

    #statsTable td {
        padding: 5px; /* Reducido de 10px */
    }

    .stats-buttons {
        gap: 10px; /* Reducido de 20px */
        margin: 10px 0; /* Reducido de 20px */
    }

    #statsScreen button {
        padding: 8px 16px; /* Reducido de 10px 20px */
        font-size: 14px; /* Reducido implícitamente para ajustarse */
    }

    /* Ajustes para #gameOverScreen */
    #gameOverScreen .container {
        padding: 10px; /* Reducido de 20px */
        width: 95%; /* Aumentado de 90% para aprovechar más el ancho */
    }

    #gameOverScreen h2 {
        font-size: 20px; /* Reducido de 24px */
        margin: 0 0 10px 0; /* Reducido de 15px */
    }

    #gameOverScreen p {
        font-size: 12px; /* Reducido de 14px */
        margin: 0 0 10px 0; /* Reducido de 20px */
    }

    .game-over-buttons {
        gap: 10px; /* Reducido de 15px */
        margin-top: 10px; /* Reducido de 20px */
    }

    #gameOverScreen button {
        padding: 8px 16px; /* Reducido de 10px 20px */
        font-size: 14px; /* Reducido de 16px */
    }
}

@media (orientation: landscape) and (max-height: 600px) {
    footer.fixed-footer {
        width: auto;
        padding: 8px 20px;
    }
}