* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 20px 0;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

header h1 {
    color: white;
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.2em;
}

/* Screen Management */
.screen {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Games Grid */
.game-selection {
    text-align: center;
    padding: 20px;
}

.game-selection h2 {
    color: white;
    margin-bottom: 30px;
    font-size: 2em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.game-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 3px solid transparent;
}

.game-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-color: #667eea;
}

.game-icon {
    font-size: 4em;
    margin-bottom: 20px;
    display: block;
}

.game-card h3 {
    font-size: 1.5em;
    margin-bottom: 15px;
    color: #333;
}

.game-card p {
    color: #666;
    font-size: 1em;
}

/* Buttons */
.btn {
    padding: 15px 25px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #dee2e6;
}

.btn-secondary:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.btn-back {
    background: #6c757d;
    color: white;
    margin-top: 20px;
}

.btn-copy {
    background: #28a745;
    color: white;
    padding: 10px 15px;
    font-size: 0.9em;
}

/* Session Setup */
.session-setup {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.session-options {
    margin: 30px 0;
}

.divider {
    margin: 25px 0;
    color: #666;
    font-weight: 600;
    font-size: 1.1em;
}

.join-section {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.join-section input {
    flex: 1;
    padding: 15px;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    font-size: 1.1em;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 3px;
    min-width: 200px;
    font-weight: bold;
}

.join-section input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

/* Waiting Room */
.waiting-room {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.session-info {
    margin: 20px 0;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 15px;
    border-left: 5px solid #667eea;
}

.session-code-display {
    font-size: 2.5em;
    font-weight: bold;
    color: #667eea;
    letter-spacing: 5px;
    display: block;
    margin: 15px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.players-list {
    margin: 30px 0;
    text-align: left;
}

.players-list h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

.players-list ul {
    list-style: none;
    padding: 0;
}

.players-list li {
    background: #f8f9fa;
    padding: 15px;
    margin: 10px 0;
    border-radius: 10px;
    border-left: 5px solid #667eea;
    font-weight: 500;
}

.waiting-actions {
    margin-top: 30px;
}

/* Game Containers */
.game-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.game-header h2 {
    color: #333;
    font-size: 2em;
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: right;
}

.status-indicator {
    background: #f8f9fa;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 600;
    color: #333;
    border: 2px solid #dee2e6;
}

.score-display {
    background: #e9ecef;
    padding: 10px 15px;
    border-radius: 15px;
    font-weight: 600;
    color: #495057;
    text-align: center;
    line-height: 1.4;
}

/* Tic Tac Toe */
.tic-tac-toe-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    max-width: 350px;
    margin: 30px auto;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 20px;
}

.cell {
    aspect-ratio: 1;
    background: white;
    border: 3px solid #dee2e6;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #333;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.cell:hover:not(.disabled) {
    background: #e9ecef;
    transform: scale(1.05);
    border-color: #667eea;
}

.cell.disabled {
    cursor: not-allowed;
    opacity: 0.7;
    background: #f8f9fa;
}

/* Rock Paper Scissors */
.rps-container {
    text-align: center;
    padding: 20px;
}

.choice-section {
    margin-bottom: 30px;
}

.choice-section h3 {
    margin-bottom: 20px;
    color: #333;
}

.choices {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.choice-btn {
    width: 100px;
    height: 100px;
    border: 4px solid #dee2e6;
    background: white;
    border-radius: 50%;
    font-size: 3em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.choice-btn:hover {
    border-color: #667eea;
    transform: scale(1.1);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.2);
}

.choice-btn.selected {
    border-color: #667eea;
    background: #667eea;
    color: white;
    transform: scale(1.1);
}

.result-section {
    margin-top: 30px;
}

.result-display {
    font-size: 1.5em;
    font-weight: bold;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.choices-display {
    font-size: 3em;
    margin: 20px 0;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Number Guess */
.number-guess-container {
    text-align: center;
    padding: 20px;
}

.guess-section {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

#guess-input {
    padding: 15px;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    font-size: 1.2em;
    text-align: center;
    width: 200px;
    font-weight: bold;
}

#guess-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.guess-history {
    margin: 20px 0;
    text-align: left;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    max-height: 300px;
    overflow-y: auto;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
}

.guess-item {
    background: white;
    padding: 10px 15px;
    margin: 8px 0;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* ========== ENHANCED DRAWING GAME STYLES ========== */

.drawing-main-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* Enhanced Canvas Container */
.canvas-container, .canvas-container-enhanced {
    position: relative;
    width: 100%;
    max-width: 1200px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 3px solid #e0e0e0;
    overflow: hidden;
    margin: 0 auto;
}

#drawing-canvas {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 17px;
    cursor: crosshair;
    touch-action: none;
    background: white;
}

/* Device Detection & Info */
.device-info {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8em;
    display: flex;
    gap: 10px;
    z-index: 100;
}

/* Fullscreen Toggle Button */
.fullscreen-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.fullscreen-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Enhanced Drawing Toolbar */
.drawing-toolbar-enhanced {
    width: 100%;
    max-width: 1200px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    align-items: center;
    justify-content: center;
    border: 2px solid #dee2e6;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.tool-group-enhanced {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.tool-group-enhanced label {
    font-weight: 600;
    color: #495057;
    font-size: 1em;
    white-space: nowrap;
}

.tool-btn-enhanced {
    padding: 10px 15px;
    border: 3px solid #dee2e6;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1em;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.tool-btn-enhanced:hover {
    border-color: #667eea;
    background: #f8f9fa;
    transform: translateY(-2px);
}

.tool-btn-enhanced.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
}

.color-palette-enhanced {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-option-enhanced {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    border: 4px solid #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.color-option-enhanced:hover {
    transform: scale(1.2);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.color-option-enhanced.active {
    border-color: #667eea;
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.5);
}

#custom-color-enhanced {
    width: 50px;
    height: 35px;
    border: 3px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
}

#brush-size-enhanced {
    width: 120px;
    cursor: pointer;
}

#size-display-enhanced {
    background: #e9ecef;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    min-width: 45px;
    text-align: center;
    font-weight: bold;
}

/* Game Actions */
.game-actions {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #f8f9fa;
}

/* ========== MOBILE GLOBE BUTTON UI ========== */

.mobile-globe-container {
    position: relative;
    display: none; /* Show only on mobile */
}

.device-mobile .mobile-globe-container {
    display: block;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
}

.globe-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    font-size: 24px;
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    position: relative;
    z-index: 2001;
}

.globe-button:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.globe-button.active {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    transform: rotate(45deg);
}

.globe-menu {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 280px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    border: 2px solid #667eea;
    padding: 20px;
    transform: translateY(20px) scale(0.8);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 2000;
}

.globe-menu.show {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.globe-menu.hidden {
    display: none;
}

.globe-panel {
    margin-bottom: 20px;
}

.globe-panel:last-child {
    margin-bottom: 0;
}

.globe-panel h4 {
    margin-bottom: 12px;
    color: #333;
    font-size: 1.1em;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 8px;
}

.globe-tools {
    display: flex;
    gap: 10px;
}

.globe-tool-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid #dee2e6;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.globe-tool-btn:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.globe-tool-btn.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.globe-colors {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 15px;
}

.globe-color {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 4px solid #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    justify-self: center;
}

.globe-color:hover {
    transform: scale(1.2);
}

.globe-color.active {
    border-color: #667eea;
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.5);
}

.globe-brush-size {
    display: flex;
    align-items: center;
    gap: 10px;
}

.globe-brush-size label {
    font-weight: 600;
    color: #666;
    font-size: 0.9em;
}

#globe-brush-size {
    flex: 1;
    height: 30px;
}

#globe-size-display {
    background: #e9ecef;
    padding: 6px 10px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: bold;
    min-width: 40px;
    text-align: center;
}

.globe-action-btn {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1em;
    transition: all 0.3s ease;
}

.globe-action-btn:last-child {
    margin-bottom: 0;
}

.clear-btn {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.clear-btn:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    transform: translateY(-2px);
}

.save-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.save-btn:hover {
    background: linear-gradient(135deg, #20c997 0%, #17a2b8 100%);
    transform: translateY(-2px);
}

.globe-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
}

.globe-backdrop.hidden {
    display: none;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 350px;
}

.toast {
    background: #333;
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 10px;
    animation: slideIn 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border-left: 5px solid #667eea;
}

.toast.success {
    background: #28a745;
    border-left-color: #20c997;
}

.toast.error {
    background: #dc3545;
    border-left-color: #fd7e14;
}

.toast.info {
    background: #17a2b8;
    border-left-color: #20c997;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========== DEVICE-SPECIFIC RESPONSIVE DESIGN ========== */

/* Mobile Styles */
.device-mobile .games-grid {
    grid-template-columns: 1fr;
    gap: 15px;
}

.device-mobile .game-card {
    padding: 20px;
    margin: 0 5px;
}

.device-mobile .canvas-container,
.device-mobile .canvas-container-enhanced {
    width: 100vw;
    margin: 0 -15px;
    border-radius: 0;
    border-left: none;
    border-right: none;
}

.device-mobile #drawing-canvas {
    border-radius: 0;
}

.device-mobile .drawing-toolbar,
.device-mobile .drawing-toolbar-enhanced {
    display: none !important;
}

.device-mobile .fullscreen-btn {
    display: none;
}

.device-mobile .device-info {
    top: 5px;
    right: 5px;
    font-size: 0.7em;
    padding: 3px 8px;
}

/* Tablet Styles */
.device-tablet .games-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.device-tablet .canvas-container,
.device-tablet .canvas-container-enhanced {
    margin: 0 10px;
}

.device-tablet .drawing-toolbar,
.device-tablet .drawing-toolbar-enhanced {
    margin: 0 10px;
    padding: 15px;
    gap: 20px;
}

/* Desktop Styles */
.device-desktop .canvas-container,
.device-desktop .canvas-container-enhanced {
    max-width: 1200px;
}

.device-desktop .drawing-toolbar,
.device-desktop .drawing-toolbar-enhanced {
    max-width: 1200px;
}

/* ========== FULLSCREEN STYLES ========== */

.drawing-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    background: #f0f0f0 !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
}

.drawing-fullscreen .canvas-container-enhanced {
    flex: 1;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    border-radius: 0 !important;
    border: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
}

.drawing-fullscreen #drawing-canvas {
    max-width: 95%;
    max-height: 85%;
    width: auto;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
}

.drawing-fullscreen .drawing-toolbar-enhanced {
    flex-shrink: 0;
    position: relative;
    bottom: 0;
    background: #333;
    color: white;
    border-radius: 0;
    margin: 0;
    width: 100%;
    max-width: none;
}

.drawing-fullscreen .tool-btn-enhanced {
    background: transparent;
    border-color: white;
    color: white;
}

.drawing-fullscreen .tool-btn-enhanced.active {
    background: white;
    color: black;
}

/* ========== ADDITIONAL RESPONSIVE BREAKPOINTS ========== */

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    header h1 {
        font-size: 2em;
    }

    .game-container {
        padding: 20px;
        margin: 0 10px;
    }

    .session-setup,
    .waiting-room {
        padding: 20px;
        margin: 0 10px;
    }

    .game-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .game-info {
        text-align: center;
    }

    .join-section {
        flex-direction: column;
        align-items: center;
    }

    .join-section input {
        min-width: auto;
        width: 100%;
        max-width: 250px;
    }

    .session-code-display {
        font-size: 2em;
        letter-spacing: 3px;
    }

    .drawing-toolbar-enhanced {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .tool-group-enhanced {
        justify-content: center;
        width: 100%;
    }
    
    .color-palette-enhanced {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    header {
        padding: 15px 0;
        margin-bottom: 20px;
    }

    header h1 {
        font-size: 1.8em;
    }

    header p {
        font-size: 1em;
    }

    #toast-container {
        left: 10px;
        right: 10px;
        top: 10px;
        max-width: none;
    }

    .toast {
        margin-bottom: 5px;
    }

    .tic-tac-toe-board {
        max-width: 250px;
        gap: 8px;
    }

    .cell {
        font-size: 1.5em;
    }

    .session-code-display {
        font-size: 1.5em;
        letter-spacing: 2px;
    }
}

/* ========== HIGH DPI DISPLAY SUPPORT ========== */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    #drawing-canvas {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: optimize-contrast;
        image-rendering: crisp-edges;
    }
}
