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

body {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    font-family: 'Courier New', monospace;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

.main-container {
    border: 2px solid #4a4a4a;
    border-radius: 15px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.main-container h1 {
    font-size: 32px;
    margin-bottom: 10px;
    text-shadow: white 0 0 10px;
}

.main-container p {
    margin-bottom: 15px;
    font-size: 0.8em;
    opacity: 0.7;
    line-height: 1.4;
}

.game-container {
    position: relative;
    width: fit-content;
    margin: 0 auto;
    border-radius: 15px;
}

#gameCanvas {
    background: linear-gradient(45deg, #1a1a2e, #16213e);
    display: block;
    border: 2px solid #4a4a4a;
    border-radius: 15px;
}

/* Score Display Row */
#scoreDisplay {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 15px;
    width: 100%;
    max-width: 480px;
}

.score-item {
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 16px;
    border-radius: 15px;
    border: 2px solid rgba(255, 215, 0, 0.6);
    color: #ffd700;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
    backdrop-filter: blur(4px);
    flex: 1;
    text-align: center;
}

.score-item:last-child {
    border-color: rgba(255, 68, 68, 0.6);
    color: #ff6666;
    text-shadow: 0 0 8px rgba(255, 68, 68, 0.5);
}

/* Start Overlay */
#startOverlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    border-radius: 15px;
    backdrop-filter: blur(5px);
}

.start-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 3px solid #4a9eff;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    color: white;
    max-width: 500px;
    box-shadow: 0 0 30px rgba(74, 158, 255, 0.3);
}

.start-content h2 {
    color: #4a9eff;
    font-size: 28px;
    margin-bottom: 20px;
    animation: glow 2s infinite alternate;
}

.start-content p {
    font-size: 16px;
    margin-bottom: 15px;
    opacity: 0.9;
}

.controls-info {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.controls-info p {
    font-size: 14px;
    margin-bottom: 8px;
}

.controls-info strong {
    color: #4a9eff;
}

.high-score-preview {
    margin: 20px 0;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.high-score-preview p {
    padding: 10px;
    margin: 0;
}

.high-score-preview span {
    color: #ffd700;
    font-weight: bold;
}

.start-btn {
    background: linear-gradient(135deg, #4a9eff, #357abd);
    border: none;
    color: white;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(74, 158, 255, 0.3);
    margin-top: 10px;
}

.start-btn:hover {
    background: linear-gradient(135deg, #357abd, #2a5d94);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 158, 255, 0.4);
}

#ui {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    font-size: 14px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.8);
    padding: 15px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    min-width: 220px;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.bar-container {
    margin: 5px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.bar-label {
    min-width: 30px;
    font-weight: bold;
}

.bar {
    width: 150px;
    height: 20px;
    background: #333;
    border: 2px solid #666;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.bar-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 8px;
}

.hp-fill {
    background: linear-gradient(90deg, #ff4444, #ff6666);
}

.xp-fill {
    background: linear-gradient(90deg, #00aa00, #00ff00);
}

.bar-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.8);
    z-index: 1;
}

.stats-row {
    display: flex;
    justify-content: space-between;
    margin: 8px 0;
    font-size: 13px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

#levelUpModal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 3px solid #ffaa00;
    border-radius: 15px;
    padding: 30px;
    color: white;
    text-align: center;
    z-index: 100;
    display: none;
    box-shadow: 0 0 20px rgba(255, 170, 0, 0.3);
    min-width: 800px;
    backdrop-filter: blur(5px);
}

#levelUpModal h2 {
    color: #ffaa00;
    font-size: 24px;
    margin-bottom: 20px;
    animation: glow 2s infinite alternate;
}

.choices-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.upgrade-choice {
    flex: 1;
    padding: 20px;
    background: linear-gradient(180deg, #2a2a40 0%, #1a1a2e 100%);
    border: 2px solid #666;
    color: white;
    cursor: pointer;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s;
    max-width: 300px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.upgrade-choice strong {
    color: #ffaa00;
    font-size: 16px;
    margin-bottom: 10px;
    display: block;
}

.upgrade-choice:hover {
    background: linear-gradient(180deg, #3a3a50 0%, #2a2a40 100%);
    border-color: #ffaa00;
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(255, 170, 0, 0.2);
}

.upgrade-choice::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 170, 0, 0.5), transparent);
}

@keyframes glow {
    from {
        text-shadow: 0 0 5px currentColor, 0 0 10px currentColor;
    }
    to {
        text-shadow: 0 0 10px currentColor, 0 0 20px currentColor;
    }
}

#gameOver {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 400px;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    border: 3px solid #ff4444;
    border-radius: 10px;
    padding: 30px;
    color: white;
    text-align: center;
    z-index: 100;
    display: none;
}

#gameOver h2 {
    font-size: 32px;
    margin-bottom: 20px;
}

.restart-btn {
    margin-top: 16px;
    padding: 10px 20px;
    background: #ff4444;
    border: none;
    color: white;
    cursor: pointer;
    border-radius: 5px;
    font-size: 16px;
}

.restart-btn:hover {
    background: #ff6666;
}