:root {
    --primary-color: #8B5CF6;
    --secondary-color: #A78BFA;
    --background: #000000;
    --surface: #0A0A0A;
    --surface-light: #1A1A1A;
    --text-primary: #FFFFFF;
    --text-secondary: #9CA3AF;
    --accent: #C084FC;
    --success: #10B981;
    --border: #1F1F1F;
    --gradient-start: #8B5CF6;
    --gradient-end: #3B82F6;
    --chat-surface: #0F0A14;
    --chat-message-bg: #15101D;
    color-scheme: only light;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    position: fixed;
    overflow-y: auto;
    /* Prevent iOS pull-to-refresh */
    overscroll-behavior-y: none;
}

/* Page Loader */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    text-align: center;
}

.logo-loader {
    margin: 0 auto 1.5rem;
    display: block;
    /* Logo statico - no animation */
}

@keyframes rotate {
    to { transform: rotate(360deg); }
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 1.5rem;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: #8B5CF6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loader-content p {
    color: #3B83F6;
    font-size: 1rem;
    font-weight: 500;
}

/* Welcome Screen */
.welcome-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('assets/background.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    overflow: hidden;
}

.welcome-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('assets/dots-pattern.webp');
    background-repeat: repeat;
    background-size: auto;
    opacity: 0.7;
    pointer-events: none;
    z-index: 1;
}

.welcome-screen::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 100%;
    background-image: url('assets/blur-overlay.webp');
    background-repeat: no-repeat;
    background-position: center bottom;
    background-size: cover;
    pointer-events: none;
    z-index: 1;
    opacity: 0.6;
}

.welcome-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.welcome-ellipse {
    position: absolute;
    width: 627px;
    height: 627px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -60%);
    z-index: 2;
    pointer-events: none;
    opacity: 1;
}

.welcome-content {
    text-align: center;
    max-width: 600px;
    padding: 3rem 2rem;
    animation: fadeInUp 0.8s ease;
    position: relative;
    z-index: 2;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.welcome-logo-img {
    max-width: 627px;
    width: 100%;
    height: auto;
    margin: 0 auto 2.5rem;
    display: block;
    filter: drop-shadow(0 10px 40px rgba(0, 0, 0, 0.5));
    /* animation: float 3s ease-in-out infinite; */ /* Disabled - uncomment to re-enable floating animation */
}

.welcome-title {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.welcome-subtitle {
    font-size: 20px;
    color: #9EA3AE;
    font-weight: 500;
    margin-bottom: 0;
    letter-spacing: -0.02em;
    opacity: 1;
    line-height: 21.9px;
}

.welcome-divider {
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #8B5CF6, transparent);
    margin: 2rem auto 2rem;
    border-radius: 2px;
}

.welcome-description {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    margin-bottom: 2rem;
    line-height: 1.6;
    opacity: 1;
}

.welcome-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: white;
    color: #1f1f1f;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.1);
}

.welcome-login-btn:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(255, 255, 255, 0.15);
}

.welcome-login-btn:active {
    transform: translateY(0);
}

.welcome-login-btn svg {
    flex-shrink: 0;
}

.welcome-footer {
    margin-top: 2rem;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.875rem;
    opacity: 1;
}

/* Hide content until loaded */
.container {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.container.loaded {
    opacity: 1;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(180deg, #000000 0%, #0A0A0A 50%, #000000 100%) !important;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    filter: none !important;
}

/* Force override browser dark mode - Samsung specific */
html {
    background: #000000 !important;
    filter: none !important;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: only light !important;
    }
    
    html, body {
        background: #000000 !important;
        filter: none !important;
    }
}

.container {
    max-width: 1600px;
    width: 100%;
    max-width: 100vw;
    margin: 0 auto;
    padding: 0;
    min-height: 100vh; /* Fallback */
    min-height: 100dvh;
    max-height: 100vh; /* Fallback */
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.header {
    background: var(--surface);
    padding: 1rem clamp(1rem, 5vw, 2rem);
    border-bottom: 2px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    width: 100%;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.header-logo {
    height: 40px;
    width: auto;
    display: block;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.user-menu {
    position: relative;
    display: inline-block;
}

.username-display {
    font-weight: 500;
    color: var(--text-primary);
    background: var(--surface-light);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.username-display:hover {
    background: rgba(139, 92, 246, 0.1);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--surface-light);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 8px;
    width: 100%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
    font-family: 'Inter', sans-serif;
    text-align: center;
}

.dropdown-item:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #EF4444;
}

.dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

.login-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    color: #1f1f1f;
    border: 1px solid #dadce0;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.login-btn:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.login-btn svg {
    flex-shrink: 0;
}

.edit-username-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background 0.2s;
    opacity: 0.7;
}

.edit-username-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    opacity: 1;
}

/* Username Modal */
.username-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.username-modal.active {
    display: flex;
}

.username-modal-content {
    background: #1a1a1a;
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    max-width: 400px;
    width: 90%;
}

.username-modal h2 {
    margin: 0 0 1rem;
    color: var(--text-primary);
}

.username-modal input {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.username-modal input:focus {
    outline: none;
    border-color: var(--accent);
}

.username-modal-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.username-modal button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: opacity 0.2s;
}

.username-modal button:hover {
    opacity: 0.9;
}

.username-modal .btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.username-modal .btn-save {
    background: linear-gradient(135deg, var(--accent) 0%, #3B82F6 100%);
    color: white;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 1rem;
    padding: 1rem;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Player Section */
.player-section {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    min-height: 0;
    overflow: hidden;
    justify-content: center;
}

.player-container {
    position: relative;
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    width: 100%;
    box-shadow: 
        0 0 0 1px rgba(139, 92, 246, 0.2),
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(139, 92, 246, 0.15);
    flex-shrink: 1;
    min-height: 0;
    transition: box-shadow 0.3s ease;
    max-width: 90%;
    margin: 0 auto;
    contain: layout;
}

.player-container:hover {
    box-shadow: 
        0 0 0 1px rgba(139, 92, 246, 0.4),
        0 12px 48px rgba(0, 0, 0, 0.5),
        0 0 60px rgba(139, 92, 246, 0.25);
}

#castr-player {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

#castr-player::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    box-shadow: 
        inset 0 0 0 1px rgba(139, 92, 246, 0.3),
        inset 0 0 40px rgba(139, 92, 246, 0.05);
    pointer-events: none;
    z-index: 5;
}

#millicast-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    min-height: 100%;
    min-width: 100%;
}

#video-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

#video-iframe {
    width: 100%;
    height: 100%;
    display: none;
}

#video-iframe.active {
    display: block;
}

/* Placeholder Image Wrapper */
.placeholder-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    z-index: 10;
    border-radius: 12px;
    overflow: hidden;
}

.placeholder-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Stream Metrics */
.stream-metrics {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.7rem;
    z-index: 10;
    max-width: calc(100% - 1rem);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .stream-metrics {
        top: 0.25rem;
        right: 0.25rem;
        padding: 0.2rem 0.35rem;
        gap: 0;
        font-size: 0.5rem;
        max-width: auto;
        border-radius: 4px;
        border-width: 0.5px;
        flex-direction: row;
        align-items: center;
    }
    
    /* Hide Local Time and Stream Time on mobile, show only Latency */
    .stream-metrics .metric:not(:first-child) {
        display: none;
    }
    
    .metric {
        gap: 0.25rem;
        flex-direction: row;
        align-items: center;
    }
    
    .metric-label {
        font-size: 0.5rem;
        letter-spacing: 0;
    }
    
    .metric-value {
        font-size: 0.6rem;
        line-height: 1;
    }
}

.metric {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.metric-label {
    color: #9ca3af;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.6rem;
    letter-spacing: 0.5px;
}

.metric-value {
    color: #A78BFA;
    font-weight: 600;
    font-size: 0.75rem;
    font-family: 'Courier New', monospace;
    word-break: break-all;
    line-height: 1.2;
    overflow-wrap: break-word;
}

/* Reactions Overlay */
.reactions-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 10;
}

.floating-reaction {
    position: absolute;
    font-size: 2.5rem;
    animation: float-up 3s ease-out forwards;
    pointer-events: none;
}

.emoji-animated-float {
    width: 2.5rem;
    height: 2.5rem;
    object-fit: contain;
    display: block;
}

@keyframes float-up {
    0% {
        transform: translateY(0) scale(0);
        opacity: 0;
    }
    10% {
        transform: translateY(-20px) scale(1);
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-400px) scale(0.5);
        opacity: 0;
    }
}

/* Reactions Bar */
.reactions-bar {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    padding: 0.8rem;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    max-width: 90%;
    margin: 0 auto;
    width: 100%;
}

.reaction-btn {
    background: var(--surface-light);
    border: 2px solid var(--border);
    border-radius: 50%;
    width: 55px;
    height: 55px;
    font-size: 1.6rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reaction-btn:hover {
    transform: scale(1.1);
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.5);
}

.reaction-btn:active {
    transform: scale(1.3);
}

/* Custom emoji icons in reaction buttons */
.custom-emoji-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

/* Chat Section */
.chat-section {
    display: flex;
    flex-direction: column;
    background: var(--chat-surface);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.1);
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    margin-bottom: env(safe-area-inset-bottom, 0px);
    /* Prevent iOS overscroll */
    overscroll-behavior: contain;
}

.chat-header {
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(59, 130, 246, 0.05) 100%);
    border-bottom: 1px solid rgba(139, 92, 246, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.online-count {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.chat-messages {
    flex: 1;
    padding: 1rem 1.5rem;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 0;
    /* iOS scroll fixes */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--surface);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--surface-light);
}

/* New Messages Badge */
.new-messages-badge {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 24px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.new-messages-badge.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.new-messages-badge:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.new-messages-badge .badge-icon {
    font-size: 1rem;
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

/* Chat Locked Overlay */
.chat-locked-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
}

.chat-locked-content {
    text-align: center;
    padding: 2rem;
}

.lock-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: lockPulse 2s ease-in-out infinite;
}

@keyframes lockPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.9;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

.lock-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ef4444;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.lock-message {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.message {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-header {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
}

.message-author {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.9rem;
    letter-spacing: -0.01em;
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.message-content {
    background: var(--chat-message-bg);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    word-wrap: break-word;
    font-size: 0.95rem;
    border: 1px solid rgba(139, 92, 246, 0.08);
    border-left: 3px solid rgba(139, 92, 246, 0.5);
    transition: border-color 0.2s ease;
}

.system-message {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
    padding: 0.5rem;
}

.chat-input-container {
    padding: 1rem clamp(0.75rem, 3vw, 1.5rem);
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(59, 130, 246, 0.03) 100%);
    border-top: 1px solid rgba(139, 92, 246, 0.15);
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

.photo-btn {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: var(--text-primary);
    padding: 0;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
}

.photo-btn:hover {
    background: rgba(139, 92, 246, 0.25);
    transform: scale(1.05);
}

#chat-input {
    flex: 1;
    min-width: 0;
    background: rgba(10, 10, 10, 0.6);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: border-color 0.2s, background 0.2s;
}

#chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(10, 10, 10, 0.8);
}

.send-btn {
    background: #009CD9;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.8rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.send-btn:hover {
    background: #007FB8;
    box-shadow: 0 4px 16px rgba(0, 156, 217, 0.4);
}

.send-btn:active {
    transform: scale(0.98);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    
    .chat-section {
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    /* iOS Safari viewport fix */
    .container {
        min-height: 100dvh;
        max-height: 100dvh;
    }
    
    .header h1 {
        font-size: 1.3rem;
    }
    
    .main-content {
        padding: 1rem;
        gap: 1rem;
        max-width: 100vw;
    }
    
    .reaction-btn {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .reactions-bar {
        gap: 0.5rem;
        padding: 0.8rem;
    }
    
    /* Prevent zoom on input focus */
    #chat-input {
        font-size: 16px;
    }
    
    /* Fix chat section height on mobile */
    .chat-section {
        max-height: 50vh;
        min-height: 300px;
    }
    
    .chat-input-container {
        padding: 0.75rem;
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
    }
    
    /* Welcome Screen Mobile */
    .welcome-content {
        padding: 2rem 1.5rem;
    }
    
    .welcome-logo {
        width: 80px;
        height: 80px;
    }
    
    .welcome-title {
        font-size: 2rem;
    }
    
    .welcome-subtitle {
        font-size: 1rem;
    }
    
    .welcome-description {
        font-size: 0.9rem;
    }
    
    .welcome-login-btn {
        padding: 0.875rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* Landscape mode on mobile devices (iPhone horizontal) */
@media (max-height: 500px) and (orientation: landscape) {
    .main-content {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr;
        gap: 0.5rem;
        padding: 0.5rem;
        height: calc(100dvh - 50px);
        max-height: calc(100dvh - 50px);
    }
    
    .video-section {
        grid-column: 1;
        grid-row: 1;
        height: 100%;
        max-height: 100%;
    }
    
    .chat-section {
        grid-column: 2;
        grid-row: 1;
        max-height: 100%;
        min-height: 100%;
        display: flex;
        flex-direction: column;
    }
    
    .chat-header {
        padding: 0.5rem 0.75rem;
        min-height: 40px;
    }
    
    .chat-header h2 {
        font-size: 0.9rem;
    }
    
    .online-count {
        font-size: 0.75rem;
    }
    
    .reactions-bar {
        padding: 0.25rem;
        gap: 0.25rem;
        min-height: 50px;
    }
    
    .reaction-btn {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .chat-messages {
        padding: 0.5rem;
        padding-bottom: 0.5rem;
        flex: 1;
        min-height: 0;
        overflow-y: auto;
    }
    
    .message {
        margin-bottom: 0.25rem;
    }
    
    .message-header {
        margin-bottom: 0.15rem;
    }
    
    .message-author {
        font-size: 0.75rem;
    }
    
    .message-time {
        font-size: 0.65rem;
    }
    
    .message-content {
        font-size: 0.85rem;
        padding: 0.4rem 0.6rem;
    }
    
    .chat-input-container {
        padding: 0.4rem;
        padding-bottom: 0.4rem;
        gap: 0.4rem;
        min-height: 50px;
        flex-shrink: 0;
    }
    
    #chat-input {
        font-size: 13px;
        padding: 0.4rem 0.6rem;
        min-height: 36px;
    }
    
    .send-btn {
        width: 70px;
        height: 36px;
        font-size: 0.85rem;
        padding: 0 0.5rem;
        flex-shrink: 0;
    }
    
    .photo-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
        flex-shrink: 0;
    }
}

/* Admin Panel */
#admin-panel,
#poll-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.admin-modal {
    background: linear-gradient(135deg, rgba(15, 15, 20, 0.98) 0%, rgba(20, 20, 30, 0.98) 100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 16px;
    padding: 0;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(139, 92, 246, 0.1);
    display: flex;
    flex-direction: column;
}

.admin-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
}

.admin-header h3 {
    margin: 0;
    color: #8B5CF6;
    font-size: 1.25rem;
    font-weight: 600;
}

.close-btn {
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: #ef4444;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.25rem;
    font-weight: 400;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(220, 38, 38, 0.2);
    transform: scale(1.05);
}

.admin-content {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.admin-section {
    margin-bottom: 2rem;
}

.admin-section:last-child {
    margin-bottom: 0;
}

.admin-section h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.admin-hint {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0 0 1rem 0;
}

.upload-area {
    border: 2px dashed rgba(139, 92, 246, 0.4);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(139, 92, 246, 0.05);
}

.upload-area:hover {
    border-color: rgba(139, 92, 246, 0.6);
    background: rgba(139, 92, 246, 0.1);
}

.upload-area.drag-over {
    border-color: #8B5CF6;
    background: rgba(139, 92, 246, 0.15);
    transform: scale(1.02);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.upload-icon {
    font-size: 3rem;
}

.upload-placeholder p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.uploading-text {
    color: #8B5CF6;
    font-size: 1rem;
    margin: 0;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

.emoji-item {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    transition: all 0.2s ease;
}

.emoji-item:hover {
    background: rgba(139, 92, 246, 0.15);
    transform: translateY(-2px);
}

.emoji-preview {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.emoji-name {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-align: center;
    word-break: break-all;
    max-width: 100%;
}

.delete-emoji-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(220, 38, 38, 0.2);
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: #ef4444;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
}

.emoji-item:hover .delete-emoji-btn {
    opacity: 1;
}

.delete-emoji-btn:hover {
    background: rgba(220, 38, 38, 0.3);
    transform: scale(1.1);
}

.loading-text,
.empty-text,
.error-text {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.error-text {
    color: #ef4444;
}

/* Custom Emoji in Reactions Bar */
.custom-emoji-btn {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-emoji-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

/* Custom Emoji in Floating Reactions */
.custom-emoji-float {
    width: 3rem;
    height: 3rem;
    object-fit: contain;
}

/* Photo Upload Features */
.photo-menu {
    position: absolute;
    top: 50%;
    left: 50%;
    background: rgba(10, 10, 20, 0.98);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1000;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
    min-width: 250px;
    backdrop-filter: blur(10px);
    animation: slideInBounce 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

@keyframes slideInBounce {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.photo-menu.closing {
    animation: slideOutBounce 0.2s ease-out forwards;
}

@keyframes slideOutBounce {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
}

.photo-menu-btn {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    letter-spacing: -0.01em;
}

.photo-menu-btn:hover {
    background: rgba(139, 92, 246, 0.3);
}

.photo-menu-btn.cancel {
    background: rgba(220, 38, 38, 0.15);
    border-color: rgba(220, 38, 38, 0.3);
}

.photo-menu-btn.cancel:hover {
    background: rgba(220, 38, 38, 0.25);
}

/* Camera Modal */
.camera-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    animation: fadeIn 0.2s ease;
}

.camera-container {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: linear-gradient(135deg, rgba(15, 15, 20, 0.95) 0%, rgba(20, 20, 30, 0.95) 100%);
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(139, 92, 246, 0.1);
}

#camera-preview {
    width: 100%;
    max-width: 640px;
    border-radius: 12px;
    border: 2px solid rgba(139, 92, 246, 0.5);
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.2), 0 0 0 1px rgba(139, 92, 246, 0.1);
    background: #000;
}

.camera-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.camera-btn {
    padding: 1rem 2rem;
    border-radius: 8px;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.camera-btn.capture {
    background: linear-gradient(135deg, #8B5CF6 0%, #3B82F6 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}

.camera-btn.capture:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(139, 92, 246, 0.5);
}

.camera-btn.cancel {
    background: rgba(220, 38, 38, 0.15);
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: #ef4444;
}

.camera-btn.cancel:hover {
    background: rgba(220, 38, 38, 0.25);
    transform: scale(1.05);
}

.camera-select {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 2px solid rgba(139, 92, 246, 0.3);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(59, 130, 246, 0.15) 100%);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    letter-spacing: -0.01em;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    max-width: 300px;
}

.camera-select:hover {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25) 0%, rgba(59, 130, 246, 0.25) 100%);
}

.camera-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25) 0%, rgba(59, 130, 246, 0.25) 100%);
}

/* Style for dropdown options */
.camera-select option {
    background: #0A0A0A;
    color: var(--text-primary);
    padding: 0.5rem;
}

/* Message Photo Display */
.message-photo-container {
    margin: 0.5rem 0;
    border-radius: 8px;
    overflow: hidden;
}

.message-photo {
    width: 100%;
    max-width: 300px;
    height: auto;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
    display: block;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

@media (max-width: 768px) {
    .message-photo {
        max-width: 200px;
    }
}

.message-photo:hover {
    transform: scale(1.02);
}

.photo-caption {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeIn 0.2s ease;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(220, 38, 38, 0.8);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lightbox-close:hover {
    background: rgba(220, 38, 38, 1);
    transform: scale(1.1);
}

.uploading-indicator {
    text-align: center;
    padding: 1rem;
    background: rgba(139, 92, 246, 0.15);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Poll Styles */
.poll-message {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(59, 130, 246, 0.05) 100%) !important;
    border-left: 3px solid #8B5CF6 !important;
    padding: 1rem !important;
}

.poll-question {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.poll-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.poll-option {
    position: relative;
    background: rgba(10, 10, 10, 0.4);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
    overflow: hidden;
}

.poll-option:not(.voted):hover {
    border-color: rgba(139, 92, 246, 0.5);
    background: rgba(139, 92, 246, 0.1);
    transform: translateX(2px);
}

.poll-option.voted {
    cursor: default;
}

.poll-option-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.3) 0%, rgba(59, 130, 246, 0.2) 100%);
    transition: width 0.5s ease;
    border-radius: 8px 0 0 8px;
}

.poll-option-content {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1;
}

.poll-option-text {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
}

.poll-option-votes {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
}

.poll-footer {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(139, 92, 246, 0.15);
}

.poll-option-input {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 400;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
}

.poll-option-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 4K Display Optimizations */
@media (min-width: 2560px) {
    /* Increase chat width for ultra-wide displays */
    .main-content {
        grid-template-columns: 1fr 500px;
        gap: 1.5rem;
    }
    
    /* Allow player to grow larger on high-res displays */
    .player-container {
        max-width: 90%;
    }
    
    .reactions-bar {
        max-width: 90%;
    }
    
    /* Increase chat font sizes for better readability */
    .chat-message {
        font-size: 1.1rem;
        padding: 0.8rem 1rem;
    }
    
    .chat-header h2 {
        font-size: 1.5rem;
    }
    
    .chat-input {
        font-size: 1.1rem;
        padding: 1rem 1.2rem;
    }
}

@media (min-width: 3440px) {
    /* 4K displays - maximize player size and chat usability */
    .main-content {
        grid-template-columns: 3fr 1fr;
        gap: 2rem;
    }
    
    /* Limit to 90% width for better centering on 4K */
    .player-container {
        max-width: 90%;
    }
    
    .reactions-bar {
        max-width: 90%;
    }
    
    /* Further increase chat readability */
    .chat-message {
        font-size: 1.2rem;
        padding: 1rem 1.2rem;
    }
    
    .chat-header h2 {
        font-size: 1.6rem;
    }
    
    .chat-input {
        font-size: 1.2rem;
        padding: 1.2rem 1.5rem;
    }
    
    /* Increase emoji and reaction sizes */
    .reaction-btn {
        font-size: 1.4rem;
        padding: 0.8rem 1rem;
    }
    
    .emoji-btn {
        font-size: 1.3rem;
        padding: 0.6rem 0.8rem;
    }
}

/* Ultra-wide 4K displays (3840px+) - even more aggressive player sizing */
@media (min-width: 3840px) {
    .main-content {
        grid-template-columns: 4fr 1fr;
        gap: 2.5rem;
        padding: 1.5rem;
    }
    
    .player-container {
        max-width: 90%;
        border-radius: 16px;
    }
    
    .reactions-bar {
        max-width: 90%;
        border-radius: 16px;
    }
    
    /* Maximize chat usability on extreme resolutions */
    .chat-section {
        border-radius: 16px;
    }
    
    .chat-message {
        font-size: 1.3rem;
        padding: 1.1rem 1.3rem;
    }
    
    .chat-header h2 {
        font-size: 1.7rem;
    }
    
    .chat-input {
        font-size: 1.3rem;
        padding: 1.3rem 1.6rem;
    }
}

