:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #1a1f2e;
    --bg-tertiary: #2a2f3e;
    --bg-glass: rgba(26, 31, 46, 0.8);
    --accent-blue: #5d9cec;
    --accent-orange: #f4b643;
    --accent-green: #4ade80;
    --accent-red: #ef4444;
    --text-primary: #ffffff;
    --text-secondary: #b4b8c0;
    --text-muted: #6b7280;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-heavy: 0 8px 32px rgba(0, 0, 0, 0.4);
    --radar-size: min(70vw, 70vh);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition-property: color, background-color, border-color, box-shadow, filter, transform;
    transition-duration: 0.15s;
    transition-timing-function: ease-out;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #060912 100%);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-container {
    display: grid;
    grid-template-columns: 320px 1fr 320px;
    gap: 24px;
    width: 100vw;
    height: 100vh;
    padding: 20px;
    align-items: center;
}

.settings-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-light);
    z-index: 1100;
    font-size: 18px;
}

.settings-panel {
    position: fixed;
    bottom: 80px;
    left: 20px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    font-size: 13px;
    color: var(--text-secondary);
    box-shadow: var(--shadow-heavy);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 220px;
    cursor: move; /* draggable hint */
}

.settings-panel.hidden {
    display: none;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.settings-header button {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
}

/* Team Panels */
.team-panel {
    display: flex;
    flex-direction: column;
    height: fit-content;
    max-height: 80vh;
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-heavy);
    overflow: hidden;
    align-self: center;
}

.panel-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.team-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.team-label.terrorist {
    color: var(--accent-red);
}

.team-label.counter-terrorist {
    color: var(--accent-blue);
}

.team-score {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.player-list {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

.player-list::-webkit-scrollbar {
    width: 6px;
}

.player-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.player-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

/* Radar Section */
.radar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    height: 100%;
    justify-content: center;
}

.radar-header {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 16px 24px;
    box-shadow: var(--shadow-light);
    width: 100%;
    max-width: var(--radar-size);
}

.game-info {
    display: flex;
    gap: 32px;
    align-items: center;
    justify-content: center;
}

.map-info, .round-info, .timer-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.map-label, .round-label, .timer-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.map-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-green);
    letter-spacing: 0.5px;
}

.round-number {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.round-time {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-orange);
    font-family: 'Courier New', monospace;
}

.radar-container {
    position: relative;
    width: var(--radar-size);
    height: var(--radar-size);
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-heavy);
    overflow: hidden;
}

.radar {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    transform-origin: center center;
    transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
}

.radar.no-transition {
    transition: none;
}

#radar-background {
position: absolute !important;
top: 0 !important;
left: 0 !important;
width: 100% !important;
height: 100% !important;
object-fit: contain !important;
z-index: -1 !important;
pointer-events: none !important;
}

.radar-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    transform-origin: top left;
    transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.radar-content.no-transition {
    transition: none;
}

.radar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center,
                                transparent 0%,
                                rgba(0, 0, 0, 0.2) 70%,
                                rgba(0, 0, 0, 0.4) 100%);
    pointer-events: none;
    z-index: 3;
}

.radar-controls {
    display: flex;
    gap: 8px;
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 8px;
    box-shadow: var(--shadow-light);
}

.control-btn {
    width: 36px;
    height: 36px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    outline: none;
}

.control-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--accent-blue);
    transform: translateY(-1px);
}

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

/* Player Cards */
.player-card {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 16px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.player-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-green);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.player-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-light);
    border-color: rgba(255, 255, 255, 0.2);
}

.player-card:hover::before {
    opacity: 1;
}

.player-card.terrorist::before {
    background: var(--accent-orange);
}

.player-card.counter-terrorist::before {
    background: var(--accent-blue);
}

.player-card.dead {
    opacity: 0.5;
    filter: grayscale(0.7);
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.player-name-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.player-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
    flex-shrink: 0;
}

.player-status-dot.dead {
    background: var(--accent-red);
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

.player-money {
    font-size: 12px;
    color: var(--accent-green);
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

/* Health and Armor Bars */
.player-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.stat-bar {
    height: 20px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.health-fill {
    background: linear-gradient(90deg, var(--accent-green), #16a34a);
}

.health-fill.low {
    background: linear-gradient(90deg, var(--accent-red), #dc2626);
}

.health-fill.medium {
    background: linear-gradient(90deg, var(--accent-orange), #d97706);
}

.armor-fill {
    background: linear-gradient(90deg, var(--accent-blue), #2563eb);
}

.stat-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
}

/* Player Equipment */
.player-equipment {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.weapon-slot {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    font-weight: 500;
}

.weapon-slot.active {
    background: rgba(93, 156, 236, 0.15);
    color: var(--accent-blue);
    border-color: var(--accent-blue);
    box-shadow: 0 0 8px rgba(93, 156, 236, 0.2);
}

.equipment-icon {
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border: 1px solid var(--border-color);
}

.equipment-icon.has-item {
    background: rgba(74, 222, 128, 0.15);
    border-color: var(--accent-green);
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.2);
}

/* Player Radar Elements */
.player-dot {
    position: absolute;
    width: 24px;
    height: 24px;
    z-index: 15 !important;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
    cursor: pointer !important;
    pointer-events: auto !important;
    transition: filter 0.1s ease, z-index 0.1s ease;
}

.player-dot:hover {
    z-index: 50 !important;
    cursor: pointer !important;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.5));
}

.player-name {
    position: absolute;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
    z-index: 20 !important;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    cursor: pointer !important;
    pointer-events: auto !important;
    transition: color 0.1s ease, background-color 0.1s ease, border-color 0.1s ease;
    transform-origin: center;
}

.player-name:hover {
    cursor: pointer !important;
    color: #ffffff;
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
    z-index: 100 !important;
    transform: translateX(-50%);
}

.player-icon {
    width: 100%;
    height: 100%;
}

.player-icon circle {
    stroke-width: 2;
}

.player-icon path {
    stroke-width: 1.5;
}

/* Bomb Elements */
.bomb-indicator {
    position: absolute;
    width: 28px;
    height: 28px;
    z-index: 15;
    filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.8));
    transition: all 0.1s ease-out;
}

.bomb-planted {
    animation: bombPulse 1.2s infinite alternate;
}

.bomb-defusing {
    animation: defusePulse 0.6s infinite alternate;
}

.bomb-critical {
    animation: criticalFlash 0.25s infinite alternate;
}

@keyframes bombPulse {
    0% {
        filter: drop-shadow(0 3px 8px rgba(255, 100, 100, 0.4));
        transform: scale(1);
    }
    100% {
        filter: drop-shadow(0 3px 12px rgba(255, 100, 100, 0.8));
        transform: scale(1.15);
    }
}

@keyframes defusePulse {
    0% {
        filter: drop-shadow(0 3px 8px rgba(93, 156, 236, 0.4));
        opacity: 0.7;
    }
    100% {
        filter: drop-shadow(0 3px 12px rgba(93, 156, 236, 0.9));
        opacity: 1;
    }
}

@keyframes criticalFlash {
    0% { opacity: 0.4; }
    100% { opacity: 1; }
}

.bomb-timer {
    position: absolute;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 0 6px rgba(0, 0, 0, 1);
    white-space: nowrap;
    pointer-events: none;
    z-index: 16;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: all 0.1s ease-out;
}

.bomb-timer.timer-critical {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.bomb-timer.timer-warning {
    background: rgba(244, 182, 67, 0.2);
    border-color: var(--accent-orange);
    color: var(--accent-orange);
}

.bomb-timer.timer-defusing {
    background: rgba(93, 156, 236, 0.2);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.bomb-carrier {
    position: absolute;
    font-size: 16px;
    z-index: 12;
    pointer-events: none;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.8));
    animation: bombCarrierPulse 2s infinite alternate;
    transition: all 0.1s ease-out;
}

@keyframes bombCarrierPulse {
    0% {
        transform: scale(1) translateY(0);
        filter: drop-shadow(0 2px 6px rgba(244, 182, 67, 0.4));
    }
    100% {
        transform: scale(1.2) translateY(-3px);
        filter: drop-shadow(0 4px 12px rgba(244, 182, 67, 0.8));
    }
}

/* Connection Status */
.connection-status {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    z-index: 1000;
    box-shadow: var(--shadow-light);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-red);
    transition: all 0.3s ease;
}

.status-indicator.online {
    background: var(--accent-green);
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
}

.status-indicator.offline {
    background: var(--accent-red);
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

/* Viewer Count */
.viewer-count {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    z-index: 1000;
    box-shadow: var(--shadow-light);
    transition: all 0.2s ease;
}

.viewer-count:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-heavy);
    border-color: var(--accent-blue);
}

.viewer-icon {
    font-size: 14px;
    opacity: 0.8;
}

#viewerCount {
color: var(--accent-blue);
font-weight: 600;
font-family: 'Courier New', monospace;
min-width: 16px;
text-align: center;
}

.viewer-label {
    color: var(--text-muted);
    font-size: 11px;
}

/* Viewer Count */
.viewer-count {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    z-index: 1000;
    box-shadow: var(--shadow-light);
    transition: all 0.2s ease;
}

.viewer-count:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-heavy);
    border-color: var(--accent-blue);
}

.viewer-icon {
    font-size: 14px;
    opacity: 0.8;
}

#viewerCount {
color: var(--accent-blue);
font-weight: 600;
font-family: 'Courier New', monospace;
min-width: 16px;
text-align: center;
}

.viewer-label {
    color: var(--text-muted);
    font-size: 11px;
}

/* Health-based colors for player dots */
.health-high {
    --player-color: var(--accent-green);
}

.health-medium-high {
    --player-color: #adff2f;
}

.health-medium {
    --player-color: var(--accent-orange);
}

.health-low {
    --player-color: var(--accent-red);
}

.player-dot.focused {
    animation: pulse-focus 1.5s ease-in-out infinite;
    z-index: 100;
    transform: scale(1.2);
}

.player-dot.focused .player-icon {
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8));
}

.player-dot.focused:hover {
    transform: scale(1.2);
}

@keyframes pulse-focus {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(255, 255, 255, 0);
    }
}

/* Responsive Design */
@media (max-width: 1400px) {
    .main-container {
        grid-template-columns: 280px 1fr 280px;
        gap: 16px;
        padding: 16px;
    }

    .game-info {
        gap: 24px;
    }

    .viewer-count {
        right: 16px;
        top: 16px;
    }
}

@media (max-width: 1200px) {
    .main-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        gap: 16px;
    }

    .team-panel {
        display: none;
    }

    .radar-section {
        height: auto;
    }

    :root {
        --radar-size: min(85vw, 85vh);
    }

    .viewer-count {
        right: 16px;
        top: 16px;
    }
}

@media (max-width: 768px) {
    .main-container {
        padding: 12px;
    }

    .radar-header {
        padding: 12px 16px;
    }

    .game-info {
        gap: 16px;
        flex-wrap: wrap;
        justify-content: center;
    }

    :root {
        --radar-size: min(95vw, 70vh);
    }

    .viewer-count {
        right: 12px;
        top: 12px;
        padding: 6px 10px;
        font-size: 11px;
    }

    .viewer-icon {
        font-size: 12px;
    }

    #viewerCount {
    font-size: 11px;
    }

    .viewer-label {
        font-size: 10px;
    }
}

/* Mobile Text Sizing */
@media screen and (max-width: 1024px), screen and (max-height: 768px) {
    .player-name {
        font-size: 8px !important;
        padding: 1px 3px !important;
        border-radius: 2px !important;
        font-weight: 500 !important;
        transform: translateX(-50%) !important;
    }

    .player-name:hover {
        transform: translateX(-50%) !important;
        font-size: 8px !important;
        padding: 1px 3px !important;
    }

    .player-dot {
        width: 16px !important;
        height: 16px !important;
    }

    .player-icon {
        width: 16px !important;
        height: 16px !important;
    }

    .player-dot::after {
        content: '';
        position: absolute;
        top: -12px;
        left: -12px;
        right: -12px;
        bottom: -12px;
        z-index: -1;
    }

    .player-name::after {
        content: '';
        position: absolute;
        top: -10px;
        left: -10px;
        right: -10px;
        bottom: -10px;
        z-index: -1;
    }
}

@media screen and (max-width: 600px), screen and (max-height: 600px) {
    .player-name {
        font-size: 6px !important;
        padding: 0px 2px !important;
        border-radius: 1px !important;
        transform: translateX(-50%) !important;
    }

    .player-name:hover {
        transform: translateX(-50%) !important;
        font-size: 6px !important;
        padding: 0px 2px !important;
    }

    .player-dot {
        width: 14px !important;
        height: 14px !important;
    }

    .player-icon {
        width: 14px !important;
        height: 14px !important;
    }
}
