/* ============================================
   PARTY PHYSICS - GAME STYLES
   ============================================ */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

/* ============================================
   GAME CONTAINER
   ============================================ */

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

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ============================================
   CONNECTION STATUS
   ============================================ */

.connection-status {
    position: fixed;
    top: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff4444;
    animation: pulse 2s infinite;
}

.connection-status.connected .status-dot {
    background: #44ff44;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   SHARE BUTTON
   ============================================ */

.share-btn {
    position: fixed;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    z-index: 100;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
}

.share-btn:hover {
    background: rgba(0, 0, 0, 0.85);
    transform: scale(1.05);
}

/* ============================================
   GAME UI OVERLAY
   ============================================ */

.game-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.game-ui > * {
    pointer-events: auto;
}

/* Player Stats */
.player-stats {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 15px 25px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    min-width: 300px;
    pointer-events: auto;
}

.stat-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.stat-bar:last-child {
    margin-bottom: 0;
}

.stat-label {
    color: white;
    font-size: 14px;
    font-weight: bold;
    min-width: 80px;
}

.stat-fill {
    flex: 1;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

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

.hp-fill {
    background: linear-gradient(90deg, #ff4444 0%, #ff6666 100%);
}

.stamina-fill {
    background: linear-gradient(90deg, #4444ff 0%, #6666ff 100%);
}

.stat-value {
    color: white;
    font-size: 14px;
    font-weight: bold;
    min-width: 40px;
    text-align: right;
}

.cooldown-indicator {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 12px;
    text-align: center;
}

/* Scoreboard */
.scoreboard {
    position: absolute;
    top: 60px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    min-width: 200px;
    max-width: 250px;
    max-height: 400px;
    overflow-y: auto;
}

.scoreboard h3 {
    color: white;
    font-size: 16px;
    margin-bottom: 10px;
    text-align: center;
}

.score-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.score-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-size: 14px;
}

.score-entry.eliminated {
    opacity: 0.5;
    text-decoration: line-through;
}

.score-entry.local {
    background: rgba(255, 215, 0, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.5);
}

.player-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-hp {
    font-weight: bold;
    margin-left: 10px;
}

/* Player Count */
.player-count {
    position: absolute;
    top: 60px;
    left: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 15px;
    border-radius: 10px;
    font-size: 14px;
    backdrop-filter: blur(10px);
}

/* ============================================
   WAITING ROOM
   ============================================ */

.waiting-room {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    overflow-y: auto;
}

.waiting-content {
    max-width: 800px;
    width: 90%;
    padding: 30px;
    text-align: center;
}

.waiting-content h1 {
    color: white;
    font-size: 48px;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.subtitle {
    color: #ddd;
    font-size: 18px;
    margin-bottom: 30px;
}

/* Mode Selection */
.mode-selection {
    margin-bottom: 30px;
}

.mode-selection h3 {
    color: white;
    font-size: 24px;
    margin-bottom: 15px;
}

.mode-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.mode-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 20px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    flex: 1;
    min-width: 200px;
    max-width: 250px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-5px);
}

.mode-btn.active {
    background: rgba(102, 126, 234, 0.5);
    border-color: rgba(102, 126, 234, 1);
}

.mode-icon {
    font-size: 40px;
}

.mode-name {
    font-size: 20px;
    font-weight: bold;
}

.mode-desc {
    font-size: 14px;
    color: #ddd;
}

/* ============================================
   MAP SELECTION
   ============================================ */

.map-selection {
    margin-bottom: 30px;
    animation: fadeIn 0.3s ease-in;
}

.map-selection h3 {
    color: white;
    font-size: 24px;
    margin-bottom: 15px;
    text-align: center;
}

.map-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
}

.map-card {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

.map-card:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.map-card.active {
    background: rgba(102, 126, 234, 0.5);
    border-color: rgba(102, 126, 234, 1);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.6);
}

.map-preview {
    width: 100%;
    height: 120px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    position: relative;
    overflow: hidden;
}

.map-preview::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, transparent 30%, rgba(0,0,0,0.3) 100%);
}

.map-info {
    padding: 12px;
    color: white;
}

.map-name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
    text-align: center;
}

.map-description {
    font-size: 12px;
    color: #ddd;
    text-align: center;
    line-height: 1.4;
}

.map-difficulty {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    margin-top: 5px;
    font-weight: bold;
}

.map-difficulty.easy {
    background: rgba(76, 175, 80, 0.3);
    color: #4caf50;
}

.map-difficulty.medium {
    background: rgba(255, 193, 7, 0.3);
    color: #ffc107;
}

.map-difficulty.hard {
    background: rgba(244, 67, 54, 0.3);
    color: #f44336;
}

/* Character Selection */
.character-selection {
    margin-bottom: 30px;
}

.character-selection h3 {
    color: white;
    font-size: 24px;
    margin-bottom: 15px;
}

.character-grid {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.character-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 100px;
}

.character-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

.character-btn.active {
    background: rgba(102, 126, 234, 0.5);
    border-color: rgba(102, 126, 234, 1);
}

.char-icon {
    font-size: 32px;
}

.char-name {
    font-size: 14px;
    font-weight: bold;
}

.char-role {
    font-size: 12px;
    color: #ddd;
}

/* Player List */
.player-list-container {
    margin-bottom: 30px;
}

.player-list-container h3 {
    color: white;
    font-size: 20px;
    margin-bottom: 15px;
}

.player-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.player-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 12px 20px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.player-item.local {
    background: rgba(255, 215, 0, 0.2);
    border: 2px solid rgba(255, 215, 0, 0.5);
}

.player-name-char {
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-char-icon {
    font-size: 24px;
}

.host-badge {
    background: rgba(255, 215, 0, 0.3);
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 12px;
}

/* Waiting Actions */
.waiting-actions {
    margin-bottom: 20px;
}

.btn-start {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 15px 40px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-start:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.5);
}

/* Controls Info */
.controls-info {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 15px;
}

.controls-info h3 {
    color: white;
    font-size: 18px;
    margin-bottom: 15px;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    color: white;
    font-size: 14px;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.key {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 12px;
}

.mobile-note {
    color: #ddd;
    font-size: 14px;
    margin-top: 15px;
    font-style: italic;
}

/* ============================================
   MOBILE CONTROLS
   ============================================ */

.mobile-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    pointer-events: none;
    z-index: 20;
}

/* Virtual Joystick */
.joystick-container {
    position: absolute;
    bottom: 30px;
    left: 30px;
    width: 150px;
    height: 150px;
    pointer-events: all;
}

.joystick-base {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    backdrop-filter: blur(5px);
}

.joystick-stick {
    position: absolute;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.6);
    border: 3px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.1s;
}

/* Action Buttons */
.action-buttons {
    position: absolute;
    bottom: 30px;
    right: 30px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    pointer-events: all;
}

.action-btn {
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.2);
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    backdrop-filter: blur(5px);
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
}

.action-btn:active {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0.95);
}

.action-btn.disabled {
    opacity: 0.3;
    pointer-events: none;
}

.btn-label {
    font-size: 10px;
    margin-top: 2px;
}

/* ============================================
   FINISH OVERLAY
   ============================================ */

.finish-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 60;
}

.finish-content {
    max-width: 600px;
    width: 90%;
    padding: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    text-align: center;
}

.finish-content h1 {
    color: white;
    font-size: 48px;
    margin-bottom: 30px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.finish-results {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    max-height: 400px;
    overflow-y: auto;
}

.result-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-bottom: 10px;
    color: white;
    font-size: 18px;
}

.result-entry:last-child {
    margin-bottom: 0;
}

.result-entry.winner {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3) 0%, rgba(255, 165, 0, 0.3) 100%);
    border: 2px solid rgba(255, 215, 0, 0.6);
}

.result-position {
    font-size: 24px;
    font-weight: bold;
    margin-right: 15px;
}

.result-name {
    flex: 1;
    text-align: left;
}

.btn-play-again {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 15px 40px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-play-again:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.5);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.hidden {
    display: none !important;
}

.host-only {
    /* Styles for host-only elements */
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .waiting-content h1 {
        font-size: 32px;
    }

    .mode-buttons {
        flex-direction: column;
    }

    .mode-btn {
        min-width: auto;
        max-width: none;
    }

    .character-grid {
        gap: 8px;
    }

    .character-btn {
        min-width: 80px;
        padding: 10px;
    }

    .char-icon {
        font-size: 24px;
    }

    .controls-info {
        display: none;
    }

    .player-stats {
        bottom: 200px;
        min-width: 250px;
    }

    .scoreboard {
        top: 60px;
        right: 10px;
        max-width: 180px;
    }
}

/* ============================================
   CAMERA CONTROLS PANEL
   ============================================ */

.camera-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-radius: 12px;
    padding: 0;
    min-width: 250px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 100;
    transition: all 0.3s ease;
    pointer-events: auto;
}

.camera-panel.dragging {
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.4);
    border-color: rgba(255, 215, 0, 0.8);
}

.camera-panel.collapsed .panel-content {
    display: none;
}

.camera-panel .panel-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 15px;
    border-radius: 10px 10px 0 0;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    cursor: move;
}

.camera-panel .panel-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.camera-panel .panel-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.camera-panel .panel-content {
    padding: 15px;
    color: white;
}

.camera-panel .control-group {
    margin-bottom: 15px;
}

.camera-panel .control-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    gap: 8px;
}

.camera-panel .control-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #FFD700;
}

.camera-panel .control-group span {
    color: #FFD700;
    font-weight: bold;
}

.camera-panel input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
}

.camera-panel input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #FFD700;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

.camera-panel input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #FFD700;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

.camera-panel .reset-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 5px;
}

.camera-panel .reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.camera-panel .camera-tips {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
}

