:root {
    /* Light mode (default) */
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #764ba2;
    --content-bg: #ffffff;
    --text-primary: #000000;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --card-bg: #f5f5f5;
    --input-bg: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

body.dark-mode {
    /* Dark mode */
    --bg-gradient-start: #1a1a2e;
    --bg-gradient-end: #16213e;
    --content-bg: #0f0f1e;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: #2a2a3e;
    --card-bg: #1a1a2e;
    --input-bg: #2a2a3e;
    --shadow-color: rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: background 0.3s ease;
    position: relative;
}

/* Top Controls Container */
.top-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 10001;
}

/* Emulation Mode Toggle */
.emulation-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    padding: 8px 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toggle-label-emulation {
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.toggle-switch-emulation {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch-emulation input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider-emulation {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.3);
    transition: 0.4s;
    border-radius: 26px;
}

.toggle-slider-emulation:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

.toggle-switch-emulation input:checked + .toggle-slider-emulation {
    background-color: #667eea;
}

.toggle-switch-emulation input:checked + .toggle-slider-emulation:before {
    transform: translateX(24px);
}

/* QR Code Toggle Button */
.qr-toggle {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.qr-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.qr-toggle svg {
    width: 24px;
    height: 24px;
    color: #ffffff;
}

/* Theme Toggle Button */
.theme-toggle {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
    color: #ffffff;
    transition: all 0.3s ease;
}

body.dark-mode .theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
    position: absolute;
}

.theme-toggle .hidden {
    opacity: 0;
    transform: rotate(180deg) scale(0);
}

body.dark-mode .theme-toggle .sun-icon {
    opacity: 0;
    transform: rotate(180deg) scale(0);
}

body.dark-mode .theme-toggle .moon-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* QR Code Modal */
.qr-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    transition: opacity 0.3s ease;
}

.qr-modal.hidden {
    display: none;
}

.qr-modal-content {
    background: var(--content-bg);
    border-radius: 20px;
    padding: 40px;
    max-width: 400px;
    text-align: center;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.qr-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    background: rgba(255, 59, 48, 0.1);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    color: #ff3b30;
    cursor: pointer;
    transition: all 0.3s ease;
}

.qr-close:hover {
    background: rgba(255, 59, 48, 0.2);
    transform: scale(1.1);
}

.qr-modal-content h2 {
    color: var(--text-primary);
    font-size: 24px;
    margin-bottom: 20px;
}

#qr-code {
    margin: 20px auto;
    padding: 20px;
    background: white;
    border-radius: 12px;
    display: inline-block;
}

.qr-url {
    color: var(--text-secondary);
    font-size: 14px;
    word-break: break-all;
    margin-top: 15px;
}

/* Webview Mode (no device frame) */
body.webview-mode {
    padding: 0;
}

body.webview-mode .device-mockup {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    margin: 0;
}

body.webview-mode .device-frame {
    border-radius: 0;
    border: none;
    box-shadow: none;
    width: 100%;
    height: 100%;
}

body.webview-mode .device-notch {
    display: none;
}

body.webview-mode .device-screen {
    border-radius: 0;
    padding-top: 0;
}

body.webview-mode .device-screen::before {
    display: none;
}

body.webview-mode .view-container {
    top: 0;
    height: 100%;
}

body.webview-mode .video-modal {
    top: 0;
    height: 100%;
}

body.webview-mode .top-controls {
    display: none;
}

/* Left Side Controls */
.left-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 12px;
    align-self: flex-start;
    margin-top: 100px;
    max-width: 200px;
}

.control-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Scroll Controls (Right Side) */
.scroll-controls-external {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 12px;
    align-self: flex-start;
    margin-top: 100px;
}

.scroll-controls-external h3 {
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.scroll-btn-external {
    width: 60px;
    height: 60px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.scroll-btn-external .icon {
    width: 28px;
    height: 28px;
    color: #ffffff;
}

.scroll-btn-external:hover {
    background: rgba(255, 255, 255, 0.3);
}

.scroll-btn-external.active {
    background: #ffffff;
    border-color: #ffffff;
}

.scroll-btn-external.active .icon {
    color: #667eea;
}

.height-controls h3 {
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.height-btn {
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid transparent;
    border-radius: 8px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 110px;
    white-space: nowrap;
}

.height-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.height-btn.active,
.player-mode-btn.active {
    background: #ffffff;
    color: #667eea;
    border-color: #ffffff;
}

/* Main Content Wrapper */
.main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

/* iPhone 16 Pro Mockup */
.device-mockup {
    position: relative;
}

.device-frame {
    width: 393px;
    height: 852px;
    background: #1a1a1a;
    border-radius: 55px;
    padding: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    transition: box-shadow 0.3s ease;
}

body.dark-mode .device-frame {
    box-shadow: 
        0 0 40px rgba(255, 255, 255, 0.3),
        0 0 80px rgba(255, 255, 255, 0.2),
        0 20px 60px rgba(0, 0, 0, 0.5);
}

.device-notch {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 30px;
    background: #1a1a1a;
    border-radius: 0 0 20px 20px;
    z-index: 10;
}

.device-screen {
    width: 100%;
    height: 100%;
    background: var(--content-bg);
    border-radius: 45px;
    overflow: hidden;
    position: relative;
    padding-top: 44px;
    transition: background 0.3s ease;
}

/* Safe area background (notch area) */
.device-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 44px;
    background: var(--content-bg);
    z-index: 5;
    transition: background 0.3s ease;
}

/* View Containers */
.view-container {
    width: 100%;
    height: calc(100% - 44px);
    position: absolute;
    top: 44px;
    left: 0;
    display: none;
}

.view-container.active {
    display: flex;
    flex-direction: column;
}

/* Full Screen Mode */
#fullscreen-view {
    background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
}

#fullscreen-view .content-area {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: var(--content-bg);
    transition: background 0.3s ease;
}

/* Slider Mode */
#slider-view.slider-mode {
    display: block;
}

.slider-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.slider-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--content-bg);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
    transition: height 0.3s ease, background 0.3s ease;
}

.slider-panel.height-50 {
    height: 50%;
}

.slider-panel.height-70 {
    height: 70%;
}

.slider-panel.height-90 {
    height: 90%;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.slider-handle {
    width: 40px;
    height: 5px;
    background: #d1d5db;
    border-radius: 3px;
    margin: 12px auto 8px;
    flex-shrink: 0;
}

.slider-panel .content-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 0 0 0;
    display: flex;
    flex-direction: column;
}

/* Content Area */
.page-content {
    display: none;
    width: 100%;
    height: 100%;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--content-bg);
    transition: background 0.3s ease;
    padding: 0 3px;
}

.page-content:not(.hidden) {
    display: flex;
}

.page-content h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    transition: color 0.3s ease;
}

.page-content p {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
    transition: color 0.3s ease;
}

/* Home Page Controls */
.home-controls-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    min-height: min-content;
    flex-shrink: 0;
}

.home-controls-container h1 {
    text-align: center;
    font-size: 32px;
    margin-bottom: 10px;
}

.home-control-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: all 0.3s ease;
}

.home-control-section h3 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    transition: color 0.3s ease;
}

.home-control-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.home-control-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    background: rgba(102, 126, 234, 0.1);
    color: var(--text-primary);
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.home-control-btn:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.home-control-btn.active {
    background: #667eea;
    color: #ffffff;
    border-color: #667eea;
}

.home-sound-control {
    display: flex;
    align-items: center;
    gap: 15px;
}

.home-toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.home-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.home-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 34px;
}

.home-toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

.home-toggle-switch input:checked + .home-toggle-slider {
    background-color: #667eea;
}

.home-toggle-switch input:checked + .home-toggle-slider:before {
    transform: translateX(26px);
}

.home-description {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Display Mode Controls */
.display-mode-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.emulation-toggle-settings {
    display: flex;
    align-items: center;
    gap: 15px;
}

.qr-button {
    width: 100%;
    padding: 12px 20px;
    background: rgba(102, 126, 234, 0.1);
    color: var(--text-primary);
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.qr-button:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.qr-button svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

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

/* API Diagnostics Styles */
.diagnostics-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
}

.diagnostics-btn:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8a 100%);
}

.diagnostics-results {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.diagnostics-results.hidden {
    display: none;
}

.diagnostics-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
    border-left: 4px solid var(--border-color);
    transition: all 0.3s ease;
}

.diagnostics-item.success {
    border-left-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.diagnostics-item.error {
    border-left-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.diagnostics-item.testing {
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.diag-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.diag-status {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.diagnostics-item.success .diag-status {
    color: #10b981;
}

.diagnostics-item.error .diag-status {
    color: #ef4444;
}

.diagnostics-item.testing .diag-status {
    color: #f59e0b;
}

/* Bottom Toolbar */
.bottom-toolbar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: var(--content-bg);
    border-top: 1px solid var(--border-color);
    padding: 8px 0 12px;
    flex-shrink: 0;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.toolbar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px 16px;
    transition: all 0.2s ease;
    flex: 1;
}

.toolbar-btn:hover {
    color: #6366f1;
}

.toolbar-btn.active {
    color: #6366f1;
}

.toolbar-btn .icon {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

.toolbar-btn span {
    font-size: 12px;
    font-weight: 500;
}

/* View Toggle Controls */
.view-toggle {
    display: flex;
    gap: 12px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 8px;
    border-radius: 12px;
}

.toggle-btn {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid transparent;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.toggle-btn.active {
    background: #ffffff;
    color: #667eea;
    border-color: #ffffff;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    body {
        flex-direction: column;
        gap: 20px;
    }
    
    .height-controls {
        flex-direction: row;
        margin-top: 0;
        width: 100%;
        justify-content: center;
    }
    
    .height-controls h3 {
        display: none;
    }
}

@media (max-width: 480px) {
    .device-frame {
        width: 340px;
        height: 736px;
    }
    
    .view-toggle {
        flex-direction: column;
        width: 100%;
    }
    
    .toggle-btn {
        width: 100%;
    }
    
    .height-controls {
        flex-wrap: wrap;
    }
    
    .height-btn {
        flex: 1;
        min-width: 60px;
    }
}

/* Scrollbar styling */
.content-area::-webkit-scrollbar {
    width: 6px;
}

.content-area::-webkit-scrollbar-track {
    background: transparent;
}

.content-area::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.content-area::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}


/* Video Grid Container */
.video-grid-container {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--content-bg);
    position: relative;
    transition: background 0.3s ease;
}

.video-grid-container.horizontal-scroll {
    overflow-y: hidden;
    overflow-x: auto;
}

.video-grid-container::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.video-grid-container::-webkit-scrollbar-track {
    background: var(--card-bg);
}

.video-grid-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.video-grid-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Video Grid - Masonry Layout (Vertical) */
.video-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    padding: 2px;
}

.video-grid-container.horizontal-scroll .video-grid {
    display: grid;
    grid-template-rows: repeat(2, 1fr);
    grid-auto-flow: column;
    gap: 8px;
    padding: 16px;
    width: max-content;
    height: calc(100% - 32px);
}

/* Video Item */
.video-item {
    position: relative;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.video-item:hover {
    transform: scale(1.02);
}

/* Masonry sizes for vertical scroll - 2 columns */
.video-grid-container.vertical-scroll .video-item:nth-child(4n+1) {
    grid-row: span 2;
}

.video-grid-container.vertical-scroll .video-item:nth-child(6n+3) {
    grid-row: span 3;
}

.video-grid-container.vertical-scroll .video-item:nth-child(8n+5) {
    grid-row: span 2;
}

/* Horizontal scroll items - 2 rows */
.video-grid-container.horizontal-scroll .video-item {
    width: 180px;
    height: 100%;
}

.video-grid-container.horizontal-scroll .video-item:nth-child(4n+1),
.video-grid-container.horizontal-scroll .video-item:nth-child(4n+2) {
    grid-column: span 1;
}

.video-grid-container.horizontal-scroll .video-item:nth-child(6n+3) {
    grid-column: span 2;
    grid-row: span 2;
}

/* Video Thumbnail */
.video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Video Overlay */
.video-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    color: white;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.video-views {
    display: flex;
    align-items: center;
    gap: 4px;
}

.video-views svg {
    width: 14px;
    height: 14px;
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.loading-spinner.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Video Skeleton Loader */
.video-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Sound Toggle */
.sound-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    position: relative;
}

.sound-toggle input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    width: 50px;
    height: 26px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 13px;
    position: relative;
    transition: background 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    top: 3px;
    left: 3px;
    transition: transform 0.3s;
}

.sound-toggle input:checked + .toggle-slider {
    background: #667eea;
}

.sound-toggle input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

.toggle-label {
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
}

/* Video Player Modal */
.video-modal {
    position: absolute;
    top: 44px;
    left: 0;
    width: 100%;
    height: calc(100% - 44px);
    background: #000000;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

.video-modal.hidden {
    display: none;
}

.device-screen {
    position: relative;
}

.modal-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 10001;
    backdrop-filter: blur(10px);
}

.modal-back-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.modal-back-btn svg {
    width: 24px;
    height: 24px;
    color: #ffffff;
}

.modal-sound-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-sound-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.modal-sound-btn .sound-icon {
    width: 24px;
    height: 24px;
    color: #ffffff;
}

/* Player Views - Base Styles */
.player-view-static,
.player-view-static-relevant,
.player-view-reel {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    background: #000000;
}

.player-view-static.hidden,
.player-view-static-relevant.hidden,
.player-view-reel.hidden {
    display: none;
}

/* Static View */
.player-view-static {
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Blurred background video */
.video-background {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: 1;
    filter: blur(40px) brightness(0.4);
    object-fit: cover;
}

/* Content wrapper - centered */
.static-content-wrapper {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 20px;
    gap: 20px;
}

.video-container {
    width: 100%;
    max-width: 500px;
    background: #000;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.video-container video {
    width: 100%;
    height: auto;
    display: block;
}

/* Sound icon overlay on video */
.video-sound-overlay {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10000;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.video-sound-overlay:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.sound-icon {
    width: 28px;
    height: 28px;
    color: #ffffff;
    transition: opacity 0.3s ease;
}

.sound-icon.hidden {
    display: none;
}

/* Center send button and ad banner */
.static-content-wrapper .send-btn {
    width: 100%;
    max-width: 500px;
    padding: 16px;
    background: #667eea;
    color: #ffffff;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.static-content-wrapper .send-btn:hover {
    background: #5568d3;
}

.static-content-wrapper .ad-banner {
    width: 100%;
    max-width: 500px;
    padding: 40px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Static + Relevant View */
.player-view-static-relevant {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.static-relevant-scroll-container {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    position: relative;
    z-index: 2;
}

.static-relevant-content {
    display: flex !important;
    flex-direction: column !important;
    width: 100%;
    grid-template-columns: none !important;
    align-items: center;
    padding-top: 80px;
}

.static-relevant-content > * {
    width: 100% !important;
    grid-column: auto !important;
}

.video-send-sticky-wrapper {
    position: sticky;
    top: 60px;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.video-container-relevant {
    width: 100%;
    flex-shrink: 0;
    background: #000;
    position: relative;
    min-height: 200px;
    display: block !important;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.video-container-relevant video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

/* Ad overlay for vertical videos */
.ad-banner-overlay {
    display: none;
}

.video-container-relevant.has-vertical-video .ad-banner-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 95%;
    height: 60px;
    padding: 0 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 10;
    backdrop-filter: blur(10px);
}

.ad-banner-overlay span {
    flex: 1;
}

.ad-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.ad-close-btn:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: scale(1.1);
}

.ad-close-btn svg {
    width: 16px;
    height: 16px;
    color: #ffffff;
}

/* Horizontal video - center vertically with auto margins */
.video-container-relevant video.horizontal {
    margin: auto;
}

/* Vertical video - position at top */
.video-container-relevant video.vertical {
    margin: 0;
}

.send-btn {
    width: 100%;
    padding: 16px;
    background: #667eea;
    color: #ffffff;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    flex-shrink: 0;
    display: block !important;
}

.send-btn:hover {
    background: #5568d3;
}

.ad-banner {
    width: 100%;
    padding: 40px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    display: block !important;
}

/* Spacing for Static + Relevant view */
.static-relevant-content .video-send-sticky-wrapper {
    margin-bottom: 20px;
}

.video-send-sticky-wrapper .send-btn {
    width: 100%;
    padding: 16px;
    background: #667eea;
    color: #ffffff;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.video-send-sticky-wrapper .send-btn:hover {
    background: #5568d3;
}

.ad-banner-sticky {
    position: sticky;
    top: 60px;
    width: 100%;
    max-width: 500px;
    margin: 0 auto 20px auto;
    padding: 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    z-index: 101;
    backdrop-filter: blur(10px);
}

/* Relevant Videos Section */
.relevant-videos-section {
    padding: 0;
    background: #000000;
    width: 100%;
}

.relevant-videos-section h3 {
    color: #ffffff;
    font-size: 18px;
    padding: 20px;
    margin: 0;
    font-weight: 600;
    background: #1a1a1a;
}

.relevant-videos-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    padding: 2px;
    width: 100%;
}

.relevant-videos-grid .video-item {
    aspect-ratio: 1;
}

/* Reel View */
.player-view-reel {
    padding: 0;
    max-width: 100%;
    overflow: hidden;
}

.reel-container {
    width: 100%;
    height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
}

.reel-item {
    width: 100%;
    height: 100%;
    position: relative;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    overflow: hidden;
}

.reel-video {
    width: auto;
    height: 100%;
    max-width: none;
    object-fit: cover;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.reel-video.vertical {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

.reel-video.horizontal {
    object-fit: cover;
    width: auto;
    height: 100%;
}

.reel-send-btn {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(102, 126, 234, 0.9);
    border: none;
    border-radius: 50%;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 10;
}

.reel-send-btn:hover {
    background: rgba(102, 126, 234, 1);
    transform: translateY(-50%) scale(1.1);
}

.reel-ad-banner {
    position: absolute;
    bottom: 50px;
    left: 20px;
    width: 42.5%;
    max-width: 200px;
    padding: 25px 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.reel-ad-banner.hidden {
    display: none;
}

.reel-ad-close {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.reel-ad-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.reel-ad-close svg {
    width: 14px;
    height: 14px;
    color: #ffffff;
}
