:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent-color: #38bdf8;
    /* Ocean Blue */
    --accent-hover: #0ea5e9;
    --danger-color: #ef4444;
    --success-color: #22c55e;
    --border-radius: 12px;
    --font-family: 'Roboto', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 1600px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--accent-color);
    /* text-transform: uppercase; Removed to fix Turkish I issue */
    letter-spacing: 2px;
}

nav {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-btn.active,
.nav-btn:hover {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    max-width: 800px;
    margin: 0 auto;
    border: 1px solid #334155;
}

h2 {
    margin-bottom: 15px;
    color: var(--text-primary);
    text-align: center;
}

.description {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 25px;
    font-size: 0.95rem;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 12px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.input-group small {
    display: block;
    margin-top: 5px;
    color: #64748b;
    font-size: 0.8rem;
}

.action-btn {
    width: 100%;
    padding: 14px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: 10px;
}

.action-btn:hover {
    background: var(--accent-hover);
}

.action-btn.secondary {
    background: #475569;
}

.action-btn.secondary:hover {
    background: #64748b;
}

.action-btn.small {
    width: auto;
    padding: 8px 16px;
    font-size: 0.9rem;
}

.result-box {
    margin-top: 30px;
    text-align: center;
    padding: 20px;
    background: rgba(56, 189, 248, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.result-box h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

#result-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-color);
}

.unit {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-left: 5px;
}

/* SIMULATION STYLES */
.simulation-container {
    background: #000;
    border-radius: var(--border-radius);
    padding: 10px;
    border: 2px solid #334155;
    position: relative;
    overflow: hidden;
}

.sim-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 10px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.control-item span {
    font-weight: bold;
    font-family: monospace;
    font-size: 1.1rem;
}

#sim-score {
    color: var(--success-color);
}

#sim-misses {
    color: var(--danger-color);
}

canvas {
    background: radial-gradient(circle, #1e3a8a 0%, #0f172a 100%);
    /* Ocean gradient */
    width: 100%;
    height: auto;
    border-radius: 4px;
    cursor: crosshair;
    display: block;
}

.sim-feedback {
    text-align: center;
    margin-top: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* SCENARIO HUD */
.scenario-panel {
    position: absolute;
    top: 60px;
    left: 20px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--accent-color);
    padding: 15px;
    border-radius: 8px;
    z-index: 20;
    width: 200px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    /* Click through */
}

.scenario-panel h3 {
    margin: 0 0 10px 0;
    color: #f59e0b;
    font-size: 1.1rem;
    border-bottom: 1px solid #334155;
    padding-bottom: 5px;
    text-align: center;
}

.scenario-details p {
    color: #cbd5e1;
    font-size: 0.95rem;
    margin: 5px 0;
    display: flex;
    justify-content: space-between;
}

.scenario-details .val {
    color: #fff;
    font-weight: bold;
    font-family: monospace;
}

.hint-text {
    margin-top: 10px;
    font-size: 0.8rem;
    color: #94a3b8;
    text-align: center;
    font-style: italic;
}

footer {
    text-align: center;
    margin-top: auto;
    padding-top: 40px;
    color: #475569;
    font-size: 0.8rem;
}

/* Range Inputs */
.range-group label {
    display: flex;
    justify-content: space-between;
}

.range-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.range-container input[type=range] {
    flex: 2;
    cursor: pointer;
    height: 8px;
    background: #334155;
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.range-container input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    transition: background .15s ease-in-out;
}

.range-container input[type=range]::-webkit-slider-thumb:hover {
    background: var(--accent-hover);
}

.range-container input[type=number] {
    flex: 1;
    min-width: 80px;
}

/* Angle Slider Special */
#angle-slider {
    width: 100%;
    margin: 10px 0;
    height: 8px;
    background: #334155;
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
}

#angle-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #f59e0b;
    cursor: pointer;
}

.hint {
    color: #64748b;
    font-size: 0.8rem;
    font-style: italic;
    display: block;
    margin-top: 5px;
}


/* Timers */
.timers-section {
    margin-top: 30px;
    border-top: 1px solid #334155;
    padding-top: 20px;
}

.timers-section h4 {
    color: var(--text-secondary);
    margin-bottom: 15px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.timer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.timer-btn {
    background: #1e293b;
    border: 1px solid #334155;
    color: #cbd5e1;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.timer-btn:hover {
    background: #334155;
    border-color: var(--accent-color);
    color: #fff;
}

.timer-btn.active {
    background: rgba(56, 189, 248, 0.1);
    border-color: var(--accent-color);
    color: var(--accent-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(56, 189, 248, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(56, 189, 248, 0);
    }
}

/* Grid Layout for Calculator */
.calc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 600px) {
    .calc-grid {
        grid-template-columns: 1fr;
    }
}

.grid-col h3 {
    font-size: 1rem;
    color: var(--accent-color);
    border-bottom: 1px solid #334155;
    padding-bottom: 5px;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.flight-info-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f172a;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #334155;
    margin-bottom: 20px;
    gap: 10px;
}

.flight-info-bar input {
    width: 80px;
    text-align: center;
    background: transparent;
    border: none;
    color: var(--accent-color);
    font-weight: bold;
    font-size: 1.2rem;
}

.flight-info-bar label {
    color: var(--text-secondary);
    font-weight: 500;
}

.flight-info-bar span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Filter Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.2s;
}

.modal-content {
    background-color: var(--card-bg);
    margin: 3% auto;
    padding: 0;
    border: 1px solid #334155;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #334155;
    background: #0f172a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    color: var(--accent-color);
}

.close-modal {
    color: #94a3b8;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover {
    color: #fff;
}

.filter-group {
    padding: 15px 20px;
    border-bottom: 1px solid #1e293b;
}

.filter-group h4 {
    margin-bottom: 10px;
    color: #f1f5f9;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.checkbox-group.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

.checkbox-group label {
    background: #1e293b;
    border: 1px solid #334155;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    user-select: none;
}

.checkbox-group label:hover {
    border-color: #64748b;
    background: #334155;
}

.checkbox-group input[type="checkbox"] {
    accent-color: var(--accent-color);
    width: 16px;
    height: 16px;
}

.modal-footer {
    padding: 15px 20px;
    background: #0f172a;
    border-radius: 0 0 12px 12px;
    display: flex;
    justify-content: flex-end;
}

/* Language Selector */
.lang-container {
    position: absolute;
    top: 20px;
    right: 20px;
}

#lang-selector {
    background: #1e293b;
    color: #f1f5f9;
    padding: 8px 12px;
    border: 1px solid #334155;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

#lang-selector:hover {
    border-color: var(--accent-color);
    background: #334155;
}

#lang-selector:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.4);
}

@media (max-width: 600px) {
    .lang-container {
        position: static;
        margin-bottom: 20px;
    }
}

.credit-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 700;
    transition: color 0.2s;
}

.credit-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* --- Main Layout with Side Panels --- */
.main-layout {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 20px;
    width: 100%;
    max-width: 1400px;
    /* Wider to fit panels */
    margin: 0 auto;
}

.side-panel {
    flex: 0 0 280px;
    /* Fixed width for side panels */
    transition: all 0.3s ease;
}

/* Info Box Styling */
.ship-info-box {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.ship-image-container {
    width: 100%;
    height: 160px;
    background: #0f172a;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #334155;
}

.ship-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.ship-placeholder {
    font-size: 3rem;
    color: #475569;
    font-weight: bold;
}

.ship-info-box h3 {
    color: var(--accent-color);
    margin-bottom: 15px;
    font-size: 1.1rem;
    border-bottom: 1px solid #334155;
    padding-bottom: 10px;
}

.ship-details {
    text-align: left;
    font-size: 0.9rem;
    color: #cbd5e1;
}

.ship-details p {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.ship-details .label {
    color: #94a3b8;
}

/* Responsive: Collapse to stack on smaller screens */
@media (max-width: 1200px) {
    .main-layout {
        flex-direction: column;
        align-items: center;
    }

    .side-panel {
        width: 100%;
        max-width: 500px;
        /* Match card width */
        order: 2;
        /* Put panels below calculator on tablet/mobile */
    }

    /* Order: Calculator first, then Attacker Panel, then Target Panel */
    .card {
        order: 1;
    }
}

/* SCOPE OVERLAY */
.scope-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
}

#scope-canvas {
    width: 100%;
    height: 100%;
    display: block;
}