/* Reset and base styles */
* {
    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;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.logo {
    font-size: 3.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.logo-icon {
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
    transition: transform 0.3s ease;
}

.logo:hover .logo-icon {
    transform: scale(1.1) rotate(5deg);
}

.tagline {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Main content */
.main-content {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.game-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 480px;
    align-items: center;
}

.option-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 2px solid rgba(255,255,255,0.2);
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 600;
    width: 100%;
    max-width: 320px;
    min-height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.option-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s ease;
}

.option-card:hover::before {
    left: 100%;
}

.option-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    border-color: rgba(255,255,255,0.4);
}

/* Option card text styling removed - now using simple button text */

/* Buttons */
.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    min-width: 150px;
}

.btn-primary {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4e9525 0%, #96d9b7 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(86, 171, 47, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #3d8bfe 0%, #00d4aa 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(79, 172, 254, 0.4);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 40px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 25px 50px rgba(0,0,0,0.2);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 15px;
}

.close:hover {
    color: #333;
}

.modal h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

/* Error Modal Specific Styles */
.error-modal {
    text-align: center;
    max-width: 400px;
}

.error-modal h2 {
    color: #dc3545;
    font-size: 1.8rem;
    margin-bottom: 30px;
}

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

.action-buttons .btn {
    padding: 15px 25px;
    font-size: 1.1rem;
    font-weight: 600;
    min-width: 120px;
}

/* Form styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
}

.form-control::placeholder {
    color: #999;
}

/* Room Code Input Styling */
.room-code-input {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    margin: 10px 0;
    width: 100%;
}

.code-digit {
    width: calc((100% - 24px) / 4);
    height: 85px;
    border: 3px solid #e1e5e9;
    border-radius: 12px;
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: #495057;
    background: #f8f9fa;
    transition: all 0.3s ease;
    cursor: pointer;
    caret-color: transparent; /* Hide cursor - focus border is the indicator */
    /* Prevent text selection and mobile selection UI (iOS + Android) */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    
    /* Android-specific improvements */
    -webkit-tap-highlight-color: transparent; /* Remove Android tap highlight */
    -webkit-touch-callout: none; /* Disable Android long-press context menu */
}

.code-digit:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

.code-digit.filled {
    background: white;
    border-color: #28a745;
    color: #28a745;
}

/* Host Password Input Styling */
.host-password-input {
    display: flex;
    gap: 6px;
    justify-content: space-between;
    margin: 10px 0;
    width: 100%;
}

.password-digit {
    width: calc((100% - 30px) / 6);
    height: 85px;
    border: 3px solid #e1e5e9;
    border-radius: 12px;
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: #495057;
    background: #f8f9fa;
    transition: all 0.3s ease;
    cursor: pointer;
    caret-color: transparent; /* Hide cursor - focus border is the indicator */
    /* Prevent text selection and mobile selection UI (iOS + Android) */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    
    /* Android-specific improvements */
    -webkit-tap-highlight-color: transparent; /* Remove Android tap highlight */
    -webkit-touch-callout: none; /* Disable Android long-press context menu */
}

.password-digit:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

.password-digit.filled {
    background: white;
    border-color: #28a745;
    color: #28a745;
}

/* Mobile input improvements (iOS + Android) */
@media (max-width: 768px) {
    .code-digit, .password-digit {
        /* Prevent zoom on iOS/Android when focusing */
        font-size: max(16px, 2rem);
        
        /* Better mobile touch targets */
        min-height: 60px;
        
        /* Cross-platform mobile improvements */
        -webkit-appearance: none;
        -webkit-border-radius: 12px;
        
        /* Hide caret - use focus outline as only indicator */
        caret-color: transparent;
        
        /* Prevent text selection and mobile selection UI (iOS + Android) */
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        
        /* Android-specific improvements */
        -webkit-tap-highlight-color: transparent; /* Remove Android tap highlight */
        -webkit-touch-callout: none; /* Disable Android long-press context menu */
    }
    
    .code-digit:focus, .password-digit:focus {
        /* Ensure focus is clearly visible on mobile (iOS + Android) */
        outline: 3px solid #667eea;
        outline-offset: 2px;
        transform: scale(1.02);
        
        /* Additional Android focus improvements */
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1), 0 0 15px rgba(102, 126, 234, 0.2);
    }
    
    /* Modal positioning adjustments for mobile keyboard */
    .modal-content {
        margin: 1% auto 10px auto;
        max-height: 95vh;
        overflow-y: auto;
        /* Prevent modal from moving when keyboard appears */
        position: relative;
    }
    
    /* Smaller gap between inputs on mobile */
    .room-code-input {
        gap: 6px;
    }
    
    .host-password-input {
        gap: 4px;
    }
}

/* Mobile Join Button */
.join-btn {
    width: 100%;
    margin-top: 10px;
    display: block;
}

/* Ensure join button is full width in modal */
.modal .join-btn {
    width: 100% !important;
    max-width: none;
}

/* Game created modal */
.game-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px 0;
    border-bottom: 1px solid #e1e5e9;
}

.info-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.info-item label {
    font-weight: 600;
    color: #333;
}

.room-code, .host-password {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: bold;
    color: #667eea;
    background: white;
    padding: 8px 15px;
    border-radius: 8px;
    border: 2px solid #e1e5e9;
}

.instructions {
    margin: 20px 0;
    padding: 20px;
    background: #e8f4fd;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.instructions p {
    margin-bottom: 15px;
    font-weight: 600;
    color: #333;
}

.instructions ol {
    margin-left: 20px;
    color: #555;
    line-height: 1.6;
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

/* Responsive design */
@media (min-width: 769px) {
    .game-options {
        max-width: 520px;
        gap: 24px;
    }
    
    .option-card {
        padding: 24px 48px;
        max-width: 360px;
        font-size: 1.3rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .logo {
        font-size: 2.5rem;
    }
    
    .tagline {
        font-size: 1rem;
    }
    
    .game-options {
        max-width: 100%;
        gap: 32px; /* Much larger gap for thumb spacing */
    }
    
    .option-card {
        padding: 24px 40px; /* Larger touch targets */
        max-width: 320px; /* Wider for easier tapping */
        min-height: 60px; /* Minimum height for thumb-friendly tapping */
        font-size: 1.3rem; /* Larger text for readability */
    }
    
    .modal-content {
        margin: 10% auto;
        padding: 30px 20px;
        width: 95%;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 250px;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 2rem;
    }
    
    .game-options {
        gap: 40px; /* Even larger gap for smaller screens with fat thumbs */
    }
    
    .option-card {
        padding: 28px 36px; /* Even larger touch targets for small screens */
        max-width: 300px; /* Wider for easier thumb access */
        min-height: 66px; /* Taller for better thumb tapping */
        font-size: 1.2rem; /* Larger text for small screens */
    }
    
    .btn {
        padding: 12px 25px;
        font-size: 1rem;
    }
}

/* Confirmation Modal Styles */
.confirmation-content {
    margin: 25px 0;
}

.game-info-summary {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
    border-left: 4px solid #667eea;
}

.game-info-summary p {
    margin: 8px 0;
    color: #555;
}

.warning-text {
    color: #dc3545;
    font-weight: 600;
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background: #f8d7da;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
}

/* Mobile-specific room code styling */
@media (max-width: 768px) {
    .room-code-input {
        gap: 6px;
    }
    
    .code-digit {
        width: calc((100% - 18px) / 4);
        height: 75px;
        font-size: 1.8rem;
    }
    
    .host-password-input {
        gap: 4px;
    }
    
    .password-digit {
        width: calc((100% - 20px) / 6);
        height: 75px;
        font-size: 1.8rem;
    }
    
    .join-btn {
        width: 100%;
        padding: 18px 30px;
        font-size: 1.2rem;
    }
}
