/* Sub Command - SSN Tactical Submarine Simulation */
/* Clean Military Interface Design */

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

:root {
    /* Primary colors - refined green palette */
    --primary: #00cc66;
    --primary-dim: #009944;
    --primary-dark: #006633;
    --primary-glow: rgba(0, 204, 102, 0.4);

    /* Secondary colors */
    --amber: #ffaa00;
    --amber-dim: #cc8800;
    --red: #ff4444;
    --red-dim: #cc3333;
    --cyan: #00cccc;
    --blue: #4488cc;

    /* Background shades */
    --bg-dark: #0a0e0a;
    --bg-panel: #0f1410;
    --bg-elevated: #141a14;
    --bg-hover: #1a221a;

    /* Border and text */
    --border: #1a2a1a;
    --border-light: #2a3a2a;
    --text: #b0c4b0;
    --text-dim: #607060;
    --text-bright: #d0e8d0;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    font-family: 'Segoe UI', 'SF Pro Display', -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    font-size: 13px;
    line-height: 1.4;
}

/* Subtle CRT effect - optional, very light */
.crt-effect::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(0,0,0,0.15) 100%);
    pointer-events: none;
    z-index: 9999;
}

/* ==================== SCREENS ==================== */
.screen {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
}

.screen.active {
    display: flex;
}

/* ==================== MAIN MENU ==================== */
#main-menu {
    background: linear-gradient(180deg, var(--bg-dark) 0%, #0a120a 100%);
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.menu-container {
    text-align: center;
    max-width: 400px;
}

.game-title {
    font-size: 56px;
    font-weight: 300;
    color: var(--primary);
    letter-spacing: 12px;
    margin-bottom: 8px;
}

.game-subtitle {
    font-size: 12px;
    color: var(--text-dim);
    letter-spacing: 6px;
    text-transform: uppercase;
    margin-bottom: 60px;
    font-weight: 400;
}

.menu-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-btn {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text);
    padding: 14px 40px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.menu-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary-dim);
    color: var(--primary);
}

.menu-btn:active {
    background: var(--primary-dark);
}

.menu-btn.back-btn {
    border-color: var(--border);
    color: var(--text-dim);
}

.menu-btn.back-btn:hover {
    border-color: var(--amber-dim);
    color: var(--amber);
}

.menu-btn.start-btn {
    background: var(--primary-dark);
    border-color: var(--primary-dim);
    color: var(--primary);
}

.menu-btn.start-btn:hover {
    background: var(--primary-dim);
    color: var(--bg-dark);
}

.player-rank {
    margin-top: 50px;
    padding: 16px 32px;
    background: var(--bg-panel);
    border-radius: 4px;
    font-size: 12px;
    display: flex;
    justify-content: center;
    gap: 24px;
}

.rank-label, .score-label {
    color: var(--text-dim);
    margin-right: 8px;
}

.rank-value {
    color: var(--amber);
    font-weight: 600;
}

.score-value {
    color: var(--primary);
    font-weight: 600;
}

/* ==================== CAMPAIGN & QUICK MISSION ==================== */
.campaign-container, .quick-mission-container, .multiplayer-container, .options-container {
    width: 100%;
    height: 100%;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-dark);
}

.campaign-container h2, .quick-mission-container h2, .multiplayer-container h2, .options-container h2 {
    color: var(--primary);
    font-size: 20px;
    font-weight: 400;
    letter-spacing: 4px;
    margin-bottom: 32px;
}

.mission-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 800px;
    width: 100%;
    margin-bottom: 32px;
    max-height: 55vh;
    overflow-y: auto;
}

.mission-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.mission-card:hover {
    border-color: var(--primary-dim);
    background: var(--bg-elevated);
}

.mission-card.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.mission-card.completed {
    border-left: 3px solid var(--primary);
}

.mission-number {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.mission-name {
    font-size: 15px;
    color: var(--text-bright);
    margin-bottom: 8px;
    font-weight: 500;
}

.mission-desc {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.5;
}

/* Quick Mission Type Select */
.mission-type-select {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.mission-type-btn {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 12px 24px;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-radius: 4px;
}

.mission-type-btn:hover, .mission-type-btn.active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--bg-elevated);
}

.difficulty-select {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    font-size: 12px;
}

.difficulty-select > span {
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.difficulty-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 8px 16px;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 4px;
}

.difficulty-btn:hover, .difficulty-btn.active {
    border-color: var(--primary);
    color: var(--primary);
}

/* ==================== BRIEFING SCREEN ==================== */
.briefing-container {
    width: 100%;
    height: 100%;
    padding: 32px;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
}

.briefing-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.classification {
    display: inline-block;
    background: var(--red);
    color: #fff;
    padding: 4px 16px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 2px;
    margin-bottom: 12px;
    border-radius: 2px;
}

.briefing-header h2 {
    color: var(--text-bright);
    font-size: 18px;
    font-weight: 400;
    letter-spacing: 3px;
}

.briefing-content {
    display: flex;
    gap: 32px;
    flex: 1;
    min-height: 0;
}

.briefing-map {
    flex: 0 0 400px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.briefing-map canvas {
    width: 100%;
    height: 100%;
    background: #0a140a;
}

.briefing-text {
    flex: 1;
    overflow-y: auto;
    padding-right: 16px;
}

.briefing-text h3 {
    color: var(--amber);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 20px 0 10px 0;
}

.briefing-text h3:first-child {
    margin-top: 0;
}

.briefing-text p {
    color: var(--text);
    font-size: 13px;
    line-height: 1.7;
}

.loadout-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.loadout-section h3 {
    color: var(--amber);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 16px;
}

.loadout-options {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
}

.loadout-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.loadout-name {
    color: var(--text-dim);
    font-size: 12px;
    min-width: 140px;
}

.loadout-item input[type="number"] {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--primary);
    padding: 6px 12px;
    width: 64px;
    font-family: inherit;
    font-size: 13px;
    text-align: center;
    border-radius: 4px;
}

.loadout-item input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-dim);
}

.briefing-buttons {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

/* ==================== OPTIONS SCREEN ==================== */
.option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 360px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.option-row label {
    color: var(--text);
    font-size: 13px;
}

.option-row input[type="range"] {
    width: 140px;
    accent-color: var(--primary);
}

.option-row select {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 16px;
    font-family: inherit;
    font-size: 12px;
    border-radius: 4px;
}

.option-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

#btn-reset-progress {
    margin-top: 32px;
    border-color: var(--red-dim);
    color: var(--red-dim);
}

#btn-reset-progress:hover {
    border-color: var(--red);
    color: var(--red);
}

/* ==================== MAIN GAME SCREEN ==================== */
#game-screen {
    display: none;
    flex-direction: column;
    background: var(--bg-dark);
}

#game-screen.active {
    display: flex;
}

/* Station Bar */
.station-bar {
    display: flex;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    height: 40px;
}

.station-btn {
    background: transparent;
    border: none;
    border-right: 1px solid var(--border);
    color: var(--text-dim);
    padding: 0 24px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.station-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.station-btn.active {
    background: var(--primary-dark);
    color: var(--primary);
}

.station-btn.alert {
    animation: alert-pulse 1s infinite;
}

@keyframes alert-pulse {
    0%, 100% { background: transparent; }
    50% { background: rgba(255, 68, 68, 0.2); }
}

/* Top Status Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    height: 80px;
}

.depth-display, .speed-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
}

.depth-display .label, .speed-display .label {
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.depth-display .value, .speed-display .value {
    font-size: 28px;
    color: var(--primary);
    font-weight: 300;
    font-family: 'SF Mono', 'Consolas', monospace;
}

.depth-display .unit, .speed-display .unit {
    font-size: 11px;
    color: var(--text-dim);
}

.layer-indicator {
    font-size: 10px;
    color: var(--amber);
    margin-top: 4px;
    letter-spacing: 1px;
}

.throttle-indicator {
    font-size: 10px;
    color: var(--cyan);
    margin-top: 4px;
}

.compass-display {
    flex: 1;
    max-width: 360px;
    margin: 0 32px;
}

.compass-display canvas {
    width: 100%;
    height: 48px;
    border-radius: 4px;
}

/* Main Game Area */
.game-area {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* Left Panel - Sonar */
.left-panel {
    width: 300px;
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
}

.sonar-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px;
}

.sonar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.panel-title {
    font-size: 11px;
    color: var(--amber);
    letter-spacing: 2px;
    font-weight: 500;
}

.sonar-modes {
    display: flex;
    gap: 4px;
}

.sonar-mode-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 4px 10px;
    font-family: inherit;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.15s;
    border-radius: 3px;
}

.sonar-mode-btn:hover, .sonar-mode-btn.active {
    border-color: var(--primary);
    color: var(--primary);
}

#sonar-canvas {
    background: #0a140a;
    border: 1px solid var(--border);
    border-radius: 4px;
    width: 100%;
    aspect-ratio: 1;
}

.waterfall-display {
    margin-top: 12px;
}

.waterfall-display canvas {
    width: 100%;
    height: 100px;
    background: #080c08;
    border: 1px solid var(--border);
    border-radius: 4px;
}

/* Target Info Panel */
.target-info-panel {
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    padding: 16px;
}

.target-details {
    margin-top: 12px;
}

.target-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 12px;
}

.target-label {
    color: var(--text-dim);
}

.target-value {
    color: var(--primary);
    font-family: 'SF Mono', 'Consolas', monospace;
}

.solution-quality {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.solution-bar {
    height: 6px;
    background: var(--bg-dark);
    border-radius: 3px;
    margin: 8px 0;
    overflow: hidden;
}

.solution-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
    border-radius: 3px;
}

.solution-text {
    font-size: 10px;
    text-align: right;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.solution-text.poor { color: var(--red); }
.solution-text.fair { color: var(--amber); }
.solution-text.good { color: var(--primary); }

/* Center Panel */
.center-panel {
    flex: 1;
    position: relative;
    background: #060a06;
    display: flex;
    flex-direction: column;
}

#game-canvas {
    flex: 1;
    width: 100%;
}

.alert-display {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.alert {
    background: rgba(255, 68, 68, 0.95);
    color: #fff;
    padding: 12px 32px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 3px;
    border-radius: 4px;
    text-transform: uppercase;
    box-shadow: 0 4px 20px rgba(255, 0, 0, 0.4);
    animation: alert-appear 0.3s ease-out;
}

.alert.yellow {
    background: rgba(255, 170, 0, 0.95);
    color: #000;
    box-shadow: 0 4px 20px rgba(255, 170, 0, 0.4);
}

.alert.red {
    background: rgba(255, 68, 68, 0.95);
    color: #fff;
}

@keyframes alert-appear {
    0% { transform: scale(1.1); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Crew Reports */
.crew-reports {
    position: absolute;
    bottom: 56px;
    left: 16px;
    right: 16px;
    background: rgba(10, 14, 10, 0.95);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 12px;
    max-height: 140px;
    overflow-y: auto;
}

.crew-report {
    display: flex;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
}

.crew-report:last-child {
    border-bottom: none;
}

.report-station {
    color: var(--amber);
    min-width: 64px;
    font-weight: 500;
}

.report-message {
    color: var(--text);
    flex: 1;
}

.report-time {
    color: var(--text-dim);
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 10px;
}

.message-log {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    font-size: 11px;
    pointer-events: none;
}

/* Right Panel - Fire Control */
.right-panel {
    width: 260px;
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
}

.fire-control-panel {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.weapon-select {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin: 12px 0;
}

.weapon-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 8px 4px;
    font-family: inherit;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.15s;
    border-radius: 3px;
}

.weapon-btn:hover, .weapon-btn.active {
    border-color: var(--primary);
    color: var(--primary);
}

.tube-status {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 12px 0;
}

.tube {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 10px;
    text-align: center;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.tube:hover {
    border-color: var(--border-light);
}

.tube.selected {
    border-color: var(--primary);
}

.tube-num {
    display: block;
    color: var(--text-dim);
    font-size: 10px;
    margin-bottom: 4px;
}

.tube-state {
    color: var(--primary);
    font-size: 11px;
    font-weight: 500;
}

.tube.loading .tube-state {
    color: var(--amber);
}

.tube.empty .tube-state {
    color: var(--red-dim);
}

.vls-status {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 12px;
    text-align: center;
    margin: 12px 0;
    border-radius: 4px;
}

.vls-label, .vls-unit {
    color: var(--text-dim);
    font-size: 10px;
}

.vls-count {
    font-size: 24px;
    color: var(--primary);
    font-weight: 300;
    margin: 0 8px;
    font-family: 'SF Mono', 'Consolas', monospace;
}

.ammo-display {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 12px;
    font-size: 11px;
    border-radius: 4px;
}

.ammo-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    color: var(--text-dim);
}

.ammo-row span:last-child {
    color: var(--text);
    font-family: 'SF Mono', 'Consolas', monospace;
}

.wire-guide-panel {
    background: rgba(255, 170, 0, 0.1);
    border: 1px solid var(--amber-dim);
    padding: 12px;
    margin: 12px 0;
    text-align: center;
    border-radius: 4px;
}

.wire-guide-header {
    color: var(--amber);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.wire-torpedo {
    font-size: 16px;
    color: var(--primary);
    margin: 8px 0;
}

.wire-controls {
    font-size: 10px;
    color: var(--text-dim);
    margin: 8px 0;
}

.wire-btn {
    background: transparent;
    border: 1px solid var(--red-dim);
    color: var(--red-dim);
    padding: 6px 16px;
    font-family: inherit;
    font-size: 10px;
    cursor: pointer;
    border-radius: 3px;
}

.wire-btn:hover {
    border-color: var(--red);
    color: var(--red);
}

.shoot-btn {
    background: var(--red-dim);
    border: none;
    color: #fff;
    padding: 14px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 2px;
    cursor: pointer;
    margin-top: auto;
    transition: all 0.15s;
    border-radius: 4px;
}

.shoot-btn:hover {
    background: var(--red);
}

.shoot-btn:active {
    transform: scale(0.98);
}

/* Status Panel */
.status-panel {
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    padding: 16px;
}

.system-status {
    margin-top: 12px;
}

.system-row {
    display: flex;
    align-items: center;
    padding: 5px 0;
    font-size: 10px;
}

.system-name {
    width: 72px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.system-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-dark);
    border-radius: 2px;
    margin-left: 12px;
    overflow: hidden;
}

.system-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s, background 0.3s;
    border-radius: 2px;
}

.system-fill.warning {
    background: var(--amber);
}

.system-fill.critical {
    background: var(--red);
}

.silent-mode {
    margin-top: 12px;
    padding: 10px;
    text-align: center;
    font-size: 10px;
    color: var(--text-dim);
    background: var(--bg-dark);
    border-radius: 4px;
    letter-spacing: 1px;
}

.silent-mode.active {
    background: rgba(0, 204, 204, 0.1);
    color: var(--cyan);
}

/* Bottom Bar */
.bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 24px;
    background: var(--bg-panel);
    border-top: 1px solid var(--border);
    height: 48px;
}

.mission-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
}

.mission-label {
    color: var(--text-dim);
}

.mission-name {
    color: var(--amber);
    font-weight: 500;
}

.objective-status {
    color: var(--text);
    margin-left: 16px;
}

.control-hints {
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 0.5px;
}

.depth-gauge canvas {
    height: 28px;
    border-radius: 4px;
}

/* ==================== OVERLAYS ==================== */

/* Tactical Map */
.tactical-map-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    background: var(--bg-panel);
    border: 1px solid var(--primary-dim);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 500;
    overflow: hidden;
}

.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}

.map-title {
    color: var(--amber);
    font-size: 12px;
    letter-spacing: 2px;
    font-weight: 500;
}

.map-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.map-btn {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text);
    width: 28px;
    height: 28px;
    font-family: inherit;
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
}

.map-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.map-scale {
    color: var(--text-dim);
    font-size: 11px;
    min-width: 48px;
    text-align: center;
}

.map-close {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    width: 28px;
    height: 28px;
    font-family: inherit;
    cursor: pointer;
    border-radius: 4px;
    margin-left: 16px;
}

.map-close:hover {
    border-color: var(--red);
    color: var(--red);
}

#tactical-map-canvas {
    width: 100%;
    height: calc(100% - 88px);
    background: #0a140a;
}

.map-legend {
    display: flex;
    justify-content: center;
    gap: 32px;
    padding: 12px;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    font-size: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dim);
}

.legend-icon {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-icon.player { background: var(--cyan); }
.legend-icon.hostile { background: var(--red); }
.legend-icon.friendly { background: var(--primary); }
.legend-icon.unknown { background: var(--amber); }
.legend-icon.waypoint { background: var(--text); border-radius: 0; }

/* Periscope View */
.periscope-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    z-index: 400;
}

.periscope-view {
    position: relative;
    width: 100%;
    height: 100%;
}

.periscope-canvas {
    width: 100%;
    height: 100%;
}

.periscope-reticle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at center, transparent 30%, rgba(0,0,0,0.9) 50%),
        linear-gradient(0deg, transparent 49.8%, rgba(0, 204, 102, 0.3) 49.8%, rgba(0, 204, 102, 0.3) 50.2%, transparent 50.2%),
        linear-gradient(90deg, transparent 49.8%, rgba(0, 204, 102, 0.3) 49.8%, rgba(0, 204, 102, 0.3) 50.2%, transparent 50.2%);
}

.periscope-bearing {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 12px 32px;
    border: 1px solid var(--primary-dim);
    border-radius: 4px;
}

.periscope-bearing span {
    color: var(--primary);
    font-size: 20px;
    font-family: 'SF Mono', 'Consolas', monospace;
    letter-spacing: 2px;
}

.periscope-controls {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.periscope-btn {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--border-light);
    color: var(--text);
    padding: 10px 20px;
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
    border-radius: 4px;
}

.periscope-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Damage Control */
.damage-control-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 640px;
    background: var(--bg-panel);
    border: 1px solid var(--amber-dim);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 500;
    overflow: hidden;
}

.dc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}

.dc-title {
    color: var(--amber);
    font-size: 12px;
    letter-spacing: 2px;
    font-weight: 500;
}

.dc-close {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    width: 28px;
    height: 28px;
    font-family: inherit;
    cursor: pointer;
    border-radius: 4px;
}

.dc-close:hover {
    border-color: var(--amber);
    color: var(--amber);
}

.dc-diagram {
    padding: 24px;
    display: flex;
    justify-content: center;
}

.dc-diagram canvas {
    background: #0a140a;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.dc-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
}

.dc-crew {
    color: var(--text);
    font-size: 12px;
}

.dc-crew span:last-child {
    color: var(--primary);
    font-weight: 500;
}

.dc-actions {
    display: flex;
    gap: 8px;
}

.dc-btn {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text);
    padding: 8px 16px;
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
}

.dc-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.dc-btn.emergency {
    border-color: var(--red-dim);
    color: var(--red-dim);
}

.dc-btn.emergency:hover {
    border-color: var(--red);
    color: var(--red);
    background: rgba(255, 68, 68, 0.1);
}

/* Pause Menu */
.pause-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 10, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 600;
}

.pause-container {
    text-align: center;
}

.pause-container h2 {
    color: var(--amber);
    font-size: 32px;
    font-weight: 300;
    letter-spacing: 8px;
    margin-bottom: 40px;
}

.pause-container .menu-btn {
    display: block;
    margin: 12px auto;
    min-width: 240px;
}

/* ==================== MISSION COMPLETE ==================== */
#mission-complete-screen {
    background: var(--bg-dark);
    justify-content: center;
    align-items: center;
}

.mission-complete-container {
    text-align: center;
    padding: 40px 48px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-width: 420px;
}

.mission-complete-container h2 {
    font-size: 24px;
    font-weight: 400;
    letter-spacing: 4px;
    margin-bottom: 32px;
}

.mission-complete-container h2.success {
    color: var(--primary);
}

.mission-complete-container h2.failed {
    color: var(--red);
}

.score-breakdown {
    text-align: left;
    padding: 20px;
    background: var(--bg-elevated);
    margin-bottom: 24px;
    border-radius: 4px;
}

.score-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 13px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
}

.score-row span:last-child {
    color: var(--text);
}

.score-row.total {
    border-bottom: none;
    padding-top: 16px;
    margin-top: 8px;
    border-top: 1px solid var(--primary-dim);
    font-size: 15px;
}

.score-row.total span {
    color: var(--primary);
    font-weight: 500;
}

.rank-update {
    padding: 16px;
    margin-bottom: 24px;
    background: rgba(255, 170, 0, 0.1);
    border: 1px solid var(--amber-dim);
    border-radius: 4px;
    font-size: 14px;
}

.rank-update span:first-child {
    color: var(--text-dim);
}

#new-rank {
    color: var(--amber);
    font-weight: 600;
}

.mission-complete-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Multiplayer Status */
.mp-status-overlay {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 700;
}

.mp-status-bar {
    display: flex;
    gap: 24px;
    background: rgba(10, 14, 10, 0.95);
    border: 1px solid var(--cyan);
    border-top: none;
    padding: 8px 24px;
    font-size: 11px;
    border-radius: 0 0 4px 4px;
}

.mp-status-bar span {
    color: var(--cyan);
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dim);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1200px) {
    .left-panel { width: 260px; }
    .right-panel { width: 240px; }
}

@media (max-width: 1000px) {
    .game-area {
        flex-wrap: wrap;
    }
    .left-panel, .right-panel {
        width: 50%;
        height: 35%;
    }
    .center-panel {
        width: 100%;
        order: -1;
        height: 65%;
    }
}
