/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --dark-color: #1f2937;
    --light-color: #f3f4f6;
    --border-color: #e5e7eb;
    --text-gray: #6b7280;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f9fafb;
}

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

/* Header Styles */
.header {
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo i {
    font-size: 2rem;
}

.nav {
    display: flex;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-gray);
    font-weight: 500;
    transition: color 0.3s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

/* Auth Section */
.auth-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Sign In Button */
.sign-in-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.625rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sign-in-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Authentication Modal Styles */
.auth-modal-content {
    max-width: 450px;
    margin: 5% auto;
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: white;
    padding: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-body {
    padding: 2rem;
    background: white;
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 2rem;
    background: var(--light-color);
    border-radius: 0.5rem;
    padding: 0.25rem;
}

.auth-tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-gray);
    border-radius: 0.375rem;
    transition: all 0.3s ease;
}

.auth-tab.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.auth-tab:hover:not(.active) {
    color: var(--dark-color);
}

.auth-form {
    display: none;
    padding: 20px 0;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
    font-size: 0.875rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.submit-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.875rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

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

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

.auth-divider span {
    background: white;
    padding: 0 1rem;
    color: var(--text-gray);
    font-size: 0.875rem;
    position: relative;
    font-weight: 500;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.google-signin-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 1.25rem;
    width: 100%;
}

/* Custom Google Sign-In Button */
.google-custom-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: white;
    border: 1px solid #dadce0;
    border-radius: 0.5rem;
    color: #3c4043;
    font-family: 'Roboto', 'Inter', sans-serif;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px 0 rgba(60,64,67,0.1), 0 1px 3px 1px rgba(60,64,67,0.05);
}

.google-custom-btn:hover {
    background: #f7f8f8;
    border-color: #d2d3d3;
    box-shadow: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
}

.google-custom-btn:active {
    background: #e8eaeb;
    box-shadow: 0 1px 2px 0 rgba(60,64,67,0.3), 0 2px 6px 2px rgba(60,64,67,0.15);
}

/* Custom Google Button Styling Override */
.google-signin-wrapper > div {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
}

/* Center the Google button iframe */
.google-signin-wrapper .g_id_signin,
.google-signin-wrapper .g_id_signin_register {
    display: flex !important;
    justify-content: center !important;
    width: 100% !important;
}

.google-signin-wrapper iframe {
    margin: 0 auto !important;
    width: 100% !important;
    max-width: 360px !important;
}

/* Add animation to modal */
#authModal {
    animation: fadeIn 0.3s ease;
}

.auth-modal-content {
    animation: slideUp 0.3s ease;
}

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

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

/* Shake animation for errors */
.shake {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Error and Success Messages */
.auth-error {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: var(--danger-color);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    display: none;
    border-left: 3px solid var(--danger-color);
    animation: slideDown 0.3s ease;
}

.auth-error i {
    margin-right: 0.5rem;
}

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

.auth-success {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: var(--secondary-color);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    display: none;
    border-left: 3px solid var(--secondary-color);
}

/* Responsive Auth Modal */
@media (max-width: 768px) {
    .auth-modal-content {
        max-width: calc(100% - 2rem);
        width: calc(100% - 2rem);
        margin: 1rem;
        margin-top: 5vh;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .auth-tabs {
        gap: 0.25rem;
    }
    
    .auth-tab {
        padding: 0.6rem 1rem;
        font-size: 0.875rem;
    }
}

/* Mobile specific styles */
@media (max-width: 480px) {
    .modal {
        padding: 0;
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        overflow: hidden;
    }
    
    .auth-modal-content {
        width: 100%;
        height: 100%;
        margin: 0;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        background: white;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
    
    .auth-modal-content .modal-header {
        display: none !important;
    }
    
    .modal-close {
        position: absolute;
        top: calc(1rem + env(safe-area-inset-top));
        right: 1rem;
        background: rgba(255, 255, 255, 0.95);
        width: 32px;
        height: 32px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #666;
        font-size: 1.25rem;
        font-weight: 300;
        border: 1px solid #e0e0e0;
        cursor: pointer;
        z-index: 100;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .auth-modal-content .modal-body {
        padding: 1.25rem;
        padding-top: calc(2.5rem + env(safe-area-inset-top));
        padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
        flex: none;
        overflow: visible;
        display: block;
        position: relative;
        min-height: 100%;
    }
    
    .auth-tabs {
        display: flex;
        flex-direction: row;
        gap: 0.5rem;
        margin-bottom: 1.5rem;
        background: transparent;
        border-radius: 0;
        padding: 0;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .auth-tab {
        flex: 1;
        padding: 1rem 0.5rem;
        font-size: 1rem;
        font-weight: 600;
        border-radius: 0;
        transition: all 0.2s ease;
        background: transparent;
        border: none;
        border-bottom: 3px solid transparent;
        color: #666;
    }
    
    .auth-tab.active {
        color: var(--primary-color);
        border-bottom-color: var(--primary-color);
        background: transparent;
    }
    
    .auth-form {
        padding: 0.5rem 0 1rem;
        display: none;
    }
    
    .auth-form.active {
        display: block;
    }
    
    .form-group {
        margin-bottom: 1.25rem;
    }
    
    .form-group:last-of-type {
        margin-bottom: 1rem;
    }
    
    .form-group label {
        font-size: 0.9375rem;
        margin-bottom: 0.5rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-weight: 600;
        color: #333;
    }
    
    .form-group input {
        padding: 1rem;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 0.75rem;
        border: 2px solid #e0e0e0;
        width: 100%;
        box-sizing: border-box;
        -webkit-appearance: none;
        background: #f8f9fa;
        transition: all 0.2s ease;
    }
    
    .form-group input:focus {
        border-color: var(--primary-color);
        outline: none;
        box-shadow: none;
        background: white;
    }
    
    .submit-btn {
        padding: 1rem 1.5rem;
        font-size: 1.0625rem;
        font-weight: 600;
        border-radius: 0.75rem;
        width: 100%;
        margin-top: 0.75rem;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        min-height: 52px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }
    
    .submit-btn i {
        font-size: 1rem;
    }
    
    .auth-divider {
        margin: 1.5rem 0;
        font-size: 0.9375rem;
        position: relative;
        text-align: center;
    }
    
    .auth-divider span {
        background: white;
        padding: 0 1rem;
        position: relative;
        color: #999;
    }
    
    .auth-divider::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        height: 1px;
        background: #e0e0e0;
    }
    
    .google-signin-wrapper {
        width: 100%;
        display: flex;
        justify-content: center;
        margin-bottom: 1rem;
    }
    
    .google-signin-wrapper > div {
        width: 100%;
        max-width: 100%;
    }
    
    /* Hide only the hidden Google iframe divs on mobile */
    .g_id_signin[style*="visibility: hidden"], 
    .g_id_signin_register[style*="visibility: hidden"] {
        display: none !important;
    }
    
    /* Clean Google signin wrapper */
    .google-signin-wrapper {
        width: 100%;
        margin-bottom: 1rem;
        position: relative;
    }
    
    /* Ensure custom Google button is always visible */
    .google-custom-btn {
        display: inline-flex !important;
    }
    
    .auth-error {
        padding: 0.75rem;
        font-size: 0.875rem;
        margin-bottom: 1rem;
    }
    
    /* Fix checkbox and link alignment */
    label[for="rememberMe"] {
        font-size: 0.875rem;
        font-weight: normal;
    }
    
    /* Forgot password link */
    a[onclick*="showNotification"] {
        font-size: 0.875rem;
    }
    
    /* Remember me checkbox container */
    div[style*="display: flex"][style*="justify-content: space-between"] {
        font-size: 0.875rem !important;
    }
    
    /* Custom Google button mobile adjustments */
    .google-custom-btn {
        font-size: 1rem;
        padding: 0.875rem 1rem;
        min-height: 48px;
        border-radius: 0.5rem;
        border: 1px solid #dadce0;
        font-weight: 500;
        width: 100%;
        background: white;
        color: #3c4043;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
        box-shadow: 0 1px 2px 0 rgba(60,64,67,0.1);
        margin: 0;
    }
    
    .google-custom-btn:active {
        background: #f8f9fa;
        box-shadow: 0 1px 2px 0 rgba(60,64,67,0.3);
    }
    
    .google-custom-btn svg {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
    }
    
    /* Form layout is handled above */
    
    /* Fix checkbox and remember me row */
    div[style*="display: flex"][style*="justify-content: space-between"] {
        margin: 0.75rem 0 !important;
    }
    
    /* Adjust error messages */
    .auth-error {
        margin-bottom: 1rem;
        padding: 0.75rem;
        border-radius: 0.5rem;
    }
}

/* iPhone specific adjustments */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari specific styles */
    @media (max-width: 480px) {
        .auth-modal-content {
            height: 100vh;
            height: -webkit-fill-available;
        }
        
        .modal {
            height: 100vh;
            height: -webkit-fill-available;
        }
    }
}

/* Password strength indicator */
.password-strength {
    height: 3px;
    background: var(--border-color);
    border-radius: 2px;
    margin-top: 0.25rem;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    width: 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.password-strength-weak {
    width: 33%;
    background: var(--danger-color);
}

.password-strength-medium {
    width: 66%;
    background: #f59e0b;
}

.password-strength-strong {
    width: 100%;
    background: var(--secondary-color);
}

/* Loading state for buttons */
.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.submit-btn i {
    margin-right: 0.5rem;
}

/* Google button centering */
.google-signin-wrapper iframe {
    display: block !important;
    margin: 0 auto !important;
}

/* Additional centering for Google button container */
.google-signin-wrapper [role="button"] {
    margin: 0 auto !important;
}

/* Ensure text alignment for wrapper */
.google-signin-wrapper {
    text-align: center !important;
}

/* Google Sign-In Button Container */
.g_id_signin,
.g_id_signin_register {
    display: inline-block !important;
    text-align: center !important;
}

/* Force center alignment for Google button iframe specifically */
.google-signin-wrapper > div > div {
    display: flex !important;
    justify-content: center !important;
}

/* Ensure the button itself is centered */
.nsm7Bb-HzV7m-LgbsSe {
    margin: 0 auto !important;
}

/* Old mock button styles - kept for reference */
.google-signin-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
}

.google-signin-btn:hover {
    box-shadow: var(--shadow);
}

.google-signin-btn img {
    width: 20px;
    height: 20px;
}

.user-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.user-score {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    background: var(--light-color);
    border-radius: 2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.user-score i {
    color: #fbbf24;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    display: none;
    z-index: 1000;
}

/* Dropdown menu is now controlled by JavaScript click events */

.dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--dark-color);
    transition: background 0.3s;
}

.dropdown-item:hover {
    background: var(--light-color);
}

/* Video Library Styles */
.video-library {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    background: var(--light-color);
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.video-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border: 2px solid transparent;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
}

.video-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.video-item.selected {
    border-color: var(--primary-color);
    background: #eef2ff;
}

.video-thumbnail {
    width: 160px;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 0.25rem;
    flex-shrink: 0;
}

.video-info {
    flex: 1;
}

.video-info h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    line-height: 1.2;
    color: var(--text-dark);
}

.video-info p {
    font-size: 0.75rem;
    color: var(--text-gray);
}

.video-thumbnail-wrapper {
    position: relative;
    width: 160px;
    flex-shrink: 0;
}

.video-library-grid .video-thumbnail-wrapper {
    width: 100%;
}

.video-item .duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Generation Modal Styles */
.generation-modal {
    max-width: 800px;
    width: 90%;
}

.generation-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

.thumbnail-placeholder {
    position: relative;
    background: var(--light-color);
    border-radius: 0.5rem;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.progress-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
}

.progress-bar-container {
    width: 80%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    margin-top: 0.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 3rem 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.25rem;
    opacity: 0.9;
}

/* Create Section */
.create-section {
    padding: 3rem 0;
    background: white;
    border-radius: 1rem;
    margin: -2rem 20px 2rem;
    box-shadow: var(--shadow-lg);
}

.create-form {
    max-width: 600px;
    margin: 0 auto;
}

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

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

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.generate-btn {
    width: 100%;
    padding: 1rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.generate-btn:hover {
    background: var(--primary-dark);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 3rem;
    border-radius: 1rem;
    text-align: center;
    max-width: 500px;
}

/* Countdown Circle */
.countdown-circle {
    position: relative;
    margin: 2rem auto;
}

.progress-bg {
    fill: none;
    stroke: var(--light-color);
    stroke-width: 10;
}

.progress-bar {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 10;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: center;
    stroke-dasharray: 565;
    stroke-dashoffset: 565;
    animation: countdown 30s linear forwards;
}

@keyframes countdown {
    to {
        stroke-dashoffset: 0;
    }
}

.countdown-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
}

.browse-btn {
    padding: 0.75rem 2rem;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.browse-btn:hover {
    background: #059669;
}

/* Results Section */
.results-section {
    padding: 3rem 0;
}

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

.thumbnail-option {
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
}

.thumbnail-option:hover {
    box-shadow: var(--shadow-lg);
}

.thumbnail-option img {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
}

.thumbnail-option-footer {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.select-btn {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background 0.3s;
}

.select-btn:hover {
    background: var(--primary-dark);
}

.regenerate-btn {
    margin: 2rem auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 2rem;
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.regenerate-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* Gallery Section */
.gallery-section {
    padding: 3rem 0;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.filter-options {
    display: flex;
    gap: 1rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    background: white;
    color: var(--text-gray);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Selected Video Info */
.selected-video-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 1rem;
    box-shadow: var(--shadow);
}

.selected-thumb {
    width: 160px;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 0.5rem;
}

.video-details {
    flex: 1;
}

.editable-title-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.editable-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark-color);
    border: 2px solid transparent;
    background: transparent;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    flex: 1;
    transition: all 0.3s;
    cursor: text;
}

.editable-title:hover {
    background: var(--light-color);
}

.editable-title:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

.edit-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    opacity: 0.7;
}

.edit-btn:hover {
    opacity: 1;
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.selected-video-info h2 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.selected-video-info p {
    color: var(--text-gray);
}

.title-hint {
    font-size: 0.875rem;
    color: var(--primary-color);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.title-hint i {
    font-size: 0.75rem;
}

/* Back Button */
.back-btn {
    padding: 0.75rem 1.5rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s;
}

.back-btn:hover {
    background: var(--light-color);
    border-color: var(--primary-color);
}

/* Generation Form - New Beautiful Design */
.generation-form-wrapper {
    background: linear-gradient(135deg, #fff 0%, #f8f9ff 100%);
    padding: 2.5rem;
    border-radius: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
    border: 1px solid rgba(99, 102, 241, 0.1);
    position: relative;
    overflow: hidden;
}

.generation-form-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.05) 0%, transparent 70%);
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(30px, -30px) rotate(180deg); }
}

.generation-form-header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.generation-form-header h3 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.generation-form-header h3 i {
    margin-right: 0.5rem;
    animation: sparkle 2s ease-in-out infinite;
}

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

.form-subtitle {
    color: var(--text-gray);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.feature-highlights {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.feature-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(118, 75, 162, 0.1));
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-color);
    transition: all 0.3s ease;
}

.feature-tag i {
    font-size: 0.7rem;
}

.feature-tag:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(118, 75, 162, 0.2));
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.15);
}

.how-it-works {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(99, 102, 241, 0.1);
}

.how-it-works-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
    text-align: center;
}

.steps-mini {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.step-mini {
    padding: 0.5rem 0.75rem;
    background: white;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    color: var(--dark-color);
    border: 1px solid var(--border-color);
    font-weight: 500;
}

.step-arrow {
    color: var(--primary-color);
    font-size: 0.75rem;
    opacity: 0.6;
}

@media (max-width: 768px) {
    .steps-mini {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .step-arrow:nth-of-type(1) {
        transform: rotate(90deg);
    }
    
    .step-arrow:nth-of-type(2) {
        display: none;
    }
    
    .step-mini {
        width: 100%;
        text-align: center;
    }
}

.create-form-inline {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    z-index: 1;
    background: transparent;
    padding: 0;
    box-shadow: none;
}

.input-wrapper {
    width: 100%;
}

.form-field {
    margin-bottom: 1.5rem;
}

.field-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.field-label i {
    margin-right: 0.5rem;
}

.label-hint {
    font-size: 0.75rem;
    color: var(--text-gray);
    font-weight: 400;
    text-transform: none;
    opacity: 0.8;
    margin-left: 0.5rem;
}

.title-input-container {
    position: relative;
    background: linear-gradient(145deg, #ffffff, #f8f9ff);
    border-radius: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 2px dashed #e5e7eb;
    background-clip: padding-box;
    transition: all 0.3s ease;
}

.title-input-container:hover {
    border-color: var(--primary-color);
    border-style: solid;
    box-shadow: 0 3px 15px rgba(99, 102, 241, 0.1);
    cursor: text;
}

.title-input-container::before {
    content: 'Click to edit title';
    position: absolute;
    top: -8px;
    left: 1rem;
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0;
    transform: translateY(5px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.title-input-container:hover::before {
    opacity: 1;
    transform: translateY(0);
}

.title-input-container:focus-within {
    border-color: var(--primary-color);
    border-style: solid;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
    background: white;
}

.title-input-container:focus-within::before {
    opacity: 0;
}

.edit-indicator {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
    opacity: 0.5;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.title-input-container:hover .edit-indicator,
.title-input-container:focus-within .edit-indicator {
    opacity: 1;
    animation: pulse 2s ease-in-out infinite;
}

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

.title-input {
    width: 100%;
    padding: 1rem 3rem 1rem 3rem;
    border: none;
    border-radius: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    background: transparent;
    color: var(--dark-color);
    cursor: text;
}

.title-input:focus {
    outline: none;
}

.title-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
    font-style: italic;
}

.textarea-container {
    position: relative;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: all 0.3s ease;
}

.textarea-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

.input-icon {
    position: absolute;
    top: 1.2rem;
    left: 1.2rem;
    color: var(--primary-color);
    z-index: 2;
    font-size: 1.1rem;
}

.textarea-container textarea {
    width: 100%;
    padding: 1.2rem 1.2rem 2rem 3rem;
    border: none;
    border-radius: 1rem;
    font-size: 1rem;
    resize: vertical;
    min-height: 100px;
    font-family: 'Inter', sans-serif;
    background: transparent;
    color: var(--dark-color);
}

.textarea-container textarea:focus {
    outline: none;
}

.textarea-container textarea::placeholder {
    color: #9ca3af;
}

.char-counter {
    position: absolute;
    bottom: 0.8rem;
    right: 1.2rem;
    font-size: 0.75rem;
    color: var(--text-gray);
    background: white;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
}

.suggestion-chips {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.chip {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 2rem;
    font-size: 0.875rem;
    color: var(--text-gray);
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.chip:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.25);
}

/* New Generate Button */
.generate-btn-new {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    padding: 1.2rem 2.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 3rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.generate-btn-new:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

.generate-btn-new:active {
    transform: translateY(-1px);
}

.btn-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.btn-content i {
    font-size: 1.2rem;
}

.btn-shimmer {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.generate-btn-new:hover .btn-shimmer {
    left: 100%;
}

/* Legacy form group styles */
.create-form-inline .form-group {
    flex: 1;
    margin-bottom: 0;
}

.create-form-inline .generate-btn {
    width: auto;
    padding: 0.75rem 2rem;
}

/* Horizontal Thumbnails Section */
.my-thumbnails-section {
    margin-bottom: 3rem;
}

.my-thumbnails-section h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.horizontal-scroll-container {
    position: relative;
    overflow: hidden;
}

.horizontal-thumbnails {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding-bottom: 1rem;
    -webkit-overflow-scrolling: touch;
}

.horizontal-thumbnails::-webkit-scrollbar {
    height: 8px;
}

.horizontal-thumbnails::-webkit-scrollbar-track {
    background: var(--light-color);
    border-radius: 4px;
}

.horizontal-thumbnails::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

/* Thumbnail Card for Horizontal Scroll */
.thumbnail-card-horizontal {
    flex: 0 0 300px;
    background: white;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.thumbnail-card-horizontal:hover {
    box-shadow: var(--shadow-lg);
}

.thumbnail-card-horizontal .thumbnail-image-wrapper {
    width: 100%;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

.thumbnail-card-horizontal .thumbnail-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
}

.horizontal-thumbnail-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.horizontal-thumbnail-overlay i {
    color: white;
    font-size: 1.25rem;
}

.thumbnail-card-horizontal:hover .horizontal-thumbnail-overlay {
    opacity: 1;
}

.thumbnail-info-horizontal {
    padding: 1rem;
}

.thumbnail-info-horizontal h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.thumbnail-meta-horizontal {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-gray);
}

.thumbnail-stats-row {
    display: flex;
    gap: 0.75rem;
}

.stat-mini {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.stat-mini i {
    font-size: 0.625rem;
    color: var(--primary-color);
}

.thumbnail-time {
    font-size: 0.7rem;
    color: #9ca3af;
}

/* Thumbnail Placeholder for Generation */
.thumbnail-placeholder-card {
    flex: 0 0 300px;
    background: var(--light-color);
    border-radius: 0.75rem;
    overflow: hidden;
    position: relative;
    height: 250px;
}

.thumbnail-placeholder-card .progress-overlay {
    height: 168px;
}

/* Stream Section */
.stream-section {
    margin-top: 2rem;
}

.stream-section h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

/* Stream Header with Sort Toggle */
.stream-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.stream-header h3 {
    margin-bottom: 0;
}

.sort-toggle {
    display: flex;
    gap: 0.5rem;
    background: var(--card-bg);
    border-radius: 8px;
    padding: 4px;
}

.sort-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.sort-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sort-btn.active {
    background: var(--primary-color);
    color: white;
}

.sort-btn i {
    font-size: 0.85rem;
}

.refresh-btn {
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-left: 0.5rem;
}

.refresh-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary-color);
}

.refresh-btn.refreshing i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.thumbnail-stream {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Loading Indicator */
.loading-indicator {
    text-align: center;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--light-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Remove old styles */
.hero,
.create-section,
.results-section,
.gallery-section {
    display: none;
}

/* Thumbnail Cards in Stream */
.thumbnail-card {
    background: white;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.thumbnail-card:hover {
    box-shadow: var(--shadow-lg);
}

.thumbnail-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    cursor: pointer;
}

.thumbnail-overlay i {
    color: white;
    font-size: 2rem;
}

.thumbnail-card:hover .thumbnail-overlay {
    opacity: 1;
}

.creator-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    font-size: 0.875rem;
}

/* Creator info in thumbnail card */
.creator-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.creator-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.creator-name {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.creator-info .thumbnail-time {
    margin-left: auto;
    font-size: 0.75rem;
    color: #9ca3af;
    white-space: nowrap;
}

.creator-avatar-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid white;
}

.thumbnail-content {
    padding: 1rem;
}

.thumbnail-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thumbnail-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-gray);
    margin-bottom: 0.75rem;
}

/* Tournament Stats */
.tournament-stats {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 0;
    border-top: 1px solid #e5e7eb;
    margin-top: 0.75rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
}

.stat-item i {
    font-size: 1rem;
    color: var(--primary-color);
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-color);
}

.stat-label {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: lowercase;
}

/* Legacy vote styles (keeping for other uses) */
.vote-buttons {
    display: flex;
    gap: 0.5rem;
}

.vote-btn-compact {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    background: var(--light-color);
    border: none;
    border-radius: 1rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.vote-btn-compact:hover {
    background: var(--primary-color);
    color: white;
}

.vote-btn-compact.upvoted {
    background: var(--secondary-color);
    color: white;
}

.vote-btn-compact.downvoted {
    background: var(--danger-color);
    color: white;
}

.vote-count {
    font-weight: 600;
    transition: transform 0.2s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header .container {
        padding: 0.75rem 15px;
    }
    
    .logo span {
        display: none;
    }
    
    .nav {
        display: none;
    }
    
    .user-score {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .view-section {
        padding: 1rem 0;
    }
    
    .view-header h1 {
        font-size: 1.75rem;
    }
    
    .video-library-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .video-library-grid .video-thumbnail {
        height: 200px;
    }
    
    .selected-video-info {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .selected-thumb {
        width: 100%;
        max-width: 300px;
        aspect-ratio: 16/9;
        object-fit: cover;
    }
    
    .video-details {
        width: 100%;
    }
    
    .editable-title-wrapper {
        justify-content: center;
    }
    
    .editable-title {
        font-size: 1.25rem;
        text-align: center;
    }
    
    .generation-form-wrapper {
        padding: 1.5rem;
    }
    
    .generation-form-header h3 {
        font-size: 1.25rem;
    }
    
    .feature-highlights {
        gap: 0.4rem;
    }
    
    .feature-tag {
        font-size: 0.7rem;
        padding: 0.3rem 0.6rem;
    }
    
    .how-it-works {
        margin-top: 1rem;
        padding-top: 1rem;
    }
    
    .form-field {
        margin-bottom: 1rem;
    }
    
    .field-label {
        font-size: 0.8rem;
    }
    
    .title-input {
        padding: 0.875rem 2.5rem 0.875rem 2.5rem;
        font-size: 1rem;
    }
    
    .edit-indicator {
        right: 0.75rem;
    }
    
    .textarea-container textarea {
        padding: 1rem 1rem 2rem 2.5rem;
        font-size: 0.9rem;
    }
    
    .input-icon {
        font-size: 0.9rem;
        left: 0.8rem;
        top: 1rem;
    }
    
    .suggestion-chips {
        gap: 0.4rem;
    }
    
    .chip {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .generate-btn-new {
        max-width: 100%;
        padding: 1rem 2rem;
        font-size: 1rem;
    }
    
    .create-form-inline {
        flex-direction: column;
        gap: 1rem;
    }
    
    .create-form-inline .generate-btn {
        width: 100%;
    }
    
    .horizontal-thumbnails {
        gap: 0.75rem;
        padding: 0 15px 1rem;
    }
    
    .thumbnail-card-horizontal {
        flex: 0 0 250px;
    }
    
    .thumbnail-placeholder-card {
        flex: 0 0 250px;
    }
    
    .thumbnail-stream {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0 15px;
    }
    
    .filter-options {
        width: 100%;
        justify-content: center;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .filter-btn {
        min-width: 80px;
        font-size: 0.875rem;
    }
    
    .thumbnail-card {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
    
    .thumbnail-content {
        padding: 0.75rem;
    }
    
    .thumbnail-title {
        font-size: 0.875rem;
    }
    
    .thumbnail-stats {
        font-size: 0.7rem;
    }
    
    .vote-btn-compact {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .vote-section {
        justify-content: space-between;
    }
    
    .tournament-stats {
        padding: 0.5rem 0;
    }
    
    .stat-item i {
        font-size: 0.875rem;
    }
    
    .stat-value {
        font-size: 1rem;
    }
    
    .stat-label {
        font-size: 0.65rem;
    }
    
    .vote-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .footer .container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .footer-links {
        gap: 1rem;
        font-size: 0.875rem;
    }
}

/* Enhanced touch targets for mobile */
@media (hover: none) and (pointer: coarse) {
    button, .vote-btn, .filter-btn, .video-item {
        min-height: 44px;
    }
    
    .dropdown-item {
        padding: 1rem 1.25rem;
    }
    
    .video-library-grid .video-item {
        min-height: auto;
    }
}

/* Footer */
.footer {
    background: var(--dark-color);
    color: white;
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-links {
    display: flex;
    gap: 2rem;
}

.footer-links a {
    color: white;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.footer-links a:hover {
    opacity: 1;
}

/* View Sections */
.view-section {
    min-height: calc(100vh - 80px);
    padding: 2rem 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.view-section.active {
    opacity: 1;
}

.view-header {
    margin-bottom: 2rem;
}

.view-header h1 {
    font-size: 2.5rem;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.view-header p {
    font-size: 1.125rem;
    color: var(--text-gray);
}

/* Video Library Grid */
.video-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.video-library-grid .video-item {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s;
    border: 3px solid transparent;
}

.video-library-grid .video-item:hover {
    box-shadow: var(--shadow-lg);
}

.video-library-grid .video-item.selected {
    border-color: var(--primary-color);
}

.video-library-grid .video-thumbnail {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
}

.video-library-grid .video-info {
    padding: 1rem;
    background: white;
    flex: 1;
}

.video-library-grid .video-info h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.video-library-grid .video-info p {
    font-size: 0.875rem;
    color: var(--text-gray);
}

/* Tournament Rating Screen */
.tournament-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    }
    
.tournament-container {
    max-width: 1000px;
    width: 90%;
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.tournament-header {
    text-align: center;
    margin-bottom: 2rem;
}

.tournament-header h2 {
        font-size: 2rem;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    }
    
.tournament-header p {
    color: var(--text-gray);
    font-size: 1.125rem;
}

.round-indicators {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.round-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--light-color);
    transition: all 0.3s;
}

.round-dot.active {
    background: var(--primary-color);
    transform: scale(1.3);
}

/* Timer Bar */
.timer-bar {
    position: relative;
    height: 40px;
    background: var(--light-color);
    border-radius: 2rem;
    margin-bottom: 2rem;
    overflow: hidden;
}

.timer-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #ef4444, #f59e0b);
    border-radius: 2rem;
    width: 0%;
    transition: width 1s linear;
}

.timer-fill.ready {
    background: linear-gradient(90deg, var(--secondary-color), var(--primary-color));
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dark-color);
    z-index: 1;
}

/* Versus Container */
.versus-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 2rem;
    }
    
.thumbnail-option-tournament {
    position: relative;
    flex: 1;
    max-width: 400px;
    border-radius: 1rem;
    overflow: hidden;
    cursor: pointer;
    transform: scale(1);
    transition: all 0.3s, opacity 0.5s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: white;
}

.thumbnail-option-tournament:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.thumbnail-option-tournament.selected {
    box-shadow: 0 0 0 4px var(--primary-color);
}

/* Removed disabled overlay to keep thumbnails fully visible */

.tournament-image {
        width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    background: transparent;
}

.option-label {
    position: absolute;
    top: 1rem;
    left: 1rem;
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
        justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--dark-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.selection-overlay {
    position: absolute;
    inset: 0;
    background: rgba(16, 185, 129, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    }
    
.thumbnail-option-tournament.selected .selection-overlay {
    opacity: 1;
    pointer-events: auto;
}

.selection-overlay i {
    font-size: 4rem;
    color: white;
}

/* Stats Overlay */
.stats-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 3;
}

.thumbnail-option-tournament.show-stats .stats-overlay {
    opacity: 1;
}

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

.stats-record {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stats-percent {
    display: block;
    font-size: 1.1rem;
    font-weight: 500;
    color: #fbbf24;
}

/* Tournament Actions */
.tournament-actions {
    text-align: center;
    margin-top: 1rem;
    z-index: 10;
    position: relative;
}

.next-round-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
}

.next-round-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.versus-badge {
    width: 60px;
    height: 60px;
    background: var(--dark-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.skip-notice {
    text-align: center;
    color: var(--text-gray);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    z-index: 10;
    position: relative;
}

.tournament-creator-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
}

.tournament-creator-info img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid white;
}

.tournament-creator-info span {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Keyboard hints */
.tournament-screen::after {
    content: "Wait 10 seconds, then press A/← for left or B/→ for right";
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 0.875rem;
    opacity: 0.7;
}

/* My Thumbnails Modal */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--dark-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-gray);
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s;
}

.close-btn:hover {
    color: var(--dark-color);
}

.modal-body {
    padding: 2rem;
    max-height: calc(80vh - 100px);
    overflow-y: auto;
}

.my-thumbnails-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.my-thumbnail-card {
    background: white;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    position: relative;
}

.my-thumbnail-card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.my-thumbnail-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.my-thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.my-thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.my-thumbnail-overlay i {
    color: white;
    font-size: 2rem;
}

.my-thumbnail-card:hover .my-thumbnail-overlay {
    opacity: 1;
}

.my-thumbnail-info {
    padding: 1rem;
}

.my-thumbnail-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.my-thumbnail-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-gray);
}

.stat-row {
    display: flex;
    gap: 0.75rem;
}

.stat-item-small {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.stat-item-small i {
    font-size: 0.75rem;
    color: var(--primary-color);
}

.my-thumbnail-votes {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.my-thumbnail-date {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* Responsive My Thumbnails Modal */
@media (max-width: 768px) {
    .modal-content {
        margin: 1rem;
        width: calc(100% - 2rem);
    }
    
    .my-thumbnails-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
}

/* Responsive Stats Overlay */
@media (max-width: 768px) {
    .stats-record {
        font-size: 1.25rem;
    }
    
    .stats-percent {
        font-size: 1rem;
    }
}

/* Responsive Tournament */
@media (max-width: 768px) {
    .tournament-screen {
        padding: 0;
        align-items: flex-start;
    }
    
    .tournament-container {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile */
        border-radius: 0;
        padding: 0.75rem;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    
    .tournament-header {
        margin-bottom: 0.75rem;
        padding-top: 0.25rem;
        flex-shrink: 0;
    }
    
    .tournament-header h2 {
        font-size: 1.25rem;
        line-height: 1.3;
        margin-bottom: 0.35rem;
    }
    
    .tournament-header p {
        font-size: 0.9rem;
        line-height: 1.3;
    }
    
    .round-indicators {
        gap: 0.5rem;
        margin-top: 0.5rem;
    }
    
    .round-dot {
        width: 10px;
        height: 10px;
    }
    
    .timer-bar {
        height: 28px;
        margin-bottom: 1rem; /* More space so it doesn't touch first thumbnail */
        flex-shrink: 0;
    }
    
    .timer-text {
        font-size: 1rem;
    }
    
    .versus-container {
        flex-direction: column;
        gap: 0.75rem;
        margin-bottom: 0.5rem;
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 0.25rem 0;
        min-height: 0; /* Important for flex children */
    }
    
    .thumbnail-option-tournament {
        max-width: 100%;
        width: 100%;
        border-radius: 0.75rem;
    }
    
    .option-label {
        width: 32px;
        height: 32px;
        font-size: 1rem;
        top: 0.75rem;
        left: 0.75rem;
    }
    
    .tournament-image {
        width: 100%;
        height: auto;
        max-height: 200px;
        object-fit: contain; /* Avoid cropping on mobile */
        display: block;
    }
    
    .tournament-info {
        display: block; /* Show title below image */
        padding: 0.4rem 0.6rem;
        border-top: 1px solid var(--border-color);
        background: white;
    }
    
    .tournament-title {
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: 0.85rem;
        margin-bottom: 0;
    }
    
    .versus-badge {
        width: 36px;
        height: 36px;
        font-size: 0.8rem;
        position: static;
        margin: 0.25rem auto;
        flex-shrink: 0;
    }
    
    /* Tournament actions always visible at bottom */
    .tournament-actions {
        flex-shrink: 0;
        padding: 0.5rem 0;
        margin-top: auto;
        position: sticky;
        bottom: env(safe-area-inset-bottom, 0);
        background: white;
    }
    
    .skip-notice {
        flex-shrink: 0;
        margin-bottom: 0.5rem;
        margin-top: 0;
    }
    
    /* Ensure first thumbnail has breathing room below timer */
    .versus-container .thumbnail-option-tournament:first-child {
        margin-top: 0.25rem;
    }
    
    .selection-overlay i {
        font-size: 3rem;
    }
    
    .stats-overlay {
        padding: 1rem;
    }
    
    .stats-record {
        font-size: 1.25rem;
    }
    
    .stats-label {
        font-size: 0.75rem;
    }
    
    .stats-percent {
        font-size: 0.875rem;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .tournament-container {
        padding: 0.5rem;
        padding-top: env(safe-area-inset-top, 0.5rem);
        padding-bottom: env(safe-area-inset-bottom, 0.5rem);
    }
    
    .tournament-header {
        margin-bottom: 0.5rem;
    }
    
    .tournament-header h2 {
        font-size: 1.1rem;
    }
    
    .tournament-header p {
        font-size: 0.8rem;
        padding: 0;
    }
    
    .round-indicators {
        margin-top: 0.35rem;
    }
    
    .timer-bar {
        height: 24px;
        border-radius: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .timer-text {
        font-size: 0.875rem;
    }
    
    .versus-container {
        gap: 0.5rem;
    }
    
    .tournament-image {
        max-height: 170px;
        height: auto;
        width: 100%;
        object-fit: contain;
    }
    
    .thumbnail-option-tournament {
        border-radius: 0.5rem;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    /* Improve touch targets */
    .thumbnail-option-tournament {
        min-height: 100px;
    }
    
    .versus-badge {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }
    
    .tournament-info {
        display: block; /* Also show on small phones */
    }
    
    /* Ensure VS badge stays visible */
    .versus-badge {
        background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }
    
    /* Mobile-optimize action buttons */
    .tournament-actions {
        padding: 0.5rem;
    }
    
    .next-round-btn {
        width: 100%;
        padding: 0.875rem 1.5rem;
        font-size: 0.95rem;
    }
    
    /* Mobile-optimize skip notice */
    .skip-notice {
        font-size: 0.8rem;
        padding: 0.5rem;
        margin-top: 0.5rem;
    }
    
    .skip-notice i {
        font-size: 0.9rem;
    }
}

/* Landscape mode adjustments for mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .tournament-container {
        height: auto;
        min-height: 100vh;
    }
    
    .versus-container {
        flex-direction: row;
        gap: 1rem;
        align-items: center;
    }
    
    .thumbnail-option-tournament {
        flex: 1;
        max-width: 45%;
    }
    
    .tournament-image {
        max-height: 150px;
        height: auto;
        width: 100%;
        object-fit: contain;
    }
    
    .tournament-info {
        display: block; /* Show in landscape as well */
    }
    
    .versus-badge {
        position: static;
        margin: 0 0.5rem;
    }
}

.tournament-info {
    position: relative;
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
}

.thumbnail-option-tournament:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    }

.tournament-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tournament-score{
    display: none !important; /* Stats now shown in overlay */
}

/* Remove creator overlay */
.tournament-creator-info { display: none !important; }

/* Rating Intro */
.rating-intro-card{
    background:white;
    max-width:520px;
    width:92%;
    padding:2.5rem 2rem 3rem;
    border-radius:1.25rem;
    text-align:center;
    box-shadow:0 20px 40px rgba(0,0,0,.25);
}
.intro-hero{
    width:80px;
    height:80px;
    display:flex;
    align-items:center;
    justify-content:center;
    margin:0 auto 1rem;
    background:var(--primary-color);
    color:#fff;
    border-radius:50%;
    font-size:2rem;
}
.intro-sub{color:var(--text-gray);margin-bottom:1.5rem;}
.intro-steps{margin:0 0 2rem;padding:0;list-style:none;text-align:left;}
.intro-steps li{display:flex;align-items:flex-start;gap:.75rem;margin-bottom:1rem;font-size:.95rem;color:var(--dark-color);}
.step-number{display:inline-flex;align-items:center;justify-content:center;background:var(--primary-color);color:#fff;border-radius:50%;width:28px;height:28px;font-weight:700;}
.primary-btn{display:inline-flex;align-items:center;gap:.5rem;padding:.9rem 2rem;background:var(--primary-color);color:#fff;border:none;border-radius:.5rem;font-size:1rem;font-weight:600;cursor:pointer;transition:background .3s;}
.primary-btn:hover{background:var(--primary-dark);}

/* VS Page Styles */
.vs-page {
    padding: 2rem 0;
}

.vs-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.vs-card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.vs-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--text-gray);
}

.vs-images {
    display: grid;
    grid-template-columns: 1fr 40px 1fr;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
}

.vs-img-wrapper {
    position: relative;
    background: #fff;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.vs-img-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

.vs-badge {
    width: 36px;
    height: 36px;
    background: var(--dark-color);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.winner .vs-img-wrapper { border: 4px solid var(--secondary-color); }
.loser  .vs-img-wrapper { filter: none; opacity: 1; }

/* VS overrides to ensure clear winner highlight and no dim on loser */
.vs-images .vs-img-wrapper,
.vs-images .vs-img-wrapper img { opacity: 1 !important; filter: none !important; }
.winner .vs-img-wrapper { border: 4px solid var(--secondary-color) !important; box-shadow: 0 0 0 2px rgba(16,185,129,.25) !important; }
.loser  .vs-img-wrapper { border: 1px solid var(--border-color) !important; }

.vs-meta {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 1rem 1rem;
    font-size: 0.8rem;
    color: var(--text-gray);
}

.vs-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .vs-list {
        grid-template-columns: 1fr;
    }
}

/* Dark overlay for rating intro */
.rating-intro{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,0.9);
    backdrop-filter:blur(3px);
    display:flex;
    align-items:center;
    justify-content:center;
    z-index:1000;
}

/* Hide auth elements when logged in */
body.logged-in .sign-in-btn,
body.logged-in .g_id_signin,
body.logged-in .g_id_signin iframe,
body.logged-in .nsm7Bb-HzV7m-LgbsSe {
    display: none !important;
}

/* Ensure user menu is visible when logged in */
body.logged-in .user-menu {
    display: flex !important;
}

/* ----- Fix: show full thumbnail images without cropping ----- */
.my-thumbnail-image {
    object-fit: contain;
}

/* Ensure horizontal cards show full image without cropping */
.thumbnail-card-horizontal .thumbnail-image-wrapper {
    aspect-ratio: auto !important;
    overflow: visible !important;
}

/* Ensure community thumbnails (grid) do not letterbox; image sizes naturally */
.thumbnail-card .thumbnail-image-wrapper {
    aspect-ratio: auto !important;
    overflow: visible !important;
}

.thumbnail-card .thumbnail-image {
    width: 100% !important;
    height: auto !important;
}

/* Enlarged Thumbnail Modal */
.enlarged-thumbnail-content {
    max-width: 90vw;
    max-height: 90vh;
    padding: 0;
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    position: relative;
}

.enlarged-thumbnail-content .close-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    color: white;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s;
}

.enlarged-thumbnail-content .close-button:hover {
    background: rgba(0, 0, 0, 0.8);
}

.enlarged-image {
    width: 100%;
    max-height: 75vh;
    object-fit: contain;
    background: #f3f4f6;
}

.enlarged-info {
    padding: 1.5rem;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.enlarged-info h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    color: var(--dark-color);
}

.enlarged-info p {
    margin: 0;
    color: #6b7280;
    font-size: 1rem;
}

/* Prompt section in enlarged modal */
.enlarged-prompt {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
    max-height: 200px;
    overflow-y: auto;
}

.prompt-section {
    margin-bottom: 1rem;
}

.prompt-section:last-child {
    margin-bottom: 0;
}

.prompt-section strong {
    display: block;
    color: var(--dark-color);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.prompt-section p {
    color: #4b5563;
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .enlarged-thumbnail-content {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .enlarged-info h2 {
        font-size: 1.25rem;
    }
}

/* Top Users Modal Styles */
.top-users-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 8px;
}

.top-users-list::-webkit-scrollbar {
    width: 6px;
}

.top-users-list::-webkit-scrollbar-track {
    background: var(--light-color);
    border-radius: 3px;
}

.top-users-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.top-user-card {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.top-user-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.rank-indicator {
    flex-shrink: 0;
    width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
}

.rank-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-gray);
}

.rank-medal {
    font-size: 1.75rem;
}

.rank-medal.gold {
    color: #FFD700;
}

.rank-medal.silver {
    color: #C0C0C0;
}

.rank-medal.bronze {
    color: #CD7F32;
}

.user-avatar-wrapper {
    flex-shrink: 0;
    margin-right: 1rem;
}

.user-avatar-large {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.user-details {
    flex-grow: 1;
    min-width: 0;
    margin-right: 1rem;
}

.user-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-join-date {
    font-size: 0.875rem;
    color: var(--text-gray);
    margin: 0;
}

.user-stats {
    display: flex;
    gap: 1.5rem;
    flex-shrink: 0;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 60px;
}

.stat-icon {
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
    color: var(--primary-color);
}

.stat-icon.upvote {
    color: var(--secondary-color);
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dark-color);
    line-height: 1;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.125rem;
}

.top-users-stats {
    background: var(--light-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

/* Responsive top users */
@media (max-width: 768px) {
    .top-user-card {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .rank-indicator,
    .user-avatar-wrapper,
    .user-details {
        margin-right: 0;
    }
    
    .user-stats {
        justify-content: center;
        gap: 2rem;
    }
    
    .user-name {
        white-space: normal;
    }
}

