/* ═══════════════════════════════════════════════════════════════════
   Match Simulator — Modern Design System
   ═══════════════════════════════════════════════════════════════════ */

/* ── Card container ───────────────────────────────────────────────── */
.sim-card {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(59, 130, 246, 0.12);
    background:
        radial-gradient(ellipse at 20% 0%, rgba(34, 197, 94, 0.08), transparent 50%),
        radial-gradient(ellipse at 80% 0%, rgba(59, 130, 246, 0.06), transparent 50%),
        linear-gradient(180deg, #0a1628 0%, #0c1424 52%, #091018 100%);
    box-shadow:
        0 1px 0 0 rgba(255,255,255,0.03) inset,
        0 24px 60px rgba(2, 6, 23, 0.32);
}

.sim-card::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(255,255,255,0.02), transparent 30%, transparent 70%, rgba(255,255,255,0.015));
}

/* ── Canvas wrap ──────────────────────────────────────────────────── */
.sim-canvas-wrap {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(0, 0, 0, 0.2);
    box-shadow:
        inset 0 2px 4px rgba(0,0,0,0.2),
        0 16px 40px rgba(2, 6, 23, 0.34);
    transition: border-color 0.4s ease;
}

.sim-canvas-wrap.goal-shake {
    animation: simCanvasShake 0.7s cubic-bezier(0.36, 0.07, 0.19, 0.97);
    border-color: rgba(16, 185, 129, 0.3);
}

@keyframes simCanvasShake {
    0%, 100% { transform: translate3d(0,0,0); }
    10% { transform: translate3d(-3px, 2px, 0); }
    20% { transform: translate3d(4px, -1px, 0); }
    30% { transform: translate3d(-5px, 1px, 0); }
    40% { transform: translate3d(3px, -2px, 0); }
    50% { transform: translate3d(-2px, 1px, 0); }
    60% { transform: translate3d(2px, 0, 0); }
    70% { transform: translate3d(-1px, 1px, 0); }
    80% { transform: translate3d(1px, 0, 0); }
}

.sim-canvas-wrap canvas {
    display: block;
    width: 100%;
    border-radius: 14px;
}

/* ── Scoreboard overlay ───────────────────────────────────────────── */
.sim-scoreboard-overlay {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 999px;
    z-index: 5;
    background: rgba(3, 7, 18, 0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow:
        0 4px 16px rgba(0,0,0,0.3),
        0 0 0 1px rgba(255,255,255,0.03) inset;
}

.sim-scoreboard-overlay .sim-score {
    min-width: 22px;
    text-align: center;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    transition: transform 0.22s ease, color 0.22s ease;
}

.sim-scoreboard-overlay .sim-score.goal-flash {
    animation: simGoalFlash 1.8s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes simGoalFlash {
    0%   { transform: scale(1);   color: #ffffff; text-shadow: none; }
    8%   { transform: scale(2.2); color: #34d399; text-shadow: 0 0 28px rgba(52, 211, 153, 0.6); }
    20%  { transform: scale(1.6); color: #6ee7b7; text-shadow: 0 0 18px rgba(52, 211, 153, 0.4); }
    40%  { transform: scale(1.15); color: #f8fafc; text-shadow: 0 0 8px rgba(255,255,255,0.2); }
    100% { transform: scale(1);   color: #ffffff; text-shadow: none; }
}

.sim-team-badge {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    object-fit: cover;
    border: 1.5px solid rgba(255,255,255,0.1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.sim-minute {
    color: #34d399;
    font-size: 0.7rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    letter-spacing: 0.02em;
}

/* ── Live dot ─────────────────────────────────────────────────────── */
.sim-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #22c55e;
    animation: simLivePulse 1.4s ease infinite;
}

@keyframes simLivePulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34,197,94,0.45); }
    60% { opacity: 0.75; box-shadow: 0 0 0 7px rgba(34,197,94,0); }
}

/* ── Progress bar ─────────────────────────────────────────────────── */
.sim-progress-track {
    position: relative;
    overflow: hidden;
    height: 3px;
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.12);
}

.sim-progress-fill {
    position: relative;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #3b82f6 0%, #10b981 50%, #34d399 100%);
    transition: width 0.22s linear;
}

.sim-progress-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: -2px;
    bottom: -2px;
    width: 6px;
    border-radius: 999px;
    background: rgba(255,255,255,0.8);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
}

/* ── Start button ─────────────────────────────────────────────────── */
.sim-start-btn {
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.sim-start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(16,185,129,0.3);
    filter: brightness(1.05);
}

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

.sim-start-btn::before {
    content: '';
    position: absolute;
    inset: -1px;
    z-index: -1;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent 35%, transparent 65%, rgba(255,255,255,0.15));
}

/* ── Top controls (mute only now) ─────────────────────────────────── */
.sim-top-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
}

.sim-mute-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(15, 23, 42, 0.65);
    color: #f8fafc;
    font-size: 1rem;
    line-height: 1;
    box-shadow: 0 4px 12px rgba(2, 6, 23, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    cursor: pointer;
}

.sim-mute-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(52, 211, 153, 0.3);
    background: rgba(15, 23, 42, 0.85);
}

.sim-mute-btn.is-muted {
    color: #fca5a5;
    border-color: rgba(248, 113, 113, 0.25);
    background: rgba(127, 29, 29, 0.18);
}

/* ── Event log ────────────────────────────────────────────────────── */
.sim-event {
    animation: simEventSlideIn 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes simEventSlideIn {
    from { opacity: 0; transform: translateY(8px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.sim-event-goal {
    border-left: 3px solid #10b981;
    background: linear-gradient(90deg, rgba(16,185,129,0.12), rgba(16,185,129,0.02) 80%);
}

.sim-event-chance {
    border-left: 3px solid rgba(59,130,246,0.45);
    background: linear-gradient(90deg, rgba(59,130,246,0.06), transparent 80%);
}

.sim-event-whistle {
    border-left: 3px solid rgba(148,163,184,0.4);
    background: linear-gradient(90deg, rgba(148,163,184,0.08), transparent 80%);
}

/* ── Live stat bars ───────────────────────────────────────────────── */
.sim-live-bar {
    height: 100%;
    transition: width 0.28s ease;
}

/* ── Goal celebration overlay ─────────────────────────────────────── */
.sim-celebration-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    pointer-events: none;
    border-radius: 14px;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.sim-celebration-overlay.sim-celebration-active {
    opacity: 1;
    animation: simCelebrationPulse 2.2s ease-out;
}

.sim-celebration-overlay.sim-celebrate-team1 {
    background: radial-gradient(ellipse at 85% 50%, rgba(59,130,246,0.2), transparent 60%);
    box-shadow: inset 0 0 60px rgba(59,130,246,0.08);
}

.sim-celebration-overlay.sim-celebrate-team2 {
    background: radial-gradient(ellipse at 15% 50%, rgba(245,158,11,0.2), transparent 60%);
    box-shadow: inset 0 0 60px rgba(245,158,11,0.08);
}

@keyframes simCelebrationPulse {
    0%   { opacity: 0; }
    15%  { opacity: 1; }
    70%  { opacity: 0.8; }
    100% { opacity: 0; }
}

/* ── Section headers ──────────────────────────────────────────────── */
.sim-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.sim-section-header .sim-section-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 639px) {
    .sim-top-controls {
        gap: 8px;
    }

    .sim-mute-btn {
        width: 34px;
        height: 34px;
        font-size: 0.95rem;
        border-radius: 10px;
    }

    .sim-scoreboard-overlay {
        top: 8px;
        gap: 5px;
        padding: 5px 10px;
    }

    .sim-scoreboard-overlay .sim-score {
        font-size: 1rem;
    }

    .sim-team-badge {
        width: 18px;
        height: 18px;
    }

    .sim-minute {
        font-size: 0.6rem;
    }

    .sim-canvas-wrap {
        border-radius: 10px;
    }

    .sim-canvas-wrap canvas {
        border-radius: 10px;
    }

    .sim-celebration-overlay {
        border-radius: 10px;
    }
}

/* ── Reduced motion ───────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .sim-score.goal-flash,
    .sim-event,
    .sim-live-dot,
    .sim-canvas-wrap.goal-shake,
    .sim-celebration-overlay.sim-celebration-active {
        animation: none !important;
    }

    .sim-progress-fill,
    .sim-start-btn,
    .sim-mute-btn {
        transition: none !important;
    }
}
