/* ── Reset & Base ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg:      #07090f;
    --surface: rgba(12, 18, 32, 0.92);
    --border:  rgba(59, 130, 246, 0.18);
    --blue:    #3b82f6;
    --green:   #22c55e;
    --amber:   #f59e0b;
    --red:     #ef4444;
    --cyan:    #06b6d4;
    --purple:  #a855f7;
    --text:    #e2e8f0;
    --text2:   #94a3b8;
    --text3:   #475569;
}

html, body {
    width: 100%; height: 100%; overflow: hidden;
    background: var(--bg); color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}

.screen-flash {
    position: fixed; inset: 0; z-index: 9998; pointer-events: none;
    background: rgba(239,68,68,0.22); opacity: 0; transition: opacity 0.6s ease;
}

.wave-alert {
    position: fixed; top: 72px; left: 50%; transform: translateX(-50%);
    z-index: 600;
    background: rgba(239,68,68,0.10); border: 1px solid rgba(239,68,68,0.55);
    border-radius: 8px; backdrop-filter: blur(14px);
    color: #fca5a5; font-size: 0.85em; font-weight: 700;
    letter-spacing: 2px; padding: 9px 28px;
    text-align: center; pointer-events: none;
    opacity: 0; transition: opacity 0.25s ease; white-space: nowrap;
}
.wave-alert.show { opacity: 1; }

.game-container { width: 100vw; height: 100vh; position: relative; overflow: hidden; }

.radar-canvas {
    position: absolute; inset: 0; z-index: 1;
    display: block; width: 100%; height: 100%; cursor: crosshair;
}

.start-screen {
    position: fixed; inset: 0; z-index: 3000;
    background: radial-gradient(ellipse at 50% 40%, #0c1829 0%, #040609 100%);
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.5s ease;
}
.start-screen.fade-out { opacity: 0; pointer-events: none; }

.start-content {
    text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 22px;
    max-width: 520px; padding: 44px 40px;
    background: rgba(12,20,38,0.80);
    border: 1px solid rgba(59,130,246,0.22); border-radius: 20px;
    backdrop-filter: blur(24px);
    box-shadow: 0 32px 80px rgba(0,0,0,0.65), inset 0 1px 0 rgba(255,255,255,0.05);
}

.css-flag {
    display: flex; width: 160px; height: 80px; border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 4px 20px rgba(141,27,61,0.45); overflow: hidden;
}
.flag-white { width: 58px; height: 100%; background: #fff; position: relative; overflow: hidden; }
.flag-white .serrations { position: absolute; right: -1px; top: 0; width: 42px; height: 100%; }
.flag-maroon { flex: 1; background: #8D1B3D; }

.start-title-en { font-size: 1.85em; font-weight: 800; letter-spacing: 3px; color: #fff; }
.start-title-ar { font-size: 1.1em; color: var(--amber); font-family: 'Arial', sans-serif; }
.start-subtitle { font-size: 0.7em; color: var(--text3); letter-spacing: 5px; font-weight: 600; }

.start-instructions {
    background: rgba(255,255,255,0.025); border: 1px solid rgba(59,130,246,0.14);
    padding: 14px 22px; border-radius: 12px;
    display: flex; flex-direction: column; gap: 8px; text-align: left; width: 100%;
}
.inst-row { display: flex; gap: 12px; align-items: center; font-size: 0.78em; color: var(--text2); }
.inst-key {
    background: rgba(59,130,246,0.10); border: 1px solid rgba(59,130,246,0.30);
    padding: 3px 10px; border-radius: 6px;
    color: #93c5fd; font-size: 0.78em; white-space: nowrap;
    min-width: 110px; text-align: center; font-weight: 600;
}

.begin-btn {
    background: linear-gradient(135deg, rgba(34,197,94,0.18), rgba(16,185,129,0.12));
    border: 1.5px solid var(--green); color: var(--green);
    font-family: inherit; font-size: 0.92em; font-weight: 700;
    letter-spacing: 2px; padding: 14px 40px; border-radius: 12px;
    cursor: pointer; pointer-events: auto; user-select: none;
    transition: all 0.2s ease; width: 100%;
}
.begin-btn:hover {
    background: linear-gradient(135deg, rgba(34,197,94,0.28), rgba(16,185,129,0.22));
    box-shadow: 0 0 28px rgba(34,197,94,0.30); transform: translateY(-1px);
}
.begin-btn:active { transform: translateY(0); }
.start-footer { font-size: 0.68em; color: var(--text3); }

.overlay-panel {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(4,6,14,0.82); backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center; pointer-events: auto;
}
.overlay-panel.hidden { display: none; }

.modal {
    background: rgba(10,16,30,0.97);
    border: 1px solid rgba(59,130,246,0.22);
    box-shadow: 0 24px 60px rgba(0,0,0,0.75);
    padding: 40px 48px; border-radius: 18px;
    text-align: center; min-width: 340px; pointer-events: auto;
}
.modal-title { font-size: 1.3em; font-weight: 700; color: #fff; margin-bottom: 20px; }
.modal-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; color: var(--text2); font-size: 0.9em;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.game-over-modal { border-color: rgba(239,68,68,0.35); }
.go-title { font-size: 1.75em; font-weight: 800; letter-spacing: 3px; color: var(--red); margin-bottom: 4px; }
.go-subtitle { color: #fca5a5; font-size: 0.9em; margin-bottom: 22px; }
.go-stats { text-align: left; }
.go-row {
    display: flex; justify-content: space-between;
    padding: 8px 0; border-bottom: 1px solid rgba(239,68,68,0.10);
    color: var(--text2); font-size: 0.9em;
}
.go-row span:last-child { color: #fff; font-weight: 600; }

.ctrl-btn {
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.10);
    color: var(--text2); font-family: inherit; font-size: 0.68em; font-weight: 600;
    letter-spacing: 0.2px; padding: 5px 9px; border-radius: 7px;
    cursor: pointer; pointer-events: auto; user-select: none;
    transition: all 0.15s ease; white-space: nowrap; flex-shrink: 0;
}
.ctrl-btn:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.18); color: var(--text); }
.ctrl-btn:active { transform: scale(0.97); }
.ctrl-btn.primary { background: rgba(34,197,94,0.10); border-color: rgba(34,197,94,0.38); color: var(--green); }
.ctrl-btn.primary:hover { background: rgba(34,197,94,0.18); border-color: var(--green); box-shadow: 0 0 14px rgba(34,197,94,0.22); }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(59,130,246,0.28); border-radius: 2px; }
