/* style.css */
:root {
    /* Black & Light Black Color Scheme */
    --primary-bg: #000000;
    /* Pure black background */
    --secondary-bg: #1a1a1a;
    /* Light black for cards/sections */
    --tertiary-bg: #2a2a2a;
    /* Lighter black for elevated elements */
    --quaternary-bg: #333333;
    /* Even lighter for hover states */

    /* Text Colors */
    --text-color-light: #ffffff;
    /* Pure white text */
    --text-color-dark: #cccccc;
    /* Light gray text */
    --text-color-muted: #888888;
    /* Muted gray text */

    /* Primary Colors */
    --primary-color: #ffffff;
    /* White for primary elements */
    --secondary-color: #cccccc;
    /* Light gray for secondary elements */
    --accent-color: #404040;
    /* Dark gray accent */

    /* Button Colors */
    --btn-primary: var(--primary-color);
    /* White buttons */
    --btn-secondary: var(--secondary-color);
    /* Gray buttons */
    --btn-danger: #ff4444;
    /* Red for danger/error */
    --btn-success: #44ff44;
    /* Green for success */

    /* Card & Layout */
    --card-bg: var(--secondary-bg);
    /* Light black cards */
    --card-elevated: var(--tertiary-bg);
    /* More elevated cards */
    --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
    /* Deep black shadows */
    --border-radius: 16px;
    /* Modern rounded corners */
    --border-color: #333333;
    /* Dark gray borders */

    /* Animation */
    --transition-duration: 0.3s;
    --transition-easing: cubic-bezier(0.4, 0, 0.2, 1);
    /* Material design easing */

    /* Team Colors */
    --team1-color: #ffffff;
    /* White for team 1 */
    --team2-color: #cccccc;
    /* Light gray for team 2 */

    /* Overlays */
    --overlay-bg: rgba(0, 0, 0, 0.95);
    /* Deep black overlay */

    /* Legacy compatibility variables */
    --primary: var(--primary-color);
    --secondary: var(--secondary-color);
    --dark: var(--primary-bg);
    --light: var(--text-color-light);
    --accent: var(--accent-color);
    --card-border: var(--border-color);
}

/* Global Styles for Preventing Horizontal Scroll (exactly without change) */
html,
body {
    width: 100%;
    height: 100%;
    /* Use 100% instead of 100vw for html/body */
    max-width: 100%;
    max-height: 100%;
    /* Ensures it doesn't exceed viewport due to content */
    overflow: hidden !important;
    /* Prevent all scrolling */
    position: fixed;
    /* Fix body position to prevent scrolling */
    box-sizing: border-box;
    margin: 0;
    /* Ensure no default margin */
    padding: 0;
    /* Ensure no default padding */
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--primary-bg);
    color: var(--text-color-light);
    touch-action: manipulation;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

*,
*::before,
*::after {
    box-sizing: inherit;
    /* Easier box-sizing management */
}

.container {
    width: 100vw;
    height: 100vh;
    /* Fill the viewport completely */
    max-width: 100vw;
    max-height: 100vh;
    /* Prevent it from exceeding viewport */
    overflow: hidden;
    /* No scrolling in container */
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    /* Remove all padding to maximize space */
    position: fixed;
    top: 0;
    left: 0;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: all var(--transition-duration) var(--transition-easing);
    position: relative;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow);
    border-color: var(--text-color-muted);
    background: var(--card-elevated);
}

.btn {
    background: var(--secondary-bg);
    color: var(--text-color-light);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem 2rem;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    transition: all var(--transition-duration) var(--transition-easing);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    text-transform: uppercase;
}

.btn:hover {
    background: var(--tertiary-bg);
    border-color: var(--text-color-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
}

/* Subtle shine effect on hover */
.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.6s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn.primary-btn {
    background: var(--text-color-light);
    color: var(--primary-bg);
    border-color: var(--text-color-light);
}

.btn.primary-btn:hover {
    background: var(--text-color-dark);
    color: var(--primary-bg);
    border-color: var(--text-color-dark);
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.2);
}

.btn.secondary-btn {
    background: transparent;
    color: var(--text-color-dark);
    border-color: var(--text-color-dark);
}

.btn.secondary-btn:hover {
    background: var(--text-color-dark);
    color: var(--primary-bg);
    border-color: var(--text-color-dark);
}

.btn.danger-btn {
    background: var(--btn-danger);
    color: var(--text-color-light);
    border-color: var(--btn-danger);
}

.btn.danger-btn:hover {
    background: #ff6666;
    border-color: #ff6666;
    box-shadow: 0 8px 25px rgba(255, 68, 68, 0.3);
}

.btn.log-btn {
    background: linear-gradient(145deg, var(--tertiary-bg), var(--quaternary-bg));
    color: var(--text-color-light);
    border: 2px solid var(--border-color);
}

.btn.log-btn:hover {
    background: linear-gradient(145deg, var(--quaternary-bg), var(--tertiary-bg));
    border-color: var(--text-color-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
}

.btn.action-btn {
    background-color: #26a69a;
    /* Teal action button */
}

.btn.action-btn:hover {
    background-color: #80cbc4;
    /* Lighter teal on hover */
}

/* Disabled button styling */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--border-color) !important;
    color: var(--text-color-muted) !important;
    border-color: var(--border-color) !important;
    transform: none !important;
    box-shadow: none !important;
    pointer-events: none;
}

.btn:disabled:hover {
    transform: none !important;
    box-shadow: none !important;
    background: var(--border-color) !important;
}

/* Navbar Styles */
.navbar {
    background-color: var(--secondary-bg);
    color: var(--text-color-light);
    padding: 0.8rem 1.5rem;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    box-shadow: var(--card-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 1.5px;
}

/* Modern Setup Screen System */
.setup-screen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--primary-bg) 0%, var(--secondary-bg) 100%);
    overflow: hidden !important;
    /* No scrolling allowed */
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(100%);
    opacity: 0;
    z-index: 1000;
    padding: 0.5rem;
    box-sizing: border-box;
}

/* Mobile-specific setup screen fixes */
@media (max-width: 768px) {
    .setup-screen {
        padding: 0.25rem;
        justify-content: center;
        align-items: center;
    }

    .setup-screen h2 {
        font-size: 1.4rem !important;
        margin-bottom: 0.8rem !important;
    }

    .player-slider-container {
        margin: 0.8rem 0 !important;
    }

    .slider-value-container {
        font-size: 1rem !important;
        margin-top: 0.8rem !important;
    }

    .difficulty-slots,
    .options-grid {
        gap: 0.8rem !important;
        margin-top: 0.8rem !important;
    }

    .difficulty-slot-btn,
    .round-slot-btn {
        padding: 0.8rem 1.2rem !important;
        font-size: 0.9rem !important;
        min-width: 80px !important;
    }
}

.setup-screen.active {
    display: flex;
    transform: translateX(0);
    opacity: 1;
    z-index: 1001;
}

.setup-screen.slide-out-left {
    transform: translateX(-100%);
    opacity: 0;
}

.setup-screen.slide-out-right {
    transform: translateX(100%);
    opacity: 0;
}

/* Individual screen styling - inherit from setup-screen */
/* .player-select-screen, .difficulty-select-screen, .round-select-screen inherit all styling from .setup-screen class */

/* Ensure card content inside overlays is not cut off */
.player-select-screen.card,
.difficulty-select-screen.card,
.round-select-screen.card {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 2rem;
    box-sizing: border-box;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
}

/* Player Select Screen Styles */
.player-select-screen {
    position: absolute;
    /* Overlay the entire container */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    /* Changed from none to flex */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: var(--primary-bg);
    /* Same background as body */
    z-index: 1002;
    /* Ensure it's on top of other content */
    opacity: 1;
    /* Changed from 0 to 1 */
    visibility: visible;
    /* Changed from hidden to visible */
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.player-select-screen,
.difficulty-select-screen {
    position: absolute;
    width: 100%;
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
}

.player-select-screen.fade-out {
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-duration) var(--transition-easing), visibility 0s linear var(--transition-duration);
    /* Fade out transition */
}

.player-select-screen h2 {
    font-size: 2.5rem;
    color: var(--text-color-light);
    margin-bottom: 2rem;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    /* Subtle text shadow */
}

/* Remove or modify existing styles for .player-slots and .player-slot-btn if they are no longer needed or conflict */
.player-slots,
.player-slot-btn {
    display: none !important;
}

/* Player Slider Styles */
.player-slider-container {
    display: flex;
    flex-direction: column;
    /* Stack slider and value display vertically */
    align-items: center;
    /* Center items horizontally */
    width: 80%;
    /* Adjust width as needed */
    max-width: 350px;
    /* Maximum width */
    margin: 20px auto;
    /* Center the container */
}

.player-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: linear-gradient(to right, var(--border-color) 0%, var(--border-color) 100%);
    border-radius: 10px;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.player-slider:hover {
    background: linear-gradient(to right, var(--text-color-muted) 0%, var(--text-color-muted) 100%);
}

/* Thumb (the draggable "dot") Styles for WebKit/Blink browsers (Chrome, Safari, Edge, Opera) */
.player-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--text-color-light);
    border-radius: 50%;
    border: 3px solid var(--primary-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Thumb Styles for Firefox */
.player-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--text-color-light);
    border-radius: 50%;
    border: 3px solid var(--primary-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Hover effects for slider thumb */
.player-slider:hover::-webkit-slider-thumb {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.4);
}

.player-slider:hover::-moz-range-thumb {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.4);
}

.slider-value-container {
    margin-top: 15px;
    /* Space between slider and value display */
    font-size: 1.3rem;
    /* Slightly larger font size */
    color: var(--text-color-light, #e0f7ff);
    font-weight: 500;
}

#slider-value {
    font-weight: 700;
    color: var(--primary, #00eeff);
    padding: 0 2px;
    /* Add a little padding inside the brackets if needed */
}

/* Styles for the confirm button, similar to your other buttons */
#confirm-player-count-btn {
    /* Uses .btn and .primary-btn styles by default */
    /* Add any specific overrides if needed */
    margin-top: 30px;
    /* More space above the button */
    padding: 1rem 2.5rem;
    /* Adjust padding */
    font-size: 1.1rem;
}

/* Difficulty Select Screen Styles - Reusing styles from player select screen */
.difficulty-select-screen {
    position: absolute;
    /* Overlay the entire container */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    /* Initially hidden - REVERT BACK TO display: none; */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: var(--primary-bg);
    /* Same background as body */
    z-index: 1001;
    /* Ensure it's on top of other content */
    opacity: 0;
    /* Initially fully transparent */
    visibility: hidden;
    /* Initially hidden using visibility */
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.difficulty-select-screen.active {
    display: block;
    /* Make visible when fading in */
    opacity: 1;
    visibility: visible;
    z-index: 1003;
    /* Higher than player select screen */
    transition: opacity var(--transition-duration) var(--transition-easing), visibility 0s linear 0s;
    /* Fade in transition */
}

.difficulty-select-screen.fade-out {
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-duration) var(--transition-easing), visibility 0s linear var(--transition-duration);
    /* Fade out transition */
}

.difficulty-select-screen h2 {
    font-size: 2.5rem;
    color: var(--text-color-light);
    margin-bottom: 2rem;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    /* Subtle text shadow */
}

.difficulty-slots {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.difficulty-slot-btn {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    letter-spacing: 1px;
}

/* Round Select Screen Styles */
.round-select-screen {
    position: absolute;
    /* Overlay the entire container */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    /* Initially hidden - REVERT BACK TO display: none; */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: var(--primary-bg);
    /* Same background as body */
    z-index: 1002;
    /* Ensure it's on top of other content */
    opacity: 0;
    /* Initially fully transparent */
    visibility: hidden;
    /* Initially hidden using visibility */
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    /* Fade in/out transition - REVERT BACK to all 0.5s ... if you changed it */
}

.round-select-screen.active {
    display: flex;
    /* Make visible when fading in */
    opacity: 1;
    visibility: visible;
    transition: opacity var(--transition-duration) var(--transition-easing), visibility 0s linear 0s;
    /* Fade in transition */
}

.round-select-screen.fade-out {
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-duration) var(--transition-easing), visibility 0s linear var(--transition-duration);
    /* Fade out transition */
}

.round-select-screen h2 {
    font-size: 2.5rem;
    color: var(--text-color-light);
    margin-bottom: 2rem;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    /* Subtle text shadow */
}

.round-slots {
    display: flex;
    gap: 2rem;
}

.round-slot-btn {
    padding: 1.2rem 2.5rem;
    font-size: 1.2rem;
    letter-spacing: 1px;
}

#round-select-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    background: var(--primary-bg);
    justify-content: center;
    align-items: center;
}

#round-select-screen .overlay-content {
    background: var(--secondary-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    text-align: center;
}

/* Prevent overlays and modals from causing scroll */
.overlay-screen,
.modal,
.turn-overlay {
    width: 100vw !important;
    max-width: 100vw !important;
    left: 0 !important;
    right: 0 !important;
    overflow-x: hidden !important;
    box-sizing: border-box;
}

/* Game Setup Section */
.game-setup {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    /* Stretch items to fill container width */
}

.game-setup h2 {
    color: var(--text-color-light);
    margin-bottom: 1.5rem;
    text-align: center;
}

.setup-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.setup-item label {
    color: var(--text-color-light);
    margin-right: 1rem;
}

.setup-item input[type="number"],
.setup-item input[type="text"] {
    padding: 0.7rem;
    border: 1px solid #455a64;
    /* Input border color */
    border-radius: var(--border-radius);
    background-color: var(--secondary-bg);
    color: var(--text-color-light);
    flex-grow: 1;
    /* Input fields take up remaining space */
    margin-right: 1rem;
    /* Space between input and button */
}

.setup-section h3 {
    color: var(--text-color-light);
    margin-bottom: 1rem;
    text-align: center;
}

/* Players List Styles (Available, Team 1, Team 2) */
.players-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 80px;
    /* Larger drop zone for mobile */
    padding: 1rem;
    border: 2px dashed #607d8b;
    border-radius: var(--border-radius);
    background-color: #37474f;
    touch-action: none;
    -webkit-overflow-scrolling: touch;
    user-select: none;
    transition: all 0.3s ease;
}

/* Mobile-specific drop zone styles */
@media (max-width: 768px) {
    .players-list {
        min-height: 100px;
        padding: 1.5rem;
        border-width: 3px;
    }

    .leader-slot {
        min-height: 80px;
        padding: 1.5rem;
        border-width: 3px;
    }
}

.players-list.drag-over,
.leader-slot.drag-over {
    background-color: rgba(0, 238, 255, 0.1);
    border-color: var(--primary-color);
    border-style: solid;
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(0, 238, 255, 0.3);
    transition: all 0.2s ease;
}

.players-list,
.leader-slot {
    min-height: 50px;
    border: 2px dashed #ccc;
    margin: 10px;
    padding: 10px;
    border-radius: 5px;
}

.players-list:hover,
.leader-slot:hover {
    border-color: #666;
    background-color: rgba(255, 255, 255, 0.1);
}

.players-list .player {
    background: var(--tertiary-bg);
    color: var(--text-color-light);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.25rem;
    border-radius: var(--border-radius);
    cursor: grab;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: all var(--transition-duration) var(--transition-easing);
}

.player {
    cursor: move;
    padding: 12px 16px;
    /* Larger touch target */
    margin: 8px;
    background-color: #4a5568;
    border-radius: 4px;
    display: inline-block;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    box-sizing: border-box;
    /* <<< ADD THIS LINE */
}

.player {
    cursor: grab;
    padding: 16px 20px;
    margin: 8px;
    background: var(--tertiary-bg);
    color: var(--text-color-light);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    display: inline-block;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    box-sizing: border-box;
    transition: all var(--transition-duration) var(--transition-easing);
    min-width: 80px;
    min-height: 44px;
    text-align: center;
    font-weight: 500;
}

.player:hover {
    transform: translateY(-2px);
    background: var(--quaternary-bg);
    border-color: var(--text-color-muted);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
}

/* Mobile-specific styles */
@media (max-width: 768px) {
    .player {
        padding: 18px 22px;
        margin: 10px 6px;
        font-size: 16px;
        /* Prevent zoom on iOS */
        min-height: 48px;
        /* Larger touch target for mobile */
    }
}

.leader-slot {
    border: 2px dashed #ffd700;
    padding: 16px;
    margin: 12px;
    min-height: 60px;
    background-color: rgba(255, 215, 0, 0.1);
}

.player.leader {
    background-color: #ffd700;
    color: #000;
    font-weight: bold;
    padding: 8px 12px;
    margin: 5px;
    border-radius: 4px;
    display: inline-block;
    cursor: move;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.leader-slot h3 {
    margin-bottom: 10px;
    color: #ffd700;
    text-align: center;
}

#team1-leader,
#team2-leader {
    min-height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Teams Section */
.teams {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    width: 100%;
    justify-content: center;
    align-items: stretch;
}

.team {
    flex: 1;
    /* Equal width for teams */
    display: flex;
    flex-direction: column;
    align-items: stretch;
    /* Stretch items to fill team container width */
    min-width: 0;
    /* Allow shrinking below content size */
}

.team h2 {
    color: var(--text-color-light);
    text-align: center;
    margin-bottom: 0.5rem;
}

.team.active {
    border: 3px solid var(--secondary-color);
    /* Highlight for active team */
    padding: calc(2rem - 3px);
    /* Adjust padding to maintain visual size with border */
}

.team .score {
    text-align: center;
    color: var(--text-color-dark);
    margin-bottom: 1rem;
}

/* Game Controls Section */
.game-controls {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    /* Stretch items to fill container width */
}

.game-controls h2 {
    color: var(--text-color-light);
    margin-bottom: 1.5rem;
    text-align: center;
}

.word-display {
    font-size: 2rem;
    font-weight: bold;
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    background-color: transparent;
    transition: all 0.3s ease;
    user-select: none;
}

#current-word {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    user-select: none;
    min-height: 2rem;
    min-width: 4rem;
    font-size: 1.5rem;
    font-weight: bold;
    background-color: transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80vw;
    box-sizing: border-box;
}

.word-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.word-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.word-controls {
    display: flex;
    gap: 1rem;
}

#start-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
    margin-top: 1rem;
}

#start-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Referee Controls Section */
.ref-section {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    /* Stretch items to fill container width */
}

.ref-section h2 {
    color: var(--text-color-light);
    margin-bottom: 1.5rem;
    text-align: center;
}

.team-logs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Initially hide both team logs */
.team-log {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    flex: 1;
    overflow: hidden;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Show only the active team's log */
.team-log.active {
    display: flex;
    opacity: 1;
}

.team-log h3 {
    color: var(--text-color-light);
    text-align: center;
    margin-bottom: 0.8rem;
    flex-shrink: 0;
    font-size: 1.2rem;
}

/* Style the input fields */
.team-log input[type="text"] {
    width: 100%;
    /* Make input fields take up the full width */
    padding: 0.7rem;
    border: 1px solid #455a64;
    border-radius: var(--border-radius);
    background-color: var(--secondary-bg);
    color: var(--text-color-light);
    margin-bottom: 0.5rem;
    /* Add some spacing below the input */
    box-sizing: border-box;
    /* Include padding and border in the element's total width and height */
}

.log-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 5px;
    background: var(--tertiary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.log-entry:hover {
    background: var(--quaternary-bg);
    border-color: var(--text-color-muted);
}

.log-entry .message {
    flex-grow: 1;
    margin-right: 10px;
    /* Add spacing between message and timestamp */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.log-entry .timestamp {
    font-size: 0.75em;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    min-width: 60px;
    /* Ensure consistent width for timestamps */
    text-align: right;
    flex-shrink: 0;
    /* Prevent timestamp from shrinking */
}

.log-entry select,
.log-entry input[type="text"] {
    padding: 0.5rem;
    border-radius: var(--border-radius);
    border: 1px solid #455a64;
    background-color: var(--secondary-bg);
    color: var(--text-color-light);
}

.log-entry input[type="text"] {
    flex-grow: 1;
    /* Input field takes up remaining space */
}

.log-display {
    background: linear-gradient(145deg, var(--secondary-bg), var(--tertiary-bg));
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.7rem;
    color: var(--text-color-light);
    font-size: 0.9rem;
    flex: 1;
    overflow-y: auto;
    /* Enable vertical scrolling */
    white-space: pre-line;
    /* Respect line breaks and spaces */
    min-height: 0;
}

/* Add these styles to your existing CSS */
.log-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 5px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.log-entry .message {
    flex-grow: 1;
}

.log-entry .timestamp {
    font-size: 0.75em;
    color: rgba(255, 255, 255, 0.5);
    margin-left: 10px;
    white-space: nowrap;
}

/* Add new styles for log input container and mic button */
.log-input-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.log-input-container input[type="text"] {
    flex-grow: 1;
    margin-bottom: 0;
}

.mic-btn {
    padding: 0.5rem 0.8rem;
    font-size: 1.2rem;
    line-height: 1;
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: var(--primary-bg);
    flex-shrink: 0;
    width: auto;
    min-width: 40px;
    text-align: center;
}

.mic-btn:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.mic-btn.listening {
    background-color: var(--btn-danger);
    border-color: var(--btn-danger);
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Results Section Styles */
.results-section {
    display: none;
    /* Initially hidden */
    flex-direction: column;
    align-items: stretch;
    /* Stretch items to fill container width */
    opacity: 0;
    /* For fade-in effect */
    transition: opacity 1s ease-out;
    /* Fade-in transition */
}

.results-section.show {
    display: flex;
    /* Show results section when 'show' class is added */
    opacity: 1;
    /* Fade in by making opaque */
}

.results-section h2 {
    color: var(--text-color-light);
    margin-bottom: 1.5rem;
    text-align: center;
}

.results-columns {
    display: flex;
    gap: 2rem;
}

.results-column {
    flex: 1;
}

.results-column h3 {
    color: var(--text-color-light);
    text-align: center;
    margin-bottom: 1rem;
}

.results-section .result-item {
    background-color: #37474f;
    border-radius: var(--border-radius);
    padding: 0.7rem 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    color: var(--text-color-light);
}

/* Guess Section Styles */
.guess-section {
    display: flex;
    gap: 1rem;
    align-items: stretch;
    /* Align items vertically */
}

.guess-section input[type="text"] {
    padding: 0.8rem;
    border: 1px solid #455a64;
    border-radius: var(--border-radius);
    background-color: var(--secondary-bg);
    color: var(--text-color-light);
    flex-grow: 2;
    /* Input takes up more space */
    font-size: 1rem;
}

/* Turn Overlay Styles */
.turn-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--overlay-bg);
    display: none;
    /* Initially hidden */
    justify-content: center;
    align-items: center;
    z-index: 999;
    /* Ensure it's above most content */
    opacity: 0;
    /* For fade effect */
    transition: opacity var(--transition-duration) var(--transition-easing), display 0s linear var(--transition-duration);
}

.turn-overlay.show {
    display: flex;
    /* Show overlay when 'show' class is added */
    opacity: 1;
    /* Fade in by making opaque */
    transition: opacity var(--transition-duration) var (--transition-easing), display 0s linear 0s;
}

.turn-message {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--card-shadow);
}

.turn-message h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var (--text-color-light);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.turn-message p {
    font-size: 1.2rem;
    color: var(--text-color-dark);
}

/* Overlay Screen Styles */
.overlay-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.overlay-screen.show {
    opacity: 1;
    visibility: visible;
}

.overlay-content {
    background: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.options-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.round-slot-btn {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.round-slot-btn:hover {
    background-color: #45a049;
}

.round-slot-btn:focus {
    outline: 2px solid #000;
}

.leader-slot {
    border: 2px dashed #4CAF50;
    padding: 10px;
    margin-bottom: 10px;
    text-align: center;
    background-color: #e8f5e9;
    border-radius: 10px;
}

.leader-slot h3 {
    margin: 0;
    font-size: 1.2em;
    color: #388e3c;
}

.leader {
    min-height: 40px;
    line-height: 40px;
    background-color: #c8e6c9;
    border: 2px solid #388e3c;
    border-radius: 5px;
    padding: 5px;
    color: #2e7d32;
    font-weight: bold;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: var(--overlay-bg);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--light);
    margin: auto;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    position: relative;
    border-radius: 10px;
    text-align: center;
    transform: translateY(30px);
    opacity: 0;
    animation: modalSlideIn 0.5s ease forwards;
}

.modal-content.victory {
    background: linear-gradient(145deg, #7700ff, #00eeff, #ff0077);
    background-size: 200% 200%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 40px rgba(0, 238, 255, 0.5), 0 0 60px rgba(119, 0, 255, 0.4);
    overflow: hidden;
    position: relative;
    animation: modalSlideIn 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards,
        victoryBackgroundPulse 4s infinite ease-in-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(50px) scale(0.9);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Animated background for victory modal */
@keyframes victoryBackgroundPulse {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Confetti container inside victory message */
.victory-message .confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

/* Confetti piece style */
.confetti-piece {
    position: absolute;
    width: 10px;
    height: 15px;
    background-color: #f00;
    top: -20px;
    opacity: 0;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation-name: fall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    will-change: transform, opacity;
}

/* Confetti falling animation */
@keyframes fall {
    0% {
        transform: translateY(0) rotateZ(0deg) rotateY(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(110vh) rotateZ(720deg) rotateY(360deg);
        opacity: 0;
    }
}

/* Victory text pop-in */
.victory-message h2 {
    font-size: 2.8rem;
    margin-bottom: 1rem;
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 2;
    opacity: 0;
    transform: scale(0.5);
    animation: victoryTextPop 0.8s 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    background: none;
    -webkit-background-clip: initial;
    background-clip: initial;
    -webkit-text-fill-color: initial;
}

@keyframes victoryTextPop {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Stats fade-in */
.victory-stats {
    margin-top: 1.5rem;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    position: relative;
    z-index: 2;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInStats 0.6s 0.8s ease-out forwards;
}

@keyframes fadeInStats {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ensure close button is usable */
.modal-content.victory .close-btn {
    z-index: 3;
    color: #fff;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

/* Improved overlay transitions */
.difficulty-select-screen,
.round-select-screen {
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.difficulty-select-screen.active,
.round-select-screen.active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

/* Fix z-index stacking context */
.player-select-screen {
    z-index: 1002;
}

.difficulty-select-screen {
    z-index: 1001;
}

.round-select-screen {
    z-index: 1000;
}

/* Animation tweaks */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOutDown {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }

    100% {
        opacity: 0.5;
        transform: scale(1);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-20px) rotate(5deg);
    }
}

/* Ensure proper overlay positioning */
.overlay-screen {
    position: fixed;
    display: flex;
    background: rgba(0, 0, 0, 0.85);
}

/* Media Queries for Responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 0.5rem;
        /* Adjust container padding for smaller screens */
    }

    .card {
        padding: 1.5rem;
        /* Reduce card padding on smaller screens */
        margin-bottom: 1.5rem;
        /* Reduce card margin on smaller screens */
    }

    .btn {
        padding: 0.8rem 1.5rem;
        /* Reduce button padding on smaller screens */
        font-size: 0.9rem;
        /* Reduce button font size on smaller screens */
    }

    .logo {
        font-size: 1.5rem;
        /* Adjust logo font size for smaller screens */
    }

    /* Player Select Screen adjustments for smaller screens */
    .player-select-screen h2 {
        font-size: 2rem;
        /* Adjust player select title font size for smaller screens */
    }

    .player-slots {
        flex-direction: column;
        /* Stack player slot buttons on smaller screens */
        gap: 1rem;
        /* Reduce gap between player slot buttons on smaller screens */
    }

    .player-slot-btn {
        padding: 1rem 2rem;
        /* Adjust player slot button padding for smaller screens */
        font-size: 1rem;
        /* Adjust player slot button font size for smaller screens */
    }

    /* Difficulty Select Screen adjustments for smaller screens */
    .difficulty-select-screen h2 {
        font-size: 2rem;
        /* Adjust difficulty select title font size for smaller screens */
    }

    .difficulty-slots {
        flex-direction: column;
        /* Stack difficulty slot buttons on smaller screens */
        gap: 1rem;
        /* Reduce gap between difficulty slot buttons on smaller screens */
    }

    .difficulty-slot-btn {
        padding: 1rem 2rem;
        /* Adjust difficulty slot button padding for smaller screens */
        font-size: 1rem;
        /* Adjust difficulty slot button font size for smaller screens */
    }

    .game-setup h2 {
        font-size: 2rem;
        /* Adjust game setup title font size for smaller screens */
    }

    .setup-item {
        flex-direction: column;
        /* Stack setup items vertically on smaller screens */
        align-items: stretch;
        /* Ensure items stretch full width */
    }

    .setup-item label {
        margin-right: 0;
        /* Remove right margin for stacked labels */
        margin-bottom: 0.5rem;
        /* Add bottom margin to labels */
        text-align: left;
        /* Align labels to the left */
    }

    .setup-item input[type="number"],
    .setup-item input[type="text"] {
        margin-right: 0;
        /* Remove right margin from inputs when stacked */
        margin-bottom: 0.8rem;
        /* Add bottom margin to input fields */
    }

    .teams {
        flex-direction: row;
        /* Keep side by side */
        gap: 0.5rem;
        /* Reduce gap on mobile */
    }

    .team {
        padding: 1rem;
        /* Reduce padding on mobile */
    }

    .player {
        padding: 0.5rem;
        /* Reduce player padding on mobile */
        font-size: 0.9rem;
        /* Smaller font on mobile */
    }

    .word-display {
        font-size: 1.3rem;
        /* Adjust word display font size for smaller screens */
        padding: 1.2rem;
        /* Reduce word display padding on smaller screens */
    }

    .word-controls {
        flex-direction: column;
        /* Stack word control buttons on smaller screens */
        gap: 0.8rem;
        /* Reduce gap between word control buttons when stacked */
    }

    .ref-section h2 {
        font-size: 2rem;
        /* Adjust referee control title font size for smaller screens */
    }

    .team-logs {
        flex-direction: column;
        /* Stack team logs vertically on smaller screens */
        gap: 1.5rem;
        /* Reduce gap between team logs when stacked */
    }

    .log-entry {
        flex-direction: row;
        /* Force horizontal layout */
        align-items: center;
        padding: 8px;
    }

    .log-entry .message {
        font-size: 0.9rem;
        /* Slightly smaller font on mobile */
        margin-right: 8px;
    }

    .log-entry .timestamp {
        font-size: 0.7em;
        /* Slightly smaller timestamp on mobile */
        min-width: 50px;
    }

    .log-display {
        padding: 5px;
        font-size: 0.85rem;
    }

    .guess-section {
        flex-direction: column;
        /* Stack guess input and button on smaller screens */
        gap: 0.8rem;
        /* Reduce gap in guess section when stacked */
    }

    .guess-section input[type="text"] {
        margin-bottom: 0;
        /* Remove bottom margin from guess input when stacked */
    }

    .turn-message h2 {
        font-size: 1.8rem;
        /* Adjust turn message title font size for smaller screens */
    }

    .turn-message p {
        font-size: 1.1rem;
        /* Adjust turn message paragraph font size for smaller screens */
    }
}

@media (max-width: 600px) {
    .container {
        max-width: 100vw;
        max-height: 100vh;
        padding: 0;
        overflow: hidden;
        position: fixed;
        top: 0;
        left: 0;
    }

    .card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .teams {
        flex-direction: row !important;
        gap: 0.5rem !important;
    }

    .team {
        min-width: 0;
        width: 50%;
        margin-bottom: 0;
    }

    .players-list,
    .leader-slot {
        margin: 5px 0;
        padding: 8px;
        min-height: 40px;
    }

    .player {
        font-size: 1rem;
        padding: 8px 10px;
        margin: 4px 0;
    }

    .word-display,
    #current-word {
        font-size: 1.2rem;
        min-width: 2rem;
        padding: 0.5rem 0.7rem;
    }

    .navbar {
        padding: 0.5rem 1rem;
    }

    .logo {
        font-size: 1.1rem;
    }

    .player-select-screen,
    .difficulty-select-screen,
    .round-select-screen {
        padding: 1rem;
    }

    .options-grid {
        flex-direction: column;
        gap: 0.5rem;
    }

    .results-columns {
        flex-direction: column;
        gap: 1rem;
    }

    .modal-content {
        padding: 1rem;
        width: 98vw;
        max-width: 98vw;
    }

    .turn-message {
        padding: 1rem;
    }
}

#player-select-screen {
    z-index: 1000;
}

#difficulty-select-screen {
    z-index: 1001;
}

#round-select-screen {
    z-index: 1002;
}

#game-container {
    z-index: 999;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

#game-container main {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.confirmation-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

#confirmation-dialog .overlay-content {
    background-color: var(--card-bg);
    color: var(--text-color-light);
    padding: 2rem;
    border-radius: var(--border-radius);
    text-align: center;
}

#confirmation-dialog h2 {
    margin-bottom: 1.5rem;
    color: var(--text-color-light);
}

.leader-container {
    min-height: 40px;
    padding: 5px;
    border-radius: 4px;
}

.player {
    background-color: #4a5568;
    color: white;
    padding: 8px 12px;
    margin: 5px;
    border-radius: 4px;
    cursor: move;
    user-select: none;
}

.player.leader {
    background-color: #ffd700;
    color: #000;
    font-weight: bold;
    position: relative;
    padding-right: 2.5rem;
    /* Make space for lock icon */
}

.player.leader::after {
    content: "🔒";
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
}

.player.leader.locked {
    cursor: not-allowed;
    opacity: 0.8;
}

/* Add hover effect to show it's locked */
.player.leader.locked:hover::before {
    content: "Locked";
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.8rem;
}

.leader-slot {
    border: 2px dashed #ffd700;
    padding: 10px;
    margin: 10px;
    border-radius: 4px;
    background-color: rgba(255, 215, 0, 0.1);
}

.players-list {
    min-height: 50px;
    border: 2px dashed #666;
    padding: 10px;
    margin: 10px;
    border-radius: 4px;
}

.leader-slot:hover,
.players-list:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Add to your style.css file */
#confirmation-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

#confirmation-dialog.show {
    display: flex;
    opacity: 1;
}

.confirmation-message {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    transform: translateY(20px);
    transition: transform 0.3s ease-in-out;
    animation: slideIn 0.3s ease-out forwards;
}

.confirmation-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.confirmation-buttons button {
    padding: 0.5rem 2rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.confirmation-buttons button:hover {
    transform: scale(1.05);
}

.confirmation-buttons .primary-btn {
    background: var(--primary-color);
    color: white;
}

.confirmation-buttons .secondary-btn {
    background: var(--secondary-bg);
    color: var(--text-color-light);
}

@keyframes slideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Cursor effect */
.custom-cursor {
    position: fixed;
    width: 30px;
    height: 30px;
    border: 2px solid var(--primary);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    transition: width 0.3s, height 0.3s, background 0.3s;
    z-index: 9999;
    mix-blend-mode: difference;
}

.custom-cursor-dot {
    position: fixed;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9999;
}

/* Loading screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--dark);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 1s ease;
}

.loading-progress {
    width: 300px;
    height: 3px;
    background: rgba(0, 238, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.loading-bar {
    height: 100%;
    width: 0;
    background: var(--primary);
    transition: width 2s ease;
}

.loading-text {
    position: absolute;
    top: -30px;
    left: 0;
    color: var(--primary);
    font-size: 1rem;
    letter-spacing: 2px;
}

.noise {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3C/rect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.04;
    pointer-events: none;
    z-index: 1000;
}

.grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(to right, rgba(0, 238, 255, 0.1) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 238, 255, 0.1) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.2;
    pointer-events: none;
    z-index: 1;
}

/* Gradient text effect */
h1,
h2,
h3 {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Victory effects */
.victory-message {
    position: relative;
    padding: 2rem;
}

.victory-message h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--dark);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.sparkles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image: radial-gradient(circle, var(--primary) 1px, transparent 1px);
    background-size: 15px 15px;
    animation: sparkleFloat 3s linear infinite;
}

.confetti {
    position: absolute;
    top: -20px;
    left: 0;
    width: 100%;
    height: calc(100% + 20px);
    pointer-events: none;
}

@keyframes sparkleFloat {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: translateY(-20px) rotate(45deg);
        opacity: 0;
    }
}

/* Add a visual indicator for touch devices */
@media (hover: none) {
    .player {
        position: relative;
    }

    .player::after {
        content: '⋮';
        /* Add drag handle indicator */
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        opacity: 0.5;
    }
}

/* Enhanced drag and drop styles */
.player.dragging {
    opacity: 0.7;
    transform: scale(1.05);
    background: var(--primary-color);
    box-shadow: 0 8px 25px rgba(0, 238, 255, 0.4);
    z-index: 1000;
    cursor: grabbing;
    transition: all 0.2s ease;
}

.players-list.drag-over,
.leader-slot.drag-over {
    border-color: var(--primary-color);
    background: rgba(0, 238, 255, 0.1);
    transition: all 0.3s ease;
}

/* Long pr
ess feedback for mobile drag initiation */
.player.long-press-active {
    animation: longPressIndicator 0.2s ease-in-out;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 238, 255, 0.5);
}

@keyframes longPressIndicator {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1.05);
    }
}

/* Enhanced dragging state for mobile */
.player.dragging {
    opacity: 0.9;
    transform: scale(1.1) rotate(3deg);
    background: var(--text-color-light);
    color: var(--primary-bg);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
    z-index: 9999 !important;
    cursor: grabbing;
    transition: none;
    border: 2px solid var(--text-color-muted);
}

/* Better drop zone feedback */
.players-list.drag-over,
.leader-slot.drag-over {
    background-color: var(--tertiary-bg);
    border-color: var(--text-color-light);
    border-style: solid;
    transform: scale(1.02);
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.1);
    animation: dropZonePulse 1s ease-in-out infinite;
}

@keyframes dropZonePulse {

    0%,
    100% {
        box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.1);
    }

    50% {
        box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.2);
    }
}

/* Prevent text selection during touch interactions */
.container * {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow text selection for inputs and ensure they work on mobile */
input,
textarea,
input[type="text"],
input[type="number"],
#player-name-input {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
    -webkit-touch-callout: default !important;
    touch-action: manipulation !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

/* Specific mobile input fixes */
@media (max-width: 768px) {

    input,
    textarea,
    input[type="text"],
    input[type="number"],
    #player-name-input {
        font-size: 16px !important;
        /* Prevent zoom */
        padding: 1rem 1.25rem !important;
        min-height: 52px !important;
        border-radius: 12px !important;
        border-width: 2px !important;
        background: var(--secondary-bg) !important;
        color: var(--text-color-light) !important;
        -webkit-user-select: text !important;
        user-select: text !important;
        touch-action: manipulation !important;
    }

    input:focus,
    textarea:focus,
    #player-name-input:focus {
        outline: none !important;
        border-color: var(--text-color-light) !important;
        background: var(--tertiary-bg) !important;
        box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1) !important;
    }
}

/* Fallback tap-to-move system styles */
.player.selected {
    background: var(--text-color-light) !important;
    color: var(--primary-bg) !important;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    animation: selectedPulse 1.5s ease-in-out infinite;
}

@keyframes selectedPulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    }

    50% {
        box-shadow: 0 0 30px rgba(255, 255, 255, 0.8);
    }
}

.move-options-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.move-options-modal.show {
    opacity: 1;
}

.move-options-content {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 15px;
    padding: 2rem;
    max-width: 90%;
    width: 400px;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.move-options-modal.show .move-options-content {
    transform: scale(1);
}

.move-options-content h3 {
    color: var(--light);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.move-options-content .btn {
    display: block;
    width: 100%;
    margin: 0.5rem 0;
    padding: 1rem;
    font-size: 1.1rem;
}

/* Mobile optimizations for move options */
@media (max-width: 768px) {
    .move-options-content {
        width: 95%;
        padding: 1.5rem;
    }

    .move-options-content .btn {
        padding: 1.2rem;
        font-size: 1.2rem;
        margin: 0.7rem 0;
    }
}

/* Mo
dern Black Theme Enhancements */

/* Subtle gradient backgrounds for depth */
.card {
    background: linear-gradient(145deg, var(--secondary-bg), var(--tertiary-bg));
}

/* Enhanced typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-color-light);
    font-weight: 600;
    letter-spacing: -0.025em;
}

/* Modern input styling */
input[type="text"],
input[type="number"],
textarea {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-color-light);
    padding: 0.75rem 1rem;
    transition: all var(--transition-duration) var(--transition-easing);
    font-size: 16px;
    /* Prevent zoom on iOS */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    touch-action: manipulation;
    -webkit-user-select: text;
    user-select: text;
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--text-color-light);
    background: var(--tertiary-bg);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

/* Mobile-specific input fixes */
@media (max-width: 768px) {

    input[type="text"],
    input[type="number"],
    textarea {
        font-size: 16px !important;
        /* Prevent zoom on mobile */
        padding: 1rem 1.25rem;
        min-height: 48px;
        /* Better touch target */
        border-width: 2px;
    }
}

/* Modern slider styling */
.player-slider {
    background: var(--border-color);
    height: 6px;
}

.player-slider::-webkit-slider-thumb {
    background: var(--text-color-light);
    border: 3px solid var(--primary-bg);
    width: 20px;
    height: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.player-slider::-moz-range-thumb {
    background: var(--text-color-light);
    border: 3px solid var(--primary-bg);
    width: 20px;
    height: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Enhanced drop zones */
.players-list,
.leader-slot {
    background: var(--secondary-bg);
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    transition: all var(--transition-duration) var(--transition-easing);
}

.players-list:hover,
.leader-slot:hover {
    border-color: var(--text-color-muted);
    background: var(--tertiary-bg);
}

/* Modern modal styling */
.modal-content {
    background: linear-gradient(145deg, var(--secondary-bg), var(--tertiary-bg));
    border: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
}

/* Enhanced team styling */
.team {
    background: linear-gradient(145deg, var(--secondary-bg), var(--tertiary-bg));
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

.team.active {
    border-color: var(--text-color-light);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

/* Modern word display */
#current-word {
    background: var(--tertiary-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem 1.5rem;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.1em;
}

/* Enhanced overlay screens */
.player-select-screen,
.difficulty-select-screen,
.round-select-screen {
    background: linear-gradient(135deg, var(--primary-bg) 0%, var(--secondary-bg) 100%);
}

/* Subtle animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInUp 0.6s ease-out;
}

/* Modern scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--secondary-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-color-muted);
}

/* Enhanced long press indicator */
.player.long-press-active {
    background: var(--text-color-light);
    color: var(--primary-bg);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

/* 
Word Hide/Show Effects */
#current-word {
    position: relative;
    transition: all 0.3s ease;
}

#current-word.word-hidden {
    filter: blur(8px);
    user-select: none;
    pointer-events: none;
}

#current-word.word-hidden::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(45deg,
            var(--primary-bg),
            var(--primary-bg) 10px,
            var(--border-color) 10px,
            var(--border-color) 12px);
    border-radius: var(--border-radius);
    opacity: 0.8;
    z-index: 1;
}

#current-word.word-hidden::after {
    content: 'HIDDEN';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-color-muted);
    font-size: 0.8rem;
    font-weight: bold;
    letter-spacing: 2px;
    z-index: 2;
}

/* Modern Setup Screen Content */
.setup-screen .card-content {
    background: linear-gradient(145deg, var(--secondary-bg), var(--tertiary-bg));
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    max-width: 95vw;
    max-height: 95vh;
    width: 95%;
    height: 95%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    opacity: 1 !important;
    transform: translateY(0) !important;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    visibility: visible;
    overflow: hidden;
    box-sizing: border-box;
}

.setup-screen .btn {
    opacity: 1 !important;
    transform: translateY(0) !important;
    transition: all 0.3s ease;
    display: inline-block;
    visibility: visible;
}

.setup-screen h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-color-light);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-color-light), var(--text-color-dark));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: titleGlow 3s ease-in-out infinite alternate;
    flex-shrink: 0;
}

@keyframes titleGlow {
    0% {
        filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.3));
    }

    100% {
        filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.6));
    }
}

/* Simplified Button Styling */

.setup-screen .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.setup-screen .btn:hover::before {
    left: 100%;
}

/* Modern Slider Styling */
.player-slider-container {
    transform: translateY(0);
    opacity: 1;
    transition: all 0.3s ease;
    margin: 1rem 0;
    flex-shrink: 0;
    width: 100%;
    max-width: 400px;
}

.slider-value-container {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color-light);
    margin-top: 1rem;
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.1);
}

#slider-value {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--tertiary-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    min-width: 3rem;
    transition: all 0.3s ease;
}

/* Enhanced Options Grid */
.difficulty-slots,
.options-grid {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1rem;
    flex-shrink: 0;
}

.difficulty-slot-btn,
.round-slot-btn {
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-radius: 12px;
    background: linear-gradient(145deg, var(--tertiary-bg), var(--quaternary-bg));
    border: 2px solid var(--border-color);
    color: var(--text-color-light);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-width: 100px;
}

.difficulty-slot-btn:hover,
.round-slot-btn:hover {
    transform: translateY(-5px) scale(1.05);
    border-color: var(--text-color-light);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
}

.difficulty-slot-btn:active,
.round-slot-btn:active {
    transform: translateY(-2px) scale(1.02);
}

/* Progress Indicator */
.setup-progress {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1rem;
    z-index: 1002;
}

.progress-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-color);
    transition: all 0.3s ease;
}

.progress-dot.active {
    background: var(--text-color-light);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    transform: scale(1.2);
}

.progress-dot.completed {
    background: var(--text-color-light);
    transform: scale(0.8);
}

/* Screen-specific enhancements */
.player-select-screen.active {
    transform: translateX(0);
    opacity: 1;
    z-index: 1001;
}

.difficulty-select-screen.active {
    transform: translateX(0);
    opacity: 1;
    z-index: 1001;
}

.round-select-screen.active {
    transform: translateX(0);
    opacity: 1;
    z-index: 1001;
}

/* Floating particles background effect */
.setup-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        radial-gradient(circle at 40% 60%, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 50px 50px, 80px 80px, 120px 120px;
    animation: floatingParticles 20s linear infinite;
    pointer-events: none;
}

@keyframes floatingParticles {
    0% {
        transform: translateY(0) rotate(0deg);
    }

    100% {
        transform: translateY(-100px) rotate(360deg);
    }
}

/* Mobile responsiveness for setup screens */
@media (max-width: 768px) {
    .setup-screen .card-content {
        padding: 2rem;
        margin: 1rem;
    }

    .setup-screen h2 {
        font-size: 2.2rem;
    }

    .difficulty-slots,
    .options-grid {
        flex-direction: column;
        align-items: center;
    }

    .difficulty-slot-btn,
    .round-slot-btn {
        width: 100%;
        max-width: 300px;
    }
}

/* Team Setup Screen Styles */
.team-setup-container {
    width: 100%;
    max-width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

.add-player-section {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
    flex-shrink: 0;
}

.add-player-section input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--secondary-bg);
    color: var(--text-color-light);
    font-size: 16px;
    /* Prevent zoom on mobile */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    touch-action: manipulation;
    -webkit-user-select: text;
    user-select: text;
    min-height: 48px;
    /* Better touch target */
}

.add-player-section input:focus {
    outline: none;
    border-color: var(--text-color-light);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

/* Mobile-specific team setup fixes */
@media (max-width: 768px) {
    .add-player-section {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .add-player-section input {
        font-size: 16px !important;
        padding: 1rem 1.25rem;
        min-height: 52px;
        width: 100%;
        box-sizing: border-box;
    }

    .add-player-section button {
        min-height: 52px;
        font-size: 16px;
        padding: 1rem 2rem;
    }
}

.players-setup {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.available-players-section {
    text-align: center;
    flex-shrink: 0;
    margin-bottom: 0.5rem;
}

.available-players-section h3 {
    color: var(--text-color-light);
    margin-bottom: 1rem;
}

.teams-setup {
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.team-setup {
    flex: 1;
    background: linear-gradient(145deg, var(--tertiary-bg), var(--quaternary-bg));
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.team-setup h3 {
    color: var(--text-color-light);
    text-align: center;
    margin-bottom: 1rem;
}

.leader-slot {
    background: var(--secondary-bg);
    border: 2px dashed var(--text-color-muted);
    border-radius: var(--border-radius);
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    min-height: 50px;
    text-align: center;
    flex-shrink: 0;
}

.leader-label {
    display: block;
    color: var(--text-color-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.leader-container {
    min-height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.players-list {
    background: var(--secondary-bg);
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.5rem;
    min-height: 60px;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: flex-start;
    align-content: flex-start;
    flex: 1;
    overflow: hidden;
}

.players-list:empty::before {
    content: 'Drop players here';
    color: var(--text-color-muted);
    font-style: italic;
    width: 100%;
    text-align: center;
    line-height: 60px;
}

/* Word Generation Screen Styles */
.word-generation-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--text-color-light);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.generated-word-display {
    text-align: center;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.generated-word-display h3 {
    color: var(--text-color-light);
    margin-bottom: 1rem;
}

.word-reveal {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-color-light);
    background: linear-gradient(145deg, var(--tertiary-bg), var(--quaternary-bg));
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem 1.5rem;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.1em;
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90vw;
    box-sizing: border-box;
}

.game-info {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.game-info p {
    margin: 0.5rem 0;
    color: var(--text-color-dark);
}

.game-info strong {
    color: var(--text-color-light);
}

/* Mobile responsiveness for team setup */
@media (max-width: 768px) {
    .teams-setup {
        flex-direction: column;
        gap: 1.5rem;
    }

    .team-setup {
        padding: 1.5rem;
        border-width: 2px;
    }

    .leader-slot {
        padding: 1.5rem;
        min-height: 80px;
        border-width: 3px;
    }

    .players-list {
        padding: 1.5rem;
        min-height: 100px;
        border-width: 3px;
    }

    .word-reveal {
        font-size: 2rem;
        padding: 1rem 1.5rem;
    }

    /* Better touch targets for mobile */
    .setup-screen .btn {
        min-height: 52px;
        font-size: 16px;
        padding: 1rem 2rem;
        touch-action: manipulation;
    }

    .setup-screen .card-content {
        padding: 2rem 1.5rem;
        margin: 1rem;
        max-width: calc(100vw - 2rem);
        box-sizing: border-box;
    }
}

/* Enhanced drag and drop for team setup */
.leader-slot.drag-over,
.players-list.drag-over {
    border-color: var(--text-color-light);
    background: var(--tertiary-bg);
    border-style: solid;
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.team-setup .player {
    background: var(--text-color-light);
    color: var(--primary-bg);
    padding: 0.75rem 1.25rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: grab;
    transition: all 0.3s ease;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    min-height: 48px;
    min-width: 80px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 16px;
    margin: 4px;
    box-sizing: border-box;
}

.team-setup .player:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

/* Mobile-specific player element styling */
@media (max-width: 768px) {
    .team-setup .player {
        padding: 1rem 1.5rem;
        min-height: 52px;
        font-size: 16px;
        margin: 6px;
        cursor: pointer;
        /* Better for touch */
    }

    .team-setup .player::after {
        content: '⋮⋮';
        margin-left: 8px;
        opacity: 0.6;
        font-size: 14px;
    }
}

/* Mobile-specific fixes for team setup functionality */
@media (max-width: 768px) {

    /* Ensure team setup screen fits without scrolling */
    #team-setup-screen {
        overflow: hidden !important;
        padding: 0.25rem;
        justify-content: center;
        align-items: center;
    }

    #team-setup-screen .card-content {
        height: calc(100vh - 0.5rem) !important;
        max-height: calc(100vh - 0.5rem) !important;
        overflow: hidden !important;
        padding: 0.5rem !important;
        margin: 0 !important;
        width: calc(100vw - 0.5rem) !important;
        max-width: calc(100vw - 0.5rem) !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
    }

    #team-setup-screen h2 {
        font-size: 1.2rem !important;
        margin-bottom: 0.5rem !important;
        flex-shrink: 0 !important;
    }

    /* Better mobile team setup container */
    .team-setup-container {
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    /* Better mobile input styling */
    #player-name-input {
        width: 100% !important;
        box-sizing: border-box !important;
        font-size: 16px !important;
        padding: 1rem 1.25rem !important;
        min-height: 52px !important;
        border: 2px solid var(--border-color) !important;
        border-radius: 12px !important;
        background: var(--secondary-bg) !important;
        color: var(--text-color-light) !important;
        -webkit-user-select: text !important;
        user-select: text !important;
        touch-action: manipulation !important;
        -webkit-appearance: none !important;
        appearance: none !important;
    }

    /* Enhanced mobile drag zones */
    .players-list,
    .leader-slot {
        min-height: 120px !important;
        padding: 1.5rem !important;
        border-width: 3px !important;
        touch-action: none !important;
        -webkit-user-select: none !important;
        user-select: none !important;
        margin: 0.5rem 0 !important;
        border-radius: 12px !important;
        font-size: 16px !important;
    }

    /* Mobile teams setup layout - optimized for no scrolling */
    .teams-setup {
        flex-direction: row !important;
        gap: 0.3rem !important;
        width: 100% !important;
        justify-content: space-between !important;
        height: 100% !important;
        overflow: hidden !important;
    }

    .team-setup {
        width: 48% !important;
        flex: 1 !important;
        margin-bottom: 0 !important;
        padding: 0.4rem !important;
        border-radius: 8px !important;
        min-width: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    .team-setup h3 {
        font-size: 0.9rem !important;
        margin-bottom: 0.3rem !important;
        text-align: center !important;
        flex-shrink: 0 !important;
    }

    /* Compact leader slots for mobile */
    .leader-slot {
        min-height: 40px !important;
        padding: 0.3rem !important;
        margin-bottom: 0.3rem !important;
        flex-shrink: 0 !important;
    }

    .leader-label {
        font-size: 0.75rem !important;
        margin-bottom: 0.2rem !important;
    }

    /* Compact players list for mobile */
    .team-setup .players-list {
        min-height: 50px !important;
        padding: 0.3rem !important;
        flex: 1 !important;
        overflow: hidden !important;
    }

    /* Compact mobile player elements */
    .player {
        min-height: 32px !important;
        min-width: 60px !important;
        padding: 0.4rem 0.6rem !important;
        font-size: 12px !important;
        margin: 2px !important;
        touch-action: none !important;
        -webkit-user-select: none !important;
        user-select: none !important;
        cursor: pointer !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        box-sizing: border-box !important;
        border-radius: 6px !important;
        font-weight: 500 !important;
        border: 1px solid var(--border-color) !important;
        word-break: break-word !important;
        hyphens: auto !important;
        line-height: 1.2 !important;
    }

    /* Visual indicator for mobile drag */
    .player::after {
        content: '⋮⋮' !important;
        margin-left: 8px !important;
        opacity: 0.6 !important;
        font-size: 14px !important;
    }

    /* Compact mobile button styling */
    #add-player-btn,
    #confirm-teams-btn {
        min-height: 44px !important;
        font-size: 14px !important;
        padding: 0.8rem 1.5rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
        touch-action: manipulation !important;
        border-radius: 8px !important;
        margin: 0.3rem 0 !important;
        flex-shrink: 0 !important;
    }

    /* Compact mobile add player section */
    .add-player-section {
        flex-direction: row !important;
        gap: 0.5rem !important;
        margin-bottom: 0.5rem !important;
        width: 100% !important;
        flex-shrink: 0 !important;
    }

    .add-player-section input {
        flex: 1 !important;
        margin-bottom: 0 !important;
        min-height: 44px !important;
        font-size: 14px !important;
        padding: 0.8rem !important;
    }

    .add-player-section button {
        min-height: 44px !important;
        font-size: 14px !important;
        padding: 0.8rem 1rem !important;
        white-space: nowrap !important;
    }

    /* Compact available players section mobile */
    .available-players-section {
        margin-bottom: 0.5rem !important;
        flex-shrink: 0 !important;
    }

    .available-players-section h3 {
        font-size: 1rem !important;
        margin-bottom: 0.3rem !important;
    }

    #available-players-setup {
        min-height: 40px !important;
        padding: 0.3rem !important;
        margin-bottom: 0.5rem !important;
    }

    /* Mobile-specific drag feedback */
    .player.long-press-active {
        transform: scale(1.1) !important;
        box-shadow: 0 0 25px rgba(255, 255, 255, 0.5) !important;
        z-index: 1000 !important;
        background: var(--text-color-light) !important;
        color: var(--primary-bg) !important;
        border-color: var(--text-color-light) !important;
    }

    .player.dragging {
        transform: scale(1.2) rotate(3deg) !important;
        box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9) !important;
        z-index: 9999 !important;
        opacity: 0.95 !important;
        background: var(--text-color-light) !important;
        color: var(--primary-bg) !important;
        border: 3px solid var(--text-color-muted) !important;
    }

    /* Enhanced drop zone feedback for mobile */
    .players-list.drag-over,
    .leader-slot.drag-over {
        transform: scale(1.05) !important;
        border-color: var(--text-color-light) !important;
        background: var(--tertiary-bg) !important;
        box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.2) !important;
        animation: mobileDragPulse 1s ease-in-out infinite !important;
    }

    @keyframes mobileDragPulse {

        0%,
        100% {
            box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.2);
        }

        50% {
            box-shadow: inset 0 0 40px rgba(255, 255, 255, 0.4);
        }
    }
}

/* Ensure mobile viewport is properly handled */
@media screen and (max-width: 768px) {
    html {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }

    body {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        -webkit-tap-highlight-color: transparent;
    }

    /* Fix for iOS Safari input zoom */
    input[type="text"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px !important;
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
    }
}

/*
 Mobile move options styling */
@media (max-width: 768px) {
    .move-options-modal {
        z-index: 10001 !important;
    }

    .move-options-content {
        width: 95% !important;
        max-width: 95% !important;
        padding: 1.5rem !important;
        border-radius: 16px !important;
    }

    .mobile-move-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.8rem;
        width: 100%;
    }

    .mobile-move-btn {
        min-height: 56px !important;
        font-size: 16px !important;
        padding: 1.2rem !important;
        border-radius: 12px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        touch-action: manipulation !important;
        font-weight: 600 !important;
    }

    .move-options-content h3 {
        font-size: 1.4rem !important;
        margin-bottom: 1.5rem !important;
        text-align: center !important;
        color: var(--text-color-light) !important;
    }
}

/* Enhanced mobile drag zone feedback */
@media (max-width: 768px) {

    .players-list.drag-over,
    .leader-slot.drag-over,
    #available-players-setup.drag-over,
    #team1-players-setup.drag-over,
    #team2-players-setup.drag-over,
    #team1-leader-container.drag-over,
    #team2-leader-container.drag-over {
        transform: scale(1.02) !important;
        border-color: var(--text-color-light) !important;
        background: var(--quaternary-bg) !important;
        box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.3) !important;
        animation: mobileDragPulse 1s ease-in-out infinite !important;
        border-width: 4px !important;
        border-style: solid !important;
    }

    @keyframes mobileDragPulse {

        0%,
        100% {
            box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.3);
        }

        50% {
            box-shadow: inset 0 0 40px rgba(255, 255, 255, 0.5);
        }
    }
}

/* Mobile instruction text */
@media (max-width: 768px) {
    .team-setup-container::before {
        content: "Tap a player to move them, or long-press and drag";
        display: block;
        text-align: center;
        color: var(--text-color-muted);
        font-size: 0.9rem;
        margin-bottom: 1rem;
        padding: 0.5rem;
        background: var(--tertiary-bg);
        border-radius: 8px;
        border: 1px solid var(--border-color);
    }
}

/* 
Final start game button styling */
#final-start-game-btn {
    margin-top: 1rem;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    background: linear-gradient(145deg, var(--text-color-light), var(--text-color-dark));
    color: var(--primary-bg);
    border: none;
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 1px;
    flex-shrink: 0;
    width: 100%;
    max-width: 300px;
    box-sizing: border-box;
}

#final-start-game-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 35px rgba(255, 255, 255, 0.3);
    background: linear-gradient(145deg, var(--text-color-dark), var(--text-color-light));
}

#final-start-game-btn:active {
    transform: translateY(-1px) scale(1.02);
}

/* Mobile styling for final start button */
@media (max-width: 768px) {
    #final-start-game-btn {
        width: 100% !important;
        max-width: 100% !important;
        margin-top: 0.8rem !important;
        padding: 0.8rem 1.5rem !important;
        font-size: 14px !important;
        min-height: 48px !important;
        touch-action: manipulation !important;
        flex-shrink: 0 !important;
    }

    /* Mobile error modal improvements */
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        padding: 1.5rem !important;
        margin: 1rem !important;
        border-radius: 16px !important;
    }

    .close-btn {
        font-size: 2rem !important;
        padding: 0.5rem !important;
        min-width: 44px !important;
        min-height: 44px !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
    }

    /* Mobile team log improvements */
    .team-log {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }

    .log-input-container {
        flex-direction: column !important;
        gap: 0.8rem !important;
    }

    .log-input-container input {
        width: 100% !important;
        font-size: 16px !important;
        min-height: 52px !important;
        padding: 1rem 1.25rem !important;
    }

    .mic-btn {
        min-height: 52px !important;
        min-width: 52px !important;
        font-size: 1.5rem !important;
        touch-action: manipulation !important;
    }

    .log-btn {
        width: 100% !important;
        min-height: 52px !important;
        font-size: 16px !important;
        margin-top: 0.5rem !important;
        touch-action: manipulation !important;
    }
}

/* Word generation screen improvements */
.word-generation-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
    flex: 1;
    overflow: hidden;
    justify-content: space-between;
}

.generated-word-display {
    text-align: center;
    opacity: 0;
    transition: opacity 0.5s ease;
    margin: 1rem 0;
}

.game-info {
    background: linear-gradient(145deg, var(--secondary-bg), var(--tertiary-bg));
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.5s ease;
    width: 100%;
    max-width: 100%;
    text-align: center;
    flex-shrink: 0;
    box-sizing: border-box;
}

.game-info p {
    margin: 0.5rem 0;
    color: var(--text-color-dark);
    font-size: 0.9rem;
}

.game-info strong {
    color: var(--text-color-light);
    font-weight: 600;
}

/* Mobile word generation adjustments */
@media (max-width: 768px) {
    .word-generation-container {
        gap: 0.8rem;
        padding: 0 0.5rem;
        height: 100%;
        justify-content: space-evenly;
    }

    .word-section {
        padding: 0.8rem !important;
        margin: 0.3rem 0 !important;
    }

    .word-section h3 {
        font-size: 1rem !important;
        margin-bottom: 0.5rem !important;
    }

    .game-info {
        padding: 0.8rem !important;
        margin: 0 !important;
    }

    .game-info p {
        font-size: 0.8rem !important;
        margin: 0.3rem 0 !important;
    }

    /* Mobile word display improvements */
    #current-word,
    #game-current-word {
        font-size: 1.3rem !important;
        padding: 0.6rem 1rem !important;
        min-width: 120px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 85vw !important;
        text-align: center !important;
        touch-action: manipulation !important;
        box-sizing: border-box !important;
    }

    .word-reveal {
        font-size: 1.4rem !important;
        padding: 0.8rem 1rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 85vw !important;
        box-sizing: border-box !important;
    }

    /* Mobile button improvements */
    .word-controls .btn {
        min-height: 44px !important;
        font-size: 14px !important;
        padding: 0.8rem 1.2rem !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
        margin: 0.2rem !important;
    }

    /* Disabled button styling */
    .word-controls .btn:disabled {
        opacity: 0.5 !important;
        cursor: not-allowed !important;
        background: var(--border-color) !important;
        color: var(--text-color-muted) !important;
        border-color: var(--border-color) !important;
        transform: none !important;
        box-shadow: none !important;
    }

    .word-controls {
        gap: 0.5rem !important;
        margin-top: 0.5rem !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
    }

    /* Mobile hide word effect */
    #current-word.word-hidden,
    #game-current-word.word-hidden {
        filter: blur(12px) !important;
        user-select: none !important;
        pointer-events: none !important;
    }
}

/* Game Screen Styling */
.game-screen {
    background: linear-gradient(145deg, var(--secondary-bg), var(--tertiary-bg));
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin: 0.5rem;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    height: calc(100vh - 120px); /* Account for navbar and margins */
    min-height: 0;
}

.game-screen h2 {
    color: var(--text-color-light);
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.current-word-display {
    text-align: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background: linear-gradient(145deg, var(--tertiary-bg), var(--quaternary-bg));
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.current-word-display h3 {
    color: var(--text-color-light);
    margin-bottom: 0.8rem;
    font-size: 1.3rem;
}

#game-current-word {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-color-light);
    background: var(--tertiary-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.8rem 1rem;
    margin: 0.5rem 0;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.1em;
    display: inline-block;
    min-width: 150px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 85vw;
    box-sizing: border-box;
}

.current-word-display .word-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

/* Mobile game screen adjustments */
@media (max-width: 768px) {
    .game-screen {
        padding: 0.8rem;
        margin: 0.25rem;
        height: calc(100vh - 80px); /* Smaller navbar on mobile */
    }
    
    .game-screen h2 {
        font-size: 1.3rem;
        margin-bottom: 0.8rem;
    }
    
    .current-word-display {
        padding: 0.8rem;
        margin-bottom: 0.8rem;
    }
    
    .current-word-display h3 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    #game-current-word {
        font-size: 1.4rem !important;
        padding: 0.6rem 0.8rem;
        min-width: 120px;
        margin: 0.3rem 0;
    }
    
    .current-word-display .word-controls {
        flex-direction: row;
        gap: 0.5rem;
        margin-top: 0.5rem;
    }
    
    .current-word-display .word-controls .btn {
        min-height: 40px;
        font-size: 14px;
        padding: 0.6rem 1rem;
        flex: 1;
    }
    
    .team-log h3 {
        font-size: 1.1rem;
        margin-bottom: 0.6rem;
    }
    
    .log-input-container {
        margin-bottom: 0.6rem;
    }
    
    .log-input-container input {
        font-size: 14px;
        padding: 0.7rem;
        min-height: 44px;
    }
    
    .mic-btn {
        min-height: 44px;
        min-width: 44px;
        font-size: 1.2rem;
    }
    
    .log-btn {
        min-height: 44px;
        font-size: 14px;
        margin-bottom: 0.6rem;
    }
    
    .log-display {
        font-size: 0.85rem;
        padding: 0.6rem;
    }
    
    .log-entry {
        padding: 6px 8px;
        margin-bottom: 3px;
    }
    
    .log-entry .message {
        font-size: 0.85rem;
    }
    
    .log-entry .timestamp {
        font-size: 0.7rem;
    }
}

/* Word section styling for word generation screen */
.word-section {
    text-align: center;
    margin: 0.5rem 0;
    padding: 1rem;
    background: linear-gradient(145deg, var(--tertiary-bg), var(--quaternary-bg));
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    opacity: 0;
    transition: opacity 0.5s ease;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

.word-section h3 {
    color: var(--text-color-light);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.word-section .word-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

/* Mobile word section adjustments */
@media (max-width: 768px) {
    .word-section {
        padding: 1rem;
        margin: 1rem 0;
    }

    .word-section .word-controls {
        flex-direction: column;
        gap: 0.8rem;
    }

    .word-section .word-controls .btn {
        min-height: 48px;
        font-size: 16px;
    }
}
