:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #ec4899;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-gradient-start: #fef3f2;
    --bg-gradient-end: #fff7ed;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: var(--text-primary);
    transition: background 0.5s ease;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(236, 72, 153, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Header Section */
.header-section {
    text-align: center;
    padding: 2rem 1rem 1rem;
    position: relative;
    z-index: 1;
}

#title {
    margin: 0;
    animation: fadeInDown 0.6s ease-out;
}

#title #logo {
    max-width: min(167px, 27vw);
    height: auto;
    display: block;
    margin: 0 auto;
    transition: max-width 0.3s ease;
}

#title #logo.spectate-mode {
    max-width: min(250px, 60vw);
}

.subtitle {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    color: var(--text-secondary);
    margin: 0.5rem 0 0;
    font-weight: 400;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Lobby Container */
.lobby-container {
    max-width: 750px;
    margin: 0 auto;
    padding: 1rem;
    position: relative;
    z-index: 1;
}

.lobby-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeInUp 0.6s ease-out 0.4s both;
}

/* Initial Menu */
.initial-menu {
    animation: fadeInUp 0.6s ease-out 0.4s both;
}

.menu-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 2rem;
}

@media (min-width: 768px) {
    .menu-options {
        grid-template-columns: repeat(3, 1fr);
    }
}

.menu-option {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.menu-option:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

.menu-option.create-option:hover {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(79, 70, 229, 0.05) 100%);
}

.menu-option.join-option:hover {
    border-color: var(--secondary-color);
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.05) 0%, rgba(219, 39, 119, 0.05) 100%);
}

.menu-option.spectate-option:hover {
    border-color: var(--accent-color);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, rgba(217, 119, 6, 0.05) 100%);
}

.menu-icon {
    font-size: 3rem;
    line-height: 1;
}

.menu-option h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.menu-option p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

.back-button {
    width: 100%;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-weight: 500;
    margin-top: 1rem;
    transition: all 0.2s ease;
}

.back-button:hover {
    background: var(--bg-primary);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateX(-4px);
}

/* Cards */
.player-setup-card,
.action-card,
.lobby-info-card,
.players-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.action-card.spectate-card,
.action-card.join-card {
    border-color: var(--accent-color);
    max-width: 300px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .action-card.spectate-card,
    .action-card.join-card {
        max-width: 250px;
        flex: 0 0 auto;
    }
}

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

.card-header {
    margin-bottom: 1rem;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem;
}

.card-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

.timer-options {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.timer-options-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.timer-options-description {
    margin: 0.25rem 0 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.timer-option-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.5rem;
}

.timer-option-button {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.timer-option-button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.timer-option-button.selected {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

/* Inputs */
input[type="text"],
textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.2s ease;
    font-family: inherit;
}

input[type="text"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

input[type="text"]::placeholder,
textarea::placeholder {
    color: var(--text-secondary);
}

/* Buttons */
button {
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-weight: 500;
}

.action-button {
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.action-button.primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.action-button.primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #4338ca 100%);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.action-button.secondary {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #db2777 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.action-button.secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, #db2777 0%, #be185d 100%);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.action-button:disabled {
    background: var(--border-color);
    color: var(--text-secondary);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.start-game-btn {
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1.125rem;
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
    border-radius: var(--radius-md);
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    margin-top: 0.5rem;
}

.start-game-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: var(--shadow-xl);
    transform: translateY(-2px);
}

.start-game-btn:disabled {
    background: var(--border-color);
    color: var(--text-secondary);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Lobby Actions Layout */
.lobby-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 768px) {
    .lobby-actions {
        flex-direction: row;
        align-items: stretch;
    }
    
    .action-card {
        flex: 1;
    }
}

/* Ensure proper display when shown/hidden */
.lobby-actions[style*="display: none"] {
    display: none !important;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 0.5rem 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.divider span {
    padding: 0 1rem;
}

@media (min-width: 768px) {
    .divider {
        flex-direction: column;
        margin: 0 1rem;
        width: auto;
    }
    
    .divider::before,
    .divider::after {
        border-bottom: none;
        border-left: 1px solid var(--border-color);
        flex: 0;
    }
    
    .divider span {
        padding: 1rem 0;
    }
}

/* Spectator Option */
.spectator-option {
    display: flex;
    justify-content: center;
    padding: 0.5rem 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.875rem;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Lobby Info */
.lobby-info-card {
    text-align: center;
    margin-top: 1.5rem;
    animation: fadeInUp 0.6s ease-out;
}

.round-timer-display {
    margin-top: 1rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.players-card {
    margin-top: 1.5rem;
    animation: fadeInUp 0.6s ease-out;
}

.start-game-btn {
    margin-top: 1.5rem;
    animation: fadeInUp 0.6s ease-out;
}

.lobby-code-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

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

.code-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: var(--primary-color);
    letter-spacing: 0.25rem;
    background: var(--bg-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    border: 2px dashed var(--primary-light);
}

.copy-btn {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem 1rem;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.05);
}

/* Players Card */
.players-card {
    min-height: 100px;
}

.players-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 1rem;
}

.player-count-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.players-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.player-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    font-size: 0.875rem;
    color: var(--text-primary);
}

.player-chip.current-user {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary-color);
    color: var(--primary-dark);
    font-weight: 600;
}

/* Settings Button */
#settingsBtn {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    color: var(--primary-color);
    border: 2px solid var(--border-color);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    line-height: 1;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
    cursor: pointer;
}

#settingsBtn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

/* Rules Button */
#rulesBtn {
    position: fixed;
    top: 4.5rem;
    right: 1rem;
    z-index: 1000;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    color: var(--primary-color);
    border: 2px solid var(--border-color);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    line-height: 1;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
    cursor: pointer;
}

#rulesBtn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

/* Rules Modal */
.rules-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    animation: fadeIn 0.2s ease-out;
}

.rules-modal.closing {
    animation: fadeOut 0.2s ease-in;
}

.rules-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 90%;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    animation: slideUp 0.3s ease-out;
    position: relative;
}

.close-rules-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    z-index: 10;
}

.close-rules-btn:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

.rules-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 90%;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
    position: relative;
}

.rules-content h2 {
    margin: 0 0 1.5rem 0;
    color: var(--text-primary);
    font-size: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

.rules-text-wrapper {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
}

.rules-text {
    color: var(--text-primary);
    line-height: 1.6;
}

.rules-text h3 {
    margin: 1.5rem 0 0.75rem 0;
    color: var(--primary-color);
    font-size: 1.125rem;
    font-weight: 600;
}

.rules-text h3:first-child {
    margin-top: 0;
}

.rules-text p {
    margin: 0.5rem 0;
}

.rules-text ol,
.rules-text ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.rules-text li {
    margin: 0.5rem 0;
}

.rules-text strong {
    color: var(--primary-dark);
    font-weight: 600;
}

@media (max-width: 768px) {
    #rulesBtn {
        top: 4rem;
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }
    
    .rules-content {
        padding: 1.5rem;
        max-width: 95%;
    }
    
    .rules-content h2 {
        font-size: 1.25rem;
    }
    
    .rules-text h3 {
        font-size: 1rem;
    }
}

/* Settings Modal */
.settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    animation: fadeIn 0.2s ease-out;
}

.settings-modal.closing {
    animation: fadeOut 0.2s ease-in;
}

.settings-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 90%;
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.3s ease-out;
    position: relative;
}

.close-settings-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    z-index: 10;
}

.close-settings-btn:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

.settings-content h2 {
    margin: 0 0 1.5rem 0;
    color: var(--text-primary);
    font-size: 1.5rem;
    text-align: center;
}

.settings-option {
    margin-bottom: 1.5rem;
}

.settings-option:last-child {
    margin-bottom: 0;
}

.settings-option label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
}

.settings-option label span {
    font-weight: 500;
}

/* Toggle Button */
.toggle-btn {
    position: relative;
    width: 50px;
    height: 26px;
    background: var(--border-color);
    border-radius: 13px;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
    padding: 0;
    outline: none;
}

.toggle-btn.sound-on {
    background: var(--primary-color);
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-btn.sound-on .toggle-slider {
    transform: translateX(24px);
}

/* Settings Action Buttons */
.settings-action-btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.settings-action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.settings-action-btn.exit-btn {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.settings-action-btn.exit-btn:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

/* Feedback Form */
.feedback-form {
    margin-top: 0;
    padding: 0;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(-10px);
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out, transform 0.3s ease-out, padding 0.3s ease-out, margin-top 0.3s ease-out;
}

.feedback-form.expanding {
    max-height: 500px;
    opacity: 1;
    transform: translateY(0);
    padding: 1rem;
    margin-top: 1rem;
}

.feedback-form.collapsing {
    max-height: 0;
    opacity: 0;
    transform: translateY(-10px);
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
}

.feedback-btn.hidden {
    display: none;
}

.feedback-flag-selector {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.feedback-flag-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-family: inherit;
}

.feedback-flag-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.feedback-flag-btn.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

.feedback-flag-btn.selected:hover {
    background: #4f46e5;
    border-color: #4f46e5;
    transform: translateY(-1px);
}

.feedback-textarea {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    box-sizing: border-box;
}

.feedback-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.feedback-actions {
    display: flex;
    gap: 0.75rem;
}

.feedback-actions .settings-action-btn {
    flex: 1;
    margin: 0;
}

.feedback-send-btn {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.feedback-send-btn:hover {
    background: #4f46e5;
    border-color: #4f46e5;
}

.feedback-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.feedback-cancel-btn {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.feedback-cancel-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    transform: none;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    animation: fadeIn 0.2s ease-out;
}

.modal.closing {
    animation: fadeOut 0.2s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-xl);
    max-width: 90%;
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.modal-content p {
    margin: 0 0 1.5rem;
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.modal button {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    min-width: 100px;
}

.modal .ok-btn {
    background: var(--success-color);
    color: white;
}

.modal .ok-btn:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.modal .cancel-btn:hover {
    background: var(--border-color);
    transform: translateY(-1px);
}

/* Game Screen */
#game {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    position: relative;
    z-index: 1;
}

#turnInfo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

#turnRound {
    font-weight: 600;
    margin: 1rem 0;
    font-size: 1.125rem;
    color: var(--text-primary);
    background: var(--bg-primary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.turn-timer {
    font-weight: 600;
    color: var(--accent-color);
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    min-width: 160px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.turn-status-message {
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    color: var(--text-secondary);
    min-height: 1.25rem;
}

.turn-status-message.warning {
    color: #b91c1c;
}

#role {
    font-weight: 600;
    color: var(--primary-color);
    margin: 1rem 0;
    font-size: 1.125rem;
    background: var(--bg-primary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

#words {
    margin: 1rem 0;
    padding: 0;
}

.words-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0;
}

.small-words-row {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.descriptor-card,
.noun-card,
.verb-card {
    margin-right: 0;
}

.word-card {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: var(--shadow-md);
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-height: 100px;
    justify-content: center;
}

.word-card.word-used {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.28) 0%, rgba(16, 185, 129, 0.12) 100%);
    border-color: var(--success-color);
    box-shadow: 0 10px 24px rgba(16, 185, 129, 0.3);
}

.word-card.word-used .word-label,
.word-card.word-used .word-value {
    color: #064e3b;
}

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

.word-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.word-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.3;
}

/* Theme card styling */
.theme-card {
    border-color: #1e40af;
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.05) 0%, rgba(30, 64, 175, 0.02) 100%);
    width: 100%;
    padding: 0.75rem 1rem;
    transition: width 0.3s ease, margin-left 0.3s ease;
}

.theme-card .word-label {
    color: #1e40af;
}

.theme-card .word-value {
    color: #1e3a8a;
}

.theme-card:hover {
    border-color: #1e3a8a;
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.1) 0%, rgba(30, 64, 175, 0.05) 100%);
}

/* Descriptor card styling */
.descriptor-card {
    border-color: var(--secondary-color);
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.05) 0%, rgba(236, 72, 153, 0.02) 100%);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    min-height: auto;
    display: inline-flex;
    width: auto;
    align-self: flex-start;
}

.descriptor-card .word-label {
    color: var(--secondary-color);
    font-size: 0.65rem;
}

.descriptor-card .word-value {
    color: #db2777;
    font-size: 0.95rem;
}

.descriptor-card:hover {
    border-color: #db2777;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.1) 0%, rgba(236, 72, 153, 0.05) 100%);
}

/* Noun card styling */
.noun-card {
    border-color: #93c5fd;
    background: linear-gradient(135deg, rgba(147, 197, 253, 0.15) 0%, rgba(147, 197, 253, 0.08) 100%);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    min-height: auto;
    display: inline-flex;
    width: auto;
    align-self: flex-start;
}

.noun-card .word-label {
    color: #60a5fa;
    font-size: 0.65rem;
}

.noun-card .word-value {
    color: #3b82f6;
    font-size: 0.95rem;
}

.noun-card:hover {
    border-color: #60a5fa;
    background: linear-gradient(135deg, rgba(147, 197, 253, 0.2) 0%, rgba(147, 197, 253, 0.12) 100%);
}

/* Verb card styling */
.verb-card {
    border-color: var(--accent-color);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, rgba(245, 158, 11, 0.02) 100%);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    min-height: auto;
    display: inline-flex;
    width: auto;
    align-self: flex-start;
}

.verb-card .word-label {
    color: var(--accent-color);
    font-size: 0.65rem;
}

.verb-card .word-value {
    color: #d97706;
    font-size: 0.95rem;
}

.verb-card:hover {
    border-color: #d97706;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.05) 100%);
}

@media (max-width: 768px) {
    .words-container {
        gap: 0.75rem;
    }
    
    .theme-card {
        padding: 0.75rem 1rem;
    }
    
    .descriptor-card,
    .noun-card,
    .verb-card {
        padding: 0.5rem 0.875rem;
    }
    
    .descriptor-card .word-label,
    .noun-card .word-label,
    .verb-card .word-label {
        font-size: 0.6rem;
    }
    
    .descriptor-card .word-value,
    .noun-card .word-value,
    .verb-card .word-value {
        font-size: 0.875rem;
    }
}

textarea {
    width: 100%;
    min-height: 120px;
    margin: 1rem 0;
    resize: vertical;
}

#submitPrompt {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: var(--radius-md);
    font-weight: 600;
    box-shadow: var(--shadow-md);
    margin: 1rem 0;
}

#submitPrompt:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #4338ca 100%);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

#submitPrompt:disabled {
    background: var(--border-color);
    color: var(--text-secondary);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

#spinner {
    text-align: center;
    font-size: 1.25rem;
    color: var(--primary-color);
    padding: 1rem;
    animation: pulse 1.5s infinite ease-in-out;
}

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

#yourImage {
    margin: 1.5rem 0;
    text-align: center;
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

#yourImage h3 {
    font-size: 1.25rem;
    color: var(--primary-color);
    margin: 0 0 1rem;
    font-weight: 600;
}

#yourImage img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    margin-bottom: 1rem;
}

#yourImage button {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
    border-radius: var(--radius-md);
    font-weight: 600;
    box-shadow: var(--shadow-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

#yourImage button:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Swiper */
.swiper {
    width: 100%;
    height: auto;
    margin: 1.5rem 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: var(--bg-primary);
}

.swiper-slide {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: transform 0.3s ease;
}

.swiper-slide:hover {
    transform: scale(1.02);
}

.swiper-slide img {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: box-shadow 0.3s ease;
}

.swiper-slide img:hover {
    box-shadow: var(--shadow-lg);
}

.swiper-slide p {
    margin: 1rem 0 0;
    text-align: center;
    font-size: 0.95rem;
    word-wrap: break-word;
    padding: 0 1rem;
    color: var(--text-secondary);
}

/* Status Circles */
#statusCircles {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 1.5rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.circle {
    width: 70px;
    height: 70px;
    border: 3px solid var(--accent-color);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background-color: var(--bg-primary);
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.circle:hover {
    transform: scale(1.1);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
}

.circle.submitting {
    border-color: var(--primary-color);
    background-color: rgba(99, 102, 241, 0.1);
    animation: spin 1.2s linear infinite;
}

.player-cutout.disconnected .circle {
    background-color: rgba(255, 200, 200, 0.5);
}

.circle .check {
    color: var(--success-color);
    font-size: 32px;
    font-weight: bold;
}

.circle.judge-circle {
    border: 4px solid var(--secondary-color);
    font-size: 32px;
}

.circle.disqualified {
    border-color: #f97316;
    background-color: rgba(249, 115, 22, 0.12);
    color: #ea580c;
}

.circle.past-judge {
    border-color: rgba(236, 72, 153, 0.5);
}

.player-cutout {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.circle-name {
    font-size: 0.875rem;
    margin-top: 0.5rem;
    text-align: center;
    max-width: 80px;
    word-wrap: break-word;
    color: var(--text-primary);
    font-weight: 500;
}

.stars-display {
    font-size: 0.875rem;
    margin-top: 0.25rem;
    color: var(--accent-color);
}

.judge-order-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--secondary-color);
    margin-bottom: 0.25rem;
}

/* Spectator Gallery */
#spectatorGallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.spectator-image-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

#spectatorGallery img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease;
    display: block;
}

#spectatorGallery img:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.focus-gallery-toggle-container {
    display: block;
    width: fit-content;
    margin: 1rem auto;
    padding: 0.5rem 1rem;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.focus-gallery-toggle-container label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
}

.focus-gallery-toggle-container .toggle-btn {
    flex-shrink: 0;
}

.focus-gallery-toggle-container .toggle-btn.focus-on {
    background: var(--primary-color);
}

.focus-gallery-toggle-container .toggle-btn.focus-on .toggle-slider {
    transform: translateX(24px);
}

/* Fullscreen Image Modal */
.image-fullscreen-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: fadeIn 0.2s ease-out;
    overflow-y: auto;
}

.fullscreen-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    width: 100%;
    max-width: 100%;
    height: 100%;
    align-content: start;
    padding: 2rem 0;
    box-sizing: border-box;
}

.fullscreen-gallery-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 400px;
    max-height: calc(100vh - 4rem);
    position: relative;
}

.fullscreen-gallery-item img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.focus-gallery-star {
    position: absolute;
    top: 0;
    left: 0;
    font-size: clamp(2.35rem, 3vw, 3.15rem);
    line-height: 1;
    pointer-events: none;
    filter: drop-shadow(0 0 18px rgba(255, 215, 0, 0.75));
    text-shadow: 0 0 12px rgba(255, 239, 140, 0.85);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.7);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
    z-index: 3200;
}

.focus-gallery-winner .focus-gallery-star {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.focus-gallery-star-flight {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(1);
    font-size: clamp(3.25rem, 5vw, 4rem);
    line-height: 1;
    pointer-events: none;
    filter: drop-shadow(0 0 22px rgba(255, 215, 0, 0.75));
    text-shadow: 0 0 12px rgba(255, 239, 140, 0.85);
    z-index: 4000;
    will-change: left, top, transform;
}

.focus-gallery-winner img {
    transform: scale(1.03);
    box-shadow: 0 0 28px rgba(255, 215, 0, 0.45);
}

.close-fullscreen-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    font-size: 2rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    z-index: 3001;
}

.close-fullscreen-btn:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

/* Game End */
#gameEnd {
    position: fixed;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: clamp(1.5rem, 4vw, 2.5rem);
    padding: clamp(1.5rem, 4vw, 3rem);
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(12px);
    z-index: 2200;
    overflow-y: auto;
    color: #f9fafb;
}

#fullGallery {
    width: min(1180px, 94vw);
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: var(--radius-xl);
    padding: clamp(1.25rem, 3vw, 2rem);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45);
}

#exitGame {
    width: min(320px, 80vw);
    padding: 1rem 2rem;
    font-size: 1.125rem;
    background: linear-gradient(135deg, var(--secondary-color) 0%, #db2777 100%);
    color: white;
    border-radius: 999px;
    font-weight: 600;
    box-shadow: 0 18px 35px rgba(236, 72, 153, 0.35);
    margin-top: 0;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

#exitGame:hover {
    background: linear-gradient(135deg, #db2777 0%, #be185d 100%);
    box-shadow: 0 26px 46px rgba(236, 72, 153, 0.45);
    transform: translateY(-3px);
}

/* Gallery Slide Content */
.gallery-slide-content {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    padding: 2rem;
    min-height: 500px;
}

@media (max-width: 968px) {
    .gallery-slide-content {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1.5rem;
    }
}

/* Gallery Image Container */
.gallery-image-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    position: relative;
    min-height: 600px;
}

.gallery-image-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    min-height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.gallery-prompt-wrapper {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    min-height: 500px;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.gallery-prompt-wrapper[style*="display: flex"] {
    pointer-events: auto;
}

.gallery-img-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-lg);
}

.gallery-image {
    max-width: 100%;
    max-height: 500px;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-md);
    display: block;
}

.gallery-star-badge {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 2.5rem;
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    animation: starPulse 2s ease-in-out infinite;
}

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

.gallery-prompt-box {
    width: 100%;
    max-width: 600px;
    min-height: 500px;
    height: 100%;
    padding: 2rem;
    background: var(--bg-primary);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-size: 1.125rem;
    line-height: 1.6;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(99, 102, 241, 0.02) 100%);
    box-sizing: border-box;
}

/* Gallery Buttons */
.gallery-toggle-btn,
.gallery-download-btn {
    width: 100%;
    max-width: 600px;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-md);
}

.gallery-toggle-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.gallery-toggle-btn:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #4338ca 100%);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.gallery-download-btn {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
}

.gallery-download-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Gallery Details Container */
.gallery-details-container {
    flex: 0 0 350px;
    display: flex;
    flex-direction: column;
}

@media (max-width: 968px) {
    .gallery-details-container {
        flex: 1;
        width: 100%;
    }
}

.gallery-details-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.03) 0%, rgba(139, 92, 246, 0.03) 100%);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(99, 102, 241, 0.1);
    border: 2px solid rgba(99, 102, 241, 0.15);
    display: flex;
    flex-direction: column;
    gap: 2rem;
    backdrop-filter: blur(10px);
}

.gallery-detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

.gallery-detail-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.detail-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary-color);
    opacity: 0.8;
}

.detail-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
}

.detail-value.winner-name {
    color: var(--primary-color);
    text-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    font-size: 1.5rem;
}

.gallery-words-list {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    margin-top: 0.5rem;
}

.word-item {
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.05) 100%);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
    font-size: 1rem;
    line-height: 1.6;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.word-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.word-type {
    font-weight: 700;
    color: var(--primary-color);
    margin-right: 0.5rem;
}

/* Credits Sequence */
.credits-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: stretch;
    justify-content: stretch;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2600;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.credits-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.credits-overlay-content {
    position: relative;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    border-radius: 0;
    border: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.credits-scroll-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem clamp(1.35rem, 4vw, 2.5rem) 2.25rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.credits-scroll-container::-webkit-scrollbar {
    width: 8px;
}

.credits-scroll-container::-webkit-scrollbar-track {
    background: transparent;
}

.credits-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 999px;
}

#creditsSequence {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.credits-title {
    margin: 0 0 2rem 0;
    text-align: center;
    font-size: clamp(3.5rem, 8vw, 5rem);
    font-weight: 700;
    color: #ffffff;
    padding: 1.5rem 0;
    text-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}

.credits-player-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-bottom: 1.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.credits-player-section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.credits-player-heading {
    font-size: clamp(1.2rem, 3vw, 1.45rem);
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
}

.credits-no-images {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

.credits-empty {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.75);
    text-align: center;
    padding: 1rem 0;
}

.credits-image-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

.credits-image-wrapper {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    display: inline-block;
    max-width: 100%;
}

.credits-image-wrapper img {
    max-width: 100%;
    max-height: min(65vh, 640px);
    height: auto;
    width: auto;
    object-fit: contain;
    display: block;
}

.credits-image-star {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    z-index: 10;
    pointer-events: none;
}

.credits-image-details {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    color: rgba(255, 255, 255, 0.85);
}

.credits-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    font-size: 0.95rem;
}

.credits-detail-label {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.65);
}

.credits-detail-value {
    flex: 1;
    min-width: 0;
    word-break: break-word;
    color: rgba(255, 255, 255, 0.9);
}

.credits-keywords {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.credits-keywords-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.credits-keyword {
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
}

.credits-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.credits-meta-row .credits-detail {
    gap: 0.4rem;
}

.credits-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.credits-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.debug-menu {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    z-index: 2700;
}

.debug-menu button {
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: transparent;
    color: #ffffff;
    padding: 0.5rem 0.9rem;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.debug-menu button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.6);
}

/* Enhanced Swiper Slide for Gallery */
#fullGallery .swiper-slide {
    display: flex;
    align-items: stretch;
    justify-content: center;
    background: transparent;
    padding: 0;
}

#fullGallery .swiper {
    background: transparent;
    box-shadow: none;
}

#fullGallery .swiper-pagination-bullet {
    background: var(--primary-color);
    opacity: 0.5;
}

#fullGallery .swiper-pagination-bullet-active {
    opacity: 1;
    background: var(--primary-dark);
}

#fullGallery .swiper-button-next,
#fullGallery .swiper-button-prev {
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.9);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
}

#fullGallery .swiper-button-next:hover,
#fullGallery .swiper-button-prev:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

#fullGallery .swiper-button-next::after,
#fullGallery .swiper-button-prev::after {
    font-size: 20px;
    font-weight: bold;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2500;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 400px;
    width: calc(100% - 2rem);
    pointer-events: none;
}

.toast {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-xl);
    border-left: 4px solid var(--success-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: toastSlideIn 0.3s ease-out;
    pointer-events: auto;
    min-width: 280px;
}

.toast.toast-success {
    border-left-color: var(--success-color);
}

.toast.toast-info {
    border-left-color: var(--primary-color);
}

.toast.toast-warning {
    border-left-color: var(--accent-color);
}

.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.toast-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    margin: 0;
}

.toast-message {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s ease;
    border-radius: var(--radius-sm);
}

.toast-close:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.toast-exiting {
    animation: toastSlideOut 0.3s ease-in forwards;
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

@media (max-width: 768px) {
    .toast-container {
        top: 0.5rem;
        right: 0.5rem;
        left: 0.5rem;
        max-width: none;
        width: auto;
    }
    
    .toast {
        min-width: auto;
        width: 100%;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .lobby-container {
        padding: 0.5rem;
    }
    
    #gameEnd {
        padding: 1.25rem 0.75rem;
    }
    
    .credits-overlay-content {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    
    .credits-scroll-container {
        padding: 1.5rem 1.25rem 1.75rem;
    }
    
    #creditsSequence {
        gap: 1.35rem;
    }
    
    .credits-player-section {
        padding-bottom: 1.25rem;
    }
    
    .credits-player-heading {
        font-size: 1.15rem;
    }
    
    .credits-image-wrapper img {
        max-height: min(55vh, 420px);
    }
    
    .credits-image-star {
        font-size: 1.8rem;
    }
    
    .credits-close-btn {
        top: 0.75rem;
        right: 0.75rem;
        width: 38px;
        height: 38px;
        font-size: 1.2rem;
    }
    
    .debug-menu {
        bottom: 0.75rem;
        right: 0.75rem;
    }
    
    #fullGallery {
        width: 100%;
        padding: 1rem;
        border-radius: var(--radius-lg);
    }
    
    #exitGame {
        width: 100%;
    }
    
    .header-section {
        padding: 1rem 0.5rem 0.5rem;
    }
    
    .player-setup-card,
    .action-card,
    .lobby-info-card,
    .players-card {
        padding: 1rem;
    }
    
    .code-value {
        font-size: 1.5rem;
    }
    
    textarea {
        min-height: 100px;
    }
    
    .circle {
        width: 60px;
        height: 60px;
    }
    
    #settingsBtn {
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
        padding: 0;
        margin: 0;
        line-height: 1;
    }
    
    .settings-content {
        padding: 1.5rem;
    }
    
    .modal-content {
        padding: 1.5rem;
    }
    
    .swiper-slide img {
        max-height: 300px;
    }
    
    .close-fullscreen-btn {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
        top: 0.5rem;
        right: 0.5rem;
    }
    
    .image-fullscreen-modal {
        padding: 1rem;
    }
    
    .fullscreen-gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1rem;
        padding: 1rem 0;
    }
    
    .fullscreen-gallery-item {
        min-height: 250px;
    }
    
    .focus-gallery-toggle-container {
        padding: 0.5rem 0.75rem;
        margin: 0.75rem 0;
    }
    
    .focus-gallery-toggle-container label {
        font-size: 1rem;
        gap: 0.5rem;
    }
    
    .gallery-slide-content {
        padding: 1rem;
        min-height: auto;
    }
    
    .gallery-img-container {
        padding: 0.75rem;
    }
    
    .gallery-image {
        max-height: 350px;
    }
    
    .gallery-star-badge {
        font-size: 2rem;
        top: 1rem;
        right: 1rem;
    }
    
    .gallery-prompt-box {
        padding: 1.5rem;
        min-height: 250px;
        font-size: 1rem;
    }
    
    .gallery-toggle-btn,
    .gallery-download-btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
    }
    
    .gallery-details-card {
        padding: 1.5rem;
    }
    
    .gallery-details-container {
        flex: 1;
    }
    
    #fullGallery .swiper-button-next,
    #fullGallery .swiper-button-prev {
        width: 36px;
        height: 36px;
    }
    
    #fullGallery .swiper-button-next::after,
    #fullGallery .swiper-button-prev::after {
        font-size: 16px;
    }
}
