/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-color: #f093fb;
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --background-dark: #0f0f23;
    --background-darker: #0a0a1a;
    --surface: #1a1a2e;
    --surface-hover: #16213e;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b7f;
    --success: #00d2ff;
    --warning: #ff6b6b;
    --border: #2d2d44;
    --glow-color: rgba(102, 126, 234, 0.3);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Roboto', sans-serif;
    background: var(--background-dark);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Hide scrollbars when not on welcome screen */
body:not(.welcome-active) {
    overflow: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(240, 147, 251, 0.1) 0%, transparent 50%),
        var(--background-dark);
    z-index: -1;
}

/* Welcome Screen Styles */
.welcome-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem 2rem 2rem;
    text-align: center;
    width: 100%;
}

.main-title {
    font-family: 'Orbitron', monospace;
    font-size: 4.5rem;
    font-weight: 900;
    margin-bottom: 2rem;
    margin-top: 1rem;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    display: inline-block;
    width: 100%;
}

.main-title::after {
    content: 'P43D';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: blur(8px);
    z-index: -1;
    opacity: 0.4;
}


.welcome-content {
    text-align: left;
    margin-bottom: 2rem;
}

.presentation,
.rules,
.features {
    background: var(--surface);
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.presentation:hover,
.rules:hover,
.features:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.presentation h3,
.rules h3,
.features h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.presentation p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 1.1rem;
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.rule-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: var(--background-darker);
    padding: 1.5rem;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.rule-icon {
    font-size: 2rem;
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-gradient);
    border-radius: 8px;
}

.rule-text h4 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.rule-text p {
    color: var(--text-secondary);
    line-height: 1.5;
    font-size: 0.9rem;
}

.features-list {
    list-style: none;
    margin-top: 1rem;
}

.features-list li {
    color: var(--text-secondary);
    padding: 0.5rem 0;
    position: relative;
    padding-left: 2rem;
    line-height: 1.5;
}

.features-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
    font-size: 1.1rem;
}

.btn-large {
    padding: 1rem 3rem;
    font-size: 1.3rem;
    margin-top: 1rem;
}

.game-modes {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 600px;
    margin: 0 auto;
}

.btn-mode {
    padding: 1.5rem 2rem;
    text-align: left;
    position: relative;
    background: var(--surface);
    border: 2px solid var(--border);
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-mode:hover:not(:disabled) {
    transform: translateY(-3px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.btn-mode.btn-primary {
    border-color: var(--primary-color);
}

.btn-mode.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.btn-mode.btn-secondary {
    border-color: var(--secondary-color);
}

.btn-mode.btn-secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(240, 147, 251, 0.1) 0%, rgba(245, 87, 108, 0.1) 100%);
    border-color: var(--secondary-color);
}

.btn-mode.btn-tertiary {
    border-color: var(--text-muted);
    color: var(--text-muted);
    cursor: pointer;
}

.btn-mode.btn-tertiary:disabled {
    cursor: not-allowed;
}

.btn-mode:disabled {
    opacity: 0.5;
}

.btn-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ========== MOBILE RESPONSIVE DESIGN ========== */

/* Large mobile screens (portrait tablets) */
@media (max-width: 768px) {
    /* Welcome Screen Mobile */
    .welcome-container {
        padding: 1.5rem 1rem 2rem;
        max-width: 100%;
    }

    .main-title {
        font-size: 3.2rem;
        margin-bottom: 1.5rem;
        margin-top: 0.5rem;
    }

    .welcome-content {
        margin-bottom: 2.5rem;
    }

    .presentation,
    .rules,
    .features {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .rules-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .rule-item {
        padding: 1.2rem;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1rem;
    }

    .rule-icon {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.5rem;
    }

    .game-modes {
        gap: 1.2rem;
    }

    .btn-mode {
        padding: 1.2rem 1.5rem;
        font-size: 1.1rem;
    }

    /* Game UI Mobile */
    .game-ui {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }

    .current-player {
        margin-bottom: 0;
    }

    .player-info {
        gap: 0.8rem;
    }

    .player-avatar {
        width: 50px;
        height: 50px;
    }

    .player-name {
        font-size: 1.1rem;
    }

    .turn-text {
        font-size: 0.85rem;
    }

    /* Bottom UI Mobile */
    .bottom-ui {
        padding: 1rem;
        flex-direction: column-reverse;
        gap: 1.5rem;
    }

    .players-status {
        flex-direction: row;
        justify-content: space-around;
        gap: 1rem;
    }

    .player-status {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        padding: 0.8rem;
        min-width: 120px;
    }

    .status-avatar {
        width: 45px;
        height: 45px;
    }

    .status-name {
        font-size: 0.9rem;
    }

    .status-wins {
        font-size: 0.8rem;
    }

    /* Game Controls Mobile */
    .game-controls {
        justify-content: center;
        gap: 2rem;
    }

    .control-wrapper {
        align-items: center;
    }

    .control-btn {
        width: 50px;
        height: 50px;
        padding: 0;
    }

    .control-btn svg {
        width: 24px;
        height: 24px;
    }

    .control-label {
        font-size: 0.8rem;
        margin-top: 0.3rem;
    }

    /* Confirmation Popup Mobile */
    .confirmation-popup {
        padding: 1rem;
    }

    .confirmation-content {
        min-width: auto;
        max-width: 90%;
        padding: 1.5rem;
    }

    .confirmation-actions {
        flex-direction: column;
        gap: 0.8rem;
    }

    .confirmation-actions .btn {
        width: 100%;
        padding: 0.8rem 1rem;
    }

    /* Modal Mobile */
    .modal-content {
        margin: 1rem;
        max-width: calc(100vw - 2rem);
        max-height: calc(100vh - 2rem);
    }

    .modal-body {
        padding: 1rem;
    }

    /* Victory/Pause Screens Mobile */
    .victory-container,
    .pause-container {
        padding: 1rem;
    }

    .victory-content,
    .pause-content {
        padding: 2rem 1.5rem;
        max-width: 90%;
    }

    .victory-actions,
    .pause-actions {
        flex-direction: column;
        gap: 1rem;
    }

    .victory-actions .btn,
    .pause-actions .btn {
        width: 100%;
        padding: 1rem;
    }
}

/* Small mobile screens */
@media (max-width: 480px) {
    .welcome-container {
        padding: 1rem 0.8rem 1.5rem;
    }

    .main-title {
        font-size: 2.5rem;
        margin-bottom: 1.2rem;
    }

    .presentation,
    .rules,
    .features {
        padding: 1.2rem;
        margin-bottom: 1.2rem;
    }

    .presentation h3,
    .rules h3,
    .features h3 {
        font-size: 1.3rem;
    }

    .presentation p {
        font-size: 1rem;
    }

    .rule-item {
        padding: 1rem;
    }

    .rule-text h4 {
        font-size: 1rem;
    }

    .rule-text p {
        font-size: 0.85rem;
    }

    .btn-mode {
        padding: 1rem 1.2rem;
        font-size: 1rem;
    }

    .btn-subtitle {
        font-size: 0.85rem;
    }

    /* Game UI Extra Small */
    .game-ui {
        padding: 0.8rem;
    }

    .player-avatar {
        width: 45px;
        height: 45px;
    }

    .player-name {
        font-size: 1rem;
    }

    .turn-text {
        font-size: 0.8rem;
    }

    .bottom-ui {
        padding: 0.8rem;
    }

    .player-status {
        padding: 0.6rem;
        min-width: 100px;
    }

    .status-avatar {
        width: 40px;
        height: 40px;
    }

    .status-name {
        font-size: 0.85rem;
    }

    .status-wins {
        font-size: 0.75rem;
    }

    .control-btn {
        width: 45px;
        height: 45px;
    }

    .control-btn svg {
        width: 22px;
        height: 22px;
    }

    .control-label {
        font-size: 0.75rem;
    }
}

/* Extra small screens (very small phones) */
@media (max-width: 350px) {
    .main-title {
        font-size: 2.2rem;
    }

    .welcome-container {
        padding: 0.8rem 0.5rem 1.2rem;
    }

    .presentation,
    .rules,
    .features {
        padding: 1rem;
    }

    .rule-item {
        padding: 0.8rem;
        gap: 0.8rem;
    }

    .rule-icon {
        width: 2.2rem;
        height: 2.2rem;
        font-size: 1.3rem;
    }

    .btn-mode {
        padding: 0.8rem 1rem;
        font-size: 0.95rem;
    }

    .game-ui {
        padding: 0.6rem;
    }

    .bottom-ui {
        padding: 0.6rem;
        gap: 1rem;
    }

    .players-status {
        gap: 0.5rem;
    }

    .player-status {
        padding: 0.5rem;
        min-width: 90px;
    }

    .game-controls {
        gap: 1.5rem;
    }
}


/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    padding-top: 2rem;
}

/* Welcome screen specific - allow scrolling */
#welcome-screen {
    overflow-y: auto;
}

/* Config screen specific - allow scrolling */
#config-screen {
    overflow-y: auto;
}

/* Game screen specific - full viewport for UI elements */
#game-screen {
    align-items: stretch;
    justify-content: stretch;
    padding-top: 0;
}

/* Pause and Victory screens - centered vertically */
#pause-screen,
#victory-screen {
    align-items: center;
    padding-top: 0;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

.screen.overlay {
    background: rgba(15, 15, 35, 0.7);
    backdrop-filter: blur(5px);
}

/* Configuration Screen */
.config-container {
    background: var(--surface);
    padding: 2rem;
    border-radius: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    max-width: 500px;
    width: 90%;
    margin: 0;
}

.config-container h2 {
    font-family: 'Orbitron', monospace;
    font-size: 1.7rem;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--text-primary);
}

.player-config {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1.5rem;
    align-items: start;
    margin-bottom: 2rem;
}

.player-section {
    background: var(--background-darker);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
}

.player-section h3 {
    font-family: 'Orbitron', monospace;
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--primary-color);
}

.vs-divider {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: var(--secondary-color);
    align-self: center;
    text-shadow: 0 0 20px var(--secondary-color);
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-group input[type="text"] {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.input-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--glow-color);
}

.profile-suggestions {
    margin-top: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface);
    max-height: 200px;
    overflow-y: auto;
}

.profile-suggestion {
    padding: 0.8rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.profile-suggestion:last-child {
    border-bottom: none;
}

.profile-suggestion:hover {
    background: var(--surface-hover);
}

.profile-suggestion-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border);
}

.profile-suggestion-name {
    color: var(--text-primary);
    font-weight: 500;
}

.color-picker {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.color-picker input[type="color"] {
    width: 60px;
    height: 40px;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    background: none;
}

.color-preview {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border);
    transition: var(--transition);
}

.config-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.config-actions .btn {
    width: 200px;
}

/* Buttons */
.btn {
    position: relative;
    padding: 1rem 2rem;
    border: none;
    border-radius: 0.8rem;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 20px var(--glow-color);
}

.btn-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.3) 50%, transparent 70%);
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
    transition: transform 0.6s;
}

.btn-primary:hover .btn-glow {
    transform: translateX(100%) translateY(100%) rotate(45deg);
}

#start-game {
    width: 100%;
    margin-top: 1rem;
}

/* Game Screen */
.game-ui {
    position: absolute;
    top: 8rem;
    left: 2rem;
    right: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 50;
    pointer-events: none;
}

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

.current-player {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.player-avatar, .current-avatar, .status-avatar, .winner-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid var(--border);
    transition: var(--transition);
}

.player-details {
    display: flex;
    flex-direction: column;
}

.player-name {
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.turn-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.game-controls {
    display: flex;
    gap: 1rem;
    background: var(--surface);
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

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

.control-btn {
    width: 50px;
    height: 50px;
    background: var(--background-darker);
    border: 1px solid var(--border);
    border-radius: 0.8rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: var(--surface-hover);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.control-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}


.game-stats {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    gap: 2rem;
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.stat-value {
    display: block;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.game-container {
    width: 100%;
    height: 100vh;
    position: relative;
    cursor: grab;
    touch-action: none; /* Disable browser touch gestures */
    user-select: none; /* Prevent text selection */
}

.game-container:active {
    cursor: grabbing;
}

/* Touch-specific improvements */
@media (hover: none) and (pointer: coarse) {
    .game-container {
        cursor: default;
    }

    .game-container:active {
        cursor: default;
    }
}

.bottom-ui {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    right: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 50;
    gap: 2rem;
}

.players-status {
    display: flex;
    gap: 2rem;
}

.player-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface);
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.player-status.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 20px var(--glow-color);
}

.status-name {
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
}

.status-wins {
    font-size: 0.85em;
    color: var(--text-secondary);
    font-weight: 400;
    text-align: center;
}

/* Pause Screen */
.pause-container {
    background: var(--surface);
    padding: 3rem;
    border-radius: 2rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    text-align: center;
    max-width: 500px;
    width: 90%;
    backdrop-filter: blur(10px);
    margin: 0;
}

.pause-title {
    font-family: 'Orbitron', monospace;
    font-size: 2.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.pause-message {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
}

.pause-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 2rem;
}

.pause-actions .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    min-height: 60px;
}

.pause-actions .btn svg {
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .pause-actions {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .pause-container {
        padding: 2rem;
        width: 95%;
    }

    .pause-title {
        font-size: 2rem;
    }
}

/* Victory Screen */
.victory-container {
    background: var(--surface);
    padding: 3rem;
    border-radius: 2rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    text-align: center;
    max-width: 700px;
    width: 90%;
    margin: 0;
}

.victory-title {
    font-family: 'Orbitron', monospace;
    font-size: 3rem;
    background: var(--secondary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2rem;
}

.winner-info {
    margin-bottom: 2rem;
}

.winner-avatar {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
}

.winner-name {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.victory-message {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.victory-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--background-darker);
    border-radius: 1rem;
    border: 1px solid var(--border);
}

.victory-stat {
    text-align: center;
}

.victory-stat-value {
    display: block;
    font-family: 'Orbitron', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.victory-stat-label {
    color: var(--text-secondary);
    font-size: 1rem;
}

.victory-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.victory-actions .btn {
    flex: 1;
    text-align: center;
    justify-content: center;
    display: flex;
    align-items: center;
}

/* Winning Line Panel Styles */
.winning-line-panel {
    position: absolute;
    top: 50%;
    right: 2rem;
    transform: translateY(-50%);
    width: 350px;
    z-index: 100;
    transition: all 0.3s ease-in-out;
    opacity: 1;
    pointer-events: all;
}

.winning-line-panel.hidden {
    opacity: 0;
    transform: translateY(-50%) translateX(50px);
    pointer-events: none;
}

.winning-line-content {
    background: var(--surface);
    border-radius: 25px;
    padding: 2rem;
    text-align: center;
    border: 2px solid var(--border);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
    width: 100%;
    position: relative;
    overflow: hidden;
}

.winning-line-content::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg,
        transparent,
        rgba(102, 126, 234, 0.1),
        transparent,
        rgba(240, 147, 251, 0.1),
        transparent
    );
    animation: shimmer 3s linear infinite;
    z-index: -1;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.winning-line-title {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
    background: linear-gradient(45deg, #ffd700, #ffed4e, #ffd700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
    animation: glow-pulse 2s ease-in-out infinite alternate;
}

@keyframes glow-pulse {
    0% { text-shadow: 0 0 20px rgba(255, 215, 0, 0.3); }
    100% { text-shadow: 0 0 40px rgba(255, 215, 0, 0.8), 0 0 60px rgba(255, 215, 0, 0.4); }
}

.winning-player-info {
    margin: 1.5rem 0;
}

.winning-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    border: 3px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.4);
    animation: winner-bounce 1.5s ease-in-out infinite;
}

@keyframes winner-bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.05); }
}

.winning-player-name {
    font-family: 'Orbitron', monospace;
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0.5rem 0 0.3rem;
    color: var(--text-primary);
}

.winning-message {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0;
}

.winning-line-actions {
    margin-top: 2rem;
}

.winning-line-actions .btn {
    font-size: 1rem;
    padding: 0.8rem 1.5rem;
    min-width: 150px;
}

/* Responsive Design for Winning Line Panel */
@media (max-width: 1200px) {
    .winning-line-panel {
        top: auto;
        bottom: 10rem;
        right: 50%;
        transform: translateX(50%);
        width: 90%;
        max-width: 400px;
    }

    .winning-line-panel.hidden {
        transform: translateX(50%) translateY(50px);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .title {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .config-container {
        padding: 2rem;
        margin-top: 4rem;
    }
    
    .player-config {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .player-section:first-child {
        order: 1;
    }

    .vs-divider {
        order: 2;
        justify-self: center;
        font-size: 1.5rem;
        margin: 0.5rem 0;
    }

    .player-section:last-child {
        order: 3;
    }
    
    .game-ui {
        flex-direction: column;
        gap: 1rem;
        top: 6rem;
        align-items: stretch;
    }
    
    .game-stats {
        gap: 1rem;
    }
    
    .bottom-ui {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .players-status {
        justify-content: space-between;
    }
    
    .game-controls {
        justify-content: center;
    }
    
    .confirmation-popup {
        width: 90%;
        max-width: 350px;
    }
    
    .confirmation-actions {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .victory-stats {
        gap: 2rem;
    }
    
    .victory-actions {
        flex-direction: column;
    }
}

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px var(--glow-color); }
    50% { box-shadow: 0 0 30px var(--glow-color), 0 0 40px var(--glow-color); }
}

.player-status.active .status-avatar {
    animation: pulse 2s infinite;
}

.current-player .player-avatar {
    animation: glow 3s infinite;
}

/* Confirmation Popup */
.confirmation-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface);
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    min-width: 300px;
}

.confirmation-popup.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.confirmation-content {
    text-align: center;
}

.confirmation-content h3 {
    font-family: 'Orbitron', monospace;
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.confirmation-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1rem;
}

.confirmation-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.confirmation-actions .btn {
    padding: 0.8rem 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ========== PROFILES MODAL STYLES ========== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    backdrop-filter: blur(8px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 1rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    animation: modalAppear 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(240, 147, 251, 0.1) 100%);
}

.modal-header h3 {
    font-family: 'Orbitron', monospace;
    color: var(--primary-color);
    font-size: 1.4rem;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.close-btn:hover {
    background: rgba(255, 107, 107, 0.1);
    color: #ff6b6b;
}

.modal-body {
    padding: 1.5rem;
    max-height: 50vh;
    overflow-y: auto;
}

.profiles-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.profile-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem;
    transition: var(--transition);
}

.profile-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.profile-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.profile-details {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.profile-name {
    font-family: 'Orbitron', monospace;
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.profile-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.profile-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.profile-color-picker {
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: none;
    padding: 0;
    border: 2px solid var(--border);
    transition: var(--transition);
}

.profile-color-picker:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.profile-select-btn {
    background: var(--primary-gradient);
    border: none;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 0.4rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    min-width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-select-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.profile-delete-btn {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    color: #ff6b6b;
    padding: 0.4rem;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.profile-delete-btn:hover {
    background: rgba(255, 107, 107, 0.2);
    border-color: #ff6b6b;
    transform: scale(1.1);
}

.profiles-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.profiles-empty p {
    margin-bottom: 1rem;
    line-height: 1.5;
}

.profiles-empty p:last-child {
    font-size: 0.9rem;
    opacity: 0.8;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: flex-end;
}

/* ========== NOTIFICATION STYLES ========== */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--primary-gradient);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 3000;
    font-weight: 500;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 300px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

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

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .profile-item {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .profile-info {
        justify-content: center;
    }

    .profile-actions {
        justify-content: center;
        gap: 1rem;
    }

    .profile-select-btn {
        flex: 1;
        min-width: 60px;
    }
}

/* ========== INVITATION MODAL STYLES ========== */

.invitation-content {
    padding: 1rem 0;
}

.invitation-step h4 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    text-align: center;
}

.invitation-link-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    align-items: center;
}

.invitation-link-input {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.75rem;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    outline: none;
    user-select: all;
}

.invitation-link-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.invitation-status {
    background: var(--surface);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: var(--transition);
    position: relative;
}

.status-indicator.active {
    background: var(--success);
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.5);
}

.status-indicator.active::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.invitation-instructions {
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.5;
    font-size: 0.95rem;
    margin: 0;
}

/* ========== ONLINE CONFIGURATION STYLES ========== */

.online-players-status {
    text-align: center;
    margin-bottom: 2rem;
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.player-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.player-status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.player-actions {
    margin-top: 1.5rem;
    text-align: center;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface);
    padding: 0.75rem 1.5rem;
    border-radius: 2rem;
    border: 1px solid var(--border);
    color: var(--success);
    font-weight: 500;
}


.ready-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    margin-right: 0.5rem;
    transition: var(--transition);
}

.ready-indicator.ready {
    background: var(--success);
    box-shadow: 0 0 8px rgba(0, 210, 255, 0.5);
}

.ready-status {
    text-align: center;
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.ready-status.all-ready {
    background: linear-gradient(135deg, rgba(0, 210, 255, 0.1) 0%, rgba(102, 126, 234, 0.1) 100%);
    border-color: var(--success);
    color: var(--success);
}

#online-player2-section.guest-view h3 {
    color: var(--text-secondary);
}

#online-player2-section.guest-view .input-group {
    opacity: 0.5;
}

#online-player2-section.guest-view input {
    background: var(--background-darker);
    pointer-events: none;
}

/* ========== COPY BUTTON ANIMATION ========== */

#copy-link.copied {
    background: var(--success) !important;
    border-color: var(--success) !important;
    transform: scale(0.95);
}

#copy-link.copied::after {
    content: '✓ Copié !';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: 500;
}

#copy-link.copied .btn-content {
    opacity: 0;
}

/* ========== RESPONSIVE DESIGN FOR ONLINE FEATURES ========== */

@media (max-width: 768px) {
    .invitation-link-container {
        flex-direction: column;
    }

    .invitation-link-input {
        margin-bottom: 0.5rem;
    }

    .status-item {
        justify-content: center;
    }

    .connection-status {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
}

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

.mobile-controls {
    display: none;
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 100;
    gap: 0.5rem;
    flex-direction: column;
}

@media (max-width: 768px) {
    .mobile-controls {
        display: flex;
    }
}

.mobile-btn {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 0.8rem;
    color: var(--text-primary);
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    min-width: 120px;
    text-align: center;
}

.mobile-btn:hover {
    border-color: var(--primary-color);
    background: var(--surface-hover);
    transform: translateY(-2px);
}

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

/* Mobile responsive game container */
@media (max-width: 768px) {
    .game-container {
        touch-action: none;
        user-select: none;
    }

    .mobile-controls {
        bottom: 6rem;
    }

    /* Hide original UI on mobile */
    .game-ui,
    .bottom-ui {
        display: none;
    }
}

/* ========== REMOVED COMPLEX MOBILE UI CODE ========== */
