/* Sub Command - Submarine Simulation Styles */

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
}

#game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#game-canvas {
    max-width: 100%;
    max-height: 100%;
}

/* Sonar Display */
.sonar-display {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, #001a00 0%, #000800 100%);
    border: 4px solid #0a3a0a;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.3), inset 0 0 40px rgba(0, 0, 0, 0.8);
    z-index: 50;
    overflow: hidden;
}

.sonar-display::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 2px;
    background: rgba(0, 255, 0, 0.3);
    transform-origin: left center;
    animation: sonar-sweep 4s linear infinite;
}

@keyframes sonar-sweep {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.sonar-display .sweep {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50%;
    height: 50%;
    background: linear-gradient(90deg, rgba(0, 255, 0, 0.4), transparent);
    transform-origin: left center;
    animation: sonar-sweep 4s linear infinite;
}

.sonar-display .grid-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(0, 255, 0, 0.2);
    border-radius: 50%;
}

.sonar-display .center-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: #0f0;
    border-radius: 50%;
}

.sonar-contact {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: contact-pulse 1s ease-in-out infinite;
}

.sonar-contact.hostile {
    background: #f00;
    box-shadow: 0 0 10px #f00;
}

.sonar-contact.neutral {
    background: #ff0;
    box-shadow: 0 0 10px #ff0;
}

.sonar-contact.friendly {
    background: #0f0;
    box-shadow: 0 0 10px #0f0;
}

@keyframes contact-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

/* Depth Gauge */
.depth-gauge {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 80px;
    height: 300px;
    background: rgba(0, 20, 40, 0.9);
    border: 2px solid #0a5a8a;
    border-radius: 10px;
    padding: 10px;
    z-index: 50;
}

.depth-gauge h4 {
    color: #0af;
    font-size: 10px;
    margin: 0 0 10px 0;
    text-align: center;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.depth-gauge .scale {
    height: 220px;
    background: linear-gradient(to bottom,
        #4a9eff 0%,
        #1a5a9a 20%,
        #0a3a6a 40%,
        #05254a 60%,
        #021530 80%,
        #010a18 100%
    );
    border-radius: 5px;
    position: relative;
    border: 1px solid #0a5a8a;
}

.depth-gauge .scale .markers {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.depth-gauge .scale .marker-line {
    position: absolute;
    left: 0;
    width: 10px;
    height: 1px;
    background: rgba(0, 170, 255, 0.5);
}

.depth-gauge .depth-indicator {
    position: absolute;
    left: -5px;
    width: calc(100% + 10px);
    height: 4px;
    background: #f00;
    box-shadow: 0 0 10px #f00;
    transition: top 0.3s ease;
}

.depth-gauge .crush-depth {
    position: absolute;
    bottom: 10%;
    left: 0;
    right: 0;
    height: 2px;
    background: #f00;
    opacity: 0.7;
}

.depth-gauge .crush-label {
    position: absolute;
    bottom: 12%;
    right: 5px;
    color: #f00;
    font-size: 8px;
    font-family: 'Courier New', monospace;
}

.depth-gauge .value {
    text-align: center;
    color: #0af;
    font-size: 18px;
    font-weight: bold;
    margin-top: 10px;
    font-family: 'Courier New', monospace;
}

.depth-gauge .value span {
    font-size: 10px;
    color: #0a8;
}

/* Top HUD */
.sub-hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    background: linear-gradient(to bottom, rgba(0, 20, 40, 0.9), transparent);
    z-index: 50;
}

.hud-section {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hud-value {
    color: #0af;
    font-size: 20px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.hud-label {
    color: #068;
    font-size: 10px;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Heading Compass */
.heading-compass {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 250px;
    height: 40px;
    background: rgba(0, 20, 40, 0.9);
    border: 2px solid #0a5a8a;
    border-radius: 5px;
    overflow: hidden;
    z-index: 50;
}

.compass-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #0af;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    white-space: nowrap;
}

.compass-marker {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #f00;
}

/* Speed/Throttle Control */
.throttle-panel {
    position: absolute;
    left: 20px;
    bottom: 20px;
    width: 200px;
    background: rgba(0, 20, 40, 0.9);
    border: 2px solid #0a5a8a;
    border-radius: 10px;
    padding: 15px;
    z-index: 50;
}

.throttle-panel h4 {
    color: #0af;
    font-size: 12px;
    margin: 0 0 10px 0;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
}

.throttle-bar {
    height: 20px;
    background: #021530;
    border-radius: 3px;
    position: relative;
    margin-bottom: 10px;
    border: 1px solid #0a5a8a;
}

.throttle-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, #0a5a8a, #0af);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.throttle-bar .markers {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 5px;
    align-items: center;
    pointer-events: none;
}

.throttle-bar .marker {
    width: 1px;
    height: 10px;
    background: rgba(0, 170, 255, 0.3);
}

.speed-display {
    display: flex;
    justify-content: space-between;
    color: #0af;
    font-family: 'Courier New', monospace;
}

.speed-display .label {
    color: #068;
    font-size: 10px;
}

.speed-display .value {
    font-size: 16px;
    font-weight: bold;
}

/* Torpedo Panel */
.torpedo-panel {
    position: absolute;
    right: 20px;
    bottom: 20px;
    width: 150px;
    background: rgba(0, 20, 40, 0.9);
    border: 2px solid #0a5a8a;
    border-radius: 10px;
    padding: 15px;
    z-index: 50;
}

.torpedo-panel h4 {
    color: #f00;
    font-size: 12px;
    margin: 0 0 10px 0;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
}

.torpedo-tubes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.torpedo-tube {
    background: #021530;
    border: 2px solid #0a5a8a;
    border-radius: 5px;
    padding: 8px;
    text-align: center;
}

.torpedo-tube.loaded {
    border-color: #0f0;
}

.torpedo-tube.empty {
    border-color: #555;
}

.torpedo-tube.firing {
    border-color: #f00;
    animation: firing-pulse 0.3s ease;
}

@keyframes firing-pulse {
    0%, 100% { box-shadow: 0 0 5px #f00; }
    50% { box-shadow: 0 0 20px #f00; }
}

.torpedo-tube .number {
    color: #068;
    font-size: 10px;
    font-family: 'Courier New', monospace;
}

.torpedo-tube .status {
    color: #0f0;
    font-size: 12px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    margin-top: 3px;
}

.torpedo-tube.empty .status {
    color: #555;
}

/* Status Alerts */
.status-alerts {
    position: absolute;
    bottom: 200px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 50;
}

.alert-light {
    padding: 8px 15px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    text-align: center;
    opacity: 0.3;
    text-transform: uppercase;
}

.alert-light.active {
    opacity: 1;
    animation: alert-blink 0.5s infinite;
}

@keyframes alert-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.alert-light.depth-warning {
    background: #8B0000;
    color: #fff;
    border: 1px solid #f00;
}

.alert-light.detected {
    background: #8B4500;
    color: #fff;
    border: 1px solid #f80;
}

.alert-light.torpedo-incoming {
    background: #8B0000;
    color: #fff;
    border: 1px solid #f00;
}

.alert-light.silent-running {
    background: #004400;
    color: #0f0;
    border: 1px solid #0f0;
}

/* Mission Panel */
.mission-panel {
    position: absolute;
    top: 130px;
    left: 20px;
    width: 200px;
    background: rgba(0, 20, 40, 0.9);
    border: 2px solid #0a5a8a;
    border-radius: 10px;
    padding: 15px;
    z-index: 50;
}

.mission-panel h4 {
    color: #ff0;
    font-size: 12px;
    margin: 0 0 10px 0;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
}

.mission-panel .objective {
    color: #0af;
    font-size: 11px;
    margin-bottom: 8px;
    font-family: 'Courier New', monospace;
    line-height: 1.4;
}

.mission-panel .target-info {
    color: #f80;
    font-size: 10px;
    font-family: 'Courier New', monospace;
}

/* Controls Help */
.controls-help {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 20, 40, 0.8);
    padding: 10px 20px;
    border-radius: 10px;
    border: 1px solid #0a5a8a;
    color: #068;
    font-size: 11px;
    z-index: 50;
    text-align: center;
    font-family: 'Courier New', monospace;
}

.controls-help kbd {
    background: #0a3a5a;
    padding: 2px 6px;
    border-radius: 3px;
    color: #0af;
    margin: 0 3px;
    border: 1px solid #0a5a8a;
}

/* Periscope View */
.periscope-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 45;
    display: none;
}

.periscope-overlay.active {
    display: block;
}

.periscope-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 80px solid #000;
    border-radius: 50%;
}

.periscope-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
}

.periscope-crosshair::before,
.periscope-crosshair::after {
    content: '';
    position: absolute;
    background: rgba(0, 255, 0, 0.5);
}

.periscope-crosshair::before {
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
}

.periscope-crosshair::after {
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
}

/* Game Over Overlay */
.gameover-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 20, 40, 0.98);
    padding: 40px 60px;
    border-radius: 16px;
    border: 2px solid #0a5a8a;
    text-align: center;
    z-index: 200;
    animation: pop-in 0.3s ease;
}

@keyframes pop-in {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.gameover-overlay h2 {
    color: #f00;
    font-size: 2rem;
    margin-bottom: 10px;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
}

.gameover-overlay.success h2 {
    color: #0f0;
}

.gameover-overlay .message {
    color: #0af;
    margin-bottom: 20px;
    font-family: 'Courier New', monospace;
}

.gameover-overlay .stats {
    color: #0f0;
    font-family: 'Courier New', monospace;
    margin-bottom: 20px;
    text-align: left;
}

.gameover-overlay .stats div {
    margin: 5px 0;
}

.gameover-overlay button {
    padding: 15px 40px;
    background: linear-gradient(135deg, #0a5a8a, #0af);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
}

.gameover-overlay button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 170, 255, 0.5);
}

/* Setup Modal */
.setup-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 20, 40, 0.98);
    padding: 30px;
    border-radius: 16px;
    border: 2px solid #0a5a8a;
    text-align: center;
    z-index: 200;
    min-width: 320px;
}

.setup-modal h3 {
    color: #0af;
    margin-bottom: 20px;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
}

.setup-modal .option-group {
    margin-bottom: 20px;
    text-align: left;
}

.setup-modal label {
    color: #068;
    display: block;
    margin-bottom: 8px;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    font-size: 12px;
}

.setup-modal select {
    width: 100%;
    padding: 12px;
    border: 2px solid #0a5a8a;
    border-radius: 6px;
    background: rgba(0, 20, 40, 0.9);
    color: #0af;
    font-size: 1rem;
    font-family: 'Courier New', monospace;
}

.setup-modal select option {
    background: #001020;
    color: #0af;
}

.setup-modal .start-btn {
    padding: 15px 50px;
    background: linear-gradient(135deg, #0a5a8a, #0af);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
}

.setup-modal .start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 170, 255, 0.5);
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Water effect overlay */
.water-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background: linear-gradient(
        180deg,
        rgba(0, 50, 100, 0.1) 0%,
        rgba(0, 30, 60, 0.2) 50%,
        rgba(0, 10, 30, 0.4) 100%
    );
    z-index: 5;
}

/* Responsive */
@media (max-width: 768px) {
    .sonar-display {
        width: 120px;
        height: 120px;
        left: 10px;
    }

    .depth-gauge {
        width: 50px;
        height: 200px;
        right: 10px;
    }

    .mission-panel {
        width: 150px;
        font-size: 10px;
    }

    .torpedo-panel {
        width: 100px;
    }

    .controls-help {
        font-size: 9px;
        padding: 8px 12px;
    }
}
