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

@font-face {
    font-family: 'GameFont';
    src: local('Courier New'), local('monospace');
}

body {
    background: #0a0a0f;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: 'Courier New', monospace;
    color: #e0e0e0;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 480px;
    height: 640px;
}

#gameCanvas {
    display: block;
    background: #0a0a12;
    border: 1px solid #1a1a2e;
    image-rendering: pixelated;
}

/* Overlays */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(5, 5, 15, 0.95);
    z-index: 10;
}

.hidden {
    display: none !important;
}

/* Title */
.title {
    font-size: 52px;
    font-weight: 900;
    letter-spacing: 8px;
    text-align: center;
    line-height: 1.1;
    background: linear-gradient(180deg, #00f0ff, #7b2fff, #ff2d95);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    margin-bottom: 8px;
    animation: titlePulse 3s ease-in-out infinite;
}

@keyframes titlePulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.3); }
}

.subtitle {
    font-size: 11px;
    letter-spacing: 6px;
    color: #555;
    margin-bottom: 40px;
}

/* Buttons */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 3px;
    padding: 12px 40px;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 200px;
}

.btn-primary {
    background: linear-gradient(135deg, #7b2fff, #00f0ff);
    color: #fff;
    clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}

.btn-primary:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
}

.btn-secondary {
    background: transparent;
    color: #888;
    border: 1px solid #333;
}

.btn-secondary:hover {
    color: #fff;
    border-color: #7b2fff;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    gap: 30px;
    margin-top: 30px;
    font-size: 13px;
}

.credit-display {
    color: #ffcc00;
}

.score-display {
    color: #00f0ff;
}

/* HUD */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 8px 14px;
    display: flex;
    justify-content: space-between;
    z-index: 5;
    font-size: 13px;
    pointer-events: none;
}

.hud-left, .hud-right {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hud-right {
    text-align: right;
    color: #666;
}

.boss-bar {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    text-align: center;
    z-index: 6;
    pointer-events: none;
}

.boss-name {
    font-size: 10px;
    letter-spacing: 3px;
    color: #f44;
    display: block;
    margin-bottom: 3px;
}

.boss-hp-track {
    width: 100%;
    height: 8px;
    background: #1a0000;
    border: 1px solid #400;
}

.boss-hp-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff0000, #ff4400, #ff0000);
    transition: width 0.15s;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.5);
}

#hudScore {
    color: #00f0ff;
    font-size: 18px;
    font-weight: bold;
}

.lives {
    display: flex;
    gap: 4px;
}

.life-pip {
    width: 10px;
    height: 10px;
    background: #ff2d95;
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

/* Hangar */
h2 {
    font-size: 28px;
    letter-spacing: 6px;
    margin-bottom: 20px;
    color: #7b2fff;
}

.ship-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 400px;
    margin-bottom: 20px;
}

.ship-card {
    width: 70px;
    height: 70px;
    border: 1px solid #222;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    background: #0d0d18;
}

.ship-card:hover {
    border-color: #7b2fff;
}

.ship-card.selected {
    border-color: #00f0ff;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

.ship-card.locked {
    opacity: 0.4;
}

.ship-card.equipped {
    border-color: #ffcc00;
}

.ship-card canvas {
    width: 40px;
    height: 40px;
    image-rendering: pixelated;
}

.ship-card .ship-name {
    font-size: 7px;
    letter-spacing: 1px;
    margin-top: 4px;
    color: #888;
}

.ship-card .ship-price {
    font-size: 7px;
    color: #ffcc00;
    position: absolute;
    bottom: 3px;
}

.ship-preview {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

#previewCanvas {
    image-rendering: pixelated;
    border: 1px solid #1a1a2e;
}

.ship-stats {
    font-size: 11px;
    line-height: 2;
}

.stat-bar {
    display: inline-block;
    width: 80px;
    height: 6px;
    background: #1a1a2e;
    margin-left: 8px;
    vertical-align: middle;
}

.stat-fill {
    height: 100%;
    background: linear-gradient(90deg, #7b2fff, #00f0ff);
}

.hangar-actions {
    display: flex;
    gap: 10px;
}

/* Level Select */
.level-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
    width: 300px;
}

.level-card {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border: 1px solid #222;
    cursor: pointer;
    transition: all 0.15s;
    background: #0d0d18;
}

.level-card:hover {
    border-color: #7b2fff;
}

.level-card.selected {
    border-color: #00f0ff;
}

.level-card.locked {
    opacity: 0.4;
    cursor: default;
}

.level-num {
    font-size: 24px;
    font-weight: bold;
    color: #7b2fff;
    margin-right: 16px;
    min-width: 40px;
}

.level-info {
    flex: 1;
}

.level-name {
    font-size: 12px;
    letter-spacing: 2px;
    margin-bottom: 2px;
}

.level-desc {
    font-size: 9px;
    color: #555;
}

.level-stars {
    color: #ffcc00;
    font-size: 14px;
    letter-spacing: 2px;
}

/* Game Over */
.go-stats {
    text-align: center;
    font-size: 14px;
    line-height: 2;
}

.go-stats span {
    color: #00f0ff;
}

.new-best {
    color: #ffcc00 !important;
    animation: flash 0.5s ease-in-out infinite alternate;
}

@keyframes flash {
    from { opacity: 0.5; }
    to { opacity: 1; }
}

/* Auth Screen */
.auth-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    width: 260px;
}

.auth-tabs {
    display: flex;
    gap: 0;
    width: 100%;
    margin-bottom: 6px;
}

.auth-tab {
    flex: 1;
    padding: 8px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 2px;
    background: transparent;
    color: #555;
    border: 1px solid #222;
    cursor: pointer;
    transition: all 0.15s;
}

.auth-tab.active {
    color: #00f0ff;
    border-color: #00f0ff;
    background: rgba(0, 240, 255, 0.05);
}

.auth-input {
    width: 100%;
    padding: 10px 14px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    letter-spacing: 1px;
    background: #0d0d18;
    border: 1px solid #222;
    color: #e0e0e0;
    outline: none;
    transition: border-color 0.15s;
}

.auth-input:focus {
    border-color: #7b2fff;
}

.auth-input::placeholder {
    color: #444;
}

.auth-error {
    color: #f44;
    font-size: 10px;
    letter-spacing: 1px;
    min-height: 14px;
}

.auth-info {
    color: #444;
    font-size: 9px;
    letter-spacing: 1px;
}

.user-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 8px;
    font-size: 11px;
}

.user-display {
    color: #7b2fff;
    letter-spacing: 2px;
}

.btn-link {
    background: none;
    border: none;
    color: #555;
    font-family: 'Courier New', monospace;
    font-size: 9px;
    letter-spacing: 2px;
    cursor: pointer;
    transition: color 0.15s;
}

.btn-link:hover {
    color: #f44;
}

/* Keyboard focus */
.kb-focus {
    outline: 2px solid #00f0ff !important;
    outline-offset: 2px;
    border-color: #00f0ff !important;
    filter: brightness(1.2);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: #0a0a12;
}

::-webkit-scrollbar-thumb {
    background: #333;
}
