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

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
}

body {
    font-family: 'Courier New', monospace;
    background: #1a1a2e;
    color: #fff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.game-container {
    max-width: 1200px;
    width: 100%;
    background: #0f0f1e;
    border: 5px solid #333;
    border-radius: 15px;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.game-header {
    background: linear-gradient(180deg, #2a2a3e 0%, #1a1a2e 100%);
    padding: 40px 20px;
    text-align: center;
    border-bottom: 3px solid #444;
    position: relative;
}

.game-title {
    font-size: 80px;
    font-weight: 900;
    color: #FFD700;
    letter-spacing: 8px;
    margin: 0;
    text-transform: uppercase;
    position: relative;
    display: inline-block;
    text-shadow:
        3px 3px 0 #CC9900,
        6px 6px 0 #AA7700,
        9px 9px 0 #886600,
        12px 12px 0 #664400,
        15px 15px 0 #442200,
        18px 18px 20px rgba(0, 0, 0, 0.8);
}

.subtitle {
    font-size: 16px;
    letter-spacing: 6px;
    color: #999;
    margin-top: 15px;
    text-transform: uppercase;
}

.main-content {
    display: flex;
    padding: 30px;
    gap: 30px;
    justify-content: center;
    align-items: flex-start;
}

.left-panel,
.right-panel {
    flex: 0 0 250px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.game-board-container {
    position: relative;
    flex-shrink: 0;
}

#gameCanvas {
    border: 4px solid #444;
    background: #000;
    display: block;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    border-radius: 5px;
}

.stats-box,
.next-box,
.controls-box,
.highscore-box {
    background: linear-gradient(145deg, #1f1f2e, #151520);
    border: 3px solid #333;
    border-radius: 10px;
    padding: 20px;
    box-shadow:
        0 5px 15px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.box-title {
    font-size: 18px;
    font-weight: bold;
    color: #FFD700;
    margin-bottom: 15px;
    text-align: center;
    letter-spacing: 3px;
    border-bottom: 2px solid #444;
    padding-bottom: 10px;
    text-shadow:
        1px 1px 0 #AA7700,
        2px 2px 0 #886600,
        3px 3px 5px rgba(0, 0, 0, 0.5);
}

.stat-item {
    margin-bottom: 20px;
    text-align: center;
}

.stat-label {
    font-size: 13px;
    color: #888;
    margin-bottom: 8px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.stat-value {
    font-size: 42px;
    font-weight: bold;
    color: #fff;
    text-shadow:
        2px 2px 0 #666,
        4px 4px 0 #444,
        6px 6px 10px rgba(0, 0, 0, 0.5);
}

#nextCanvas {
    display: block;
    margin: 0 auto;
    background: #000;
    border: 2px solid #333;
    border-radius: 5px;
}

.control-item {
    font-size: 13px;
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-left: 3px solid #FFD700;
    padding-left: 12px;
    color: #ccc;
    border-radius: 3px;
}

.highscore-list {
    max-height: 400px;
    overflow-y: auto;
}

.highscore-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-left: 3px solid #FFD700;
    font-size: 14px;
    border-radius: 3px;
    transition: all 0.2s;
}

.highscore-item:hover {
    background: rgba(255, 215, 0, 0.1);
    transform: translateX(5px);
}

.highscore-rank {
    color: #FFD700;
    font-weight: bold;
    margin-right: 10px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.highscore-name {
    flex: 1;
    color: #ccc;
}

.highscore-score {
    color: #fff;
    font-weight: bold;
}

.loading {
    text-align: center;
    color: #888;
    padding: 20px;
}

.retro-button {
    width: 100%;
    padding: 16px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: bold;
    color: #000;
    background: linear-gradient(180deg, #FFD700 0%, #FFA500 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow:
        0 4px 0 #CC8800,
        0 8px 15px rgba(0, 0, 0, 0.4);
    transition: all 0.1s;
    position: relative;
}

.retro-button:hover {
    background: linear-gradient(180deg, #FFE44D 0%, #FFB700 100%);
    transform: translateY(-2px);
    box-shadow:
        0 6px 0 #CC8800,
        0 10px 20px rgba(0, 0, 0, 0.5);
}

.retro-button:active {
    transform: translateY(2px);
    box-shadow:
        0 2px 0 #CC8800,
        0 4px 10px rgba(0, 0, 0, 0.3);
}

.start-button {
    margin-top: 20px;
}

.game-over-overlay,
.pause-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.game-over-content {
    text-align: center;
    padding: 40px;
    background: linear-gradient(145deg, #1f1f2e, #151520);
    border: 4px solid #444;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.game-over-content h2 {
    font-size: 56px;
    color: #ff3366;
    text-shadow:
        2px 2px 0 #cc0033,
        4px 4px 0 #990022,
        6px 6px 0 #660011,
        8px 8px 20px rgba(0, 0, 0, 0.8);
    margin-bottom: 25px;
    letter-spacing: 4px;
}

.final-score {
    font-size: 28px;
    color: #FFD700;
    margin-bottom: 25px;
    text-shadow:
        1px 1px 0 #AA7700,
        2px 2px 5px rgba(0, 0, 0, 0.5);
}

#playerName {
    width: 100%;
    padding: 14px;
    margin-bottom: 20px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    background: #000;
    border: 2px solid #444;
    color: #fff;
    border-radius: 5px;
    text-align: center;
}

#playerName:focus {
    outline: none;
    border-color: #FFD700;
}

.game-over-content .retro-button {
    margin-top: 12px;
}

.pause-content {
    font-size: 80px;
    font-weight: bold;
    color: #FFD700;
    letter-spacing: 10px;
    text-shadow:
        3px 3px 0 #CC9900,
        6px 6px 0 #AA7700,
        9px 9px 0 #886600,
        12px 12px 20px rgba(0, 0, 0, 0.8);
}

.hidden {
    display: none !important;
}

.game-footer {
    background: #0a0a15;
    padding: 18px;
    text-align: center;
    border-top: 2px solid #333;
    font-size: 12px;
    color: #666;
    letter-spacing: 2px;
}

/* Scrollbar Styling */
.highscore-list::-webkit-scrollbar {
    width: 10px;
}

.highscore-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
}

.highscore-list::-webkit-scrollbar-thumb {
    background: #FFD700;
    border-radius: 5px;
}

.highscore-list::-webkit-scrollbar-thumb:hover {
    background: #FFA500;
}

/* Mobile Controls */
.mobile-controls {
    display: none;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(145deg, #1f1f2e, #151520);
    border: 3px solid #333;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.mobile-controls-top,
.mobile-controls-bottom {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.mobile-dpad {
    display: flex;
    gap: 10px;
}

.mobile-btn {
    width: 70px;
    height: 70px;
    font-size: 28px;
    font-weight: bold;
    color: #000;
    background: linear-gradient(180deg, #FFD700 0%, #FFA500 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow:
        0 4px 0 #CC8800,
        0 8px 15px rgba(0, 0, 0, 0.4);
    transition: all 0.1s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.mobile-btn-rotate,
.mobile-btn-drop {
    width: 90px;
    height: 70px;
}

.mobile-btn span {
    font-size: 32px;
    line-height: 1;
}

.btn-label {
    font-size: 10px;
    margin-top: 3px;
    letter-spacing: 1px;
}

.mobile-btn:active,
.mobile-btn.active {
    transform: translateY(3px);
    box-shadow:
        0 2px 0 #CC8800,
        0 4px 10px rgba(0, 0, 0, 0.3);
}

.mobile-btn-arrow {
    width: 65px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
        align-items: center;
    }

    .left-panel,
    .right-panel {
        flex: none;
        width: 100%;
        max-width: 400px;
    }

    .game-title {
        font-size: 56px;
    }
}

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

    .game-container {
        border-width: 3px;
    }

    .game-header {
        padding: 25px 15px;
    }

    .game-title {
        font-size: 42px;
        letter-spacing: 4px;
        text-shadow:
            2px 2px 0 #CC9900,
            4px 4px 0 #AA7700,
            6px 6px 0 #886600,
            8px 8px 0 #664400,
            10px 10px 15px rgba(0, 0, 0, 0.8);
    }

    .subtitle {
        font-size: 12px;
        letter-spacing: 3px;
    }

    .main-content {
        padding: 20px;
        gap: 20px;
    }

    #gameCanvas {
        width: 100%;
        max-width: 200px;
        height: auto !important;
    }

    .left-panel,
    .right-panel {
        max-width: 100%;
    }

    .stats-box,
    .next-box,
    .controls-box,
    .highscore-box {
        padding: 15px;
    }

    .box-title {
        font-size: 16px;
    }

    .stat-value {
        font-size: 36px;
    }

    .controls-box {
        display: none;
    }

    .mobile-controls {
        display: flex;
    }

    .game-over-content {
        padding: 30px 20px;
        max-width: 90%;
    }

    .game-over-content h2 {
        font-size: 40px;
    }

    .final-score {
        font-size: 22px;
    }

    .pause-content {
        font-size: 60px;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 36px;
        letter-spacing: 2px;
    }

    .mobile-btn {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }

    .mobile-btn-rotate,
    .mobile-btn-drop {
        width: 75px;
        height: 60px;
    }

    .mobile-btn span {
        font-size: 28px;
    }

    .btn-label {
        font-size: 9px;
    }

.game-board-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
    }
}