@import url('https://fonts.googleapis.com/css2?family=Titan+One&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Titan One', sans-serif;
}

html, body {
    height: 100%;
    overflow: hidden;
    background: white;
    color: black;
}

canvas {
    display: block;
    width: 100vw;
    height: 100vh;
    background: white;
    touch-action: none;
}

/* Inverted world styles */
.inverted {
    filter: invert(1) hue-rotate(180deg);
}

#startMenu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    z-index: 1000;
}

#startMenu h1 {
    font-size: 48px;
    margin-bottom: 20px;
    color: black;
}

#gameEdition {
    font-size: 24px;
    margin-bottom: 20px;
    color: #007bff;
    font-weight: bold;
}

#playButton, #howToPlayButton, #downloadButton, #donateButton {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 24px;
    border-radius: 20px;
    cursor: pointer;
    margin: 5px;
}

#gameOverScreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    font-size: 24px;
    z-index: 1000;
    font-family: 'Titan One', sans-serif;
    color: black;
}

#restart, #menuButton {
    margin-top: 20px;
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 20px;
    cursor: pointer;
}

#restart {
    background: #00f;
    margin-top: 12px;
}

#pauseButton {
    position: fixed;
    bottom: 15px;
    right: 15px;
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 22px;
    border-radius: 20px;
    font-size: 18px;
    cursor: pointer;
    z-index: 1100;
    font-family: 'Titan One', sans-serif;
    user-select: none;
}

#musicButton {
    position: fixed;
    bottom: 15px;
    right: 130px;
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 18px;
    cursor: pointer;
    z-index: 1100;
    font-family: 'Titan One', sans-serif;
    user-select: none;
    min-width: 50px;
}

#devButton {
    position: fixed;
    bottom: 15px;
    right: 190px;
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 18px;
    cursor: pointer;
    z-index: 1100;
    font-family: 'Titan One', sans-serif;
    user-select: none;
    min-width: 50px;
}

#pauseMenu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    font-size: 32px;
    font-family: 'Titan One', sans-serif;
    color: black;
    z-index: 1200;
}

#resumeButton, #quitGameButton {
    margin-top: 20px;
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 20px;
    font-size: 24px;
    cursor: pointer;
}

#quitGameButton {
    background: #dc3545;
}

#quitGameButton:hover {
    background: #c82333;
}

/* Quit Confirmation Dialog */
#quitConfirmDialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1300;
    font-family: 'Titan One', sans-serif;
}

#quitConfirmContent {
    background: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    color: black;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

#quitConfirmContent h3 {
    font-size: 28px;
    color: #dc3545;
    margin-bottom: 15px;
}

#quitConfirmContent p {
    font-size: 18px;
    margin-bottom: 25px;
    line-height: 1.4;
}

#quitConfirmButtons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

#confirmQuitButton {
    background: #dc3545;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 15px;
    font-size: 18px;
    cursor: pointer;
    font-family: 'Titan One', sans-serif;
}

#confirmQuitButton:hover {
    background: #c82333;
}

#cancelQuitButton {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 15px;
    font-size: 18px;
    cursor: pointer;
    font-family: 'Titan One', sans-serif;
}

#cancelQuitButton:hover {
    background: #5a6268;
}

button:focus {
    outline: none;
}

/* Developer Panel */
#devPanel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1500;
    font-family: 'Titan One', sans-serif;
}

#devPanelContent {
    background: white;
    padding: 30px;
    border-radius: 20px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    color: black;
    text-align: center;
}

#devPanelContent h3 {
    color: #28a745;
    margin-bottom: 20px;
    font-size: 28px;
}

#devPasswordSection {
    margin-bottom: 20px;
}

#devPassword {
    padding: 10px;
    font-size: 16px;
    border: 2px solid #007bff;
    border-radius: 10px;
    margin-right: 10px;
    font-family: 'Titan One', sans-serif;
}

#devLoginBtn {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    font-family: 'Titan One', sans-serif;
}

.dev-section {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.dev-section h4 {
    color: #007bff;
    margin-bottom: 15px;
    font-size: 20px;
}

.dev-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 12px;
    margin: 5px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    font-family: 'Titan One', sans-serif;
}

.dev-btn:hover {
    background: #0056b3;
}

#closeDev {
    background: #dc3545;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 15px;
    font-size: 18px;
    cursor: pointer;
    font-family: 'Titan One', sans-serif;
    margin-top: 20px;
}

#fullscreenBtn {
    position: absolute;
    z-index: 10;
    top: 10px;
    right: 10px;
    padding: 10px 15px;
    font-size: 16px;
    cursor: pointer;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 12px;
    font-family: 'Titan One', sans-serif;
}

#versionInfo {
    position: fixed;
    bottom: 10px;
    left: 10px;
    font-size: 14px;
    color: black;
    font-family: 'Titan One', sans-serif;
    z-index: 1000;
    user-select: none;
}

/* Power-up notification */
#powerupNotification {
    position: fixed;
    top: 50px;
    right: 10px;
    background: rgba(255, 215, 0, 0.9);
    color: black;
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 16px;
    font-family: 'Titan One', sans-serif;
    z-index: 1000;
    display: none;
}

/* World transition effect */
#worldTransition {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, #007bff, #0056b3);
    z-index: 1500;
    display: none;
    justify-content: center;
    align-items: center;
    font-family: 'Titan One', sans-serif;
    color: white;
}

#worldTransitionContent {
    text-align: center;
    animation: fadeInScale 2s ease-in-out;
}

#worldTransitionTitle {
    font-size: 48px;
    margin-bottom: 20px;
}

#worldTransitionDesc {
    font-size: 24px;
}

@keyframes fadeInScale {
    0% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 1; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

/* Item Shop Styles */
#itemShop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1400;
    display: none;
    justify-content: center;
    align-items: center;
    font-family: 'Titan One', sans-serif;
}

#shopContent {
    background: white;
    padding: 30px;
    border-radius: 20px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    color: black;
    text-align: center;
}

#shopContent h2 {
    color: #007bff;
    margin-bottom: 20px;
    font-size: 32px;
}

#shopCoins {
    font-size: 24px;
    color: gold;
    margin-bottom: 20px;
}

.shop-item {
    background: #f0f0f0;
    margin: 10px 0;
    padding: 15px;
    border-radius: 10px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.shop-item:hover {
    border-color: #007bff;
    background: #e0e0e0;
}

.shop-item.owned {
    background: #d4edda;
    border-color: #28a745;
}

.shop-item.owned .item-button {
    background: #28a745;
    cursor: not-allowed;
}

.item-name {
    font-size: 20px;
    color: #007bff;
    margin-bottom: 5px;
}

.item-description {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.item-price {
    font-size: 18px;
    color: gold;
    margin-bottom: 10px;
}

.item-button {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 16px;
}

.item-button:hover:not(:disabled) {
    background: #0056b3;
}

.item-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#worldProgression {
    margin: 20px 0;
    padding: 15px;
    background: #e3f2fd;
    border-radius: 10px;
}

#nextWorldBtn {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 20px;
    font-size: 18px;
    cursor: pointer;
    margin-top: 10px;
}

#nextWorldBtn:hover {
    background: #218838;
}

#closeShop {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 20px;
    font-size: 20px;
    cursor: pointer;
    margin-top: 20px;
}

/* How to Play Screen */
#howToPlayScreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1500;
    display: none;
    justify-content: center;
    align-items: center;
    font-family: 'Titan One', sans-serif;
}

#howToPlayContent {
    background: white;
    padding: 30px;
    border-radius: 20px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    color: black;
    text-align: left;
}

#howToPlayContent h2 {
    text-align: center;
    color: #007bff;
    margin-bottom: 25px;
    font-size: 32px;
}

#howToPlayContent h3 {
    color: #007bff;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 20px;
}

#howToPlayContent p {
    margin: 8px 0;
    font-size: 16px;
    line-height: 1.4;
}

#howToPlayContent strong {
    color: #007bff;
}

.instructions {
    margin-bottom: 20px;
}

.closeInstruction {
    text-align: center;
    font-size: 18px;
    color: #666;
    margin-top: 20px;
    padding: 10px;
    background: #f0f0f0;
    border-radius: 10px;
}

/* Mobile Touch Controls */
#mobileControls {
    position: fixed;
    bottom: 80px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1050;
    pointer-events: none;
}

#leftControls {
    display: flex;
    gap: 15px;
    pointer-events: auto;
}

.control-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 123, 255, 0.8);
    color: white;
    font-size: 24px;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.control-btn:active {
    background: rgba(0, 123, 255, 1);
    transform: scale(0.95);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Hide mobile controls on desktop */
@media (min-width: 768px) {
    #mobileControls {
        display: none;
    }
}

/* Game UI Elements */
#coins, #score, #levelCounter, #worldCounter {
    position: fixed;
    top: 10px;
    color: white;
    font-size: 20px;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 5px;
    font-family: 'Titan One', sans-serif;
    min-width: 120px;
    text-align: right;
}

#coins {
    left: 10px;
    color: gold;
}

#score {
    left: 140px;
}

#levelCounter {
    left: 270px;
}

#worldCounter {
    left: 400px;
    color: #00ff00;
}

/* Winning Screen */
#winningScreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: black;
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: white;
    font-family: 'Titan One', sans-serif;
    opacity: 0;
    transition: opacity 2s ease-in-out;
}

#winningScreen h1 {
    font-size: 48px;
    margin-bottom: 20px;
    text-align: center;
}

#winningScreen p {
    font-size: 24px;
    text-align: center;
    margin: 10px 0;
}

#winningScreen button {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 24px;
    border-radius: 20px;
    cursor: pointer;
    margin-top: 30px;
    font-family: 'Titan One', sans-serif;
}

#winningScreen button:hover {
    background: #0056b3;
}

/* Mobile responsive adjustments */
@media (max-width: 767px) {
    #startMenu h1 {
        font-size: 36px;
        margin-bottom: 15px;
    }
    
    #personalBest {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    #playButton, #howToPlayButton {
        font-size: 20px;
        padding: 10px 25px;
    }
    
    #pauseButton {
        padding: 8px 16px;
        font-size: 16px;
        bottom: 20px;
        right: 20px;
    }
    
    #musicButton {
        padding: 8px 12px;
        font-size: 16px;
        bottom: 20px;
        right: 100px;
    }
    
    #howToPlayContent, #shopContent {
        padding: 20px;
        margin: 10px;
        max-height: 90vh;
        font-size: 14px;
    }
    
    #howToPlayContent h2, #shopContent h2 {
        font-size: 24px;
    }
    
    #howToPlayContent h3 {
        font-size: 18px;
    }
    
    #fullscreenBtn {
        padding: 8px 12px;
        font-size: 14px;
    }

    #score, #coins, #levelCounter, #worldCounter {
        font-size: 16px;
        padding: 4px 8px;
        min-width: 100px;
    }

    #score {
        left: 110px;
    }

    #levelCounter {
        left: 220px;
    }

    #worldCounter {
        left: 330px;
    }

    .control-btn {
        width: 60px;
        height: 60px;
        font-size: 20px;
    }
}