/* Patterkin Video Archive Styles */

/* Dark Mode CSS Variables */
:root {
    /* Light mode colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #e0e0e0;
    --border-light: #f0f0f0;
    --accent-primary: #007bff;
    --accent-secondary: #ff6b6b;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.15);
    --shadow-dark: rgba(0, 0, 0, 0.3);
    --video-bg: #000000;
    --input-bg: #ffffff;
    --input-border: #e1e5e9;
    --card-bg: #ffffff;
    --modal-bg: #ffffff;
    --overlay-bg: rgba(0, 0, 0, 0.8);
}

/* Dark mode colors */
[data-theme="dark"] {
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --bg-tertiary: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #999999;
    --border-color: #3a3a3a;
    --border-light: #2a2a2a;
    --accent-primary: #4dabf7;
    --accent-secondary: #ff6b6b;
    --shadow-light: rgba(0, 0, 0, 0.6);
    --shadow-medium: rgba(0, 0, 0, 0.8);
    --shadow-dark: rgba(0, 0, 0, 0.95);
    --video-bg: #000000;
    --input-bg: #1e1e1e;
    --input-border: #3a3a3a;
    --card-bg: #1e1e1e;
    --modal-bg: #1e1e1e;
    --overlay-bg: rgba(0, 0, 0, 0.9);
}

/* Theme transition for smooth switching */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* High-contrast links (especially important in dark mode) */
.photo-album-link {
    color: var(--accent-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.photo-album-link:hover,
.photo-album-link:focus {
    color: var(--accent-primary);
    text-decoration-thickness: 2px;
}

/* Authentication Modal Styles */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.auth-modal.is-visible {
    display: flex;
}

.auth-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease-out;
}

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

.auth-header {
    text-align: center;
    padding: 30px 30px 20px;
    border-bottom: 1px solid #eee;
}

.auth-header h1 {
    color: var(--text-primary);
    font-size: 28px;
    margin-bottom: 8px;
    font-weight: 600;
}

.auth-header p {
    color: #666;
    font-size: 16px;
}

.auth-form {
    padding: 30px;
}

.auth-form h2 {
    color: var(--text-primary);
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    background: #fff;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.auth-button {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.auth-button.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.auth-button.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.auth-button:active {
    transform: translateY(0);
}

.auth-switch {
    text-align: center;
    color: #666;
    font-size: 14px;
}

.auth-switch a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.auth-loading {
    text-align: center;
    padding: 40px 30px;
}

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

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

.auth-loading p {
    color: #666;
    font-size: 16px;
}

.auth-error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 20px 30px;
    font-size: 14px;
    text-align: center;
}

/* Header Controls */
.header-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.user-menu span {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
}

.hamburger-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.hamburger-button:hover {
    background: #f8f9fa;
}

.hamburger-line {
    width: 20px;
    height: 2px;
    background: #333;
    transition: all 0.3s ease;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #e53935;
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    font-weight: 600;
    border: 2px solid #fff;
}

.hamburger-button.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-button.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-button.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 10px 0;
    min-width: 260px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.user-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.logout-button {
    background: none;
    border: none;
    color: #6c757d;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    text-align: left;
}

.notifications-panel {
    padding: 4px 0 8px;
}

.notifications-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    padding: 0 16px 8px;
    color: #495057;
    font-weight: 600;
}

.notifications-mark-read {
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
}

.notifications-list {
    max-height: 320px;
    overflow-y: auto;
}

.notification-item {
    padding: 10px 16px;
    border-top: 1px solid #f1f3f5;
    font-size: 13px;
    color: #495057;
}

.notification-item.unread {
    background: #f8f9ff;
}

.notification-item.notification-pending {
    opacity: 0.75;
}

.notification-meta {
    font-size: 11px;
    color: #8a8f98;
    margin-top: 6px;
}

.notification-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.notification-btn {
    border: none;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}

.notification-btn-approve {
    background: #2f79ff;
    color: #fff;
}

.notification-btn-deny {
    background: #e0e0e0;
    color: #333;
}

.notification-btn-allow {
    background: #111827;
    color: #fff;
}

.notification-status {
    margin-top: 8px;
    font-size: 12px;
    color: #4b5563;
    font-weight: 600;
}

.notifications-empty {
    padding: 12px 16px;
    font-size: 12px;
    color: #8a8f98;
}

.logout-button:hover {
    background: #f8f9fa;
    color: #495057;
}

/* Dark Mode Toggle Button */
.theme-toggle {
    background: none;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-primary);
    transition: all 0.3s ease;
    margin-left: 10px;
}

.theme-toggle:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
    transform: scale(1.05);
}

.theme-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.theme-toggle .sun-icon {
    opacity: 1;
    transform: rotate(0deg);
}

.theme-toggle .moon-icon {
    opacity: 0;
    transform: rotate(180deg);
    position: absolute;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    opacity: 0;
    transform: rotate(180deg);
}

[data-theme="dark"] .theme-toggle .moon-icon {
    opacity: 1;
    transform: rotate(0deg);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

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

main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

header {
    background: var(--bg-primary);
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px var(--shadow-light);
    margin-bottom: 0;
}

header h1 {
    margin: 0;
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 600;
}

header h1 a:hover {
    color: var(--accent-primary);
    transition: color 0.3s ease;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.tape-selector {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.tape-selector label {
    color: #cccccc;
    font-size: 1rem;
    font-weight: 500;
}

.tape-selector select {
    background-color: #333;
    color: #ffffff;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 1rem;
    min-width: 200px;
}

.tape-selector select:focus {
    outline: none;
    border-color: #ff6b6b;
    box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.2);
}

.tape-selector select option {
    background-color: #333;
    color: #ffffff;
}

/* Responsive 4:3 Video Container */
.video-container {
    position: relative;
    width: 100%;
    max-width: 720px; /* Match typical video width */
    margin: 0 auto;
    background: #000;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    /* Optimize for faster rendering */
    transform: translateZ(0);
    will-change: transform;
    /* Ensure container fits content exactly */
    display: inline-block;
}

/* Compilation "watch full clip" overlay */
.compilation-watch-overlay {
    position: absolute;
    /* Sit above the Video.js control bar */
    bottom: 56px;
    right: 10px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    pointer-events: auto;
}

.compilation-watch-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    backdrop-filter: blur(6px);
}

.compilation-watch-link:hover {
    background: rgba(0, 0, 0, 0.85);
    border-color: rgba(255, 255, 255, 0.28);
}

.compilation-watch-meta {
    max-width: 260px;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    line-height: 1.2;
    text-align: right;
    backdrop-filter: blur(6px);
}

/* Timestamped comments panel */
.video-reactions {
    margin: 14px 0 10px 0;
}

.timestamped-comments-panel {
    margin-top: 14px;
    padding: 12px;
    border: 1px solid var(--border-color, rgba(0,0,0,0.12));
    border-radius: 12px;
    background: var(--card-bg, rgba(255,255,255,0.7));
}

[data-theme="dark"] .timestamped-comments-panel {
    background: rgba(0, 0, 0, 0.22);
    border-color: rgba(255, 255, 255, 0.12);
}

.timestamped-comments-panel h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.timestamped-comments-list {
    max-height: 220px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

.timestamped-comments-loading,
.timestamped-comments-empty,
.timestamped-comments-error {
    color: var(--text-secondary);
    font-size: 13px;
    padding: 8px 0;
}

.timestamped-comment {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--border-color, rgba(0,0,0,0.10));
    background: var(--card-bg, rgba(255,255,255,0.92));
    box-shadow: 0 2px 8px var(--shadow-light);
}

[data-theme="dark"] .timestamped-comment {
    background: rgba(0,0,0,0.24);
    border-color: rgba(255,255,255,0.14);
}

.timestamped-comment-time {
    flex: 0 0 auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-primary, #ff6b6b);
    cursor: pointer;
    user-select: none;
    padding-top: 2px;
}

.timestamped-comment-body {
    flex: 1 1 auto;
    min-width: 0;
}

.timestamped-comment-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.timestamped-comment-avatar {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: var(--accent-primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 13px;
    flex: 0 0 28px;
    overflow: hidden;
}

.timestamped-comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.timestamped-comment-avatar-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
}

.timestamped-comment-meta-text {
    min-width: 0;
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.timestamped-comment-author {
    font-weight: 700;
    color: var(--text-primary);
}

.timestamped-comment-date {
    font-weight: 500;
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.9;
}

.timestamped-comment-content {
    font-size: 15px;
    line-height: 1.55;
    color: var(--text-primary);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.timestamped-comment-actions {
    margin-top: 12px;
    padding-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border-light, rgba(0,0,0,0.08));
}

.timestamped-comment-reactions {
    margin-top: 0;
    display: flex;
    justify-content: flex-end;
}

.timestamped-comment-actions-left .timestamped-comment-reactions {
    justify-content: flex-start;
}

.timestamped-comment-actions-left {
    display: flex;
    align-items: center;
    min-width: 0;
}

.timestamped-comment-actions-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
}

/* Keep reactions compact in comment footer */
.timestamped-comment-actions-left .reaction-wrapper,
.timestamped-comment-actions-right .reaction-wrapper {
    flex-wrap: nowrap;
    gap: 6px;
}

.timestamped-comment-actions-left .reaction-list,
.timestamped-comment-actions-right .reaction-list {
    flex-wrap: nowrap;
    gap: 6px;
}

.timestamped-comment-delete {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    padding: 0;
}

.timestamped-comment-delete:hover {
    color: var(--accent-primary, #ff6b6b);
}

.timestamped-comments-input {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#timestamped-comment-input {
    width: 100%;
    resize: vertical;
    border-radius: 10px;
    padding: 10px;
    border: 1px solid rgba(0,0,0,0.12);
    background: rgba(255,255,255,0.9);
    color: var(--text-primary);
}

[data-theme="dark"] #timestamped-comment-input {
    background: rgba(0,0,0,0.22);
    border-color: rgba(255,255,255,0.12);
}

.timestamped-comments-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.timestamped-comments-attach {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    user-select: none;
}

.timestamped-comment-add {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.12);
    background: var(--accent-primary, #ff6b6b);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.timestamped-comment-add:disabled {
    opacity: 0.6;
    cursor: default;
}

/* Mobile: keep the unified Comments panel compact */
@media (max-width: 520px) {
    #video-chat .chat-input-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    #video-chat .chat-send-button {
        width: 100%;
    }

    #video-chat .timestamped-comments-actions {
        justify-content: flex-start;
    }

    .timestamped-comment {
        flex-direction: column;
        gap: 6px;
    }

    .timestamped-comment-time {
        padding-top: 0;
    }

    .timestamped-comment-actions {
        flex-direction: row;
        align-items: center;
    }
}

/* Video.js player styling with responsive 4:3 aspect ratio */
.video-js {
    width: 100%;
    height: auto;
    background: #000;
    /* Let Video.js handle its own sizing based on aspect ratio */
    display: block;
    /* Ensure no extra height */
    min-height: 0;
    max-height: none;
    /* Force 4:3 aspect ratio */
    aspect-ratio: 4/3;
}

/* Override Video.js fluid sizing to maintain 4:3 */
.video-js.vjs-fluid {
    padding-top: 75% !important; /* 4:3 aspect ratio */
    height: 0 !important;
}

.video-js.vjs-fluid .vjs-tech {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

/* Ensure video content fits properly in the container */
.video-js .vjs-tech {
    object-fit: contain !important;
    width: 100% !important;
    height: 100% !important;
}

.video-js video {
    object-fit: contain !important;
    width: 100% !important;
    height: 100% !important;
}

/* Fullscreen specific styling for 4:3 videos */
.video-js.vjs-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: #000 !important;
}

.video-js.vjs-fullscreen .vjs-tech {
    object-fit: contain !important;
    width: 100% !important;
    height: 100% !important;
}

.video-js.vjs-fullscreen video {
    object-fit: contain !important;
    width: 100% !important;
    height: 100% !important;
}

/* Tablet optimizations */
@media (max-width: 1024px) and (min-width: 769px) {
    .video-container {
        max-width: 600px;
        margin: 0 auto;
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .video-container {
        margin-left: calc(-50vw + 50%);
        margin-right: calc(-50vw + 50%);
        width: 100vw;
        max-width: none;
        border-radius: 0;
    }
    
    .video-js .vjs-tech {
        object-fit: contain !important;
        width: 100% !important;
        height: auto !important;
    }
}

/* Large desktop optimizations */
@media (min-width: 1200px) {
    .video-container {
        max-width: 800px;
        margin: 0 auto;
    }
}

.video-js .vjs-big-play-button {
    background-color: rgba(255, 107, 107, 0.8);
    border: none;
    border-radius: 50%;
    font-size: 2em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.video-js .vjs-big-play-button:hover {
    background-color: rgba(255, 107, 107, 1);
    transform: scale(1.1);
}

.video-js .vjs-big-play-button:focus {
    outline: 3px solid #ff6b6b !important;
    outline-offset: 2px !important;
    background-color: rgba(255, 107, 107, 1);
}


.video-info {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box; /* Prevent padding from causing horizontal overflow on mobile */
    box-shadow: 0 4px 12px var(--shadow-light);
}

.video-info h2 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.8rem;
    font-weight: 600;
}

.metadata {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.metadata p {
    background: var(--bg-secondary);
    padding: 10px 15px;
    border-radius: 4px;
    border-left: 3px solid var(--accent-primary);
    color: var(--text-primary);
}

.metadata strong {
    color: var(--accent-primary);
}

/* Current Scene Info Styles */
.current-scene-info {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px var(--shadow-light);
    border-left: 4px solid var(--accent-primary);
    transition: all 0.3s ease;
}

.current-scene-loading,
.current-scene-empty {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.current-scene-header {
    margin-bottom: 15px;
}

.current-scene-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.current-scene-time {
    color: var(--accent-primary);
    font-weight: bold;
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    min-width: 70px;
}

.current-scene-title {
    flex: 1;
    margin: 0;
    color: var(--text-primary);
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.3;
}

.current-scene-watch-indicator {
    margin-left: auto;
}

.current-scene-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.current-scene-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-light);
}

.current-scene-reactions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-light);
}

.current-scene-reactions .reaction-wrapper {
    background: var(--bg-secondary);
    border-radius: 999px;
    padding: 8px 16px;
    box-shadow: 0 2px 6px var(--shadow-light);
}

.scenes h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.3rem;
    font-weight: 600;
}

#scenes-list {
    list-style: none;
}

#scenes-list li {
    background: var(--bg-secondary);
    margin-bottom: 12px;
    padding: 12px 15px;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s, border-color 0.2s;
    border: 1px solid var(--border-color);
    border-left: 3px solid transparent;
    color: var(--text-primary);
    box-shadow: 0 2px 8px var(--shadow-light);
}

#scenes-list li:hover {
    background: var(--bg-tertiary);
    border-left-color: var(--accent-primary);
}

.scene-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    column-gap: 10px;
    margin-bottom: 4px;
}

.scene-time {
    color: var(--accent-primary);
    font-weight: bold;
    margin-right: 0;
    min-width: 72px;
    font-family: 'Courier New', monospace;
}

.scene-title {
    font-weight: 500;
    min-width: 0;
    line-height: 1.25;
}

.watch-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    transition: background-color 0.2s, color 0.2s;
}

.watch-indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.watch-indicator[data-status="unwatched"] {
    color: #d32f2f;
    background: rgba(211, 47, 47, 0.12);
}

.watch-indicator[data-status="partial"] {
    color: #f57c00;
    background: rgba(245, 124, 0, 0.12);
}

.watch-indicator[data-status="watched"] {
    color: #2e7d32;
    background: rgba(46, 125, 50, 0.15);
}

[data-theme="dark"] .watch-indicator[data-status="unwatched"] {
    background: rgba(211, 47, 47, 0.12);
    color: #d32f2f;
}

[data-theme="dark"] .watch-indicator[data-status="partial"] {
    background: rgba(245, 124, 0, 0.12);
    color: #f57c00;
}

[data-theme="dark"] .watch-indicator[data-status="watched"] {
    background: rgba(46, 125, 50, 0.15);
    color: #2e7d32;
}

.scene-header .scene-watch-indicator {
    margin-left: 0;
    padding: 2px 6px;
    font-size: 0.7rem;
}

.scene-header .scene-watch-indicator .watch-indicator-label {
    font-weight: 500;
}

/* Scene list: keep the pill, but remove the Watched/Unwatched text (current scene keeps text). */
#scenes-list .scene-watch-indicator {
    padding: 4px 6px;
    gap: 0;
}

#scenes-list .scene-watch-indicator .watch-indicator-label {
    display: none;
}

#scenes-list .scene-share {
    margin-left: 0;
}

@media (max-width: 480px) {
    .scene-time {
        min-width: 60px;
    }
}

.scene-header .scene-watch-indicator .watch-indicator-label {
    font-weight: 500;
}

#tape-watch-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0;
    padding: 12px 16px;
    border-radius: 12px;
}

#tape-watch-status .watch-indicator-dot {
    width: 12px;
    height: 12px;
}

#tape-watch-status .watch-indicator-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.watch-indicator-count {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.scene-header .scene-watch-indicator[data-status="watched"] {
    background: rgba(46, 125, 50, 0.12);
    color: #2e7d32;
}

[data-theme="dark"] .scene-header .scene-watch-indicator[data-status="watched"] {
    background: rgba(46, 125, 50, 0.12);
    color: #2e7d32;
}

#scenes-list li[data-watch-status="watched"] {
    border-left-color: #2e7d32;
    background: rgba(46, 125, 50, 0.08);
}

[data-theme="dark"] #scenes-list li[data-watch-status="watched"] {
    background: rgba(46, 125, 50, 0.08);
    border-left-color: #2e7d32;
}

.video-card .video-watch-indicator {
    position: relative;
    bottom: auto;
    left: auto;
    z-index: auto;
    pointer-events: auto;
    margin: 0;
}

.video-card .video-watch-indicator .watch-indicator-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.video-card[data-watch-status="watched"] {
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.2);
}

.scene-card[data-watch-status="watched"] {
    box-shadow: 0 8px 25px rgba(46, 125, 50, 0.18);
}

[data-theme="dark"] .scene-card[data-watch-status="watched"] {
    box-shadow: 0 8px 25px rgba(46, 125, 50, 0.18);
}

.scene-card-watch-overlay {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 6;
    pointer-events: none;
}

.scene-card-watch-overlay .scene-card-watch-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(211, 47, 47, 0.9);
    box-shadow: 0 0 6px rgba(0,0,0,0.2);
    transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease;
    display: inline-block;
}

.scene-card-watch-indicator[data-status="watched"] {
    background: rgba(46, 125, 50, 0.9);
}

[data-theme="dark"] .scene-card-watch-indicator[data-status="unwatched"] {
    background: rgba(211, 47, 47, 0.9);
}

[data-theme="dark"] .scene-card-watch-indicator[data-status="watched"] {
    background: rgba(46, 125, 50, 0.9);
}

.scene-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
}

.scene-date {
    color: #4CAF50;
    font-size: 0.85rem;
    background: rgba(76, 175, 80, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
}

.scene-location {
    color: #2196F3;
    font-size: 0.85rem;
    background: rgba(33, 150, 243, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
}

.scene-people {
    color: #FF9800;
    font-size: 0.85rem;
    background: rgba(255, 152, 0, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
}

/* Dark mode adjustments for scene meta tags */
[data-theme="dark"] .scene-date {
    background: rgba(76, 175, 80, 0.2);
}

[data-theme="dark"] .scene-location {
    background: rgba(33, 150, 243, 0.2);
}

[data-theme="dark"] .scene-people {
    background: rgba(255, 152, 0, 0.2);
}

.scene-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.scene-loading {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 20px;
    border-radius: 4px;
    border-left: 3px solid #ffc107;
    margin-top: 4px;
}

/* Responsive design */
@media (max-width: 768px) {
    /* Authentication responsive styles */
    .auth-modal {
        padding: 10px;
    }
    
    .auth-container {
        max-width: 100%;
        margin: 0;
        border-radius: 8px;
    }
    
    .auth-header {
        padding: 20px 20px 15px;
    }
    
    .auth-header h1 {
        font-size: 24px;
    }
    
    .auth-form {
        padding: 20px;
    }
    
    .auth-form h2 {
        font-size: 20px;
    }
    
    .form-group input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 14px 16px;
    }
    
    .auth-button {
        padding: 16px;
        font-size: 16px;
    }
    
    .header-controls {
        flex-direction: row;
        gap: 8px;
        align-items: center;
        justify-content: flex-end;
        flex-wrap: nowrap;
        flex-shrink: 0;
    }
    
    .tape-selector {
        width: 100%;
    }
    
    .tape-selector select {
        width: 100%;
        font-size: 16px;
        padding: 12px;
    }
    
    .user-menu {
        justify-content: flex-end;
        flex-wrap: nowrap;
        flex-shrink: 0;
        gap: 8px;
    }
    
    .container {
        padding: 10px;
    }
}

/* Smart TV and large screen styles */
@media (min-width: 1920px) {
    .auth-container {
        max-width: 500px;
    }
    
    .auth-header h1 {
        font-size: 32px;
    }
    
    .auth-form h2 {
        font-size: 28px;
    }
    
    .form-group input {
        padding: 16px 20px;
        font-size: 18px;
    }
    
    .auth-button {
        padding: 18px;
        font-size: 18px;
    }
    
    .header h1 {
        font-size: 3rem;
    }
    
    .tape-selector select {
        font-size: 18px;
        padding: 16px;
    }
    
    .user-menu span {
        font-size: 16px;
    }
    
    .logout-button {
        padding: 12px 20px;
        font-size: 16px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .metadata {
        grid-template-columns: 1fr;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Error states */
.error {
    color: var(--accent-secondary);
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid var(--accent-secondary);
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
}

/* Sprite Preview Styles */
.sprite-preview {
    position: fixed;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.9);
    border: 0;
    outline: none;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    transform: translateX(-50%) translateY(-180px);
}

.sprite-image {
    width: 160px;
    height: 120px;
    background-size: 1600px 840px; /* Full sprite sheet size */
    background-repeat: no-repeat;
    border-radius: 4px;
    overflow: hidden;
}

.sprite-time {
    color: #ffffff;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    margin-top: 4px;
    background: rgba(255, 107, 107, 0.8);
    padding: 2px 6px;
    border-radius: 3px;
}

/* Video.js progress bar hover enhancement */
.video-js .vjs-progress-control:hover {
    cursor: pointer;
}

.video-js .vjs-progress-control .vjs-progress-holder {
    cursor: pointer;
}

/* Search Highlight Styles */
.search-highlight {
    background-color: #ffeb3b;
    color: #333;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(255, 235, 59, 0.3);
}

/* Transcript Styles */
.transcript {
    margin-top: 25px;
}

.transcript h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.3rem;
    font-weight: 600;
}

.transcript-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

#transcript-search {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-size: 14px;
}

#transcript-search:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

#toggle-transcript {
    padding: 8px 16px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

#toggle-transcript:hover {
    background: #0056b3;
}

.transcript-panel {
    background: #f8f9fa;
    border-radius: 8px;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
}

.transcript-panel::-webkit-scrollbar {
    width: 8px;
}

.transcript-panel::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 4px;
}

.transcript-panel::-webkit-scrollbar-thumb {
    background: #007bff;
    border-radius: 4px;
}

.transcript-panel::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}

.transcript-segment {
    padding: 12px 15px;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
    transition: background-color 0.2s;
    color: #333;
}

.transcript-segment:hover {
    background: #e9ecef;
}

.transcript-segment:last-child {
    border-bottom: none;
}

.transcript-segment.highlighted {
    background: rgba(0, 123, 255, 0.1);
    border-left: 3px solid #007bff;
}

.transcript-time {
    color: #007bff;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 4px;
}

.transcript-text {
    color: #333;
    line-height: 1.4;
    font-size: 14px;
}

.transcript-text .highlight {
    background: rgba(0, 123, 255, 0.2);
    padding: 1px 2px;
    border-radius: 2px;
}

/* Video.js subtitle styling - clean text overlay */
.video-js .vjs-text-track-display {
    font-size: 20px;
    line-height: 1.3;
    text-align: center;
    bottom: 80px;
}

.video-js .vjs-text-track-cue {
    background: none !important;
    color: #fff !important;
    padding: 0 !important;
    border: none !important;
    font-weight: 600 !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9) !important;
    max-width: 90% !important;
    margin: 0 auto !important;
}

.video-js .vjs-text-track-cue div {
    background: transparent !important;
    color: inherit !important;
    padding: 0 !important;
    border: none !important;
}

/* Chat System Styles */
.chat-section {
    margin-top: 5px;
    border-top: 2px solid #e0e0e0;
    padding-top: 20px;
}

.chat-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
}

.chat-tab {
    background: none;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-size: 16px;
    color: #666;
    transition: all 0.2s ease;
}

.chat-tab:hover {
    color: #333;
    background-color: #f8f9fa;
}

.chat-tab.active {
    color: #007bff;
    border-bottom-color: #007bff;
    font-weight: 600;
}

.chat-panel {
    display: none;
}

.chat-panel.active {
    display: block;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 20px 10px 20px;
    border-bottom: 1px solid #eee;
}

.chat-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
}

.chat-controls {
    display: flex;
    gap: 10px;
}

.chat-button {
    background: #f8f9fa;
    border: 1px solid #ddd;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #666;
    transition: all 0.2s ease;
}

.chat-button:hover {
    background: #e9ecef;
    color: #333;
}

.chat-messages {
    height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    background: var(--bg-secondary);
    margin-bottom: 15px;
}

.chat-message {
    margin-bottom: 15px;
    padding: 14px;
    background: var(--card-bg);
    border-radius: 14px;
    box-shadow: 0 2px 8px var(--shadow-light);
    border: 1px solid var(--border-color, rgba(0,0,0,0.10));
    position: relative;
}

.chat-message-sending {
    opacity: 0.7;
}

.chat-sending-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-top: 8px;
    padding-left: 4px;
}

.chat-sending-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: chat-sending-pulse 1.4s ease-in-out infinite;
}

.chat-sending-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-sending-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes chat-sending-pulse {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    30% {
        opacity: 1;
        transform: scale(1);
    }
}

.chat-message-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.chat-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #007bff;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    margin-right: 10px;
    overflow: hidden;
    flex: 0 0 32px;
}

.chat-user-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chat-user-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 14px;
}

.chat-timestamp {
    color: var(--text-secondary);
    font-size: 12px;
    margin-left: auto;
    opacity: 0.9;
}

.chat-message-content {
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.55;
    padding-top: 10px;
    margin-top: 8px;
    margin-bottom: 10px;
    border-top: 1px solid var(--border-light, rgba(0,0,0,0.08));
}

.chat-video-link {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px 12px;
    margin: 8px 0;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
}

.chat-photo-link {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px 12px;
    margin: 8px 0;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
}

.chat-album-link {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px 12px;
    margin: 8px 0;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
}

.chat-video-link:hover {
    background: var(--bg-secondary);
    transform: translateY(-1px);
}

.chat-photo-link:hover {
    background: var(--bg-secondary);
    transform: translateY(-1px);
}

.chat-album-link:hover {
    background: var(--bg-secondary);
    transform: translateY(-1px);
}

.chat-video-link-icon {
    margin-right: 6px;
    color: var(--accent-primary);
}

.chat-photo-link-icon {
    margin-right: 6px;
    color: var(--accent-primary);
}

.chat-album-link-icon {
    margin-right: 6px;
    color: var(--accent-primary);
}


.chat-reactions {
    margin-top: 8px;
}

.chat-reaction {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.chat-reaction:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.chat-reaction.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.chat-reaction-count {
    font-size: 11px;
    font-weight: 600;
}

.reaction-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    position: relative;
}

.reaction-list {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}

.reaction-add-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 300;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.reaction-add-btn:hover,
.reaction-add-btn:focus {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.reaction-picker {
    position: absolute;
    bottom: 42px;
    left: 0;
    display: none;
    flex-direction: row;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    z-index: 20;
}

.reaction-picker.open {
    display: flex;
}

.reaction-picker-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    transition: transform 0.2s ease, background 0.2s ease;
}

.reaction-picker-option:hover,
.reaction-picker-option:focus {
    background: rgba(0,0,0,0.06);
    transform: translateY(-1px);
}

.reaction-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.video-reactions-section,
.video-reactions-section h3 {
    display: none;
}

.video-reactions {
    display: inline-flex;
    gap: 12px;
    align-items: center;
}

.scene-reactions {
    margin-top: 12px;
    position: relative;
}

.reaction-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    z-index: 1000;
    margin-bottom: 4px;
    max-width: 200px;
    word-wrap: break-word;
    white-space: normal;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.reaction-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.85);
}

/* Desktop: show on hover */
@media (hover: hover) and (pointer: fine) {
    .chat-reaction:hover .reaction-tooltip,
    .chat-reaction:focus .reaction-tooltip {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);
    }
}

/* Mobile: show on tap (using touch events) */
@media (hover: none) and (pointer: coarse) {
    .chat-reaction.tooltip-active .reaction-tooltip {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);
    }
}

.chat-input-container {
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.chat-input-wrapper input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    background: var(--input-bg);
    color: var(--text-primary);
}

.chat-input-wrapper textarea {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    background: var(--input-bg);
    color: var(--text-primary);
    resize: vertical;
    min-height: 40px;
}

.chat-input-wrapper input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0,123,255,0.1);
}

.chat-input-wrapper textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0,123,255,0.1);
}

.chat-send-button {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s ease;
    flex: 0 0 auto;
}

.chat-send-button:hover {
    background: #0056b3;
}

.chat-send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.chat-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.chat-error {
    background: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 10px;
    border: 1px solid #f5c6cb;
}

/* Video Link Styles */
.video-link-preview {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px;
    border-radius: 8px;
    margin: 8px 0;
    cursor: pointer;
    transition: transform 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.video-link-preview:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.video-link-icon {
    font-size: 20px;
}

.video-link-info h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
}

.video-link-info p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

/* Main Page Layout Styles */
.main-container {
    min-height: 100vh;
    background: var(--bg-secondary);
}

.main-header {
    background: var(--bg-primary);
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px var(--shadow-light);
}

.main-header h1 {
    margin: 0;
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 600;
}

.brand-title {
    display: flex;
    align-items: center;
}

.primary-nav {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 0 32px;
}

.primary-nav .nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    position: relative;
    transition: color 0.2s ease, opacity 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.primary-nav .nav-icon {
    display: none;
    font-size: 20px;
    line-height: 1;
}

.primary-nav .nav-text {
    display: inline;
}

.primary-nav .nav-link:hover,
.primary-nav .nav-link:focus {
    color: var(--accent-primary);
    outline: none;
}

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

.primary-nav .nav-link.active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -6px;
    height: 2px;
    background: var(--accent-primary);
    border-radius: 999px;
}

.main-content {
    display: flex;
    min-height: calc(100vh - 80px);
    position: relative;
}

/* Video Page Layout */
.video-page-content {
    display: grid;
    /* Keep the Feed/Chat column readable: never let it get "squashed". */
    grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
    /* Two-row layout: video on top, details underneath (avoid an empty stretching row causing a gap). */
    grid-template-rows: auto 1fr;
    gap: 20px;
    min-height: calc(100vh - 80px);
    padding: 20px;
}

.video-section {
    grid-column: 1;
    grid-row: 1;
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    width: 100%;
    /* Center the video container */
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* Image viewer page: stack photo + reactions vertically */
.photo-viewer-section {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    overflow: visible;
    background: transparent;
}

.photo-viewer-section .photo-container {
    width: 100%;
}

.photo-reactions {
    width: 100%;
    margin-top: 0;
    padding: 0 14px 14px 14px;
    box-sizing: border-box;
}

/* Timeline Layout */
.timeline-layout {
    padding: 30px;
    background: var(--bg-secondary);
    min-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.timeline-header h2 {
    margin: 0;
    font-size: 26px;
    color: var(--text-primary);
}

.timeline-subtitle {
    margin: 8px 0 0 0;
    color: var(--text-secondary);
    font-size: 15px;
}

.timeline-loading,
.timeline-empty {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 6px var(--shadow-light);
}

.timeline-loading {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    text-align: center;
}

.timeline-empty {
    text-align: center;
    font-size: 16px;
    color: var(--text-secondary);
}

.timeline-stream {
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: relative;
}

.timeline-month {
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 18px 22px;
    box-shadow: 0 4px 12px var(--shadow-light);
    border-left: 4px solid var(--accent-primary);
}

.timeline-month--empty {
    opacity: 0.65;
    border-left-color: var(--border-color);
}

.timeline-month-header {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.timeline-month-label {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.timeline-age-label {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-primary);
    text-transform: uppercase;
}

.timeline-birthday-badge {
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 193, 7, 0.18);
    color: #b8860b;
    font-weight: 600;
}

.timeline-scenes {
    margin-top: 16px;
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.timeline-scene-thumb {
    width: 100%;
    height: 0;
    padding-top: 56%;
    background: var(--bg-tertiary);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    background-size: cover;
    background-position: center;
    margin-bottom: 14px;
    transition: background-position 0.2s ease, background-size 0.2s ease;
}

.timeline-scene-thumb--empty {
    padding-top: 0;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(120, 120, 120, 0.12), rgba(80, 80, 80, 0.12));
    color: var(--text-tertiary);
    font-size: 13px;
    font-style: italic;
}

.timeline-scene-card {
    background: var(--bg-secondary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    padding: 16px 18px;
    box-shadow: 0 2px 8px var(--shadow-light);
}

.timeline-photo-card {
    background: var(--bg-secondary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    padding: 16px 18px;
    box-shadow: 0 2px 8px var(--shadow-light);
    cursor: pointer;
}

.timeline-photo-thumb {
    width: 100%;
    height: 0;
    padding-top: 56%;
    background: var(--bg-tertiary);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    margin-bottom: 14px;
}

.timeline-photo-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.timeline-photo-header {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.timeline-photo-title {
    margin: 8px 0 6px 0;
    font-size: 18px;
    color: var(--text-primary);
}

.timeline-photo-meta {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.timeline-photo-actions {
    display: flex;
    justify-content: flex-end;
}

.timeline-photo-link {
    font-size: 14px;
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
}

.timeline-photo-link:hover,
.timeline-photo-link:focus {
    text-decoration: underline;
}

.timeline-scene-header {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.timeline-scene-title {
    margin: 8px 0 6px 0;
    font-size: 18px;
    color: var(--text-primary);
}

.timeline-scene-meta {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.timeline-scene-description {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.timeline-scene-location {
    font-size: 13px;
    color: var(--accent-primary);
    margin-bottom: 10px;
}

.timeline-scene-location::before {
    content: '📍 ';
}

.timeline-scene-actions {
    display: flex;
    justify-content: flex-end;
}

.timeline-scene-link {
    font-size: 14px;
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
}

.timeline-scene-link:hover,
.timeline-scene-link:focus {
    text-decoration: underline;
}

.timeline-month-empty-note {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-tertiary);
    font-style: italic;
}

.timeline-year-marker {
    align-self: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    padding: 6px 20px;
    margin: 12px 0;
    border-radius: 999px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    box-shadow: 0 8px 20px var(--shadow-light);
}

.timeline-milestone {
    align-self: center;
    max-width: 520px;
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 24px 28px;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px var(--shadow-medium);
    position: relative;
    overflow: hidden;
}

.timeline-milestone::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top, rgba(255,255,255,0.18), transparent 65%);
    pointer-events: none;
}

.timeline-milestone h3 {
    margin: 0 0 10px 0;
    font-size: 22px;
    color: var(--accent-primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.timeline-milestone p {
    margin: 0;
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.timeline-milestone--birth {
    border-color: rgba(76, 175, 80, 0.45);
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.12), var(--bg-primary));
}

.timeline-milestone--teen {
    border-color: rgba(33, 150, 243, 0.45);
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.12), var(--bg-primary));
}

.timeline-milestone--adult {
    border-color: rgba(255, 193, 7, 0.45);
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.16), var(--bg-primary));
}

.video-details {
    grid-column: 1;
    grid-row: 2;
    display: grid;
    gap: 20px;
    grid-template-columns: 1fr;
    grid-template-areas:
        "current"
        "comments"
        "primary";
    align-items: start;
}

@media (min-width: 1024px) {
    .video-details {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
            "current current"
            "primary comments";
        align-items: start;
    }
}

.video-details .video-info {
    max-width: none;
    margin: 0;
}

.video-details .video-current {
    grid-area: current;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.video-current .current-scene-info {
    /* This card is already separated from the next section by the grid gap.
       Avoid double-spacing between Current Scene and Comments. */
    margin-bottom: 0;
}

/* If the whole-video reactions bar has no content, don't let its margins create a big gap. */
.video-current .video-reactions:empty {
    display: none;
    margin: 0;
}

.video-details .video-primary {
    grid-area: primary;
}

.video-details .video-comments {
    grid-area: comments;
}

/* New ordering: Transcript comes first in the primary stack */
.video-primary .transcript {
    margin-top: 0;
}

.video-primary .scenes {
    margin-top: 25px;
}


.video-chat-panel {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-light);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chat-section {
    grid-column: 2;
    grid-row: 1 / 3;
    display: flex;
    flex-direction: column;
}

/* Video Gallery Section */
.video-gallery-section {
    flex: 1;
    padding: 30px;
    background: var(--bg-secondary);
    overflow-y: auto;
    /* Reserve space for fixed chat sidebar (width + padding). */
    margin-right: 392px;
}

.gallery-header {
    margin-bottom: 30px;
    padding: 0;
}

.gallery-header h2 {
    margin: 0 0 20px 0;
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 600;
}

.gallery-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.gallery-controls input,
.gallery-controls select {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    background: var(--input-bg);
    color: var(--text-primary);
}

.gallery-controls input:focus,
.gallery-controls select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0,123,255,0.1);
}

.gallery-controls input {
    flex: 1;
    max-width: 300px;
}

/* Video Cards Grid */
.video-cards-grid {
    display: grid;
    /* Keep cards from stretching wider than sprite-friendly dimensions. */
    grid-template-columns: repeat(auto-fill, minmax(300px, 320px));
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
}

.video-cards-grid.is-updating {
    opacity: 0.7;
    transition: opacity 120ms ease;
}

.gallery-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.2;
}

.gallery-status .loading-spinner {
    width: 16px;
    height: 16px;
    border-width: 2px;
    margin: 0;
    border-top-color: var(--accent-primary);
}

/* Scene Cards */
.scene-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px var(--shadow-light);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    cursor: pointer !important;
    position: relative;
    height: 420px; /* Match video card height for consistent grid layout */
    display: flex;
    flex-direction: column;
}

.scene-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px var(--shadow-medium);
}

.scene-card-image {
    position: relative;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.scene-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.scene-card:hover .scene-card-image img {
    transform: scale(1.05);
}

.scene-card-content {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.scene-card-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scene-card-tape-info {
    margin: 0 0 10px 0;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.scene-card-description {
    margin: 0 0 12px 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.scene-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.scene-card-meta span {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.scene-card-time-overlay {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    z-index: 5;
}

.scene-card-tape-overlay {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    z-index: 5;
}

/* Cycling animations */
.video-card-title {
    transition: opacity 0.8s ease-in-out;
}

.video-card-poster {
    transition: background-position 0.3s ease-in-out;
}

.video-card,
.image-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px var(--shadow-light);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    cursor: pointer !important;
    position: relative;
    height: 420px; /* Increased card height */
    display: flex;
    flex-direction: column;
}

.video-card-top,
.video-card-bottom {
    padding: 14px 16px;
    background: var(--card-bg);
}

.video-card-top {
    border-bottom: 1px solid var(--border-light);
}

.video-card-bottom {
    border-top: 1px solid var(--border-light);
}

.video-card-top-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.video-card-top-main {
    flex: 1;
    min-width: 0;
}

.video-card-top-actions {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 0 0 auto;
}

.video-card:hover,
.image-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px var(--shadow-medium);
}

.video-card-image {
    position: relative;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    background: #f8f9fa; /* Light background for when image is loading */
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Fill full width/height, cropping is OK */
    transition: transform 0.3s ease;
}

/* Image cards: show full portrait thumbnails (no top/bottom crop) */
.image-card[data-orientation="portrait"] .video-card-image img.image-card-thumb {
    object-fit: contain;
    background: var(--bg-secondary);
}

.video-card:hover .video-card-image img,
.image-card:hover .video-card-image img {
    transform: scale(1.05);
}

.video-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.video-card:hover .video-card-overlay {
    opacity: 1 !important;
}

.play-button {
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #007bff;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.video-card:hover .play-button {
    background: rgba(255,255,255,1);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.video-card-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.video-card-description {
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.video-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.video-card-meta-bottom {
    margin-top: 0;
}

.video-card-media-type {
    background: rgba(111, 66, 193, 0.12);
    color: #6f42c1;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.video-card-people {
    color: #6f42c1;
    font-size: 0.85rem;
    background: rgba(111, 66, 193, 0.12);
    padding: 2px 6px;
    border-radius: 3px;
}

.video-card-year {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.video-card-duration {
    color: #4CAF50;
    font-size: 0.85rem;
    background: rgba(76, 175, 80, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
}

.video-card-people {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.video-card-location {
    color: #2196F3;
    font-size: 0.85rem;
    background: rgba(33, 150, 243, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
}

.video-card-location:before {
    content: "📍 ";
}

/* Dark mode adjustments for video card meta tags */
[data-theme="dark"] .video-card-location {
    background: rgba(33, 150, 243, 0.2);
}

[data-theme="dark"] .video-card-duration {
    background: rgba(76, 175, 80, 0.2);
}

[data-theme="dark"] .video-card-media-type {
    background: rgba(111, 66, 193, 0.22);
}

[data-theme="dark"] .video-card-people {
    background: rgba(111, 66, 193, 0.22);
}

.video-card-full-tape-overlay {
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 5;
}

/* Chat Sidebar (Desktop) */
.chat-sidebar {
    position: fixed;
    top: 80px; /* Below header */
    right: 0;
    width: 360px;
    background: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
    z-index: 100;
    padding: 16px;
    box-sizing: border-box;
}

.chat-sidebar .chat-header {
    padding: 0 0 15px 0;
    margin-bottom: 15px;
    flex-shrink: 0;
}

/* Desktop sidebar: let feed + chat split the available height */
.chat-sidebar .family-feed {
    flex: 1 1 0;
}

.chat-sidebar #main-chat-messages {
    flex: 1 1 0;
    min-height: 0;
}

.family-feed {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* allow internal scroller */
    margin-bottom: 12px;
}

.family-feed-header,
.family-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 0 10px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
    flex-shrink: 0;
}

.family-feed-header h4,
.family-chat-header h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
}

.family-feed-items {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    background: var(--bg-secondary);
}

.family-feed-item {
    display: flex;
    gap: 12px;
    padding: 14px;
    border-radius: 14px;
    background: var(--card-bg);
    box-shadow: 0 2px 8px var(--shadow-light);
    border: 1px solid var(--border-color, rgba(0,0,0,0.10));
    margin-bottom: 10px;
}

.family-feed-item:last-child {
    margin-bottom: 0;
}

.family-feed-item-body {
    flex: 1;
    min-width: 0;
}

.family-feed-item-text {
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.55;
    margin-bottom: 8px;
    word-break: break-word;
}

.family-feed-item-meta {
    color: var(--text-secondary);
    font-size: 12px;
    opacity: 0.9;
}

.family-feed-preview {
    color: var(--text-secondary);
}

.family-feed-comment-jump {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
    font: inherit;
}

.family-feed-comment-jump:hover {
    text-decoration: underline;
}

.timestamped-comment-highlight {
    outline: 2px solid var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(0,123,255,0.12);
}

.chat-sidebar .chat-messages {
    flex: 1;
    height: auto;
    max-height: none;
    overflow-y: auto;
    min-height: 0; /* Important for flex scrolling */
    margin: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
}

.chat-sidebar .chat-input-container {
    padding: 0;
    margin-top: 15px;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

.chat-sidebar .chat-input-wrapper {
    width: 100%;
    box-sizing: border-box;
    gap: 8px; /* Reduce gap to save space */
}

.chat-sidebar .chat-input-wrapper input {
    min-width: 0; /* Allow input to shrink */
    flex: 1;
}

.chat-sidebar .chat-send-button {
    flex-shrink: 0; /* Prevent button from shrinking */
    white-space: nowrap;
    padding: 10px 16px; /* Slightly reduce horizontal padding */
}

/* Mobile Chat Button */
.mobile-chat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,123,255,0.3);
    transition: all 0.3s ease;
    z-index: 1000;
    display: none;
}

.mobile-chat-button:hover {
    background: #0056b3;
    transform: scale(1.1);
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Mobile Chat Overlay */
.mobile-chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.55);
    z-index: 2000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow: hidden; /* Prevent overlay from scrolling */
}

.mobile-chat-overlay.active {
    display: flex;
    opacity: 1;
}

/* Prevent body scroll when mobile chat is open */
body.mobile-chat-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

.mobile-chat-container {
    background: var(--bg-primary);
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    overflow: hidden; /* Prevent container from scrolling */
    touch-action: pan-y; /* Allow vertical scrolling within container */
    /* Subtle depth + nicer separation from backdrop */
    box-shadow: 0 -10px 40px rgba(0,0,0,0.35);
}

.mobile-chat-overlay.active .mobile-chat-container {
    transform: translateY(0);
}

.mobile-chat-header {
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px 12px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    min-height: 44px;
}

.mobile-chat-header::before {
    content: "Feed & Chat";
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.mobile-chat-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
}

.close-chat-button {
    background: none;
    border: none;
    font-size: 32px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    transition: background-color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.close-chat-button:hover {
    background: var(--bg-tertiary);
}

.mobile-chat-messages {
    flex: 1;
    padding: 14px 12px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-secondary);
    min-height: 0; /* Important for flex scrolling */
    max-height: 100%;
    touch-action: pan-y; /* Allow vertical panning (scrolling) */
    overscroll-behavior: contain; /* Prevent scroll chaining */
}

.mobile-chat-input {
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom)) 12px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
    display: flex;
    gap: 10px;
    align-items: center;
}

.mobile-chat-input input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    background: var(--input-bg);
    color: var(--text-primary);
    min-width: 0;
}

/* Mobile overlay: don't inherit generic mobile "send button is full width" rules */
.mobile-chat-input .chat-send-button {
    width: auto !important;
    flex: 0 0 auto;
    padding: 12px 16px;
    min-width: 90px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    color: #fff;
}

.mobile-chat-input input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0,123,255,0.1);
}

/* Mobile: feed + chat stack inside the overlay */
.mobile-family-feed {
    flex: 0 0 40%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 12px 12px 0 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.mobile-family-feed .family-feed-header {
    padding: 0 0 10px 0;
    margin-bottom: 10px;
}

/* Make the two section headers feel consistent and "sticky" within their sections */
.mobile-family-feed .family-feed-header,
.mobile-chat-container > .family-chat-header {
    position: sticky;
    top: 0;
    z-index: 2;
}

/* Mobile overlay: make Chat header match Feed header spacing */
.mobile-chat-container > .family-chat-header {
    padding: 0 12px 10px 12px;
    margin-bottom: 10px;
    background: var(--bg-secondary);
}

.mobile-chat-container > .family-chat-header h4 {
    margin: 0;
}

.mobile-family-feed .family-feed-items {
    /* Avoid the "extra container" look: items are the cards, not the scroller wrapper. */
    border: none;
    background: transparent;
    padding: 0;
    border-radius: 0;
    /* Give a little breathing room so the first card doesn't feel glued to the header */
    padding-top: 4px;
}

/* Overlay: slightly tighter feed cards for mobile density */
.mobile-family-feed .family-feed-item {
    border-radius: 16px;
}

/* Video/Image pages: make the right-column feed+chat behave like the main page sidebar (full height, internal scrolling). */
.video-page-content .chat-section {
    background: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    padding: 16px;
    box-sizing: border-box;
    height: calc(95vh - 80px);
    overflow: hidden;
    min-height: 0;
}

.video-page-content .chat-section .chat-panel.active {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
}

.video-page-content .chat-section .family-feed {
    flex: 1 1 0;
    margin-bottom: 12px;
}

.video-page-content .chat-section .family-feed-items {
    max-height: none;
}

.video-page-content .chat-section #main-chat-messages {
    flex: 1 1 0;
    min-height: 0;
    height: auto;
}

.video-page-content .chat-section .chat-messages {
    height: auto;
    min-height: 0;
}

.video-page-content .chat-section .chat-input-container {
    flex-shrink: 0;
}

/* Loading States */
.gallery-loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.gallery-loading-title {
    margin: 0 0 10px 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.gallery-loading-subtext {
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-secondary);
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

.gallery-loading-retry {
    margin-top: 16px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
}

.gallery-loading-retry:hover {
    background: var(--bg-primary);
}

.gallery-loading .loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

/* Scroll Loading Indicator */
#scroll-loading-indicator {
    grid-column: 1 / -1;
    margin: 20px 0;
}

#scroll-loading-indicator .loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f4f6;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

/* End of Content Message */
#end-of-content-message {
    grid-column: 1 / -1;
    margin: 20px 0;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.error-message {
    text-align: center;
    padding: 40px 20px;
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    margin: 20px 0;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }
    
    .chat-sidebar {
        position: relative;
        top: auto;
        right: auto;
        width: 100%;
        height: 300px;
        border-left: none;
        border-top: 1px solid #e0e0e0;
    }
    
    .video-gallery-section {
        padding: 20px;
        margin-right: 0; /* Remove margin on tablet/mobile */
    }
    
    .video-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 320px));
        justify-content: center;
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .main-header {
        padding: 12px 15px;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        flex-wrap: nowrap;
        /* Remove the tiny “sliver” below the header on mobile (border/shadow). */
        border-bottom: none;
        box-shadow: none;
    }
    
    .main-header h1 {
        font-size: 20px;
        white-space: nowrap;
    }
    
    .brand-title {
        flex-shrink: 0;
    }
    
    .primary-nav {
        margin: 0 8px;
        flex-shrink: 1;
        min-width: 0;
        gap: 8px;
        flex-wrap: nowrap;
    }
    
    .primary-nav .nav-link {
        font-size: 14px;
        white-space: nowrap;
        padding: 6px;
        border-radius: 6px;
        transition: background-color 0.2s ease;
    }
    
    .primary-nav .nav-link:hover {
        background-color: var(--bg-secondary);
    }
    
    .primary-nav .nav-icon {
        display: inline-block;
        font-size: 22px;
    }
    
    .primary-nav .nav-text {
        display: none;
    }
    
    .primary-nav .nav-link.active::after {
        display: none;
    }
    
    .primary-nav .nav-link.active {
        background-color: var(--bg-secondary);
    }
    
    .header-controls {
        flex-direction: row;
        justify-content: flex-end;
        align-items: center;
        gap: 8px;
        flex-wrap: nowrap;
        flex-shrink: 0;
        margin-left: auto;
    }
    
    .theme-toggle {
        margin-left: 0;
        flex-shrink: 0;
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .user-menu {
        justify-content: flex-end;
        flex-wrap: nowrap;
        flex-shrink: 0;
        gap: 8px;
    }
    
    .user-menu span {
        font-size: 13px;
        white-space: nowrap;
    }
    
    .hamburger-button {
        padding: 6px;
    }
    
    .hamburger-line {
        width: 18px;
    }
    
    .video-gallery-section {
        padding: 20px;
        margin-right: 0; /* Remove margin on mobile */
    }

    .timeline-layout {
        padding: 20px;
    }

    .timeline-scenes {
        grid-template-columns: 1fr;
    }
    
    .gallery-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .gallery-controls input,
    .gallery-controls select {
        width: 100%;
        max-width: none;
    }
    
    .video-cards-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .video-card,
    .image-card {
        height: auto; /* Allow cards to expand naturally on mobile */
    }

    .scene-card {
        height: auto; /* Allow cards to expand naturally on mobile */
    }
    
    /* Keep video/scenes card media behavior consistent with desktop (sprites/posters). */
    .video-card-image {
        height: 360px;
        min-height: 0;
    }

    .scene-card-image {
        height: 240px;
        min-height: 0;
    }

    /* But for photo cards, let the image area expand and show full portrait */
    .image-card .video-card-image {
        min-height: 60vh; /* Let the photo be the focus on mobile */
        height: auto;
    }

    /* On mobile, show full photo (no crop) */
    .image-card .video-card-image img.image-card-thumb {
        object-fit: contain;
        height: 100%;
        background: var(--bg-secondary);
    }

    /* Albums: show full-width cover (no side crop) and let card height follow the image (no letterboxing). */
    .album-card .video-card-image {
        display: block;
        min-height: 0;
        height: auto;
        background: transparent;
    }

    .album-card .video-card-image img.image-card-thumb {
        display: block;
        width: 100%;
        height: auto;
        object-fit: contain;
        background: transparent;
    }
    
    .chat-sidebar {
        display: none;
    }
    
    .mobile-chat-button {
        display: block;
    }
    
    .mobile-chat-messages {
        padding: 15px;
    }
    
    .mobile-chat-input {
        padding: 15px;
    }
    
    /* Video page mobile layout */
    .video-page-content {
        display: block;
        padding: 15px;
        overflow-x: hidden; /* Clamp any accidental mobile overflow (e.g., long content or 100vw children) */
    }

    /* On mobile, use the floating button + overlay for Feed/Chat (like the main page). */
    .video-page-content .chat-section {
        display: none;
    }

    /* Below-video sections should never exceed the viewport width */
    .video-details,
    .video-details > * {
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
    
    .video-section {
        margin-bottom: 20px;
        max-width: none;
        width: 100vw;
        margin-left: calc(-50vw + 50%);
        margin-right: calc(-50vw + 50%);
        border-radius: 0;
    }
    
    /* Current Scene Info Mobile Styles */
    .current-scene-info {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .current-scene-header {
        position: relative;
        padding-right: 40px; /* Make room for share button */
    }
    
    .current-scene-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .current-scene-time {
        font-size: 0.85rem;
        min-width: auto;
        order: 1;
    }
    
    .current-scene-title {
        font-size: 1.15rem;
        width: 100%;
        order: 2;
        line-height: 1.4;
        margin-bottom: 0;
    }
    
    .current-scene-title-row > .current-scene-watch-indicator {
        margin-left: 0;
        margin-top: 4px;
        order: 3;
        align-self: flex-start;
    }
    
    .current-scene-title-row > .scene-share {
        position: absolute;
        top: 0;
        right: 0;
        margin: 0;
    }
    
    .current-scene-meta {
        gap: 6px;
        margin-top: 10px;
        font-size: 0.85rem;
    }
    
    .current-scene-meta .scene-date,
    .current-scene-meta .scene-location,
    .current-scene-meta .scene-people {
        font-size: 0.8rem;
        padding: 3px 8px;
    }
    
    .current-scene-description {
        font-size: 0.9rem;
        padding-top: 12px;
        margin-bottom: 12px;
        line-height: 1.5;
    }
    
    .current-scene-reactions {
        margin-top: 12px;
        padding-top: 12px;
    }
    
    .current-scene-reactions .reaction-wrapper {
        padding: 6px 12px;
    }
    
    .current-scene-reactions .chat-reaction {
        font-size: 12px;
        padding: 3px 6px;
        min-height: 24px;
    }
    
    .current-scene-reactions .chat-reaction-emoji {
        font-size: 14px;
    }
    
    .current-scene-reactions .reaction-add-btn {
        width: 24px;
        height: 24px;
        font-size: 14px;
    }
    
    .video-js {
        width: 100vw;
        height: 0;
        padding-bottom: 75vw; /* 4:3 aspect ratio for Video8 recordings */
        margin-left: calc(-50vw + 50%);
        margin-right: calc(-50vw + 50%);
        position: relative;
    }
    
    .chat-section {
        margin-top: 20px;
    }
}

/* Chat responsive styles */
@media (max-width: 768px) {
    .chat-messages {
        height: 250px;
    }
    
    .chat-input-wrapper {
        flex-direction: column;
    }
    
    .chat-send-button {
        width: 100%;
    }
    
    .chat-tabs {
        flex-direction: column;
    }
    
    .chat-tab {
        text-align: left;
        border-bottom: none;
        border-right: 2px solid transparent;
    }
    
    .chat-tab.active {
        border-bottom-color: transparent;
        border-right-color: #007bff;
    }

    /* Transcript controls: prevent overflow on mobile and make it feel cleaner */
    .transcript-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    #transcript-search,
    #toggle-transcript {
        width: 100%;
        box-sizing: border-box;
    }

    #transcript-search {
        min-width: 0;
        border-radius: 10px;
        padding: 10px 12px;
    }

    #toggle-transcript {
        border-radius: 10px;
        padding: 10px 14px;
        white-space: nowrap;
    }

    .transcript-panel {
        max-height: 50vh;
    }
}

/* Transcript Styles */
.transcript {
    margin-top: 25px;
}

.transcript h3 {
    color: var(--accent-secondary);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.transcript-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

#transcript-search {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 14px;
}

#transcript-search:focus {
    outline: none;
    border-color: var(--accent-secondary);
    box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.2);
}

#toggle-transcript {
    padding: 8px 16px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

#toggle-transcript:hover {
    background: #ff5252;
}

.transcript-panel {
    background: var(--bg-tertiary);
    border-radius: 8px;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
}

.transcript-panel::-webkit-scrollbar {
    width: 8px;
}

.transcript-panel::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.transcript-panel::-webkit-scrollbar-thumb {
    background: var(--accent-secondary);
    border-radius: 4px;
}

.transcript-panel::-webkit-scrollbar-thumb:hover {
    background: #ff5252;
}

.transcript-segment {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
}

.transcript-segment:hover {
    background: var(--bg-tertiary);
}

.transcript-segment:last-child {
    border-bottom: none;
}

.transcript-segment.highlighted {
    background: rgba(255, 107, 107, 0.2);
    border-left: 3px solid var(--accent-secondary);
}

.transcript-time {
    color: var(--accent-secondary);
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 4px;
}

.transcript-text {
    color: var(--text-primary);
    line-height: 1.4;
    font-size: 14px;
}

.transcript-text .highlight {
    background: rgba(255, 107, 107, 0.3);
    padding: 1px 2px;
    border-radius: 2px;
}

/* Video.js subtitle styling - clean text overlay */
.video-js .vjs-text-track-display {
    font-size: 20px;
    line-height: 1.3;
    text-align: center;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.video-js .vjs-text-track-cue {
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border-radius: 4px;
    margin: 4px 0;
}

/* Video.js Share Button Styles */
.vjs-share-button {
    cursor: pointer;
    font-family: inherit;
    font-weight: normal;
    font-style: normal;
    position: relative;
}

.vjs-share-button:before {
    /* Legacy icon hook (older implementation). Keep disabled to avoid double icons with MenuButton. */
    content: none;
}

/* When the share control is a Video.js MenuButton (like captions), the icon placeholder is inside the button. */
.video-js .vjs-share-button .vjs-icon-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 1;
}

.video-js .vjs-seek-button .vjs-icon-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 1;
}

.video-js .vjs-seek-back .vjs-icon-placeholder:before {
    content: "⟲";
    font-size: 1.7em;
}

.video-js .vjs-seek-forward .vjs-icon-placeholder:before {
    content: "⟳";
    font-size: 1.7em;
}

.vjs-share-button .vjs-icon-placeholder:before {
    content: "🔗";
    font-size: 1.2em;
    line-height: 1.67;
    display: block;
    transform: translateY(2.5px); /* Nudge to visually align with Video.js icon font */
}

.vjs-share-button:hover .vjs-icon-placeholder:before {
    text-shadow: 0 0 1em #fff;
}

.vjs-share-button:focus {
    outline: 2px solid #00a0d2;
    outline-offset: 2px;
}

.vjs-share-dropdown {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: #2B333F;
    border-radius: 0;
    padding: 0;
    min-width: 160px;
    z-index: 10000;
    margin-bottom: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

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

.vjs-share-dropdown-content {
    display: flex;
    flex-direction: column;
}

.vjs-share-option {
    background: none;
    border: none;
    color: white;
    padding: 8px 16px;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
    width: 100%;
    border-radius: 0;
}

.vjs-share-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.vjs-share-option:focus {
    outline: 2px solid #00a0d2;
    outline-offset: -2px;
    background: rgba(255, 255, 255, 0.1);
}

.vjs-share-option-icon {
    font-size: 16px;
}

/* Seek zones (hover/tap) */
.video-container {
    position: relative;
}

.video-js .vjs-progress-control {
    position: relative;
}

.seek-zone {
    position: absolute;
    top: 0;
    bottom: 52px;
    width: 28%;
    z-index: 6;
}

.seek-zone-left {
    left: 0;
}

.seek-zone-right {
    right: 0;
}

/* Seek time marker on progress bar */
.video-js .seek-time-marker {
    position: absolute;
    bottom: 24px;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
    white-space: nowrap;
    z-index: 4;
}

.video-js .seek-time-marker.is-visible {
    opacity: 1;
}

@media (max-width: 768px) {
    .seek-zone {
        bottom: 58px;
        width: 34%;
    }
    .video-js .seek-time-marker {
        bottom: 28px;
        font-size: 11px;
    }
}

/* Clip share dialog */
.clip-share-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 10, 12, 0.75);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 12000;
    padding: 24px;
}

.clip-share-card {
    width: min(440px, 100%);
    background: #12161c;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 18px 20px 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    color: #f2f2f2;
}

.clip-share-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.clip-share-title {
    font-size: 16px;
    font-weight: 600;
}

.clip-share-close {
    border: none;
    background: transparent;
    color: #bfc7d5;
    font-size: 18px;
    cursor: pointer;
}

.clip-share-body {
    display: grid;
    gap: 10px;
}

.clip-share-label {
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: #cdd5e0;
}

.clip-share-input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: #0c0f14;
    color: #f1f4f9;
    font-size: 14px;
}

.clip-share-input:focus {
    outline: 2px solid rgba(125, 179, 255, 0.55);
    border-color: rgba(125, 179, 255, 0.55);
}

.clip-share-hint {
    font-size: 12px;
    color: #8f9aae;
}

.clip-share-error {
    font-size: 12px;
    color: #8f9aae;
    min-height: 16px;
}

.clip-share-approvers {
    font-size: 12px;
    color: #4b5563;
    min-height: 16px;
}

.clip-share-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
}

.clip-share-link {
    margin-top: 12px;
    display: none;
    gap: 6px;
}

.clip-share-link-label {
    font-size: 12px;
    color: #8f9aae;
}

.clip-share-link-row {
    display: flex;
    gap: 8px;
}

.clip-share-link-input {
    flex: 1;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: #0c0f14;
    color: #f1f4f9;
    font-size: 13px;
}

.clip-share-btn {
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
    border: none;
}

.clip-share-btn:disabled {
    opacity: 0.65;
    cursor: wait;
}

.clip-share-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #f2f2f2;
}

.clip-share-btn-primary {
    background: #2f79ff;
    color: #fff;
}

/* Scene Share Button Styles */
.scene-share-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    opacity: 0.7;
    transition: all 0.2s ease;
}

.scene-share-btn:hover {
    opacity: 1;
    background: #5a6268;
}

.scene-share {
    position: relative;
    margin-left: 12px;
    display: inline-flex;
    align-items: center;
}

.scene-share-dropdown {
    position: absolute;
    top: 50%;
    right: calc(100% + 8px);
    left: auto;
    transform: translateY(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 140px;
    margin-top: 2px;
    animation: slideDown 0.2s ease-out;
    white-space: nowrap;
}

.scene-share-option {
    width: 100%;
    background: none;
    border: none;
    padding: 8px 12px;
    text-align: left;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s ease;
}

.scene-share-option:hover {
    background: var(--bg-tertiary);
}

/* Video Card Share Button Styles */
.video-card-share-btn {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
}

.video-card:hover .video-card-share-btn,
.image-card:hover .video-card-share-btn {
    opacity: 1;
}

.video-card-share-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.video-card-share-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 140px;
    margin-top: 2px;
    animation: slideDown 0.2s ease-out;
}

.video-card-share-option {
    width: 100%;
    background: none;
    border: none;
    padding: 8px 12px;
    text-align: left;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s ease;
}

.video-card-share-option:hover {
    background: var(--bg-tertiary);
}
.video-card-share-controls {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 7;
}

.image-card .video-card-share-controls {
    top: 12px;
    right: 12px;
    bottom: auto;
    z-index: 12;
}

.image-card .video-card-share-controls .video-card-share-dropdown {
    top: 100%;
    bottom: auto;
    margin-top: 8px;
    margin-bottom: 0;
}

.video-card-watch-overlay {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 6;
    pointer-events: none;
}

.video-card-watch-overlay .watch-indicator {
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
}

[data-theme="dark"] .video-card-watch-overlay .watch-indicator {
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
}
.video-card-share-controls .video-card-share-btn {
    top: 0;
    right: 0;
}
.video-card-share-controls .video-card-share-dropdown {
    top: auto;
    bottom: 100%;
    margin-bottom: 8px;
}

/* Cards: move share/watch controls into top bar (no overlays on image) */
.video-card-top .video-card-share-controls,
.image-card .video-card-top .video-card-share-controls {
    position: relative;
    bottom: auto;
    right: auto;
    top: auto;
    left: auto;
    z-index: 10;
}

.scene-card .video-card-top .video-card-share-controls {
    position: relative;
}

.video-card-top .video-card-share-btn,
.image-card .video-card-top .video-card-share-btn {
    position: static;
    opacity: 1;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 6px 10px;
}

.video-card-top .video-card-share-btn:hover,
.image-card .video-card-top .video-card-share-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .video-card-top .video-card-share-btn,
[data-theme="dark"] .image-card .video-card-top .video-card-share-btn {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
}

.video-card-top .video-card-share-dropdown,
.image-card .video-card-top .video-card-share-dropdown {
    top: 100%;
    bottom: auto;
    right: 0;
    margin-top: 8px;
    margin-bottom: 0;
}

.video-card-top .video-card-watch-overlay {
    position: static;
    pointer-events: auto;
    z-index: 10;
}

.video-card-top .scene-card-watch-overlay {
    position: static;
    pointer-events: none;
    z-index: 10;
}

.video-card-top .scene-card-watch-overlay .scene-card-watch-indicator {
    box-shadow: none;
}

.video-card-top .video-card-watch-overlay .watch-indicator {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .video-card-top .video-card-watch-overlay .watch-indicator {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.18);
}

/* Photo viewer (image.html) */
.photo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: transparent;
    border: none;
    position: relative;
}

.photo-frame {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

#photo-viewer {
    display: block;
    max-width: 100%;
    height: auto;
    max-height: 75vh;
    object-fit: contain;
    background: transparent;
}

/* Photo viewer share control: bottom-right overlay, show on hover */
.photo-share-controls {
    position: absolute;
    bottom: max(8px, env(safe-area-inset-bottom));
    right: 12px;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 8px;
}

.photo-nav-controls {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 12px;
    right: 12px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    pointer-events: none;
}

.photo-nav-controls .photo-nav-btn {
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 40px;
    height: 34px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.photo-nav-controls .photo-nav-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.photo-nav-controls .photo-nav-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.photo-nav-status {
    pointer-events: none;
    background: rgba(0, 0, 0, 0.45);
    color: white;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
}

.photo-share-controls .photo-action-btn {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    line-height: 1;
}

.photo-share-controls .photo-action-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Override video-card share defaults inside the photo overlay */
.photo-share-controls .video-card-share-btn {
    position: static;
    top: auto;
    right: auto;
}

.photo-container .photo-action-btn {
    opacity: 0;
}

.photo-container:hover .photo-action-btn {
    opacity: 1;
}

/* Show album nav all the time (desktop + mobile) */
.photo-container .photo-nav-controls {
    opacity: 1;
    transition: opacity 0.2s ease;
}

.photo-container:hover .photo-nav-controls {
    opacity: 1;
}

/* Mobile/touch: show bottom sheet trigger instead of hover controls.
   Note: Some emulators don't flip (hover:none) reliably, so include pointer+width too. */
@media (hover: none), (pointer: coarse), (max-width: 900px) {
    /* Use bottom sheet on mobile: show only the ⋯ button */
    #photo-view-full-btn,
    #photo-download-btn,
    #album-share-btn,
    #photo-share-btn {
        display: none;
    }

    .photo-mobile-actions-btn {
        display: inline-flex !important;
    }

    .photo-container .photo-action-btn {
        opacity: 1;
    }

    .photo-container .photo-nav-controls {
        opacity: 1;
    }
}

.photo-mobile-actions-btn {
    display: none;
    font-size: 16px;
    padding: 6px 10px;
}

.photo-share-controls .video-card-share-dropdown {
    top: auto;
    bottom: 100%;
    right: 0;
    margin-bottom: 8px;
}

/* Mobile action sheet */
.photo-action-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 9998;
}

.photo-action-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: var(--card-bg);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.25);
    border-top: 1px solid var(--border-color);
    padding: 10px 14px 16px 14px;
}

.photo-action-sheet-handle {
    width: 44px;
    height: 5px;
    border-radius: 999px;
    background: rgba(0,0,0,0.2);
    margin: 2px auto 10px auto;
}

[data-theme="dark"] .photo-action-sheet-handle {
    background: rgba(255,255,255,0.25);
}

.photo-action-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.photo-action-sheet-title {
    font-weight: 700;
    color: var(--text-primary);
}

.photo-action-sheet-close {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 6px 10px;
    cursor: pointer;
}

.photo-action-sheet-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.photo-action-sheet-action {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 12px;
    font-size: 15px;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
}

.photo-action-sheet-action:active {
    transform: translateY(1px);
}

.photo-action-sheet-icon {
    width: 22px;
    display: inline-flex;
    justify-content: center;
}

/* Card Reactions - Horizontal Layout at Bottom */
.video-card-reactions,
.image-card-reactions,
.scene-card-reactions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 36px;
}

.video-card-reactions .reaction-wrapper,
.image-card-reactions .reaction-wrapper,
.scene-card-reactions .reaction-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    width: 100%;
    position: relative;
}

.video-card-reactions .reaction-list,
.image-card-reactions .reaction-list,
.scene-card-reactions .reaction-list {
    display: flex;
    flex-direction: row;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.video-card-reactions .chat-reaction,
.scene-card-reactions .chat-reaction {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    min-height: 28px;
    font-size: 13px;
}

.video-card-reactions .chat-reaction-emoji,
.scene-card-reactions .chat-reaction-emoji {
    font-size: 16px;
    line-height: 1;
}

.video-card-reactions .chat-reaction-count,
.scene-card-reactions .chat-reaction-count {
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.video-card-reactions .reaction-add-btn,
.scene-card-reactions .reaction-add-btn {
    width: 28px;
    height: 28px;
    font-size: 16px;
    margin-left: 4px;
}

.video-card-reactions .reaction-add-btn.disabled,
.scene-card-reactions .reaction-add-btn.disabled,
.video-card-reactions .reaction-add-btn:disabled,
.scene-card-reactions .reaction-add-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.video-card-reactions .reactions-disabled,
.scene-card-reactions .reactions-disabled {
    opacity: 0.6;
}

.video-card-reactions .reactions-disabled .chat-reaction,
.scene-card-reactions .reactions-disabled .chat-reaction {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.video-card-reactions .reaction-picker,
.scene-card-reactions .reaction-picker {
    flex-direction: row;
    bottom: 38px;
    left: 0;
    right: auto;
    transform: none;
    position: absolute;
    white-space: nowrap;
}

.video-card-reactions .reaction-tooltip,
.scene-card-reactions .reaction-tooltip {
    bottom: 100%;
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(-8px);
    top: auto;
    margin-bottom: 4px;
    margin-right: 0;
}

.video-card-reactions .reaction-tooltip::after,
.scene-card-reactions .reaction-tooltip::after {
    top: 100%;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    border-top-color: rgba(0, 0, 0, 0.85);
    border-right-color: transparent;
    border-left-color: transparent;
    border-bottom-color: transparent;
}

@media (hover: hover) and (pointer: fine) {
    .video-card-reactions .chat-reaction:hover .reaction-tooltip,
    .video-card-reactions .chat-reaction:focus .reaction-tooltip,
    .scene-card-reactions .chat-reaction:hover .reaction-tooltip,
    .scene-card-reactions .chat-reaction:focus .reaction-tooltip {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);
    }
}

/* ------------------------------------------------------------
   Onboarding tooltip overlays (desktop)
------------------------------------------------------------ */
body.pk-tooltip-open {
    overflow: hidden;
}

/* ------------------------------------------------------------
   Welcome walkthrough (mobile + desktop)
------------------------------------------------------------ */
.pk-walkthrough-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.pk-walkthrough-panel {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(860px, calc(100vw - 24px));
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: end;
    gap: 14px;
    padding: 0 12px;
}

@media (max-width: 640px) {
    .pk-walkthrough-panel {
        top: auto;
        bottom: 18px;
        transform: translateX(-50%);
        grid-template-columns: 1fr;
        justify-items: center;
        width: min(860px, calc(100vw - 18px));
    }
}

.pk-walkthrough-bubble {
    position: relative;
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 16px 16px 14px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.pk-walkthrough-content p {
    margin: 0 0 10px 0;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-primary);
}

.pk-walkthrough-content p:last-child {
    margin-bottom: 0;
}

.pk-walkthrough-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.pk-walkthrough-progress {
    display: flex;
    gap: 6px;
}

.pk-walkthrough-dot {
    width: 8px;
    height: 8px;
    border-radius: 99px;
    background: rgba(127, 127, 127, 0.35);
}

.pk-walkthrough-dot.is-active {
    background: var(--accent-primary);
}

.pk-walkthrough-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pk-walkthrough-btn {
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.pk-walkthrough-btn:hover,
.pk-walkthrough-btn:focus {
    background: var(--bg-tertiary);
}

.pk-walkthrough-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pk-walkthrough-next {
    background: var(--accent-primary);
    color: #fff;
    border-color: rgba(0, 0, 0, 0.0);
}

.pk-walkthrough-next:hover,
.pk-walkthrough-next:focus {
    filter: brightness(0.95);
}

.pk-avatar-picker-heading {
    margin-top: 14px;
    font-weight: 800;
    font-size: 15px;
    color: var(--text-primary);
}

.pk-avatar-picker-sub {
    margin-top: 4px;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.pk-avatar-picker {
    display: grid;
    grid-template-columns: repeat(3, 72px);
    justify-content: center;
    gap: 10px;
    margin-top: 6px;
}

.pk-avatar-choice {
    border: 1px solid var(--border-color);
    background: transparent;
    padding: 0;
    border-radius: 999px;
    cursor: pointer;
    overflow: hidden;
}

.pk-avatar-choice-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--bg-secondary);
    display: grid;
    place-items: center;
    border-radius: 999px;
    overflow: hidden;
}

.pk-avatar-choice img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pk-avatar-choice-fallback {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    font-size: 24px;
    color: var(--text-secondary);
}

.pk-avatar-choice-check {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    display: none;
    place-items: center;
    font-weight: 900;
    font-size: 13px;
}

.pk-avatar-choice.is-selected {
    outline: 3px solid var(--accent-primary);
    outline-offset: 2px;
}

.pk-avatar-choice.is-selected .pk-avatar-choice-check {
    display: grid;
}

@media (max-width: 480px) {
    .pk-avatar-picker {
        grid-template-columns: repeat(3, 60px);
        gap: 8px;
    }
    .pk-avatar-choice-check {
        right: 7px;
        bottom: 7px;
        width: 20px;
        height: 20px;
        font-size: 12px;
    }
}

.pk-tooltip-highlight {
    z-index: 10001 !important;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35) !important;
    outline: 3px solid rgba(255, 255, 255, 0.85);
    outline-offset: 6px;
    border-radius: 14px;
}

[data-theme="dark"] .pk-tooltip-highlight {
    outline: 3px solid rgba(255, 255, 255, 0.65);
}

.pk-tooltip-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: block;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.pk-tooltip-backdrop {
    position: absolute;
    inset: 0;
}

.pk-tooltip-panel {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 14px;
    pointer-events: none;
}

.pk-tooltip-panel > * {
    pointer-events: auto;
}

.pk-tooltip-avatar-wrap {
    width: 76px;
    height: 76px;
    border-radius: 999px;
    background: var(--card-bg);
    border: 3px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
    display: grid;
    place-items: center;
    overflow: hidden;
    flex: 0 0 auto;
}

.pk-tooltip-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pk-tooltip-avatar-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    font-size: 34px;
    background: linear-gradient(180deg, rgba(255,255,255,0.85), rgba(255,255,255,0.55));
    color: #111;
}

[data-theme="dark"] .pk-tooltip-avatar-fallback {
    background: linear-gradient(180deg, rgba(255,255,255,0.20), rgba(255,255,255,0.10));
    color: #fff;
}

.pk-tooltip-bubble {
    position: relative;
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
    max-width: min(640px, 100%);
}

.pk-tooltip-bubble::before {
    content: "";
    position: absolute;
    left: var(--pk-tooltip-arrow-x, 54px);
    top: -10px;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid var(--card-bg);
    filter: drop-shadow(0 -1px 0 var(--border-color));
}

.pk-tooltip-text {
    font-size: 16px;
    line-height: 1.4;
    font-weight: 600;
    padding-right: 26px;
}

.pk-tooltip-close {
    position: absolute;
    top: 8px;
    right: 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.pk-tooltip-close:hover,
.pk-tooltip-close:focus {
    color: var(--text-primary);
}

/* ========================================
   Watch Together
   ======================================== */

.watch-together-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.watch-together-btn:hover {
    background: rgba(0, 0, 0, 0.85);
    border-color: rgba(255, 255, 255, 0.4);
}

.watch-together-panel {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    min-width: 220px;
    max-width: 280px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.watch-together-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.watch-together-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.watch-together-code {
    font-family: monospace;
    font-size: 14px;
    font-weight: 700;
    padding: 3px 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    color: var(--accent-color);
    letter-spacing: 1px;
}

.watch-together-share-btn {
    margin-left: auto;
    padding: 4px 10px;
    font-size: 12px;
    background: var(--accent-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.watch-together-share-btn:hover {
    opacity: 0.85;
}

.watch-together-participants {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
    min-height: 32px;
    align-items: center;
}

.watch-no-participants {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

.watch-participant {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
    transition: transform 0.15s ease;
}

.watch-participant:hover {
    transform: scale(1.1);
}

.watch-participant.is-host {
    border-color: var(--accent-color);
}

.watch-participant.is-me {
    border-color: var(--success-color, #22c55e);
}

.watch-participant-avatar {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.watch-host-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: var(--accent-color);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.watch-participant-more {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.watch-together-controls,
.watch-together-guest-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
}

.watch-control-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
}

.watch-control-toggle input {
    cursor: pointer;
}

.watch-control-indicator {
    font-size: 12px;
    color: var(--text-secondary);
}

.watch-control-indicator.can-control {
    color: var(--success-color, #22c55e);
}

.watch-leave-btn {
    margin-left: auto;
    padding: 4px 10px;
    font-size: 12px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.watch-leave-btn:hover {
    background: var(--danger-color, #ef4444);
    color: #fff;
    border-color: var(--danger-color, #ef4444);
}

.watch-together-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
}

.watch-sync-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color, #22c55e);
}

.watch-sync-indicator.synced {
    background: var(--success-color, #22c55e);
}

.watch-sync-indicator.catching-up {
    background: var(--warning-color, #f59e0b);
    animation: pulse 1s infinite;
}

.watch-sync-indicator.out-of-sync {
    background: var(--danger-color, #ef4444);
}

.watch-sync-indicator.disconnected {
    background: var(--text-secondary);
}

.watch-sync-indicator.buffering {
    background: var(--warning-color, #f59e0b);
    animation: pulse 1s infinite;
}

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

#watch-sync-status {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Watch Together Dialog */
.watch-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.watch-dialog-content {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    max-width: 360px;
    width: 90%;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.watch-dialog-content h3 {
    margin: 0 0 12px;
    font-size: 18px;
    color: var(--text-primary);
}

.watch-dialog-content p {
    margin: 0 0 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.watch-transfer-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.watch-transfer-option {
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.watch-transfer-option:hover {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
}

.watch-dialog-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.watch-dialog-actions .btn-secondary {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
}

.watch-dialog-actions .btn-danger {
    padding: 8px 16px;
    background: var(--danger-color, #ef4444);
    border: none;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
}

/* Watch Together Toast */
.watch-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 14px;
    color: var(--text-primary);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    opacity: 0;
    transition: all 0.3s ease;
}

.watch-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .watch-together-btn {
        top: auto;
        bottom: 70px;
        right: 10px;
        padding: 6px 12px;
        font-size: 12px;
    }

    .watch-together-panel {
        top: auto;
        bottom: 70px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}
