@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&family=Chakra+Petch:wght@300;400;700&display=swap');

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

body {
    font-family: 'Chakra Petch', 'Orbitron', sans-serif;
    background-color: #0a0a14;
    color: #fff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
}

body.desktop-only-blocked {
    margin: 0;
    padding: 24px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.desktop-only-message {
    max-width: 620px;
    width: 100%;
    border: 1px solid rgba(81, 203, 238, 0.45);
    background: linear-gradient(to bottom, rgba(20, 10, 40, 0.95), rgba(8, 6, 20, 0.95));
    box-shadow: 0 0 0 1px rgba(153, 51, 204, 0.35), 0 10px 30px rgba(0, 0, 0, 0.55);
    clip-path: polygon(
        0% 14px, 14px 0%,
        calc(100% - 14px) 0%, 100% 14px,
        100% calc(100% - 14px), calc(100% - 14px) 100%,
        14px 100%, 0% calc(100% - 14px)
    );
    padding: 28px 24px;
    text-align: center;
}

.desktop-only-message h1 {
    display: block;
    margin: 0 0 12px;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    letter-spacing: 0.04em;
    color: #9fe8ff;
    text-shadow: 0 0 10px rgba(81, 203, 238, 0.6);
}

.desktop-only-message p {
    margin: 8px 0;
    font-size: 1rem;
    line-height: 1.5;
    color: #e6f7ff;
}

.game-container {
    width: 95%;
    max-width: 1300px; /* Increased max-width to accommodate sidebar */
    background-color: rgba(16, 16, 28, 0.95);
    padding: 10px;
    box-shadow: 0 0 0 1px rgba(81, 203, 238, 0.3), 0 4px 6px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Add angular accent lines */
.game-container::before, .game-container::after {
    content: '';
    position: absolute;
    background-color: rgba(81, 203, 238, 0.4);
    z-index: 0;
}

.game-container::before {
    width: 100%;
    height: 2px;
    top: 0;
    left: 0;
}

.game-container::after {
    width: 2px;
    height: 100px;
    top: 0;
    left: 0;
}

.game-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px 15px;
    position: relative;
    z-index: 1;
    background: linear-gradient(to bottom, rgba(20, 10, 40, 0.9), rgba(10, 5, 30, 0.8));
    /* Add crystalline shape to header */
    clip-path: polygon(
        0% 0%, 100% 0%, 
        100% calc(100% - 15px), calc(100% - 15px) 100%, 
        15px 100%, 0% calc(100% - 15px)
    );
    border-bottom: 2px solid rgba(153, 51, 204, 0.8);
    box-shadow: 0 0 20px rgba(153, 51, 204, 0.5);
    font-family: 'Orbitron', sans-serif;
}

/* Add crystalline accent to header */
.game-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
        rgba(153, 51, 204, 0.1) 0%, 
        rgba(81, 203, 238, 0.05) 50%, 
        rgba(153, 51, 204, 0.1) 100%);
    pointer-events: none;
    z-index: -1;
}

/* Add crystalline decorative elements to the header */
.game-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(45deg, transparent 48%, rgba(153, 51, 204, 0.3) 49%, rgba(153, 51, 204, 0.3) 51%, transparent 52%),
        linear-gradient(135deg, transparent 48%, rgba(81, 203, 238, 0.3) 49%, rgba(81, 203, 238, 0.3) 51%, transparent 52%);
    background-size: 30px 30px, 30px 30px;
    background-position: 0 0, 15px 15px;
    pointer-events: none;
    z-index: -1;
    opacity: 0.5;
}

/* Remove the h1 styles since we removed the title */
h1 {
    display: none;
}

.game-stats {
    display: flex;
    gap: 15px;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 15px;
    /* Add crystalline shape */
    clip-path: polygon(
        0% 8px, 8px 0%, 
        calc(100% - 8px) 0%, 100% 8px, 
        100% calc(100% - 8px), calc(100% - 8px) 100%, 
        8px 100%, 0% calc(100% - 8px)
    );
    border: 1px solid rgba(81, 203, 238, 0.3);
    position: relative;
    overflow: visible;
}

/* Add crystalline accent to game-stats */
.game-stats::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(135deg, transparent 49.5%, rgba(81, 203, 238, 0.15) 49.5%, rgba(81, 203, 238, 0.15) 50.5%, transparent 50.5%),
        linear-gradient(45deg, transparent 49.5%, rgba(81, 203, 238, 0.1) 49.5%, rgba(81, 203, 238, 0.1) 50.5%, transparent 50.5%);
    background-size: 15px 15px;
    pointer-events: none;
    z-index: 0;
}

.score-container {
    display: flex;
    align-items: center;
    background: linear-gradient(to bottom, rgba(0, 20, 40, 0.8), rgba(0, 10, 20, 0.8));
    color: white;
    padding: 5px 15px;
    /* More aggressive crystalline shape */
    clip-path: polygon(
        0% 0%, 95% 0%, 
        100% 30%, 100% 100%, 
        5% 100%, 0% 70%
    );
    font-size: 1.2rem;
    min-width: 160px;
    box-sizing: border-box;
    margin-right: 0; /* Remove margin since we're using gap in the parent */
    position: relative;
    border: 1px solid rgba(81, 203, 238, 0.4);
    box-shadow: 0 0 10px rgba(81, 203, 238, 0.2);
    z-index: 1;
}

/* Add glowing edge to score container */
.score-container::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, rgba(81, 203, 238, 0.8), rgba(81, 203, 238, 0.2));
    z-index: 2;
}

.credits-container {
    display: flex;
    align-items: center;
    background: linear-gradient(to bottom, rgba(0, 30, 15, 0.8), rgba(0, 15, 10, 0.8));
    color: #00ffaa; /* Different color for credits */
    padding: 5px 15px;
    /* More aggressive crystalline shape - mirrored from score container */
    clip-path: polygon(
        5% 0%, 100% 0%, 
        100% 70%, 95% 100%, 
        0% 100%, 0% 30%
    );
    font-size: 1.2rem;
    min-width: 180px; /* Increased from 160px to provide more space */
    box-sizing: border-box;
    position: relative;
    border: 1px solid rgba(0, 255, 170, 0.4);
    box-shadow: 0 0 10px rgba(0, 255, 170, 0.2);
    z-index: 1;
}

/* Add glowing edge to credits container */
.credits-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 255, 170, 0.8), rgba(0, 255, 170, 0.2));
    z-index: 2;
}

.score-container span:first-child, .credits-container span:first-child {
    width: 70px;
    display: inline-block;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.credits-container span:first-child {
    width: 80px; /* Increased width to prevent overlap */
    text-shadow: 0 0 5px rgba(0, 255, 170, 0.5);
}

#score, #credits {
    display: inline-block;
    min-width: 70px;
    text-align: left;
    position: relative;
    z-index: 2;
    font-family: 'Orbitron', monospace;
    font-weight: bold;
}

#score {
    color: #ffffff;
    text-shadow: 0 0 5px rgba(81, 203, 238, 0.7);
}

#credits {
    color: #00ffaa;
    text-shadow: 0 0 5px rgba(0, 255, 170, 0.7);
}

.level-container {
    display: flex;
    align-items: center;
    background-color: rgba(10, 30, 60, 0.7);
    border: 1px solid #173e68;
    padding: 8px 12px;
    /* Replace rounded corners with crystalline shape */
    clip-path: polygon(
        0% 4px, 4px 0%, 
        calc(100% - 4px) 0%, 100% 4px, 
        100% calc(100% - 4px), calc(100% - 4px) 100%, 
        4px 100%, 0% calc(100% - 4px)
    );
    box-shadow: 0 0 10px rgba(0, 100, 255, 0.3);
    font-size: 1.1rem;
    height: 40px; /* Slightly increased height */
    box-sizing: border-box;
    justify-content: space-between;
    overflow: visible;
    position: relative;
    z-index: 1;
}

.level-label {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(153, 51, 204, 0.8);
    font-weight: bold;
    margin-right: 10px;
    letter-spacing: 1px;
}

.timer-label {
    width: 60px; /* Increased from 55px to 60px */
    text-align: right;
    color: #51cbee;
    margin-left: auto; /* Push to right side */
    flex-shrink: 0; /* Prevent shrinking */
    padding-right: 5px; /* Add spacing between label and timer value */
}

.level-indicators {
    display: flex;
    gap: 5px;
    margin: 0 10px; /* Add some margin */
    position: relative; /* Needed for z-index */
    z-index: 10; /* <<< Increased z-index significantly >>> */
}

.level-indicator {
    display: inline-block;
    width: 30px;
    height: 30px;
    margin: 0 5px;
    line-height: 30px;
    text-align: center;
    background: linear-gradient(135deg, rgba(20, 10, 40, 0.9), rgba(10, 5, 30, 0.8));
    color: #51cbee;
    border: 1px solid rgba(153, 51, 204, 0.5);
    box-shadow: 0 0 10px rgba(153, 51, 204, 0.3);
    clip-path: polygon(
        50% 0%, 
        100% 25%, 
        100% 75%, 
        50% 100%, 
        0% 75%, 
        0% 25%
    );
    font-weight: bold;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2; /* <<< Increased z-index from 1 >>> */
}

.level-indicator.active {
    background: linear-gradient(135deg, rgba(153, 51, 204, 0.8), rgba(81, 203, 238, 0.8));
    color: white;
    box-shadow: 0 0 15px rgba(153, 51, 204, 0.8);
    transform: scale(1.1);
    z-index: 3; /* <<< Increased z-index for active state too >>> */
}

.level-indicator.active::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: transparent;
    border: 2px solid rgba(153, 51, 204, 0.7);
    clip-path: polygon(
        50% -5%, 
        105% 25%, 
        105% 75%, 
        50% 105%, 
        -5% 75%, 
        -5% 25%
    );
    z-index: -1;
    animation: pulse-border 2s infinite alternate;
}

@keyframes pulse-border {
    0% { 
        box-shadow: 0 0 5px rgba(153, 51, 204, 0.5);
        border-color: rgba(153, 51, 204, 0.5);
    }
    100% { 
        box-shadow: 0 0 15px rgba(153, 51, 204, 0.9);
        border-color: rgba(153, 51, 204, 0.9);
    }
}

.level-indicator.completed {
    background-color: rgba(81, 203, 238, 0.2);
    color: #51cbee;
}

.level-indicator.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid #51cbee;
    z-index: 3;
}

#timer {
    font-family: 'Orbitron', monospace; /* Changed from 'Courier New' to match game aesthetic */
    font-weight: bold;
    color: #51cbee;
    text-shadow: 0 0 5px rgba(81, 203, 238, 0.7);
    width: 70px; /* Increased from 60px to 70px to prevent chopping */
    display: inline-block;
    text-align: left;
    flex-shrink: 0; /* Prevent shrinking */
    padding-right: 5px; /* Add padding to ensure text doesn't touch container edge */
    overflow: visible; /* Changed from hidden to visible to prevent chopping */
}

/* Styles for the main game area and sidebar layout */
.game-content {
    display: flex;
    gap: 10px; /* Space between game area and sidebar */
    flex-grow: 1; /* Allow content to fill available space */
}

.game-interface {
    flex-grow: 1; /* Make the game area take up most space */
    position: relative; /* <<< ADDED: Establish positioning context */
}

canvas#gameCanvas {
    display: block; /* Removes extra space below canvas */
    background-color: #000;
    width: 100%;
    height: 800px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
    position: relative;
    z-index: 1;
    margin: 0;
}

/* Add grid overlay */
#gameCanvas::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(81, 203, 238, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(81, 203, 238, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 0;
}

/* Game sidebar styling */
.game-sidebar {
    width: 220px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 10px;
    background: linear-gradient(to bottom, rgba(20, 10, 40, 0.9), rgba(10, 5, 30, 0.8));
    border-left: 2px solid rgba(153, 51, 204, 0.8);
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(153, 51, 204, 0.3);
    /* Add crystalline shape to sidebar */
    clip-path: polygon(
        0% 0%, 100% 0%, 
        100% calc(100% - 20px), calc(100% - 20px) 100%, 
        20px 100%, 0% calc(100% - 20px)
    );
}

/* Add crystalline accent to sidebar */
.game-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(135deg, transparent 49.5%, rgba(153, 51, 204, 0.2) 49.5%, rgba(153, 51, 204, 0.2) 50.5%, transparent 50.5%),
        linear-gradient(45deg, transparent 49.5%, rgba(81, 203, 238, 0.1) 49.5%, rgba(81, 203, 238, 0.1) 50.5%, transparent 50.5%);
    background-size: 30px 30px;
    pointer-events: none;
    z-index: 0;
}

/* Add crystalline decorative elements to the sidebar */
.game-sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(45deg, transparent 48%, rgba(153, 51, 204, 0.3) 49%, rgba(153, 51, 204, 0.3) 51%, transparent 52%),
        linear-gradient(135deg, transparent 48%, rgba(81, 203, 238, 0.3) 49%, rgba(81, 203, 238, 0.3) 51%, transparent 52%);
    background-size: 30px 30px;
    background-position: 0 0, 15px 15px;
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}

/* High Scores Panel */
.high-scores-panel {
    background: linear-gradient(to bottom, rgba(20, 10, 40, 0.9), rgba(10, 5, 30, 0.8));
    border: 1px solid rgba(153, 51, 204, 0.6);
    box-shadow: 0 0 15px rgba(153, 51, 204, 0.3), inset 0 0 8px rgba(153, 51, 204, 0.2);
    padding: 8px;
    position: relative;
    overflow: hidden;
    /* Replace rounded corners with sharp crystalline edges */
    clip-path: polygon(
        0% 10px, 10px 0%, 
        calc(100% - 10px) 0%, 100% 10px, 
        100% calc(100% - 10px), calc(100% - 10px) 100%, 
        10px 100%, 0% calc(100% - 10px)
    );
    z-index: 1;
}

.high-scores-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10px;
    right: 10px;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(153, 51, 204, 0.8), transparent);
}

.high-scores-header {
    text-align: center;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(153, 51, 204, 0.4);
    position: relative;
}

.high-scores-header h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    color: #ffffff;
    margin: 0;
    text-shadow: 0 0 10px rgba(153, 51, 204, 0.8);
    letter-spacing: 1px;
}

.high-scores-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.high-score-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 5px;
    font-family: 'Chakra Petch', sans-serif;
    font-size: 0.85rem;
    background-color: rgba(20, 10, 40, 0.4);
    /* Replace rounded corners with sharp edges */
    clip-path: polygon(
        0% 0%, 100% 0%, 
        100% calc(100% - 4px), calc(100% - 4px) 100%, 
        0% 100%
    );
    transition: background-color 0.2s ease;
    border-left: 1px solid rgba(153, 51, 204, 0.3);
}

.high-score-entry:hover {
    background-color: rgba(153, 51, 204, 0.15);
}

.high-score-entry .rank {
    color: #51cbee;
    font-weight: bold;
    width: 20px;
}

.high-score-entry .player-name {
    flex: 1;
    padding-left: 5px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.high-score-entry .score-value {
    color: #ffcc00;
    font-family: 'Orbitron', monospace;
    min-width: 70px;
    text-align: right;
}

/* Highlight the top score */
.high-score-entry:first-child {
    background-color: rgba(255, 215, 0, 0.15);
    border: 1px solid rgba(255, 215, 0, 0.3);
    /* Special crystalline shape for top score */
    clip-path: polygon(
        0% 0%, 100% 0%, 
        100% calc(100% - 6px), calc(100% - 6px) 100%, 
        0% 100%
    );
}

.high-score-entry:first-child .rank,
.high-score-entry:first-child .player-name {
    color: #ffcc00;
}

.high-score-entry:first-child .score-value {
    color: #fff;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.7);
}

/* Game status styling - updated to look like a crystalline console */
.game-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    position: relative;
    z-index: 1;
    margin-top: auto;
    padding: 20px;
    border-top: 1px solid rgba(153, 51, 204, 0.3);
    background: linear-gradient(to bottom, rgba(20, 10, 40, 0.9), rgba(10, 5, 30, 0.8));
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5), inset 0 0 5px rgba(153, 51, 204, 0.3);
    min-height: 230px; /* Increased from 180px to 230px */
    width: 100%;
    /* Replace rounded corners with crystalline shape */
    clip-path: polygon(
        0% 15px, 15px 0%, 
        calc(100% - 15px) 0%, 100% 15px, 
        100% calc(100% - 15px), calc(100% - 15px) 100%, 
        15px 100%, 0% calc(100% - 15px)
    );
}

/* Add console details */
.game-status::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    height: 2px;
    background: linear-gradient(to right, transparent, rgba(153, 51, 204, 0.7), transparent);
}

.game-status::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 15%;
    right: 15%;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.3), transparent);
}

/* Add crystalline accent lines to game status */
.game-status::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(135deg, transparent 49.5%, rgba(153, 51, 204, 0.1) 49.5%, rgba(153, 51, 204, 0.1) 50.5%, transparent 50.5%),
        linear-gradient(45deg, transparent 49.5%, rgba(81, 203, 238, 0.05) 49.5%, rgba(81, 203, 238, 0.05) 50.5%, transparent 50.5%);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: -1;
}

/* Status Container for dynamic indicators */
.status-container {
    position: relative;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 15px;
    width: 100%;
    min-height: 40px;
    margin-top: 15px;
}

/* Create a container for shield and energy bars */
.status-bars-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 25px;
    width: 100%;
    margin-top: 10px;
}

.status-bar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: auto;
    min-width: 70px;
    position: relative;
    padding: 10px 15px;
    background-color: rgba(20, 10, 40, 0.4);
    border: 1px solid rgba(153, 51, 204, 0.4);
    box-shadow: 0 0 10px rgba(153, 51, 204, 0.2);
    /* Replace rounded corners with crystalline shape */
    clip-path: polygon(
        0% 8px, 8px 0%, 
        calc(100% - 8px) 0%, 100% 8px, 
        100% calc(100% - 8px), calc(100% - 8px) 100%, 
        8px 100%, 0% calc(100% - 8px)
    );
}

.status-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    color: #fff;
    margin: 0;
    letter-spacing: 1px;
    text-align: center;
    text-shadow: 0 0 5px rgba(153, 51, 204, 0.7);
}

.status-bar-background {
    width: 25px;
    height: 120px;
    background-color: rgba(10, 5, 20, 0.6);
    border: 1px solid rgba(153, 51, 204, 0.6);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5), 0 0 10px rgba(153, 51, 204, 0.3);
    /* Replace rounded corners with crystalline shape */
    clip-path: polygon(
        0% 5px, 5px 0%, 
        calc(100% - 5px) 0%, 100% 5px, 
        100% calc(100% - 5px), calc(100% - 5px) 100%, 
        5px 100%, 0% calc(100% - 5px)
    );
}

/* Add tick marks to the bars */
.status-bar-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: linear-gradient(to bottom, 
        transparent 19%, rgba(255, 255, 255, 0.1) 20%, 
        rgba(255, 255, 255, 0.1) 21%, transparent 22%,
        transparent 39%, rgba(255, 255, 255, 0.1) 40%, 
        rgba(255, 255, 255, 0.1) 41%, transparent 42%,
        transparent 59%, rgba(255, 255, 255, 0.1) 60%, 
        rgba(255, 255, 255, 0.1) 61%, transparent 62%,
        transparent 79%, rgba(255, 255, 255, 0.1) 80%, 
        rgba(255, 255, 255, 0.1) 81%, transparent 82%);
    pointer-events: none;
}

.status-bar-fill {
    width: 100%;
    height: 100%;
    position: absolute;
    bottom: 0;
    left: 0;
    transition: height 0.3s ease-out;
}

#shield-bar-fill {
    /* Removing the fixed background that might override JavaScript style changes */
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

#energy-bar-fill {
    background: linear-gradient(to top, #cc7700, #ffaa00);
    box-shadow: 0 0 8px #ffaa00, 0 0 15px #ffaa00;
}

/* Update Generator Level Indicator styling */
#generator-level-indicator {
    position: relative;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #33cc33;
    padding: 10px;
    margin-bottom: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 0 10px rgba(51, 204, 51, 0.5);
    transition: all 0.3s ease;
    /* Replace rounded corners with crystalline shape */
    clip-path: polygon(
        0% 8px, 8px 0%, 
        calc(100% - 8px) 0%, 100% 8px, 
        100% calc(100% - 8px), calc(100% - 8px) 100%, 
        8px 100%, 0% calc(100% - 8px)
    );
}

.generator-header {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 5px;
    width: 100%;
    justify-content: center;
}

.generator-icon {
    width: 12px;
    height: 12px;
    background-color: #33cc33;
    /* Replace rounded shape with crystalline shape */
    clip-path: polygon(
        0% 50%, 25% 0%, 
        75% 0%, 100% 50%, 
        75% 100%, 25% 100%
    );
}

.generator-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    color: #33cc33;
    text-shadow: 0 0 5px rgba(51, 204, 51, 0.7);
    letter-spacing: 1px;
}

.generator-level {
    display: flex;
    gap: 3px;
    margin-bottom: 5px;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 3px 5px;
    /* Replace rounded corners with crystalline shape */
    clip-path: polygon(
        0% 0%, 100% 0%, 
        100% calc(100% - 4px), calc(100% - 4px) 100%, 
        0% 100%
    );
}

.generator-pip {
    width: 10px;
    height: 10px;
    background-color: rgba(51, 204, 51, 0.2);
    border: 1px solid rgba(51, 204, 51, 0.5);
    /* Replace rounded shape with crystalline shape */
    clip-path: polygon(
        0% 50%, 25% 0%, 
        75% 0%, 100% 50%, 
        75% 100%, 25% 100%
    );
}

.generator-pip.active {
    background-color: #33cc33;
    box-shadow: 0 0 5px #33cc33;
}

.generator-regen-info {
    font-family: 'Chakra Petch', sans-serif;
    font-size: 0.65rem;
    color: #33cc33;
    text-align: center;
    margin-top: 2px;
    /* Add crystalline background */
    background-color: rgba(0, 0, 0, 0.4);
    padding: 2px 5px;
    /* Replace rounded corners with crystalline shape */
    clip-path: polygon(
        0% 0%, 100% 0%, 
        100% calc(100% - 3px), calc(100% - 3px) 100%, 
        0% 100%
    );
    border: 1px solid rgba(51, 204, 51, 0.3);
}

.game-controls {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    z-index: 1;
}

.audio-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
    padding: 8px 10px;
    border: 1px solid rgba(81, 203, 238, 0.35);
    background: linear-gradient(to bottom, rgba(12, 18, 35, 0.9), rgba(8, 12, 24, 0.85));
    clip-path: polygon(
        0% 6px, 6px 0%,
        calc(100% - 6px) 0%, 100% 6px,
        100% calc(100% - 6px), calc(100% - 6px) 100%,
        6px 100%, 0% calc(100% - 6px)
    );
}

.audio-controls label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #9fe8ff;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 1px;
}

#masterVolumeSlider {
    width: 100%;
    accent-color: #51cbee;
}

button {
    background: linear-gradient(to bottom, rgba(20, 10, 40, 0.9), rgba(10, 5, 30, 0.8));
    color: #ffffff;
    border: 1px solid rgba(153, 51, 204, 0.6);
    padding: 8px 15px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    letter-spacing: 1px;
    cursor: pointer;
    flex: 1;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
    text-shadow: 0 0 5px rgba(153, 51, 204, 0.8);
    /* Replace rounded corners with crystalline shape */
    clip-path: polygon(
        0% 8px, 8px 0%, 
        calc(100% - 8px) 0%, 100% 8px, 
        100% calc(100% - 8px), calc(100% - 8px) 100%, 
        8px 100%, 0% calc(100% - 8px)
    );
    box-shadow: 0 0 10px rgba(153, 51, 204, 0.3);
}

button::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    background-color: rgba(153, 51, 204, 0.8);
}

button:hover {
    transform: translateY(-2px);
    background: linear-gradient(to bottom, rgba(30, 15, 60, 0.9), rgba(20, 10, 40, 0.8));
    box-shadow: 0 0 15px rgba(153, 51, 204, 0.5);
}

/* Instructions section */
.instructions {
    background: linear-gradient(to bottom, rgba(20, 10, 40, 0.7), rgba(10, 5, 30, 0.7));
    padding: 10px;
    font-size: 0.8rem;
    z-index: 1;
    /* Replace rounded corners with crystalline shape */
    clip-path: polygon(
        0% 8px, 8px 0%, 
        calc(100% - 8px) 0%, 100% 8px, 
        100% calc(100% - 8px), calc(100% - 8px) 100%, 
        8px 100%, 0% calc(100% - 8px)
    );
    border: 1px solid rgba(153, 51, 204, 0.4);
    box-shadow: 0 0 10px rgba(153, 51, 204, 0.2);
    width: 100%;
    text-align: center;
    /* Prevent focus outline and tab focus */
    outline: none;
    /* The following will prevent the button from receiving focus */
    pointer-events: all;
}

.instructions p {
    margin: 2px 0;
    position: relative;
    padding-left: 10px;
}

.instructions p::before {
    content: '›';
    position: absolute;
    left: 0;
    color: #9933cc;
}

.instructions-title {
    font-weight: bold;
    margin-bottom: 5px;
    color: #fff;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(153, 51, 204, 0.3);
    padding-bottom: 2px;
    letter-spacing: 1px;
    text-shadow: 0 0 5px rgba(153, 51, 204, 0.7);
}

/* Compact power-ups and enemies display */
.instructions-column span[style] {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 3px;
    position: relative;
    top: -1px;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .game-container {
        width: 98%;
    }
    
    #gameCanvas {
        height: 700px;
    }
}

@media (max-width: 900px) {
    .game-content {
        flex-direction: column;
    }
    
    .game-sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
    }
    
    .game-controls {
        flex-direction: row;
        width: auto;
    }
    
    button {
        width: auto;
    }
    
    .game-status {
        width: 100%;
        flex-wrap: wrap;
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 15px;
        margin-top: 10px;
        min-height: 230px;
    }
    
    .status-bars-row {
        flex-direction: row;
        width: 100%;
        justify-content: center;
    }
    
    .level-indicators {
        gap: 2px;
    }
    
    .level-indicator {
        width: 22px;
        height: 22px;
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    button {
        padding: 5px 10px;
        font-size: 0.9rem;
    }
    
    .level-container {
        width: 300px;
    }
    
    .game-stats {
        flex-direction: column;
        gap: 10px;
        width: 100%;
        align-items: center;
    }
    
    .score-container, .credits-container {
        font-size: 1rem;
        padding: 3px 8px;
        width: 300px;
        justify-content: center;
    }
    
    .level-label, .timer-label, .score-container span:first-child, .credits-container span:first-child {
        font-size: 0.9rem;
        min-width: 50px;
    }
    
    .timer-label {
        margin-left: auto;
        text-align: right;
    }
    
    .level-indicator {
        width: 20px;
        height: 20px;
        font-size: 0.75rem;
    }
    
    #timer, #score, #credits {
        min-width: 40px;
        text-align: left;
    }
}

@media (max-width: 480px) {
    .level-container, .score-container, .credits-container {
        width: 280px;
    }
    
    .level-indicators {
        width: 120px; /* Further reduced width */
    }
    
    .level-indicator {
        width: 18px;
        height: 18px;
        font-size: 0.7rem;
        margin: 0 1px;
    }
}

/* Digital readout for shield and energy values */
.digital-readout {
    font-family: 'Orbitron', monospace;
    font-size: 0.7rem;
    color: #ffffff;
    background-color: rgba(20, 10, 40, 0.8);
    padding: 2px 5px;
    margin-top: 5px;
    text-align: center;
    min-width: 50px;
    text-shadow: 0 0 5px rgba(153, 51, 204, 0.7);
    /* Replace rounded corners with crystalline shape */
    clip-path: polygon(
        0% 0%, 100% 0%, 
        100% calc(100% - 4px), calc(100% - 4px) 100%, 
        0% 100%
    );
    border: 1px solid rgba(153, 51, 204, 0.4);
    box-shadow: 0 0 5px rgba(153, 51, 204, 0.3);
}

/* Debug panel styling */
#debug-panel {
    width: 20%;
    max-width: 300px;
    margin: 10px auto 0;
    background-color: #333;
    border: 2px solid #ff3333;
    /* Replace rounded corners with crystalline shape */
    clip-path: polygon(
        0% 5px, 5px 0%, 
        calc(100% - 5px) 0%, 100% 5px, 
        100% calc(100% - 5px), calc(100% - 5px) 100%, 
        5px 100%, 0% calc(100% - 5px)
    );
    padding: 10px;
    box-shadow: 0 0 10px rgba(255, 51, 51, 0.5);
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

#debug-panel h3 {
    color: #ff3333;
    font-family: 'Orbitron', sans-serif;
    margin: 0 0 10px 0;
    text-align: center;
    font-size: 14px;
}

#debug-panel button {
    background-color: #500;
    color: #fff;
    padding: 5px 10px;
    cursor: pointer;
    width: 100%;
    margin: 5px 0;
    display: block;
    border: 1px solid #f33;
    /* Replace rounded corners with crystalline shape */
    clip-path: polygon(
        0% 4px, 4px 0%, 
        calc(100% - 4px) 0%, 100% 4px, 
        100% calc(100% - 4px), calc(100% - 4px) 100%, 
        4px 100%, 0% calc(100% - 4px)
    );
    text-transform: uppercase;
    transition: all 0.2s ease;
}

#debug-panel button:hover {
    background-color: #700;
    transform: translateY(-2px);
}

#debug-panel button:active {
    background-color: #900;
    transform: translateY(1px);
}

/* High Scores Loading and Error States */
.high-scores-loading {
    padding: 10px;
    text-align: center;
    color: #51cbee;
    font-size: 14px;
    animation: pulse 1.5s infinite alternate;
}

.high-scores-error {
    padding: 10px;
    text-align: center;
    color: #ff3333;
    font-size: 14px;
    border: 1px solid #ff3333;
    border-radius: 5px;
    margin: 5px;
}

/* Connection status indicator */
.connection-status {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 10px;
    height: 10px;
    /* Replace rounded shape with hexagonal shape */
    clip-path: polygon(
        50% 0%, 100% 25%, 
        100% 75%, 50% 100%, 
        0% 75%, 0% 25%
    );
}

.connection-status.online {
    background: #00cc00;
    box-shadow: 0 0 5px #00cc00;
}

.connection-status.offline {
    background: #ff3333;
    box-shadow: 0 0 5px #ff3333;
}

@keyframes pulse {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Add styles for powerup shop */
.powerup-shop-button {
    background: linear-gradient(to bottom, #004466, #002233);
    border: 2px solid #00ccff;
    /* Replace rounded corners with crystalline shape */
    clip-path: polygon(
        0% 10px, 10px 0%, 
        calc(100% - 10px) 0%, 100% 10px, 
        100% calc(100% - 10px), calc(100% - 10px) 100%, 
        10px 100%, 0% calc(100% - 10px)
    );
    color: white;
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    padding: 10px 20px;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 204, 255, 0.5);
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 20px auto;
    display: block;
}

.powerup-shop-button:hover {
    background: linear-gradient(to bottom, #005577, #003344);
    box-shadow: 0 0 15px rgba(0, 204, 255, 0.7);
    transform: scale(1.05);
}

.powerup-shop-button:active {
    transform: scale(0.98);
}

.powerup-item {
    background: rgba(0, 30, 60, 0.8);
    border: 2px solid;
    /* Replace rounded corners with crystalline shape */
    clip-path: polygon(
        0% 10px, 10px 0%, 
        calc(100% - 10px) 0%, 100% 10px, 
        100% calc(100% - 10px), calc(100% - 10px) 100%, 
        10px 100%, 0% calc(100% - 10px)
    );
    padding: 15px;
    margin: 10px;
    position: relative;
    transition: all 0.2s ease;
}

.powerup-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.powerup-item.shield {
    border-color: #3399ff;
    box-shadow: 0 0 10px rgba(51, 153, 255, 0.3);
}

.powerup-item.energy {
    border-color: #33cc33;
    box-shadow: 0 0 10px rgba(51, 204, 51, 0.3);
}

.powerup-item.weapon {
    border-color: #ff3333;
    box-shadow: 0 0 10px rgba(255, 51, 51, 0.3);
}

.powerup-item.multi-shot {
    border-color: #cc33ff;
    box-shadow: 0 0 10px rgba(204, 51, 255, 0.3);
}

.powerup-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: bold;
    color: white;
    margin-bottom: 5px;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.powerup-description {
    font-family: 'Chakra Petch', sans-serif;
    font-size: 14px;
    color: #cccccc;
    margin-bottom: 10px;
    padding: 5px;
    background: rgba(0, 0, 0, 0.3);
    /* Add crystalline shape to description box */
    clip-path: polygon(
        0% 0%, 100% 0%, 
        100% calc(100% - 5px), calc(100% - 5px) 100%, 
        0% 100%
    );
    box-sizing: border-box; /* ADDED: Prevent padding from causing overflow */
}

.powerup-cost {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    color: #ffcc00;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(255, 204, 0, 0.5);
}

.buy-button {
    background: linear-gradient(to bottom, #006699, #004466);
    border: 1px solid #00ccff;
    color: white;
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    padding: 5px 15px;
    cursor: pointer;
    position: absolute;
    bottom: 15px;
    right: 15px;
    transition: all 0.2s ease;
    /* Replace rounded corners with crystalline shape */
    clip-path: polygon(
        0% 5px, 5px 0%, 
        calc(100% - 5px) 0%, 100% 5px, 
        100% calc(100% - 5px), calc(100% - 5px) 100%, 
        5px 100%, 0% calc(100% - 5px)
    );
}

.buy-button:hover {
    background: linear-gradient(to bottom, #0088cc, #006699);
    box-shadow: 0 0 10px rgba(0, 204, 255, 0.5);
}

.buy-button:active {
    transform: scale(0.95);
}

.insufficient-credits {
    color: #ff6666;
    font-family: 'Chakra Petch', sans-serif;
    font-size: 14px;
    font-style: italic;
    position: absolute;
    bottom: 15px;
    right: 15px;
    text-shadow: 0 0 5px rgba(255, 102, 102, 0.5);
}

.shop-back-button {
    background: linear-gradient(to bottom, #333333, #222222);
    border: 2px solid #666666;
    color: white;
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    padding: 10px 30px;
    cursor: pointer;
    margin: 20px auto;
    display: block;
    transition: all 0.2s ease;
    /* Replace rounded corners with crystalline shape */
    clip-path: polygon(
        0% 8px, 8px 0%, 
        calc(100% - 8px) 0%, 100% 8px, 
        100% calc(100% - 8px), calc(100% - 8px) 100%, 
        8px 100%, 0% calc(100% - 8px)
    );
}

.shop-back-button:hover {
    background: linear-gradient(to bottom, #444444, #333333);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.shop-back-button:active {
    transform: scale(0.98);
}

/* Add styles for level complete screen */
.level-complete-header {
    font-family: 'Orbitron', sans-serif;
    font-size: 40px;
    color: white;
    text-align: center;
    margin-bottom: 20px;
    text-shadow: 0 0 15px #00ccff;
}

.level-complete-info {
    font-family: 'Chakra Petch', sans-serif;
    font-size: 24px;
    color: #51cbee;
    text-align: center;
    margin-bottom: 30px;
}

.level-complete-score {
    font-family: 'Orbitron', sans-serif;
    font-size: 28px;
    color: #ffcc00;
    text-align: center;
    margin-bottom: 40px;
}

.next-level-info {
    font-family: 'Orbitron', sans-serif;
    font-size: 22px;
    color: white;
    text-align: center;
    margin-top: 40px;
}

.next-level-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
    color: #51cbee;
    text-align: center;
    margin-top: 10px;
}

.next-level-description {
    font-family: 'Chakra Petch', sans-serif;
    font-size: 16px;
    color: #cccccc;
    text-align: center;
    margin-top: 10px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.continue-instructions {
    font-family: 'Chakra Petch', sans-serif;
    font-size: 18px;
    color: #aaaaaa;
    text-align: center;
    margin-top: 40px;
}

.debug-value {
    background-color: #300;
    padding: 5px;
    color: #ff3333;
    font-size: 14px;
    border: 1px solid #ff3333;
    /* Replace rounded corners with crystalline shape */
    clip-path: polygon(
        0% 5px, 5px 0%, 
        calc(100% - 5px) 0%, 100% 5px, 
        100% calc(100% - 5px), calc(100% - 5px) 100%, 
        5px 100%, 0% calc(100% - 5px)
    );
    margin: 5px;
}

/* Debug Enemy Viewer Styles */
#debug-enemy-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    color: #fff;
    z-index: 1001; /* Ensure it's above the debug menu */
    overflow-y: auto; /* Allow scrolling if many enemies */
    padding: 20px;
    box-sizing: border-box;
    display: none; /* Hidden by default */
}

#debug-enemy-viewer-close {
    position: absolute;
    top: 15px;
    right: 20px;
    padding: 8px 15px;
    background-color: #555;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
}

#debug-enemy-viewer-close:hover {
    background-color: #777;
}

#debug-enemy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); /* Responsive grid */
    gap: 25px;
    padding-top: 50px; /* Space below close button */
    padding-bottom: 20px;
}

.debug-enemy-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid #444;
    border-radius: 5px;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.05);
}

.debug-enemy-item canvas {
    /* Canvas size is set dynamically, ensure it doesn't overflow */
    max-width: 100%; 
    max-height: 150px; /* Limit canvas height within the item box */
    object-fit: contain; /* Ensure aspect ratio is maintained if scaled */
    margin-bottom: 8px;
}

.debug-enemy-item p {
    margin: 0;
    font-size: 13px;
    text-align: center;
    color: #ccc;
} 