/* === CS:STRIKE — Browser Edition === */

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

body {
    overflow: hidden;
    background: #000;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    cursor: none;
    user-select: none;
}

#gameCanvas {
    display: block;
    width: 100vw;
    height: 100vh;
}

.hidden {
    display: none !important;
}

/* ==============================
   HUD
   ============================== */

#hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* --- Radar --- */
#radar {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%; /* circular radar */
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

/* --- Health Panel --- */
#health-panel {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    padding: 8px 16px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.hud-icon {
    color: #4ade80;
    font-size: 20px;
    font-weight: 700;
}

.shield-icon {
    font-size: 16px;
    color: #60a5fa;
}

#health-value {
    color: #4ade80;
    font-size: 28px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    min-width: 36px;
}

#armor-value {
    color: #60a5fa;
    font-size: 28px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    min-width: 28px;
}

.hud-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 4px;
}

/* --- Ammo Panel --- */
#ammo-panel {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: baseline;
    gap: 4px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    padding: 8px 16px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

#ammo-mag {
    color: #fbbf24;
    font-size: 32px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

.ammo-divider {
    color: rgba(255, 255, 255, 0.35);
    font-size: 24px;
}

#ammo-reserve {
    color: rgba(251, 191, 36, 0.55);
    font-size: 20px;
    font-family: 'Courier New', monospace;
}

/* --- Weapon Name --- */
#weapon-name {
    position: absolute;
    bottom: 58px;
    right: 22px;
    color: rgba(255, 255, 255, 0.45);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* --- Crosshair --- */
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.ch-line {
    position: absolute;
    background: rgba(0, 255, 0, 0.85);
}

.ch-top    { width: 2px; height: 8px; left: -1px; top: -12px; }
.ch-bottom { width: 2px; height: 8px; left: -1px; top: 4px;   }
.ch-left   { width: 8px; height: 2px; left: -12px; top: -1px; }
.ch-right  { width: 8px; height: 2px; left: 4px;   top: -1px; }

.ch-dot {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(0, 255, 0, 0.85);
    left: -1px;
    top: -1px;
}

/* --- Kill Feed --- */
#kill-feed {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 320px;
}

.kill-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 500;
    animation: killFadeIn 0.3s ease;
    white-space: nowrap;
}

.kill-entry.fade-out {
    animation: killFadeOut 0.5s ease forwards;
}

@keyframes killFadeIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes killFadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

.kill-attacker { color: #fbbf24; }
.kill-victim   { color: #f87171; }
.kill-weapon { color: #fff; font-size: 11px; opacity: 0.8; }

.kill-weapon-badge {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.kill-hs {
    font-size: 12px;
    margin: 0 -2px;
}

/* --- Round Timer --- */
#round-timer {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 16px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

#round-timer.warning {
    color: #ef4444;
    animation: timerPulse 1s infinite;
}

@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

/* --- Round Score --- */
#round-score {
    position: absolute;
    top: 46px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    display: flex;
    gap: 6px;
}

.t-color  { color: #fbbf24; }
.ct-color { color: #60a5fa; }

/* --- Alive Counter --- */
#alive-counter {
    position: absolute;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 10px;
    border-radius: 12px;
}
.score-divider { color: rgba(255, 255, 255, 0.35); }

/* --- Hit Marker --- */
#hit-marker {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
}

.hm-line {
    position: absolute;
    background: #fff;
    width: 8px;
    height: 2px;
}

.hm-1 { top: 3px;  left: 14px; transform: rotate(45deg);  }
.hm-2 { top: 14px; left: 17px; transform: rotate(135deg); }
.hm-3 { top: 19px; left: 6px;  transform: rotate(225deg); }
.hm-4 { top: 8px;  left: 1px;  transform: rotate(315deg); }

#hit-marker.headshot .hm-line {
    background: #ef4444; /* Red color for headshots */
}

/* --- Damage Vignette --- */
#damage-vignette {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    box-shadow: inset 0 0 120px rgba(255, 0, 0, 0);
    transition: box-shadow 0.1s ease;
}

#damage-vignette.active {
    box-shadow: inset 0 0 120px rgba(255, 0, 0, 0.5);
}

#flash-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: white;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s;
    z-index: 100;
}

/* --- Round Announcement --- */
#round-announce {
    position: absolute;
    top: 32%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 48px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.7);
    animation: announceIn 0.5s ease;
}

@keyframes announceIn {
    from { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
    to   { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
}

/* --- Death Screen --- */
#death-screen {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(120, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.death-fade {
    animation: deathFadeOut 3s ease forwards;
}

@keyframes deathFadeOut {
    0%   { opacity: 1; }
    30%  { opacity: 1; }
    100% { opacity: 0; }
}

.death-text {
    color: #ef4444;
    font-size: 64px;
    font-weight: 700;
    letter-spacing: 8px;
    text-shadow: 0 0 30px rgba(239, 68, 68, 0.5);
}

.death-sub {
    color: rgba(255, 255, 255, 0.55);
    font-size: 18px;
    margin-top: 12px;
}

/* ==============================
   START SCREEN
   ============================== */

#start-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    cursor: pointer;
}

.start-content { text-align: center; }

.game-title {
    font-size: 80px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 4px;
    margin-bottom: 4px;
}

.title-accent { color: #fbbf24; }

.start-subtitle {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 12px;
    margin-bottom: 32px;
    text-transform: uppercase;
}

.start-prompt {
    font-size: 20px;
    font-weight: 600;
    color: #000;
    background: #fbbf24;
    letter-spacing: 4px;
    padding: 16px 40px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s ease;
    animation: promptPulse 2s infinite;
    margin-bottom: 40px;
    width: 100%;
    max-width: 400px;
    font-family: inherit;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
}

.start-prompt:hover {
    background: #fcd34d;
    transform: scale(1.02);
    box-shadow: 0 0 25px rgba(251, 191, 36, 0.6);
}

.start-prompt:active {
    transform: scale(0.98);
}

@keyframes promptPulse {
    0%, 100% { box-shadow: 0 0 15px rgba(251, 191, 36, 0.4); }
    50%      { box-shadow: 0 0 30px rgba(251, 191, 36, 0.8); }
}

.controls-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    justify-content: center;
    max-width: 420px;
    margin: 0 auto;
}

.control-row {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    gap: 6px;
}

.key {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ==============================
   BUY MENU
   ============================== */

#buy-menu {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.buy-menu-inner {
    background: linear-gradient(180deg, rgba(20, 20, 30, 0.95), rgba(10, 10, 20, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 24px 32px;
    min-width: 320px;
    backdrop-filter: blur(10px);
}

.buy-menu-inner h2 {
    color: #fbbf24;
    font-size: 18px;
    letter-spacing: 4px;
    margin-bottom: 16px;
    text-align: center;
}

.buy-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.config-menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0 auto 32px auto;
    background: rgba(0, 0, 0, 0.6);
    padding: 24px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 400px;
    backdrop-filter: blur(10px);
}

.config-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.config-row select, .config-row input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 15px;
    width: 180px;
    outline: none;
    transition: border-color 0.2s ease;
}

.config-row select:focus, .config-row input:focus {
    border-color: #fbbf24;
}

.config-row input[type="number"] {
    text-align: right;
}

.buy-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    pointer-events: auto;
}

.buy-item:hover {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.3);
}

.buy-key {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #fbbf24;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 700;
}

.buy-name {
    color: #fff;
    font-size: 15px;
    font-weight: 600;
}

.buy-desc {
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
}

.buy-money {
    text-align: right;
    color: #4ade80;
    font-size: 20px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.buy-close {
    text-align: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 12px;
    margin-top: 8px;
}

/* --- Reload indicator --- */
#reload-indicator {
    position: absolute;
    bottom: 80px;
    right: 22px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    animation: reloadBlink 0.6s ease-in-out infinite;
}

@keyframes reloadBlink {
    0%, 100% { opacity: 0.4; }
    50%      { opacity: 1; }
}

/* --- Scope Overlay --- */
#scope-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 30%, rgba(0,0,0,0.8) 70%, rgba(0,0,0,1) 100%);
    pointer-events: none;
    z-index: 10;
}

.scope-line {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
}

.scope-horizontal {
    width: 100%;
    height: 2px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.scope-vertical {
    width: 2px;
    height: 100%;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

.scope-dot {
    position: absolute;
    width: 4px;
    height: 4px;
    background: red;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
}

/* --- Directional Damage --- */
#directional-damage-container {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    pointer-events: none;
    z-index: 5;
}

.dmg-indicator {
    position: absolute;
    bottom: 150px; /* Orbit distance from center */
    left: -30px;
    width: 60px;
    height: 20px;
    background: radial-gradient(ellipse at bottom, rgba(255, 0, 0, 0.9), transparent 70%);
    border-radius: 50% 50% 0 0;
    transform-origin: 50% 170px; /* 150px + 20px height */
    animation: dmgFade 1.5s ease-out forwards;
}

@keyframes dmgFade {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}

/* ==============================
   PAUSE SCREEN
   ============================== */

#pause-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(10, 15, 20, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    cursor: default;
}

.pause-content {
    background: rgba(20, 25, 30, 0.95);
    padding: 3rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    text-align: center;
    color: white;
}

.pause-stats {
    font-size: 1.2rem;
    margin: 20px 0;
}
