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

body {
    background: #1a1a2e;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    aspect-ratio: 16 / 9;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#logo-container {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1000;
    width: 120px;
    height: auto;
    display: block;
    text-decoration: none;
}

#logo-container img {
    width: 100%;
    height: auto;
    display: block;
}

#touch-controls {
    position: absolute;
    bottom: 10px !important;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 30px;
    z-index: 15;
    pointer-events: none;
}

.touch-btn {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    pointer-events: all;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
}

.touch-btn:active {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(0.95);
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: auto;
}

@media (max-width: 768px) {
    body {
        margin: 0;
        padding: 0;
    }

    #game-container {
        width: 100vw;
        height: 100dvh;
        overflow: hidden;
    }

    #gameCanvas {
        width: 1280px;
        height: 720px;
    }

    #touch-controls {
        bottom: 10px !important;
    }
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
    padding: 15px 25px;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    z-index: 10;
    gap: 20px;
}

#ui-overlay div {
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    margin: 4px 0;
}

#ui-stats-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

#ui-stats-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-left: auto;
}

#score-display {
    font-size: 28px;
    color: #ffd54a;
}

#lives-display {
    font-size: 24px;
}

#combo-display {
    color: #ff6b6b;
    font-size: 22px;
}

#multiplier-display {
    color: #4ecdc4;
}

#highscore-display {
    font-size: 16px;
    color: #aaa;
    text-align: right;
}

#pause-hint {
    position: absolute;
    bottom: 18px;
    left: 18px;
    z-index: 10;
    font-size: 13px;
    color: #fff;
    background: rgba(0, 0, 0, 0.45);
    padding: 5px 14px;
    border-radius: 12px;
    text-align: left;
    pointer-events: none;
    letter-spacing: 0.5px;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    z-index: 20;
    color: #fff;
}

.screen.active {
    display: flex;
}

.screen h1 {
    font-size: 56px;
    margin-bottom: 40px;
    color: #ffd54a;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
}

.screen h2 {
    font-size: 48px;
    margin-bottom: 30px;
    color: #ffd54a;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
}

#menu-buttons,
#pause-buttons,
#gameover-buttons,
#zen-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.menu-btn {
    padding: 15px 40px;
    font-size: 22px;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 300px;
    pointer-events: all;
}

.menu-btn:hover {
    transform: scale(1.05);
}

#btn-classic {
    background: #4ecdc4;
    color: #fff;
}

#btn-classic:hover {
    background: #3dbdb5;
}

#btn-survival {
    background: #ff6b6b;
    color: #fff;
}

#btn-survival:hover {
    background: #ee5a5a;
}

#btn-zen {
    background: #a8e6cf;
    color: #333;
}

#btn-zen:hover {
    background: #98d6bf;
}

#btn-combo {
    background: #ffd54a;
    color: #333;
}

#btn-combo:hover {
    background: #e8c43a;
}

#btn-resume {
    background: #4ecdc4;
    color: #fff;
}

#btn-resume:hover {
    background: #3dbdb5;
}

#btn-quit,
#btn-menu,
#btn-zen-menu {
    background: #666;
    color: #fff;
}

#btn-quit:hover,
#btn-menu:hover,
#btn-zen-menu:hover {
    background: #555;
}

#btn-retry,
#btn-zen-retry {
    background: #ffd54a;
    color: #333;
}

#btn-retry:hover,
#btn-zen-retry:hover {
    background: #e8c43a;
}

#stats-display,
#gameover-stats,
#zen-stats {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px 40px;
    border-radius: 10px;
    text-align: center;
}

#stats-display p,
#gameover-stats p,
#zen-stats p {
    font-size: 20px;
    margin: 8px 0;
}

#stats-display span,
#gameover-stats span,
#zen-stats span {
    color: #ffd54a;
    font-weight: bold;
}

@media (max-width: 1280px), (max-height: 720px) {
    #game-container {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
    }

    #logo-container {
        width: 80px;
        top: 5px;
        right: 5px;
    }

    #ui-overlay {
        padding: 8px 12px;
    }

    #ui-overlay div {
        font-size: 14px;
    }

    #score-display {
        font-size: 20px;
    }

    #lives-display {
        font-size: 18px;
    }

    #combo-display {
        font-size: 16px;
    }

    .screen h1 {
        font-size: 32px;
        margin-bottom: 20px;
    }

    .screen h2 {
        font-size: 28px;
        margin-bottom: 15px;
    }

    #menu-buttons,
    #pause-buttons,
    #gameover-buttons,
    #zen-buttons {
        gap: 8px;
        margin-bottom: 15px;
    }

    .menu-btn {
        padding: 10px 25px;
        font-size: 16px;
        min-width: 220px;
    }

    #stats-display,
    #gameover-stats,
    #zen-stats {
        padding: 12px 25px;
    }

    #stats-display p,
    #gameover-stats p,
    #zen-stats p {
        font-size: 16px;
    }
}

@media (hover: none) and (pointer: coarse) {
    #touch-controls {
        display: flex;
    }

    #pause-hint {
        display: none;
    }
}

@media (max-width: 600px) {
    #logo-container {
        width: 55px;
        top: 3px;
        right: 3px;
    }

    .touch-btn {
        width: 70px;
        height: 70px;
        font-size: 26px;
    }

    #touch-controls {
        bottom: 10px;
        gap: 20px;
    }

    #ui-overlay {
        padding: 5px 8px;
    }

    #ui-overlay div {
        font-size: 11px;
    }

    #score-display {
        font-size: 16px;
    }

    #lives-display {
        font-size: 14px;
    }

    #combo-display {
        font-size: 13px;
    }

    .screen h1 {
        font-size: 24px;
        margin-bottom: 12px;
    }

    .screen h2 {
        font-size: 22px;
        margin-bottom: 10px;
    }

    .menu-btn {
        padding: 8px 18px;
        font-size: 14px;
        min-width: 180px;
    }

    #stats-display,
    #gameover-stats,
    #zen-stats {
        padding: 8px 18px;
    }

    #stats-display p,
    #gameover-stats p,
    #zen-stats p {
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    #touch-controls {
        bottom: 10px !important;
    }
}
