/* ========================================
   মানুষ ও ভুত — Ghost Fighter
   Premium Game CSS
   ======================================== */

:root {
    --bg-dark: #0a0810;
    --bg-mid: #12101e;
    --bg-card: rgba(255, 255, 255, 0.04);
    --border-glass: rgba(255, 255, 255, 0.08);
    --text-primary: #f0eef5;
    --text-secondary: rgba(240, 238, 245, 0.6);
    --text-muted: rgba(240, 238, 245, 0.3);
    --human-color: #4ade80;
    --human-glow: rgba(74, 222, 128, 0.3);
    --ghost-color: #c084fc;
    --ghost-glow: rgba(192, 132, 252, 0.3);
    --danger-color: #f43f5e;
    --warning-color: #f59e0b;
    --accent-gradient: linear-gradient(135deg, #4ade80, #22d3ee, #c084fc);
    --font-primary: 'Outfit', 'Noto Sans Bengali', sans-serif;
    --font-bengali: 'Noto Sans Bengali', 'Outfit', sans-serif;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-primary);
    background: var(--bg-dark);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    user-select: none;
}

/* ===== Fog Background ===== */
.fog-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.fog-1 {
    background: radial-gradient(ellipse at 20% 80%, rgba(100, 50, 180, 0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 20%, rgba(50, 180, 100, 0.06) 0%, transparent 50%);
    animation: fogDrift1 20s ease-in-out infinite;
}

.fog-2 {
    background: radial-gradient(ellipse at 60% 60%, rgba(192, 132, 252, 0.05) 0%, transparent 40%),
                radial-gradient(ellipse at 30% 30%, rgba(74, 222, 128, 0.04) 0%, transparent 40%);
    animation: fogDrift2 25s ease-in-out infinite;
}

@keyframes fogDrift1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -20px) scale(1.05); }
}

@keyframes fogDrift2 {
    0%, 100% { transform: translate(0, 0) scale(1.05); }
    50% { transform: translate(-20px, 15px) scale(1); }
}

/* ===== Screens ===== */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-smooth);
}

.screen.active {
    opacity: 1;
    pointer-events: all;
}

.screen-content {
    text-align: center;
    max-width: 520px;
    padding: 2rem;
}

/* Two-column Start Screen Grid */
.start-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    max-width: 960px;
    width: 90%;
    margin: 0 auto;
    padding: 2.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(15px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    align-items: center;
}

.start-left {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.start-right {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.play-actions-box {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.play-actions-box .difficulty-select {
    margin-top: 0;
    width: 100%;
}

.start-game-btn {
    width: 100%;
}

@media (max-width: 800px) {
    .start-container {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 1.5rem;
    }
}

/* ===== Start Screen ===== */
.title-ghost-icon {
    font-size: 5rem;
    animation: ghostBounce 2s ease-in-out infinite;
    filter: drop-shadow(0 0 30px rgba(192, 132, 252, 0.5));
}

@keyframes ghostBounce {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-15px) rotate(5deg); }
}

.game-title {
    font-family: var(--font-bengali);
    font-size: 3.2rem;
    font-weight: 800;
    margin: 0.5rem 0 0.25rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.vs-text {
    font-size: 1.8rem;
    opacity: 0.6;
}

.game-subtitle {
    font-family: var(--font-primary);
    font-size: 0.9rem;
    color: var(--text-muted);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.story-box {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(10px);
}

.story-box p {
    font-family: var(--font-bengali);
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    line-height: 1.6;
}

.story-box p:last-child {
    margin-bottom: 0;
}

/* Controls Info */
.controls-info {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.control-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.control-item span {
    font-family: var(--font-bengali);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.key-group {
    display: flex;
    gap: 4px;
}

kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: 3px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-family: var(--font-primary);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 2.5rem;
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.2), rgba(192, 132, 252, 0.2));
    border: 1px solid rgba(74, 222, 128, 0.3);
    color: var(--text-primary);
    font-family: var(--font-bengali);
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.1), rgba(192, 132, 252, 0.1));
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn-primary:hover {
    transform: translateY(-2px);
    border-color: rgba(74, 222, 128, 0.5);
    box-shadow: 0 8px 30px rgba(74, 222, 128, 0.15), 0 0 60px rgba(192, 132, 252, 0.1);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 2rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    font-family: var(--font-bengali);
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    transform: translateY(-1px);
}

/* Difficulty */
.difficulty-select {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.difficulty-select label {
    font-family: var(--font-bengali);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-right: 0.25rem;
}

.diff-btn {
    padding: 0.4rem 1rem;
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    font-family: var(--font-bengali);
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.diff-btn:hover {
    border-color: rgba(192, 132, 252, 0.3);
    color: var(--text-primary);
}

.diff-btn.active {
    background: rgba(192, 132, 252, 0.15);
    border-color: rgba(192, 132, 252, 0.4);
    color: #d8b4fe;
}

/* ===== Game Screen ===== */
#gameScreen {
    z-index: 15;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* ===== HUD ===== */
#gameHUD {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: linear-gradient(180deg, rgba(10, 8, 16, 0.8) 0%, transparent 100%);
}

.hud-player {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 200px;
}

.hud-avatar {
    font-size: 2.2rem;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.2));
}

.hud-name {
    font-family: var(--font-bengali);
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: 0.02em;
}

.hud-human .hud-name { color: var(--human-color); }
.hud-ghost .hud-name { color: var(--ghost-color); }

.health-bar {
    width: 180px;
    height: 18px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 9px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.health-fill {
    height: 100%;
    border-radius: 9px;
    transition: width 0.3s ease-out;
    position: relative;
}

.health-human {
    width: 100%;
    background: linear-gradient(90deg, #22c55e, #4ade80);
    box-shadow: 0 0 12px rgba(74, 222, 128, 0.4);
}

.health-ghost {
    width: 100%;
    background: linear-gradient(90deg, #a855f7, #c084fc);
    box-shadow: 0 0 12px rgba(192, 132, 252, 0.4);
}

.health-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, transparent 100%);
    border-radius: 9px 9px 0 0;
}

.health-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.hud-score {
    font-family: var(--font-bengali);
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.hud-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.round-display {
    font-family: var(--font-bengali);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.3rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
}

.timer-display {
    font-family: var(--font-primary);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.timer-display.warning {
    color: var(--warning-color);
    animation: timerPulse 0.5s ease-in-out infinite;
}

.timer-display.danger {
    color: var(--danger-color);
    animation: timerPulse 0.3s ease-in-out infinite;
}

@keyframes timerPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ===== Action Feedback ===== */
.action-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 25;
    pointer-events: none;
    font-family: var(--font-bengali);
    font-size: 2.5rem;
    font-weight: 800;
    text-shadow: 0 0 30px rgba(0,0,0,0.5);
    opacity: 0;
    transition: none;
}

.action-feedback.show {
    animation: feedbackPop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes feedbackPop {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    30% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
    100% { opacity: 0; transform: translate(-50%, -70%) scale(1); }
}

/* ===== Overlays ===== */
.overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 8, 16, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    transition: opacity var(--transition-smooth);
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    text-align: center;
    padding: 2rem;
}

.overlay-content h2 {
    font-family: var(--font-bengali);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.overlay-content .btn-primary,
.overlay-content .btn-secondary {
    margin: 0.5rem;
}

.round-info p {
    font-family: var(--font-bengali);
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* ===== Game Over Screen ===== */
.winner-icon {
    font-size: 5rem;
    animation: winnerBounce 1s ease-in-out infinite;
    filter: drop-shadow(0 0 40px rgba(255, 215, 0, 0.5));
}

@keyframes winnerBounce {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
}

.game-over-title {
    font-family: var(--font-bengali);
    font-size: 2.5rem;
    font-weight: 800;
    margin: 1rem 0;
    background: linear-gradient(135deg, #fde68a, #f59e0b, #fde68a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.final-scores {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.25rem 2rem;
    margin: 1.5rem 0;
    font-family: var(--font-bengali);
    backdrop-filter: blur(10px);
}

.final-scores .score-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-glass);
}

.final-scores .score-row:last-child {
    border-bottom: none;
}

.final-scores .score-name {
    font-size: 1rem;
    font-weight: 600;
}

.final-scores .score-value {
    font-size: 1.2rem;
    font-weight: 800;
}

.game-over-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

/* ===== Particles Container ===== */
#particlesContainer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

.hit-particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: particleBurst 0.6s ease-out forwards;
}

@keyframes particleBurst {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--px), var(--py)) scale(0); opacity: 0; }
}

/* Damage flash on characters */
.damage-flash {
    animation: damageFlash 0.3s ease-out;
}

@keyframes damageFlash {
    0% { filter: brightness(3) saturate(0); }
    100% { filter: brightness(1) saturate(1); }
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .game-title { font-size: 2.2rem; }
    .story-box { padding: 1rem; }
    .controls-info { flex-direction: column; gap: 0.75rem; }
    .health-bar { width: 120px; }
    #gameHUD { padding: 0.5rem 0.75rem; }
    .hud-avatar { font-size: 1.5rem; }
    .game-over-buttons { flex-direction: column; align-items: center; }
}

@media (max-width: 400px) {
    .game-title { font-size: 1.8rem; }
    .hud-center { display: none; }
    .health-bar { width: 90px; height: 14px; }
}

/* ===== Player Setup Box ===== */
.player-setup-box {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.3rem;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(10px);
    text-align: left;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.setup-title {
    font-family: var(--font-bengali);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--human-color);
    margin-bottom: 0.85rem;
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.2);
    border-bottom: 1px solid rgba(74, 222, 128, 0.15);
    padding-bottom: 0.4rem;
}

.setup-inputs {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.input-group label {
    font-family: var(--font-bengali);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.input-group input[type="text"] {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.75rem;
    color: var(--text-primary);
    font-family: var(--font-bengali);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    outline: none;
}

.input-group input[type="text"]:focus {
    border-color: var(--human-color);
    background: rgba(74, 222, 128, 0.02);
    box-shadow: 0 0 12px rgba(74, 222, 128, 0.15);
}

.upload-group {
    margin-top: 0.1rem;
}

.upload-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-upload-btn {
    padding: 0.5rem 1rem !important;
    font-size: 0.8rem !important;
    cursor: pointer;
    font-family: var(--font-bengali);
}

.avatar-preview-container {
    position: relative;
    width: 44px;
    height: 44px;
}

.avatar-preview {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    overflow: hidden;
    transition: all var(--transition-fast);
}

.avatar-preview.has-image {
    border-style: solid;
    border-color: var(--human-color);
    box-shadow: 0 0 12px var(--human-glow);
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-face-btn {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--danger-color);
    color: white;
    border: none;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all var(--transition-fast);
    z-index: 5;
}

.remove-face-btn:hover {
    transform: scale(1.1);
    background: #ff5c75;
}

.hidden {
    display: none !important;
}
