/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --apple-blue: #007AFF;
    --apple-green: #34C759;
    --apple-orange: #FF9500;
    --apple-red: #FF3B30;
    --apple-gray: #8E8E93;
    --apple-gray-2: #C7C7CC;
    --apple-gray-3: #D1D1D6;
    --apple-gray-4: #E5E5EA;
    --apple-gray-5: #F2F2F7;
    --apple-gray-6: #F8F8F8;

    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: rgba(0, 0, 0, 0.1);

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);

    --border-radius: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 20px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #f8f9ff 0%, #e8f2ff 100%);
    min-height: 100vh;
    color: #1d1d1f;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    min-height: 100vh;
}

/* Screen management */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Image Upload Studio */
.upload-studio {
    width: 100%;
    max-width: 1400px;
    margin: 2rem auto;
    padding: 3rem;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.upload-studio-header {
    text-align: center;
    margin-bottom: 3rem;
}

.upload-studio-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1d1d1f;
    margin: 0 0 1rem 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.upload-studio-header p {
    font-size: 1.2rem;
    color: #666;
    margin: 0;
    font-weight: 400;
}

.upload-drop-zone {
    width: 100%;
    min-height: 300px;
    border: 3px dashed #667eea;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.upload-drop-zone:hover {
    border-color: #764ba2;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.2);
}

.drop-zone-content {
    text-align: center;
    padding: 2rem;
}

.drop-zone-text {
    font-size: 1.3rem;
    color: #667eea;
    font-weight: 600;
}

.upload-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.upload-btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 180px;
    justify-content: center;
}

.upload-all-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.upload-all-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
}

.upload-next-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(245, 87, 108, 0.3);
}

.upload-next-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(245, 87, 108, 0.4);
}

.clear-btn {
    background: linear-gradient(135deg, #a8a8a8 0%, #7f7f7f 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(168, 168, 168, 0.3);
}

.clear-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(168, 168, 168, 0.4);
}

.upload-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.preview-card {
    background: white;
    border: 2px solid #f0f0f0;
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.preview-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.preview-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.preview-card-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.preview-card-name {
    font-weight: 600;
    color: #1d1d1f;
    font-size: 1.1rem;
}

.preview-card-filename {
    color: #666;
    font-size: 0.9rem;
}

.preview-card-status {
    color: #667eea;
    font-size: 0.9rem;
    font-weight: 500;
}

.photo-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2rem;
    margin-bottom: 1rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    transition: var(--transition);
    min-height: 120px;
    width: 90%;
    margin: 0 auto 1rem auto;
}

.photo-row:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.4);
}







/* Registration Form */
.registration-form {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
    max-width: 400px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-group label {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--apple-gray-2);
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
}

#room-name-input, #organizer-email-input, #max-players-input {
    width: 100%;
    max-width: 400px;
    padding: 0.875rem 1rem;
    border: 1px solid var(--apple-gray-4);
    border-radius: var(--border-radius);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    font-size: 1rem;
    font-weight: 500;
    color: var(--apple-gray-2);
    transition: var(--transition);
    margin: 0 auto;
}

#room-name-input:focus, #organizer-email-input:focus, #max-players-input:focus {
    outline: none;
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

#room-name-input[readonly] {
    background: rgba(240, 240, 240, 0.8);
    color: var(--apple-gray);
    cursor: not-allowed;
}

/* Select dropdown styling */
#max-players-input {
    color: #999;
    font-weight: 400;
}

#max-players-input:focus,
#max-players-input:not([value=""]) {
    color: var(--apple-gray-2);
    font-weight: 500;
}

/* Add spacing between Add Photo button and menu */
.photo-section {
    margin: 2rem 0 4rem 0;
}

#add-creation-photo-btn {
    margin-bottom: 3rem;
}

/* Avatar Grid */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 0.5rem;
}

.avatar-option {
    aspect-ratio: 1;
    border-radius: var(--border-radius);
    border: 3px solid transparent;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    position: relative;
    overflow: hidden;
}

.avatar-option:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.avatar-option.selected {
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

.avatar-option.selected::after {
    content: '✓';
    position: absolute;
    bottom: 0.25rem;
    right: 0.25rem;
    background: var(--apple-blue);
    color: white;
    border-radius: 50%;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Landing page */
.container {
    max-width: 420px;
    width: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-xl);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1d1d1f;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #1d1d1f 0%, #424245 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.125rem;
    color: #86868b;
    margin-bottom: 2.5rem;
    line-height: 1.6;
    font-weight: 400;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

#room-code-section {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#room-code-input {
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--apple-gray-4);
    border-radius: var(--border-radius);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    transition: var(--transition);
    font-weight: 500;
    color: #1d1d1f;
    text-align: center;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

#room-code-input:focus {
    outline: none;
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
    transform: scale(1.02);
}

/* Game room layout */
.game-room {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    position: relative;
    min-height: 80vh;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--apple-gray-5);
    position: relative;
}

.game-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--apple-blue), transparent);
}

.room-info {
    display: flex;
    align-items: center;
    gap: 2rem;
}

#room-code-display {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--apple-gray);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

#timer {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--apple-red);
    background: rgba(255, 59, 48, 0.1);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 59, 48, 0.2);
    backdrop-filter: blur(10px);
    letter-spacing: 0.05em;
    min-width: 60px;
    text-align: center;
}

.game-container {
    display: grid;
    grid-template-columns: 1fr 320px;
    height: calc(100vh - 140px);
    min-height: 700px;
    max-height: 800px;
}

.game-main {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
}

.photo-container {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-xl);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 2px 16px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 500px;
    max-width: 700px;
    margin: 0 auto;
    transition: all var(--transition);
}

#current-photo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}

.upload-area {
    text-align: center;
    padding: 3rem;
    max-width: 400px;
    animation: fadeInUp 0.6s ease-out;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.6;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.1));
}

.upload-area p {
    font-size: 1.125rem;
    color: var(--apple-gray);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.game-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: auto;
    padding-top: 1rem;
}

.sidebar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(30px);
    border-left: 1px solid var(--glass-border);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--apple-gray-4) transparent;
}

/* Upload section */
.upload-section h3,
.chat-section h3,
.players-section h3,
.scoreboard h3 {
    margin: 0 0 1.5rem 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--apple-gray-2);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    position: relative;
    padding-bottom: 0.75rem;
}

.upload-section h3::after,
.chat-section h3::after,
.players-section h3::after,
.scoreboard h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30px;
    height: 2px;
    background: linear-gradient(90deg, var(--apple-blue), var(--apple-green));
    border-radius: 1px;
}

.photo-upload-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}



.photo-input-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.person-name-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--apple-gray-4);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
}

.person-name-input:focus {
    outline: none;
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.1);
}

.photo-preview {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
    min-width: 300px;
    background: rgba(240, 248, 255, 0.8);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid rgba(0, 122, 255, 0.2);
}

.photo-preview.show {
    background: rgba(240, 248, 255, 1);
    border-color: var(--apple-blue);
}

.preview-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--border-radius);
    border: 2px solid var(--apple-blue);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: #f0f0f0;
}

.preview-image[src=""], .preview-image:not([src]) {
    background: #f0f0f0;
    border: 2px dashed #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-image[src=""]:before, .preview-image:not([src]):before {
    content: "📷";
    font-size: 24px;
    color: #999;
}

.preview-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.preview-filename {
    font-size: 1rem;
    font-weight: 600;
    color: var(--apple-gray-2);
}

.preview-filename:empty:before {
    content: "No file selected";
    color: #999;
    font-style: italic;
    font-weight: normal;
}

.preview-status {
    font-size: 0.875rem;
    color: var(--apple-blue);
    font-weight: 500;
}

.preview-status:empty:before {
    content: "Choose a photo to preview";
    color: #666;
    font-style: italic;
    font-weight: normal;
}

.btn-small {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid var(--apple-gray-4);
    border-radius: var(--border-radius);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-small:hover {
    background: rgba(255, 255, 255, 1);
    border-color: var(--apple-blue);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.choose-photo-btn {
    background: linear-gradient(135deg, var(--apple-blue) 0%, #0056b3 100%);
    color: white;
    border: none;
    font-weight: 600;
}

.choose-photo-btn:hover {
    background: linear-gradient(135deg, #0056b3 0%, var(--apple-blue) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 122, 255, 0.3);
}

.remove-row-btn {
    color: var(--apple-red);
    border-color: var(--apple-red);
}

.remove-row-btn:hover {
    background: rgba(255, 59, 48, 0.1);
    border-color: #ff3b30;
}



.preview-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}


}

.photo-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.uploaded-photos {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.uploaded-photo-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.uploaded-photo-thumb {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    object-fit: cover;
    border: 1px solid var(--apple-gray-4);
}

.uploaded-photo-info {
    flex: 1;
}

.uploaded-photo-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: #1d1d1f;
}

.uploaded-photo-person {
    font-size: 0.75rem;
    color: var(--apple-gray);
}

/* Chat section */

.chat-messages {
    height: 300px;
    overflow-y: auto;
    border: 1px solid var(--apple-gray-4);
    border-radius: var(--border-radius);
    padding: 1rem;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    margin-bottom: 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--apple-gray-3) transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--apple-gray-3);
    border-radius: 3px;
}

.chat-message {
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    line-height: 1.4;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.chat-message.correct {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    font-weight: 600;
    border-color: #c3e6cb;
    box-shadow: 0 2px 8px rgba(21, 87, 36, 0.1);
}

.chat-input {
    display: flex;
    gap: 0.5rem;
}

#chat-input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 1px solid var(--apple-gray-4);
    border-radius: var(--border-radius);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    font-size: 0.875rem;
    font-weight: 500;
    color: #1d1d1f;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

#chat-input:focus {
    outline: none;
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

/* Players list */
.players-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.player-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.player-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--apple-blue);
    opacity: 0;
    transition: var(--transition);
}

.player-item.player-host::before {
    opacity: 1;
}

.player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--apple-blue) 0%, #0051cc 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.875rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 1;
}

.player-name {
    flex: 1;
    font-weight: 600;
    color: #1d1d1f;
    font-size: 0.875rem;
}

.player-status {
    font-size: 0.75rem;
    color: var(--apple-gray);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.player-drawer {
    color: var(--apple-blue);
    font-weight: 700;
    text-shadow: 0 0 8px rgba(0, 122, 255, 0.3);
}

/* Scoreboard */
.scoreboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.score-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.score-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--apple-green) 0%, var(--apple-blue) 100%);
    opacity: 0.7;
}

.score-name {
    font-weight: 600;
    color: #1d1d1f;
    font-size: 0.875rem;
}

.score-points {
    font-weight: 700;
    color: var(--apple-blue);
    font-size: 1rem;
    background: rgba(0, 122, 255, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    min-width: 40px;
    text-align: center;
}

/* Buttons */
.btn {
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.02em;
    min-height: 44px;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn:active {
    transform: translateY(0);
    transition: transform 0.1s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--apple-blue) 0%, #0051cc 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0051cc 0%, #003d99 100%);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    color: #1d1d1f;
    border: 1px solid var(--apple-gray-4);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--apple-gray-3);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: linear-gradient(135deg, var(--apple-green) 0%, #28a745 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-success:hover {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    box-shadow: var(--shadow-lg);
}

.btn-ghost {
    background: transparent;
    color: var(--apple-blue);
    border: 1px solid var(--apple-blue);
    backdrop-filter: blur(10px);
}

.btn-ghost:hover {
    background: rgba(0, 122, 255, 0.1);
    border-color: #0051cc;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.animate-fadeInUp {
    animation: fadeInUp 0.6s ease-out;
}

.animate-slideInRight {
    animation: slideInFromRight 0.5s ease-out;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

/* Loading states */
.loading-shimmer {
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.4) 50%, transparent 100%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .game-container {
        grid-template-columns: 1fr 300px;
    }
    
    .photo-container {
        height: 450px;
        max-width: 600px;
    }
}

@media (max-width: 992px) {
    .game-container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
        height: auto;
        min-height: auto;
    }
    
    .sidebar {
        border-left: none;
        border-top: 1px solid var(--glass-border);
        max-height: 400px;
    }
    
    .photo-container {
        height: 400px;
        max-width: 500px;
    }
    
    .game-main {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .photo-section {
        margin: 1.5rem 0;
    }
    
    .game-room {
        margin: 1rem;
        border-radius: var(--border-radius-lg);
    }
    
    .game-header {
        padding: 1rem 1.5rem;
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .room-info {
        justify-content: center;
        gap: 1rem;
    }
    
    .photo-container {
        height: 300px;
        max-width: 100%;
    }
    
    .game-main {
        padding: 1rem;
    }
    
    .sidebar {
        padding: 1rem;
    }
    
    .photo-input-group {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .person-name-input {
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 480px) {
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .upload-icon {
        font-size: 3rem;
    }
    
    .upload-area p {
        font-size: 1rem;
    }
    
    .photo-row {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

/* Utility classes */
.hidden {
    display: none !important;
}

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

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }

/* Responsive design */
@media (max-width: 768px) {
    .game-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid #e9ecef;
    }

    .title {
        font-size: 2rem;
    }

    .menu {
        flex-direction: row;
        justify-content: center;
    }
}

/* Game State and Flow Styles */
.game-status {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#game-status-text {
    font-size: 0.875rem;
    color: #6b7280;
}

.timer {
    background: #3b82f6;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 700;
    font-size: 1.125rem;
    min-width: 3rem;
    text-align: center;
    animation: pulse 1s infinite;
}

.timer.warning {
    background: #f59e0b;
}

.timer.danger {
    background: #ef4444;
}

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

/* Game Status Panel */
.game-status-panel {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 1rem;
    margin-bottom: 2rem;
}

.status-message h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
}

.status-message p {
    margin: 0 0 1rem 0;
    opacity: 0.9;
}

.photo-count, .attempts-left {
    font-weight: 600;
    font-size: 1.125rem;
}

.attempts-left {
    color: #fbbf24;
}

/* Guess Section */
.guess-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.guess-input-container {
    display: flex;
    gap: 1rem;
    align-items: center;
}

#guess-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}

#guess-input:focus {
    outline: none;
    border-color: #3b82f6;
}

.guess-feedback {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-align: center;
}

.guess-feedback.correct {
    background: #d1fae5;
    color: #065f46;
}

.guess-feedback.incorrect {
    background: #fee2e2;
    color: #991b1b;
}

.guess-feedback.attempts-exhausted {
    background: #fef3c7;
    color: #92400e;
}

/* Current Photo */
.current-photo {
    max-width: 100%;
    max-height: 400px;
    border-radius: 1rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    object-fit: cover;
}

/* Organizer Controls */
.organizer-only {
    border-top: 2px solid #e5e7eb;
    padding-top: 1rem;
    margin-top: 2rem;
}

/* Enhanced Scoreboard */
.score-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.score-item.first-place {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    font-weight: bold;
}

.score-rank {
    font-weight: bold;
    color: #6b7280;
    min-width: 2rem;
}

.score-avatar {
    font-size: 1.25rem;
}

.score-name {
    flex: 1;
    font-weight: 600;
}

.score-points {
    font-weight: bold;
    font-size: 1.125rem;
    color: #3b82f6;
}

.first-place .score-rank,
.first-place .score-points {
    color: white;
}

/* Organizer Reconnection */
.organizer-reconnect {
    margin-top: 2rem;
    padding-top: 1.5rem;
}

.divider {
    text-align: center;
    margin: 1rem 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e5e7eb;
}

.divider span {
    background: white;
    padding: 0 1rem;
    color: #6b7280;
    font-size: 0.875rem;
}

.reconnect-text {
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
    margin: 1rem 0;
}

.reconnect-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

#organizer-reconnect-email {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

#organizer-reconnect-email:focus {
    outline: none;
    border-color: #3b82f6;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #374151;
}

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

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

.game-item {
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.game-item:hover {
    border-color: #3b82f6;
    background: #f8fafc;
}

.game-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.game-room-code {
    font-weight: bold;
    font-size: 1.125rem;
    color: #3b82f6;
}

.game-status {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.game-status.waiting {
    background: #fef3c7;
    color: #92400e;
}

.game-status.active {
    background: #d1fae5;
    color: #065f46;
}

.game-status.completed {
    background: #e5e7eb;
    color: #6b7280;
}

.game-info {
    color: #6b7280;
    font-size: 0.875rem;
}

.no-games {
    text-align: center;
    color: #6b7280;
    padding: 2rem;
}

.no-games p {
    margin: 0.5rem 0;
}
