/* TAG Raiders - Game Styles */

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

body {
    font-family: 'Courier New', monospace;
    background: #000011;
    color: #ffffff;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    display: block;
}

#game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    border: none;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    margin: 0;
    padding: 0;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #000022 0%, #000011 50%, #000000 100%);
    image-rendering: pixelated;
}

/* Game UI Overlay */
#game-ui {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

/* HUD */
#hud {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 20px;
    font-size: 14px;
    font-weight: bold;
    color: #4a7bff;
    text-shadow: 0 0 5px rgba(74, 123, 255, 0.5);
    pointer-events: none;
}

#hud > div {
    background: rgba(0, 0, 0, 0.7);
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid #4a7bff;
}

/* Centered Wave Display */
#wave-display-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    font-weight: bold;
    color: #4a7bff;
    text-shadow: 0 0 10px rgba(74, 123, 255, 0.8), 0 0 20px rgba(74, 123, 255, 0.5);
    background: rgba(0, 0, 0, 0.9);
    padding: 20px 40px;
    border-radius: 8px;
    border: 3px solid #4a7bff;
    box-shadow: 0 0 30px rgba(74, 123, 255, 0.6);
    pointer-events: none;
    z-index: 100;
    animation: wavePulse 2s ease-in-out infinite;
}

@keyframes wavePulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
}

/* Energy Bar */
.energy-bar {
    height: 8px;
    width: 100%;
    background: #333;
    border: 1px solid #666;
    border-radius: 2px;
    overflow: hidden;
    transition: width 0.2s, background 0.2s;
}

/* Fleet Status */
#fleet-status {
    position: absolute;
    top: 10px;
    right: 10px;
}

#ship-status {
    display: flex;
    gap: 5px;
}

.ship-health {
    width: 20px;
    height: 8px;
    background: #333;
    border: 1px solid #666;
    border-radius: 2px;
    overflow: hidden;
}

.ship-health .health-bar {
    height: 100%;
    background: linear-gradient(90deg, #ff4444, #44ff44);
    transition: width 0.2s;
}

/* Power-ups */
#powerup-display {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: flex;
    gap: 10px;
}

.powerup-item {
    width: 30px;
    height: 30px;
    border: 2px solid #4a7bff;
}

.powerup-item.selected {
    border: 3px solid #ffff00;
    box-shadow: 0 0 10px rgba(255, 255, 0, 0.8);
    transform: scale(1.2);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    color: #4a7bff;
}

/* Controls Help */
#controls-help {
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 11px;
    color: #888;
    text-align: right;
    line-height: 1.4;
    pointer-events: none;
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Skill tree screen needs scrolling */
#skill-tree-screen {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
}

/* Pause screen with grayed out background */
#pause-screen {
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    text-align: center;
    animation: fadeIn 0.5s ease-in-out;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 30px 20px 40px 20px;
    box-sizing: border-box;
}

#pause-screen::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: -1;
}

#intro-screen.screen {
    padding: 0;
    justify-content: center;
    background: #000011;
}

.screen::-webkit-scrollbar {
    width: 8px;
}

.screen::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

.screen::-webkit-scrollbar-thumb {
    background: rgba(74, 123, 255, 0.5);
    border-radius: 4px;
}

.screen::-webkit-scrollbar-thumb:hover {
    background: rgba(74, 123, 255, 0.7);
}

.screen h1 {
    font-size: 48px;
    color: #4a7bff;
    margin-top: 0;
    margin-bottom: 20px;
    padding-top: 0;
    text-shadow: 0 0 20px rgba(74, 123, 255, 0.5);
    word-wrap: break-word;
}

.screen h2 {
    font-size: 36px;
    color: #ffffff;
    margin-bottom: 30px;
    word-wrap: break-word;
}

.screen p {
    font-size: 18px;
    color: #cccccc;
    margin-bottom: 30px;
    max-width: 600px;
    width: 100%;
    line-height: 1.6;
    word-wrap: break-word;
    padding: 0 10px;
    box-sizing: border-box;
}

/* Difficulty Selection */
.difficulty-select {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.difficulty-btn {
    padding: 10px 20px;
    background: rgba(74, 123, 255, 0.2);
    border: 2px solid #4a7bff;
    color: #4a7bff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.difficulty-btn:hover {
    background: rgba(74, 123, 255, 0.3);
    transform: translateY(-2px);
}

.difficulty-btn.active {
    background: #4a7bff;
    color: #ffffff;
    box-shadow: 0 0 15px rgba(74, 123, 255, 0.5);
}

/* Start Button */
.start-btn {
    padding: 15px 30px;
    background: linear-gradient(135deg, #4a7bff, #6b8fff);
    border: none;
    color: #ffffff;
    border-radius: 8px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 30px;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(74, 123, 255, 0.3);
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 30px rgba(74, 123, 255, 0.5);
}

/* Instructions */
.instructions {
    max-width: 500px;
    width: 100%;
    text-align: center;
    margin: 20px auto 40px auto;
    padding: 0 10px;
    box-sizing: border-box;
}

.instructions h3 {
    color: #4a7bff;
    margin-bottom: 15px;
    text-align: center;
}

.instructions ul {
    list-style: none;
    padding: 0;
    text-align: center;
    display: inline-block;
    margin: 0 auto;
    width: 100%;
}

.instructions li {
    color: #cccccc;
    margin-bottom: 10px;
    padding: 0;
    position: relative;
    word-wrap: break-word;
    line-height: 1.5;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.instructions li:before {
    content: "▶";
    color: #4a7bff;
    position: static;
    flex-shrink: 0;
}

/* Follow Button (Top Right) */
.support-btn {
    position: fixed;
    top: 10px;
    right: 10px;
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #4a7bff;
    border-radius: 5px;
    color: #4a7bff;
    text-decoration: none;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    z-index: 10001;
    cursor: pointer;
    transition: all 0.2s;
}

.support-btn:hover {
    background: rgba(74, 123, 255, 0.2);
    box-shadow: 0 0 10px rgba(74, 123, 255, 0.5);
    transform: translateY(-2px);
}

/* Changelog Button (Bottom Left) */
.changelog-btn {
    position: fixed;
    bottom: 10px;
    left: 10px;
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #4a7bff;
    border-radius: 5px;
    color: #4a7bff;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    z-index: 10001;
    cursor: pointer;
    transition: all 0.2s;
    pointer-events: auto;
}

.changelog-btn:hover {
    background: rgba(74, 123, 255, 0.2);
    box-shadow: 0 0 10px rgba(74, 123, 255, 0.5);
    transform: translateY(-2px);
}

/* Guide Button (Bottom Right) */
.guide-btn {
    position: fixed;
    bottom: 10px;
    right: 10px;
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #4a7bff;
    border-radius: 5px;
    color: #4a7bff;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    z-index: 10001;
    cursor: pointer;
    transition: all 0.2s;
    pointer-events: auto;
}

.guide-btn:hover {
    background: rgba(74, 123, 255, 0.2);
    box-shadow: 0 0 10px rgba(74, 123, 255, 0.5);
    transform: translateY(-2px);
}

/* Leaderboard Button (Top Left) */
.leaderboard-btn {
    position: fixed;
    top: 10px;
    left: 10px;
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #4a7bff;
    border-radius: 5px;
    color: #4a7bff;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    z-index: 10001;
    cursor: pointer;
    transition: all 0.2s;
}

.leaderboard-btn:hover {
    background: rgba(74, 123, 255, 0.2);
    box-shadow: 0 0 10px rgba(74, 123, 255, 0.5);
    transform: translateY(-2px);
}

/* Username Container (Top Left, below leaderboard) */
.username-container {
    position: fixed;
    top: 50px;
    left: 10px;
    display: flex;
    gap: 5px;
    z-index: 10001;
}

#username-input {
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #4a7bff;
    border-radius: 5px;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    width: 150px;
    outline: none;
}

#username-input:focus {
    border-color: #88aaff;
    box-shadow: 0 0 8px rgba(74, 123, 255, 0.5);
}

#username-input::placeholder {
    color: #888;
}

#username-submit-btn {
    padding: 6px 12px;
    background: rgba(74, 123, 255, 0.8);
    border: 2px solid #4a7bff;
    border-radius: 5px;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

#username-submit-btn:hover {
    background: rgba(74, 123, 255, 1);
    box-shadow: 0 0 8px rgba(74, 123, 255, 0.5);
}

/* Leaderboard Styles */
/* Leaderboard Difficulty Tabs */
.leaderboard-difficulty-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.leaderboard-difficulty-btn {
    padding: 10px 20px;
    background: rgba(74, 123, 255, 0.2);
    border: 2px solid rgba(74, 123, 255, 0.5);
    color: #ffffff;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.leaderboard-difficulty-btn:hover {
    background: rgba(74, 123, 255, 0.4);
    border-color: rgba(74, 123, 255, 0.8);
}

.leaderboard-difficulty-btn.active {
    background: rgba(74, 123, 255, 0.6);
    border-color: #4a7bff;
    box-shadow: 0 0 15px rgba(74, 123, 255, 0.5);
}

#leaderboard-screen {
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.leaderboard-screen-content {
    max-width: 800px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.leaderboard-title {
    font-size: 48px;
    color: #4a7bff;
    text-shadow: 0 0 20px rgba(74, 123, 255, 0.8);
    margin-bottom: 30px;
    font-weight: 900;
    letter-spacing: 2px;
}

.leaderboard-container {
    width: 100%;
    background: rgba(0, 0, 0, 0.8);
    border: 3px solid #4a7bff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 0 30px rgba(74, 123, 255, 0.5);
    margin-bottom: 20px;
}

.leaderboard-list {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
}

.leaderboard-list::-webkit-scrollbar {
    width: 8px;
}

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

.leaderboard-list::-webkit-scrollbar-thumb {
    background: #4a7bff;
    border-radius: 4px;
}

.leaderboard-list::-webkit-scrollbar-thumb:hover {
    background: #6b8fff;
}

.leaderboard-header {
    display: grid;
    grid-template-columns: 80px 1fr 150px 100px;
    gap: 15px;
    padding: 15px;
    background: rgba(74, 123, 255, 0.2);
    border-bottom: 2px solid #4a7bff;
    margin-bottom: 10px;
    border-radius: 8px 8px 0 0;
    font-weight: bold;
    color: #4a7bff;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 12px;
}

.header-rank, .header-player, .header-score, .header-wave {
    text-align: center;
}

.header-player {
    text-align: left;
}

.leaderboard-entry {
    display: grid;
    grid-template-columns: 80px 1fr 150px 100px;
    gap: 15px;
    padding: 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(74, 123, 255, 0.3);
    align-items: center;
}

.leaderboard-entry:hover {
    transform: translateX(5px);
    background: rgba(0, 0, 0, 0.6);
    border-color: #4a7bff;
    box-shadow: 0 0 15px rgba(74, 123, 255, 0.4);
}

.leaderboard-entry.top-three {
    border-width: 3px;
    padding: 18px;
    margin-bottom: 12px;
}

.leaderboard-entry.rank-1 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 170, 0, 0.2));
    border-color: #ffd700;
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.6);
}

.leaderboard-entry.rank-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.3), rgba(136, 136, 136, 0.2));
    border-color: #c0c0c0;
    box-shadow: 0 0 25px rgba(192, 192, 192, 0.6);
}

.leaderboard-entry.rank-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.3), rgba(139, 69, 19, 0.2));
    border-color: #cd7f32;
    box-shadow: 0 0 25px rgba(205, 127, 50, 0.6);
}

.entry-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-weight: bold;
    font-size: 18px;
}

.rank-emoji {
    font-size: 28px;
}

.rank-number {
    color: #4a7bff;
    font-size: 16px;
}

.leaderboard-entry.rank-1 .rank-number,
.leaderboard-entry.rank-2 .rank-number,
.leaderboard-entry.rank-3 .rank-number {
    color: #ffffff;
    font-weight: 900;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
}

.entry-player {
    display: flex;
    align-items: center;
}

.player-name {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
}

.leaderboard-entry.rank-1 .player-name,
.leaderboard-entry.rank-2 .player-name,
.leaderboard-entry.rank-3 .player-name {
    color: #ffffff;
    font-weight: 900;
    font-size: 18px;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
}

.entry-score {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.score-value {
    font-size: 18px;
    font-weight: bold;
    color: #4a7bff;
}

.score-label {
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
}

.leaderboard-entry.rank-1 .score-value,
.leaderboard-entry.rank-2 .score-value,
.leaderboard-entry.rank-3 .score-value {
    color: #ffffff;
    font-size: 20px;
}

.leaderboard-entry.rank-1 .score-label,
.leaderboard-entry.rank-2 .score-label,
.leaderboard-entry.rank-3 .score-label {
    color: #333;
}

.entry-wave {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 16px;
    font-weight: 600;
    color: #9bafff;
}

.wave-icon {
    font-size: 18px;
}

.wave-value {
    color: #9bafff;
}

.leaderboard-entry.rank-1 .wave-value,
.leaderboard-entry.rank-2 .wave-value,
.leaderboard-entry.rank-3 .wave-value {
    color: #ffffff;
    font-weight: 900;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
}

.leaderboard-empty {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-title {
    font-size: 24px;
    font-weight: bold;
    color: #4a7bff;
    margin-bottom: 10px;
}

.empty-message {
    font-size: 16px;
    color: #aaa;
}

.leaderboard-close-btn {
    margin-top: 20px;
    padding: 12px 30px;
    font-size: 16px;
}

.leaderboard-loading {
    text-align: center;
    padding: 40px;
    color: #4a7bff;
    font-size: 18px;
}

/* Changelog Styles */
#changelog-screen {
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.changelog-screen-content {
    max-width: 900px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.changelog-title {
    font-size: 48px;
    color: #4a7bff;
    text-shadow: 0 0 20px rgba(74, 123, 255, 0.8);
    margin-bottom: 10px;
    font-weight: 900;
    letter-spacing: 2px;
}

.changelog-current-version {
    font-size: 18px;
    color: #9bafff;
    margin-bottom: 30px;
    font-weight: 600;
}

.changelog-container {
    width: 100%;
    background: rgba(0, 0, 0, 0.8);
    border: 3px solid #4a7bff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 0 30px rgba(74, 123, 255, 0.5);
    margin-bottom: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.changelog-container::-webkit-scrollbar {
    width: 8px;
}

.changelog-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

.changelog-container::-webkit-scrollbar-thumb {
    background: #4a7bff;
    border-radius: 4px;
}

.changelog-container::-webkit-scrollbar-thumb:hover {
    background: #6b8fff;
}

.changelog-entry {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid rgba(74, 123, 255, 0.3);
}

.changelog-entry:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.changelog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(74, 123, 255, 0.2);
}

.changelog-version {
    font-size: 28px;
    font-weight: 900;
    color: #4a7bff;
    text-shadow: 0 0 10px rgba(74, 123, 255, 0.5);
}

.changelog-date {
    font-size: 14px;
    color: #9bafff;
    font-weight: 600;
}

.changelog-section {
    margin-bottom: 20px;
}

.changelog-section:last-child {
    margin-bottom: 0;
}

.changelog-section-title {
    font-size: 18px;
    font-weight: bold;
    color: #4a7bff;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.changelog-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.changelog-list li {
    color: #cccccc;
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
    line-height: 1.6;
    font-size: 14px;
}

.changelog-list li:before {
    content: "•";
    color: #4a7bff;
    position: absolute;
    left: 0;
    font-weight: bold;
}

.changelog-close-btn {
    margin-top: 20px;
    padding: 12px 30px;
    font-size: 16px;
}

/* Guide Screen Styles */
#guide-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 3000;
    overflow-y: auto;
    padding: 20px;
}

.guide-screen-content {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100%;
}

.guide-title {
    font-size: 48px;
    color: #4a7bff;
    text-shadow: 0 0 20px rgba(74, 123, 255, 0.8);
    margin-bottom: 30px;
    font-weight: 900;
    letter-spacing: 2px;
}

/* Guide Tabs */
.guide-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.guide-tab {
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #4a7bff;
    border-radius: 5px;
    color: #4a7bff;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.guide-tab:hover {
    background: rgba(74, 123, 255, 0.2);
    box-shadow: 0 0 10px rgba(74, 123, 255, 0.5);
    transform: translateY(-2px);
}

.guide-tab.active {
    background: rgba(74, 123, 255, 0.3);
    border-color: #6a9bff;
    box-shadow: 0 0 15px rgba(74, 123, 255, 0.7);
}

/* Guide Content */
.guide-content {
    width: 100%;
    max-width: 1100px;
}

.guide-tab-panel {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.guide-tab-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.guide-section {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #4a7bff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.guide-section h3 {
    color: #4a7bff;
    font-size: 24px;
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(74, 123, 255, 0.5);
}

.guide-section p {
    color: #cccccc;
    line-height: 1.6;
    font-size: 16px;
}

/* Control Items */
.control-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px;
    margin-bottom: 10px;
    background: rgba(74, 123, 255, 0.1);
    border-left: 3px solid #4a7bff;
    border-radius: 4px;
}

.control-key {
    min-width: 180px;
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #4a7bff;
    border-radius: 4px;
    color: #4a7bff;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    text-align: center;
}

.control-desc {
    color: #cccccc;
    font-size: 16px;
    flex: 1;
}

/* Guide Items Grid */
.guide-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.guide-item {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #4a7bff;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s;
    cursor: pointer;
}

.guide-item:hover {
    background: rgba(74, 123, 255, 0.2);
    border-color: #6a9bff;
    box-shadow: 0 0 20px rgba(74, 123, 255, 0.5);
    transform: translateY(-5px);
}

.guide-item[data-rarity="rare"] {
    border-color: #ffaa44;
}

.guide-item[data-rarity="rare"]:hover {
    box-shadow: 0 0 20px rgba(255, 170, 68, 0.5);
}

.guide-item[data-rarity="legendary"] {
    border-color: #ff44aa;
}

.guide-item[data-rarity="legendary"]:hover {
    box-shadow: 0 0 20px rgba(255, 68, 170, 0.5);
}

.guide-item-boss {
    grid-column: span 2;
    max-width: 100%;
    margin: 0 auto;
}

#bosses-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    justify-items: center;
    width: 100%;
}

.guide-item-visual-container {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.guide-item-visual {
    image-rendering: pixelated;
    border: 2px solid #4a7bff;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.5);
}

.guide-item-visual-boss {
    width: 96px;
    height: 96px;
}

.guide-item-info {
    text-align: center;
}

.guide-item-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.guide-item-symbol {
    font-size: 24px;
}

.guide-item-name {
    color: #4a7bff;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(74, 123, 255, 0.5);
}

.guide-item-rarity {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.guide-item-rarity.common {
    background: rgba(74, 123, 255, 0.3);
    color: #4a7bff;
    border: 1px solid #4a7bff;
}

.guide-item-rarity.rare {
    background: rgba(255, 170, 68, 0.3);
    color: #ffaa44;
    border: 1px solid #ffaa44;
}

.guide-item-rarity.legendary {
    background: rgba(255, 68, 170, 0.3);
    color: #ff44aa;
    border: 1px solid #ff44aa;
}

.guide-item-description {
    color: #cccccc;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 10px;
}

.guide-item-wave,
.guide-item-stats {
    color: #888888;
    font-size: 12px;
    margin-top: 8px;
}

.guide-item-stats {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.guide-item-stat {
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

.guide-item-difficulty {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.guide-item-difficulty.medium {
    background: rgba(255, 170, 68, 0.3);
    color: #ffaa44;
    border: 1px solid #ffaa44;
}

.guide-item-difficulty.hard {
    background: rgba(255, 68, 68, 0.3);
    color: #ff4444;
    border: 1px solid #ff4444;
}

.guide-item-difficulty.very-hard {
    background: rgba(170, 68, 255, 0.3);
    color: #aa44ff;
    border: 1px solid #aa44ff;
}

.guide-item-difficulty.extreme {
    background: rgba(68, 68, 68, 0.3);
    color: #444444;
    border: 1px solid #444444;
}

.guide-close-btn {
    margin-top: 30px;
    padding: 12px 30px;
    font-size: 16px;
}

@keyframes goldPulse {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.9);
        transform: scale(1.02);
    }
}

@keyframes silverPulse {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(192, 192, 192, 0.6);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 30px rgba(192, 192, 192, 0.9);
        transform: scale(1.02);
    }
}

@keyframes bronzePulse {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(205, 127, 50, 0.6);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 30px rgba(205, 127, 50, 0.9);
        transform: scale(1.02);
    }
}

/* Game Over Stats */
#final-stats {
    margin: 20px 0;
    font-size: 18px;
    color: #cccccc;
}

#final-stats > div {
    margin: 10px 0;
}

.rewards {
    margin: 30px 0;
    padding: 20px;
    background: rgba(74, 123, 255, 0.1);
    border-radius: 8px;
    border: 1px solid #4a7bff;
}

.rewards h3 {
    color: #4a7bff;
    margin-bottom: 10px;
}

#animation-credits {
    font-size: 24px;
    color: #44ff44;
    font-weight: bold;
}

/* Buttons */
/* Pause Menu Tabs */
.pause-tabs {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    justify-content: center;
}

.pause-tab {
    padding: 10px 20px;
    background: rgba(74, 123, 255, 0.2);
    border: 2px solid #4a7bff;
    color: #4a7bff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.pause-tab:hover {
    background: rgba(74, 123, 255, 0.3);
    transform: translateY(-2px);
}

.pause-tab.active {
    background: #4a7bff;
    color: #ffffff;
    box-shadow: 0 0 15px rgba(74, 123, 255, 0.5);
}

.pause-content {
    max-width: 600px;
    width: 100%;
    min-height: 300px;
    margin: 20px 0;
}

.pause-tab-content {
    display: none;
    text-align: left;
}

.pause-tab-content.active {
    display: block;
}

.guide-section {
    background: rgba(0, 0, 0, 0.5);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #4a7bff;
}

.guide-section h3 {
    color: #4a7bff;
    margin-bottom: 15px;
    font-size: 20px;
}

.guide-list {
    list-style: none;
    padding: 0;
}

.guide-list li {
    color: #cccccc;
    margin-bottom: 12px;
    padding-left: 20px;
    position: relative;
    line-height: 1.6;
}

.guide-list li:before {
    content: "▸";
    color: #4a7bff;
    position: absolute;
    left: 0;
}

.pause-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.restart-btn, .menu-btn, .resume-btn, .quit-btn, .continue-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin: 10px;
    transition: all 0.3s ease;
}

.restart-btn {
    background: linear-gradient(135deg, #4a7bff, #6b8fff);
    color: #ffffff;
}

.resume-btn {
    background: linear-gradient(135deg, #44ff44, #66ff66);
    color: #ffffff;
}

.menu-btn, .quit-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid #666;
}

.continue-btn {
    background: linear-gradient(135deg, #ffaa44, #ffbb66);
    color: #ffffff;
}

.restart-btn:hover, .resume-btn:hover, .continue-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(74, 123, 255, 0.3);
}

/* Upgrade Screen */
#upgrade-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 50;
    font-family: 'Courier New', monospace;
    color: #ffffff;
    border: 4px solid #4a7bff;
    box-shadow: 0 0 20px rgba(74, 123, 255, 0.5);
}

#upgrade-screen h2 {
    color: #ffffff;
    font-size: 2.5rem;
    text-shadow:
        0 0 5px #4a7bff,
        0 0 10px #4a7bff,
        0 0 15px #4a7bff,
        0 0 20px #4a7bff;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: none;
    background: linear-gradient(45deg, #4a7bff, #6b8fff, #4a7bff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#upgrade-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 30px 0;
    max-width: 700px;
}

.upgrade-option {
    padding: 25px 15px;
    background: linear-gradient(145deg, rgba(74, 123, 255, 0.15), rgba(74, 123, 255, 0.08));
    border: 3px solid #4a7bff;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.1s step-end;
    font-size: 12px;
    position: relative;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 0 15px rgba(74, 123, 255, 0.5);
    font-family: 'Courier New', monospace;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: none;
}

.upgrade-option::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 1px solid rgba(74, 123, 255, 0.5);
    pointer-events: none;
}

.upgrade-option:hover {
    background: linear-gradient(145deg, rgba(74, 123, 255, 0.2), rgba(74, 123, 255, 0.1));
    border-color: #6b8fff;
    box-shadow: 0 0 15px rgba(74, 123, 255, 0.8);
    transform: translateY(-2px);
}

.upgrade-option.selected {
    background: linear-gradient(145deg, rgba(74, 123, 255, 0.3), rgba(74, 123, 255, 0.15));
    border-color: #ffffff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.upgrade-option.selected::after {
    content: 'SELECTED';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    color: #ffffff;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.upgrade-option h3 {
    color: #4a7bff;
    margin: 0 0 8px 0;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: none;
}

.upgrade-option p {
    color: #cccccc;
    margin: 0;
    font-size: 10px;
    line-height: 1.3;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: none;
}

/* Intro Screen */
#intro-screen {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    overflow: hidden;
    align-items: center;
    justify-content: center;
    background: #000011 !important;
    display: none; /* Will be set to flex by JS */
    z-index: 1000 !important;
}

.intro-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 10;
    pointer-events: auto;
}

.intro-logo {
    margin-bottom: 50px;
    animation: logoGlow 3s ease-in-out infinite alternate, logoFloat 4s ease-in-out infinite;
}

.logo-text {
    font-size: 72px;
    font-weight: 900;
    color: #4a7bff;
    text-shadow: 0 0 30px rgba(74, 123, 255, 0.8);
    letter-spacing: 8px;
    margin-bottom: 10px;
}

.logo-subtext {
    font-size: 24px;
    color: #9bafff;
    font-weight: 600;
    letter-spacing: 4px;
    text-shadow: 0 0 15px rgba(155, 175, 255, 0.5);
}

/* Mobile optimizations for intro and menu screens */
@media (max-width: 768px) and (orientation: landscape) {
    #intro-screen {
        overflow: visible !important;
    }
    
    .intro-content {
        padding: 5px;
        max-height: 100vh;
        overflow-y: auto;
    }
    
    .logo-text {
        font-size: 32px;
        letter-spacing: 3px;
        margin-bottom: 5px;
        line-height: 1.2;
    }
    
    .logo-subtext {
        font-size: 12px;
        letter-spacing: 1px;
        line-height: 1.3;
    }
    
    .intro-logo {
        margin-bottom: 15px;
        transform: scale(0.8);
    }
    
    .start-content {
        max-width: 100%;
        padding: 5px;
        max-height: 100vh;
        overflow-y: auto;
    }
    
    .start-content h1 {
        font-size: 24px;
        margin-bottom: 10px;
        line-height: 1.2;
    }
    
    .start-content h2 {
        font-size: 18px;
        margin-bottom: 8px;
        line-height: 1.2;
    }
    
    .difficulty-buttons {
        flex-direction: row;
        gap: 6px;
        margin: 10px 0;
        flex-wrap: wrap;
    }
    
    .difficulty-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .start-btn, .menu-btn {
        padding: 8px 16px;
        font-size: 12px;
        margin: 5px;
    }
    
    .settings-section {
        margin: 8px 0;
        padding: 8px;
    }
    
    .volume-control {
        margin: 6px 0;
        font-size: 11px;
    }
    
    .instructions {
        margin: 8px auto 15px auto;
        padding: 8px;
        max-width: 95%;
    }
    
    .instructions h3 {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .instructions ul {
        font-size: 10px;
    }
    
    .instructions li {
        margin-bottom: 5px;
        padding-left: 12px;
        line-height: 1.3;
    }
}

/* Keep old class names for backwards compatibility */
.tag-logo {
    margin-bottom: 50px;
    animation: logoGlow 3s ease-in-out infinite alternate;
}

.tag-text {
    font-size: 72px;
    font-weight: 900;
    color: #4a7bff;
    text-shadow: 0 0 30px rgba(74, 123, 255, 0.8);
    letter-spacing: 8px;
    margin-bottom: 10px;
}

.tag-subtitle {
    font-size: 24px;
    color: #9bafff;
    font-weight: 600;
    letter-spacing: 4px;
    text-shadow: 0 0 15px rgba(155, 175, 255, 0.5);
}

.intro-stars {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.star {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #ffffff;
    border-radius: 50%;
    animation: twinkle 2s ease-in-out infinite alternate;
}

.star:nth-child(1) { top: 20%; }
.star:nth-child(2) { top: 35%; }
.star:nth-child(3) { top: 50%; }
.star:nth-child(4) { top: 65%; }

.intro-sequence {
    margin: 40px 0;
}

.intro-line {
    font-size: 1.2rem;
    color: #ffff00;
    margin: 8px 0;
    opacity: 0;
    animation: textFadeIn 0.8s ease-out forwards, textPulse 2s ease-in-out infinite;
    text-shadow: 0 0 5px #ffff00, 0 0 10px #ffff00;
    font-family: 'Courier New', monospace;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: none;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transform-origin: center;
}

#intro-line-1 { 
    animation-delay: 0.5s; 
    animation: textFadeIn 0.8s ease-out 0.5s forwards, textPulse 2s ease-in-out 1.3s infinite;
}
#intro-line-2 { 
    animation-delay: 1.0s; 
    font-size: 1.5rem; 
    color: #00ffff; 
    font-weight: bold;
    text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff, 0 0 30px #00ffff;
    animation: textFadeIn 0.8s ease-out 1.0s forwards, textPulse 2s ease-in-out 1.8s infinite, textGlow 3s ease-in-out 1.8s infinite;
}
#intro-line-3 { 
    animation-delay: 1.5s; 
    animation: textFadeIn 0.8s ease-out 1.5s forwards, textPulse 2s ease-in-out 2.3s infinite;
}
#intro-line-4 { 
    animation-delay: 2.0s; 
    animation: textFadeIn 0.8s ease-out 2.0s forwards, textPulse 2s ease-in-out 2.8s infinite;
}

.intro-progress {
    margin: 30px 0;
    width: 200px;
    height: 8px;
    background: #000000;
    border: 2px solid #ffffff;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 0 10px #00ffff;
}

.progress-bar {
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        #00ffff 0px,
        #00ffff 4px,
        #0080ff 4px,
        #0080ff 8px
    );
    width: 0%;
    animation: progressFill 3s steps(20, end) forwards;
    border-right: 2px solid #ffffff;
}

@keyframes progressFill {
    to { width: 100%; }
}

.skip-btn {
    position: absolute;
    bottom: 30px;
    right: 30px;
    padding: 8px 16px;
    background: #000000;
    border: 2px solid #00ffff;
    color: #00ffff;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
    transition: all 0.1s step-end;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: none;
    box-shadow: 0 0 0 2px #000000;
}

.skip-btn:hover {
    background: #00ffff;
    color: #ffffff;
    box-shadow: 0 0 10px #00ffff;
}

.skip-btn:active {
    background: #ffffff;
    color: #ffffff;
}

.start-content {
    max-width: 600px;
    width: 100%;
    text-align: center;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    padding: 0;
    margin: 0 auto;
    box-sizing: border-box;
    position: relative;
    z-index: 10;
    visibility: visible;
    opacity: 1;
}

/* Settings */
.settings-section {
    margin: 20px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #4a7bff;
    border-radius: 8px;
    min-width: 250px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
    padding: 5px 0;
}

.setting-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: bold;
    color: #4a7bff;
    text-shadow: 0 0 5px rgba(74, 123, 255, 0.5);
}

.setting-icon {
    font-size: 16px;
}

.setting-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-control input[type="range"] {
    width: 100px;
    height: 6px;
    background: #333;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.setting-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #4a7bff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(74, 123, 255, 0.5);
}

.setting-control input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #4a7bff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 5px rgba(74, 123, 255, 0.5);
}

#volumeValue {
    font-size: 12px;
    color: #ffffff;
    min-width: 35px;
    text-align: right;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes logoGlow {
    from {
        filter: brightness(1) drop-shadow(0 0 20px rgba(74, 123, 255, 0.5));
    }
    to {
        filter: brightness(1.2) drop-shadow(0 0 40px rgba(74, 123, 255, 1));
    }
}

@keyframes twinkle {
    from {
        opacity: 0.3;
        transform: scale(1);
    }
    to {
        opacity: 1;
        transform: scale(1.5);
    }
}

@keyframes textFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes textPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes textGlow {
    0%, 100% {
        text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff, 0 0 30px #00ffff;
    }
    50% {
        text-shadow: 0 0 20px #00ffff, 0 0 40px #00ffff, 0 0 60px #00ffff;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 30px rgba(255, 0, 0, 0.6);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.15);
        box-shadow: 0 0 50px rgba(255, 0, 0, 1);
    }
}

/* Orientation Warning */
.orientation-warning {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    flex-direction: column;
}

.orientation-warning.show {
    display: flex;
}

.orientation-warning-content {
    text-align: center;
    padding: 30px;
    background: rgba(74, 123, 255, 0.1);
    border: 2px solid #4a7bff;
    border-radius: 10px;
    max-width: 400px;
}

.orientation-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: rotate 2s ease-in-out infinite;
}

@keyframes rotate {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

.orientation-warning-content h2 {
    color: #4a7bff;
    margin-bottom: 15px;
    font-size: 24px;
}

.orientation-warning-content p {
    color: #ffffff;
    font-size: 16px;
    line-height: 1.5;
}

/* Mobile Controls */
.mobile-controls {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 5000;
    display: none;
}

@media (max-width: 1024px) and (orientation: landscape) {
    .mobile-controls {
        display: block !important;
    }
}

/* Joystick */
.joystick-container {
    position: absolute;
    bottom: 30px;
    width: 120px;
    height: 120px;
    pointer-events: auto;
    display: block;
}

.joystick-container.joystick-left {
    left: 30px;
}

.joystick-container.joystick-right {
    right: 30px;
    display: block !important;
}

.joystick-base {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(74, 123, 255, 0.2);
    border: 2px solid rgba(74, 123, 255, 0.5);
    box-shadow: 0 0 20px rgba(74, 123, 255, 0.3);
}

.joystick-handle {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(74, 123, 255, 0.4);
    border: 2px solid rgba(74, 123, 255, 0.8);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.1s ease-out;
    box-shadow: 0 0 15px rgba(74, 123, 255, 0.5);
}

.joystick-handle.active {
    background: rgba(74, 123, 255, 0.6);
    box-shadow: 0 0 25px rgba(74, 123, 255, 0.8);
}

/* Mobile Buttons */
.mobile-button {
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
    font-size: 14px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    pointer-events: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s ease;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.mobile-button:active {
    transform: scale(0.9);
    background: rgba(74, 123, 255, 0.4);
    border-color: rgba(74, 123, 255, 0.8);
    box-shadow: 0 0 30px rgba(74, 123, 255, 0.6);
}

.fire-button {
    bottom: 30px;
    right: 30px;
    background: rgba(255, 0, 0, 0.2);
    border-color: rgba(255, 0, 0, 0.5);
}

.fire-button:active {
    background: rgba(255, 0, 0, 0.4);
    border-color: rgba(255, 0, 0, 0.8);
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.6);
}

.abilities-button {
    bottom: 110px;
    right: 20px;
    width: 60px;
    height: 60px;
    font-size: 10px;
    background: rgba(255, 215, 0, 0.2);
    border-color: rgba(255, 215, 0, 0.5);
}

.abilities-button:active {
    background: rgba(255, 215, 0, 0.4);
    border-color: rgba(255, 215, 0, 0.8);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
}

/* Mobile and Tablet Support */
@media (max-width: 1024px) {
    /* Tablet adjustments */
    .guide-items-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    
    .guide-item-boss {
        grid-column: span 1;
    }
    
    #hud {
        font-size: 12px;
        gap: 10px;
    }
    
    .control-key {
        min-width: 140px;
        font-size: 14px;
        padding: 6px 12px;
    }
    
    .guide-title {
        font-size: 36px;
    }
    
    .changelog-title {
        font-size: 36px;
    }
}

@media (max-width: 768px) {
    /* Mobile phone adjustments */
    body {
        touch-action: none;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    #game-canvas {
        touch-action: none;
    }
    
    /* Show orientation warning in portrait on mobile */
    @media (orientation: portrait) {
        .orientation-warning {
            display: flex !important;
        }
        
        .mobile-controls {
            display: none !important;
        }
    }
    
    /* Optimize for landscape on mobile (16:9 optimized) */
    @media (orientation: landscape) {
        .orientation-warning {
            display: none !important;
        }
        
        .mobile-controls {
            display: block !important;
        }
        
        /* Smaller joysticks - left for movement, right for aiming */
        .joystick-container {
            bottom: 15px;
            width: 70px;
            height: 70px;
        }
        
        .joystick-container.joystick-left {
            left: 15px;
        }
        
        .joystick-container.joystick-right {
            right: 15px;
        }
        
        .joystick-base {
            width: 70px;
            height: 70px;
        }
        
        .joystick-handle {
            width: 35px;
            height: 35px;
        }
        
        /* Abilities button */
        .mobile-button {
            width: 55px;
            height: 55px;
            font-size: 9px;
        }
        
        .abilities-button {
            bottom: 95px;
            right: 15px;
        }
        
        /* Ensure all UI fits in 16:9 viewport */
        #hud {
            font-size: 9px;
            gap: 4px;
            top: 3px;
            left: 3px;
        }
        
        #fleet-status {
            top: 3px;
            right: 3px;
        }
        
        #powerup-display {
            bottom: 3px;
            left: 3px;
            gap: 4px;
        }
        
        .powerup-item {
            width: 22px;
            height: 22px;
            font-size: 11px;
        }
        
        #controls-help {
            bottom: 3px;
            right: 3px;
            font-size: 8px;
            padding: 3px 5px;
            max-width: 100px;
        }
        
        #selected-powerup-title {
            bottom: 30px;
            left: 3px;
        }
        
        #wave-display-bottom-right {
            bottom: 30px;
            right: 3px;
        }
        
        /* Active powerup timers - scale down */
        #active-powerup-timers {
            top: 5px;
            right: 5px;
            font-size: 10px;
            padding: 5px;
            min-width: 120px;
        }
    }
    
    .guide-items-grid {
        grid-template-columns: 1fr;
    }
    
    .guide-item-boss {
        grid-column: span 1;
    }
    
    #hud {
        font-size: 11px;
        gap: 8px;
        top: 5px;
        left: 5px;
    }
    
    #hud > div {
        padding: 4px 8px;
    }
    
    .guide-title, .changelog-title, .leaderboard-title {
        font-size: 28px;
        margin-bottom: 20px;
    }
    
    .guide-tabs {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .guide-tab {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .control-key {
        min-width: 120px;
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .control-desc {
        font-size: 14px;
    }
    
    .guide-item {
        padding: 12px;
    }
    
    .guide-item-name {
        font-size: 18px;
    }
    
    .guide-item-description {
        font-size: 13px;
    }
    
    .changelog-btn, .guide-btn, .leaderboard-btn, .support-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .username-container {
        top: 40px;
    }
    
    #username-input {
        font-size: 12px;
        padding: 4px 8px;
        width: 120px;
    }
    
    #username-submit-btn {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .pause-buttons {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .menu-btn, .resume-btn, .quit-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .screen h2 {
        font-size: 28px;
    }
    
    #wave-display-bottom-right {
        bottom: 50px;
        right: 5px;
    }
    
    #wave-display-bottom-right span {
        font-size: 12px;
    }
    
    .guide-screen-content, .changelog-screen-content, .leaderboard-screen-content {
        padding: 15px;
    }
    
    .guide-container, .changelog-container, .leaderboard-container {
        max-height: 60vh;
    }
}

@media (max-width: 480px) {
    /* Small mobile phones */
    .guide-title, .changelog-title, .leaderboard-title {
        font-size: 24px;
    }
    
    .guide-tab {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .control-key {
        min-width: 100px;
        font-size: 11px;
    }
    
    .guide-item-visual {
        width: 48px;
        height: 48px;
    }
    
    .guide-item-visual-boss {
        width: 72px;
        height: 72px;
    }
    
    #hud {
        font-size: 10px;
    }
    
    .changelog-btn, .guide-btn {
        bottom: 5px;
        padding: 5px 10px;
        font-size: 11px;
    }
    
    .leaderboard-btn, .support-btn {
        top: 5px;
        padding: 5px 10px;
        font-size: 11px;
    }
}