* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

html, body {
    position: fixed;
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: #000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#root {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #1a1a1a;
}

.viewer-container {
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
    background: #1a1a1a;
    outline: none;
}

/* Background image */
.scene-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 300px; /* Anchor to text box height */
    width: 100%;
    height: calc(100vh - 300px); /* Fill space above text box */
    object-fit: cover;
    transition: opacity 0.3s ease;
}

/* Character display */
.character-container {
    position: absolute;
    bottom: 300px; /* Anchor to text box height */
    left: 0;
    right: 0;
    height: calc(100vh - 300px); /* Fill remaining space above text box */
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

.character {
    max-height: 80%;
    width: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

/* Full screen character display */
.character-container.character-full {
    top: 0;
    left: 0;
    right: 0;
    bottom: 300px; /* Keep text box space */
    width: 100%;
    height: calc(100vh - 300px);
    display: block; /* Remove flex positioning */
    z-index: 1; /* Ensure character appears above background */
}

.character.character-full-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover; /* Fill the entire viewport like a background */
}

/* Video container */
.video-container {
    position: absolute;
    bottom: 300px; /* Anchor to text box height */
    left: 0;
    right: 0;
    height: calc(100vh - 300px); /* Fill remaining space above text box */
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

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

/* Video loading state */
.video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    color: white;
    text-align: center;
}

/* Video error state */
.video-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    color: white;
    text-align: center;
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    border-radius: 8px;
    padding: 1rem;
    max-width: 300px;
}

.error-message {
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #ff6b6b;
}

.error-details {
    font-size: 0.9rem;
    color: #ccc;
}

/* Fallback character when video fails */
.fallback-character {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
}

/* Video/Audio mute button */
.video-mute-button {
    position: absolute;
    top: 4rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10;
}

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

.video-mute-button:active {
    transform: scale(0.95);
}

.video-mute-button .material-icons-outlined {
    font-size: 1.5rem;
}

/* Text box */
.text-box {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 300px;
    min-height: 300px;
    max-height: 300px;
    background: rgba(0, 0, 0, 0.9);
    padding: 1rem;
    /* Multiple fallbacks for different browsers */
    padding-bottom: constant(safe-area-inset-bottom, 1rem); /* iOS 11.0 */
    padding-bottom: env(safe-area-inset-bottom, 1rem); /* iOS 11.2+ */
    padding-bottom: calc(1rem + constant(safe-area-inset-bottom, 0px)); /* iOS 11.0 */
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); /* iOS 11.2+ */
    color: white;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

.character-name {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #4a90e2;
}

.text-content {
    font-size: var(--text-font-size, 1rem);
    line-height: 1.5;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Navigation buttons */
.nav-buttons {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
}

/* When there are 3 buttons, center the chapters button */
.nav-buttons.three-buttons {
    justify-content: space-between;
}

.nav-buttons.three-buttons .chapters-button {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav-button {
    background: rgba(74, 144, 226, 0.8);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    font-size: 0.9rem;
    cursor: pointer;
    touch-action: manipulation;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-button:active {
    background: rgba(53, 122, 189, 0.8);
}

.nav-button.profile-button {
    background: rgba(156, 39, 176, 0.8);
}

.nav-button.profile-button:active {
    background: rgba(123, 31, 162, 0.8);
}

/* Chapters Modal */
.chapters-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.chapters-modal {
    background: #1a1a1a;
    border-radius: 0.5rem;
    max-width: 400px;
    width: 90%;
    max-height: 70vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chapters-header {
    padding: 1rem;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chapters-header h3 {
    color: white;
    margin: 0;
    font-size: 1.2rem;
}

.close-chapters {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}

.close-chapters:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chapters-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.chapter-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #2a2a2a;
}

.chapter-item:hover {
    background: rgba(74, 144, 226, 0.1);
}

.chapter-item.current {
    background: rgba(74, 144, 226, 0.2);
}

.chapter-number {
    background: rgba(74, 144, 226, 0.8);
    color: white;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: bold;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.chapter-info {
    flex: 1;
}

.chapter-title {
    color: white;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.current-indicator {
    color: #4a90e2;
    font-size: 0.8rem;
    font-weight: 500;
}

/* End Story Navigation Modal */
.end-story-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2500;
}

.end-story-modal {
    background: #1a1a1a;
    border-radius: 0.75rem;
    max-width: 450px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid #333;
}

.end-story-header {
    padding: 1.5rem;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
}

.end-story-header h3 {
    color: white;
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.close-end-story {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}

.close-end-story:hover {
    background: rgba(255, 255, 255, 0.2);
}

.end-story-content {
    padding: 1.5rem;
    flex: 1;
}

.end-story-content p {
    color: #ccc;
    margin: 0 0 1.5rem 0;
    font-size: 1rem;
    text-align: center;
}

.end-story-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.end-story-option {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    gap: 1rem;
    font-family: inherit;
}

.end-story-option.primary {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
}

.end-story-option.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.end-story-option.secondary {
    background: #2a2a2a;
    color: white;
    border: 1px solid #444;
}

.end-story-option.secondary:hover {
    background: #333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.end-story-option .material-icons-outlined {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.option-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.option-subtitle {
    font-size: 0.85rem;
    opacity: 0.8;
}

@media (max-width: 480px) {
    .end-story-modal {
        max-width: 95%;
        margin: 1rem;
    }
    
    .end-story-header,
    .end-story-content {
        padding: 1rem;
    }
    
    .end-story-option {
        padding: 0.75rem;
    }
    
    .option-title {
        font-size: 0.9rem;
    }
    
    .option-subtitle {
        font-size: 0.8rem;
    }
}

/* Character Selection Modal */
.character-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    padding: 1rem;
}

.character-modal {
    background: #1a1a1a;
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.character-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.character-modal-header h3 {
    color: white;
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
}

.close-character-modal {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-character-modal:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

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

.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

.character-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 120px;
}

.character-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.character-card:active {
    transform: translateY(0);
}

.character-card-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.character-card-name {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.2;
}

@media (max-width: 600px) {
    .character-modal {
        margin: 1rem;
        max-height: 70vh;
    }
    
    .character-modal-header {
        padding: 1rem;
    }
    
    .character-modal-header h3 {
        font-size: 1.1rem;
    }
    
    .character-modal-content {
        padding: 1rem;
    }
    
    .character-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.75rem;
    }
    
    .character-card {
        padding: 0.75rem;
        min-height: 100px;
    }
    
    .character-card-avatar {
        width: 50px;
        height: 50px;
    }
    
    .character-card-name {
        font-size: 0.8rem;
    }
}

/* Chat Window Styles */
.chat-window-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 4000;
    padding: 1rem;
}

.chat-window {
    width: 100%;
    max-width: 800px;
    height: 95vh;
    background: #000;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-character-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-character-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.chat-character-name {
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
}

.close-chat {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-chat:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.chat-character-display {
    flex: 0.4;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    background: #000;
}

.chat-character-image {
    max-height: 80%;
    max-width: 60%;
    object-fit: contain;
    border-radius: 12px;
}

.chat-messages {
    flex: 1.6;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.02);
    min-height: 300px;
    max-height: 50vh;
}

.chat-message {
    display: flex;
    flex-direction: column;
    max-width: 70%;
}

.chat-message.user {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-message.character {
    align-self: flex-start;
    align-items: flex-start;
}

.message-content {
    padding: 0.75rem 1rem;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-message.user .message-content {
    background: #4a90e2;
    color: white;
}

.chat-message.character .message-content {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.message-time {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.25rem;
    padding: 0 0.5rem;
}

.chat-message.typing .message-content {
    padding: 1rem;
}

.typing-indicator {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: typing 1.5s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-10px);
    }
}

.chat-input-container {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    -webkit-user-select: text;
    user-select: text;
}

.character-count {
    text-align: right;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

.chat-error {
    background: rgba(255, 0, 0, 0.1);
    color: #ff6b6b;
    padding: 0.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    border: 1px solid rgba(255, 0, 0, 0.2);
}

.chat-input-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    -webkit-user-select: text;
    user-select: text;
}

.chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 16px;
    outline: none;
    transition: all 0.2s ease;
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
    touch-action: manipulation;
    -webkit-appearance: none;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.chat-input:focus {
    border-color: #4a90e2;
    background: rgba(255, 255, 255, 0.1);
}

.chat-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.send-button {
    background: #4a90e2;
    border: none;
    color: white;
    padding: 0.75rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
}

.send-button:hover:not(:disabled) {
    background: #357abd;
    transform: scale(1.05);
}

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

/* Mobile responsive */
@media (max-width: 768px) {
    .chat-window {
        height: 100vh;
        border-radius: 0;
        max-width: 100%;
    }
    
    .chat-window-overlay {
        padding: 0;
    }
    
    .chat-character-display {
        padding: 0.5rem;
        flex: 0.3;
    }
    
    .chat-character-image {
        max-height: 70%;
        max-width: 50%;
    }
    
    .chat-messages {
        max-height: 40vh;
        min-height: 250px;
        flex: 1.7;
        padding: 0.75rem;
    }
    
    .chat-message {
        max-width: 85%;
        margin-bottom: 0.5rem;
    }
    
    .message-content {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        line-height: 1.3;
        word-break: break-word;
        overflow-wrap: break-word;
    }
    
    .chat-input-container {
        padding: 0.75rem;
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    }
}

/* Navigation Indicators */
.nav-indicator {
    position: absolute;
    bottom: 320px; /* Move down more (was 340px) */
    color: rgba(255, 255, 255, 0.5); /* Semi-transparent white */
    font-size: 2rem; /* Adjust size as needed */
    z-index: 1550; /* Below engagement buttons but above content */
    pointer-events: none; /* Don't interfere with clicks */
    opacity: 0; /* Hidden by default */
    transition: opacity 0.3s ease;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.nav-indicator.left {
    left: 1rem;
}

.nav-indicator.right {
    right: 1rem; /* Move further to the right (was 4.5rem) */
}

.nav-indicator.visible {
    opacity: 0.9; /* Increase opacity (was 0.6) */
}

/* Mobile adjustments for indicators */
@media (max-width: 601px) {
    .nav-indicator {
        font-size: 1.8rem;
        bottom: calc(25vh + 60px); /* Move arrows higher on mobile */
    }
    .nav-indicator.left {
        left: 0.5rem;
    }
    .nav-indicator.right {
        /* Keep consistent positioning like wide screens */
        right: 1rem; 
    }
    
    /* Navigation indicators are hidden when comments are open on mobile */

    /* Mobile video mute button */
    .video-mute-button {
        width: 3rem;
        height: 3rem;
        top: 4.5rem;
        right: 0.5rem;
    }

    .video-mute-button .material-icons-outlined {
        font-size: 1.4rem;
    }
}

/* Keep right indicator visible on all screen sizes */
@media (max-width: 350px) {
    .nav-indicator.right {
        right: 1rem; /* Keep consistent positioning even on very narrow screens */
    }
}

/* Hide navigation arrows when comments are open */
body.comments-open .nav-indicator {
    display: none; /* Hide navigation arrows when comments are open */
}

/* Desktop-only shrunk navigation indicator behavior */
@media (min-width: 602px) {
    .story-content.shrunk .nav-indicator {
        display: none; /* Hide navigation arrows when comments are open on desktop */
    }
}



/* Loading state */
.loading {
    color: white;
    text-align: center;
    padding: 2rem;
    font-size: 1.2rem;
}

/* Click areas for navigation */
.click-area {
    position: absolute;
    top: 0;
    bottom: 25vh;
    width: 50%;
    z-index: 10;
    cursor: pointer;
}

.click-area.left {
    left: 0;
}

.click-area.right {
    right: 0;
}

/* Navigation indicators - arrows positioned just above text box */
.click-area::before {
    content: '';
    position: absolute;
    bottom: 45px; /* Just above the text box */
    font-family: 'Material Icons Outlined';
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 11;
}

.click-area.left::before {
    content: 'arrow_back_ios';
    left: 1rem;
}

.click-area.right::before {
    content: 'arrow_forward_ios';
    right: 1rem;
}

/* Mobile responsive */
@media (max-width: 601px) {
    /* Ensure background stays anchored to text box on mobile */
    .scene-background {
        object-fit: cover;
        object-position: center bottom;
        /* Force the image to maintain its connection to the text box */
        bottom: 25vh; /* Reduced from 300px to 25vh */
        height: calc(100vh - 25vh); /* Adjusted height */
        min-height: calc(100vh - 25vh);
    }
    
    .character-container {
        bottom: 25vh; /* Reduced from 300px to 25vh */
        height: calc(100vh - 25vh); /* Adjusted height */
    }

    .character {
        max-height: 50%; /* Scale down character on mobile (was 90% on desktop) */
    }

    /* Full screen character mobile styles */
    .character-container.character-full {
        top: 0;
        left: 0;
        right: 0;
        bottom: 25vh; /* Adjust for mobile text box */
        width: 100%;
        height: calc(100vh - 25vh);
        display: block;
    }

    .character.character-full-screen {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
    }

    .video-container {
        bottom: 25vh; /* Reduced from 300px to 25vh */
        height: calc(100vh - 25vh); /* Adjusted height */
    }
    
    .text-box {
        padding: 0.8rem;
        /* Multiple safe area approaches for mobile browsers */
        padding-bottom: 30px; /* Base fallback for older browsers */
        padding-bottom: constant(safe-area-inset-bottom, 30px); /* iOS 11.0 */
        padding-bottom: env(safe-area-inset-bottom, 30px); /* iOS 11.2+ */
        padding-bottom: calc(0.8rem + constant(safe-area-inset-bottom, 20px)); /* iOS 11.0 */
        padding-bottom: calc(0.8rem + env(safe-area-inset-bottom, 20px)); /* iOS 11.2+ */
        height: 25vh; /* Reduced from 300px to 25vh */
        min-height: 25vh;
        max-height: 25vh;
        /* Ensure content is above browser UI */
        margin-bottom: 10px; /* Additional spacing for browser controls */
    }
    
    .character-name {
        font-size: 1rem;
        margin-bottom: 0.4rem;
    }
    
    /* Mobile navigation indicators */
    .click-area::before {
        font-size: 1.5rem;
        bottom: 30px;
    }
    
    .click-area.left::before {
        left: 0.5rem;
    }
    
    .click-area.right::before {
        right: 1rem;
    }
    
    .text-content {
        font-size: var(--text-font-size, 0.9rem);
        line-height: 1.4;
    }
    
    .nav-button {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    

}

/* Progress bar */
.progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    z-index: 2000;
}

.progress-fill {
    height: 100%;
    background: #4a90e2;
    transition: width 0.3s ease;
    position: relative;
}

/* Mobile progress bar adjustments */
@media (max-width: 601px) {
    .progress-bar {
        height: 5px;
        /* Use better safe area handling for mobile browsers */
        bottom: constant(safe-area-inset-bottom, 10px); /* iOS 11.0 */
        bottom: env(safe-area-inset-bottom, 10px); /* iOS 11.2+ */
        bottom: calc(10px + constant(safe-area-inset-bottom, 0px)); /* iOS 11.0 */
        bottom: calc(10px + env(safe-area-inset-bottom, 0px)); /* iOS 11.2+ */
        bottom: var(--safe-bottom-space, 10px); /* JavaScript-calculated fallback */
    }
}

/* Desktop centering */
@media (min-width: 602px) {
    .viewer-container {
        width: 600px;
        max-width: 100%;
        margin: 0 auto;
    }
}

/* Font Size Menu */
.font-size-menu {
    position: absolute;
    bottom: 270px; /* Position in top right of text box (300px - 30px padding) */
    right: 1rem;
    z-index: 1000;
}

.font-size-trigger {
    background: rgba(74, 144, 226, 0.8);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    transition: background-color 0.2s;
    font-size: 16px;
}

.font-size-trigger:active {
    background: rgba(53, 122, 189, 0.8);
}

.font-size-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid rgba(74, 144, 226, 0.3);
    border-radius: 0.5rem;
    min-width: 280px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    z-index: 1001;
}

.font-size-header {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: bold;
    color: #4a90e2;
    border-bottom: 1px solid rgba(74, 144, 226, 0.2);
    text-align: center;
}

.font-size-options-container {
    display: flex;
    flex-direction: row;
    padding: 0.5rem;
    gap: 0.5rem;
}

.font-size-option {
    flex: 1;
    padding: 0.75rem 0.5rem;
    background: transparent;
    color: white;
    border: 1px solid rgba(74, 144, 226, 0.2);
    border-radius: 0.4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.2s;
    font-size: 0.8rem;
    min-width: 0;
}

.font-size-option:hover {
    background: rgba(74, 144, 226, 0.2);
    border-color: rgba(74, 144, 226, 0.5);
    transform: translateY(-1px);
}

.font-size-option.active {
    background: rgba(74, 144, 226, 0.3);
    border-color: #4a90e2;
    color: #4a90e2;
}

.font-size-example {
    text-align: center;
    font-weight: bold;
    margin-bottom: 0.2rem;
}

.font-size-example.small {
    font-size: 1.2rem;
}

.font-size-example.medium {
    font-size: 1.5rem;
}

.font-size-example.large {
    font-size: 1.8rem;
}

.font-size-label {
    font-size: 0.7rem;
    text-align: center;
    opacity: 0.8;
}

.font-size-check {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 12px;
    color: #4a90e2;
}

/* Additional mobile browser fixes */
@media (max-width: 601px) {
    /* Force minimum padding for problematic browsers */
    .text-box {
        /* Webkit-specific fixes for Chrome/Safari mobile */
        -webkit-appearance: none;
        min-height: calc(25vh + 20px) !important;
    }
    
    /* Chrome mobile specific fixes */
    @supports (-webkit-appearance: none) and (not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px)))) {
        .text-box {
            padding-bottom: calc(0.8rem + 40px) !important;
            margin-bottom: 15px !important;
        }
        
        .progress-bar {
            bottom: 25px !important;
        }
    }
    
    /* Safari iOS specific fixes */
    @supports (-webkit-overflow-scrolling: touch) {
        .text-box {
            padding-bottom: calc(0.8rem + 35px) !important;
            -webkit-transform: translateZ(0); /* Force hardware acceleration */
        }
        
        .progress-bar {
            bottom: 20px !important;
            -webkit-transform: translateZ(0);
        }
    }
    

    

}

/* Browser-specific mobile fixes using JavaScript-added classes */
@media (max-width: 601px) {
    /* Chrome mobile aggressive fixes */
    body.mobile-chrome .text-box {
        padding-bottom: calc(0.8rem + 45px) !important;
        margin-bottom: 20px !important;
    }
    
    body.mobile-chrome .progress-bar {
        bottom: 30px !important;
    }
    
    /* Safari mobile aggressive fixes */
    body.mobile-safari .text-box {
        padding-bottom: calc(0.8rem + 40px) !important;
        margin-bottom: 15px !important;
        transform: translateZ(0); /* Force GPU acceleration */
    }
    
    body.mobile-safari .progress-bar {
        bottom: 25px !important;
        transform: translateZ(0);
    }
}

/* Mobile adjustments for font size menu */
@media (max-width: 601px) {
    .font-size-menu {
        top: 70%; /* Keep consistent with desktop - position relative to text box */
        transform: none; /* Prevent any transforms that could cause shifting */
    }
    
    .font-size-trigger {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .font-size-dropdown {
        right: -0.5rem;
        min-width: 250px;
    }
    
    .font-size-options-container {
        padding: 0.4rem;
        gap: 0.4rem;
    }
    
    .font-size-option {
        padding: 0.6rem 0.4rem;
        font-size: 0.7rem;
    }
    
    .font-size-header {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .font-size-example.small {
        font-size: 1rem;
    }
    
    .font-size-example.medium {
        font-size: 1.3rem;
    }
    
    .font-size-example.large {
        font-size: 1.6rem;
    }
    
    .font-size-label {
        font-size: 0.65rem;
    }
}

/* Social Features Styles */

/* Engagement Buttons */
.engagement-buttons {
    position: absolute;
    right: 0.7rem;
    bottom: 40%;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    z-index: 1000;
    padding: 0.4rem;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 2rem;
}

.engagement-button {
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.4rem;
    transition: all 0.2s ease;
    position: relative;
}

.engagement-button::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    width: 24px;
    height: 24px;
    opacity: 0;
    pointer-events: none;
}

.engagement-button.liked::after {
    content: 'favorite';
    font-family: 'Material Icons Outlined';
    animation: ghostFloat 0.6s ease-out forwards;
}

.engagement-button.commented::after {
    content: 'chat_bubble';
    font-family: 'Material Icons Outlined';
    animation: ghostFloat 0.6s ease-out forwards;
}

.engagement-button.shared::after {
    content: 'share';
    font-family: 'Material Icons Outlined';
    animation: ghostFloat 0.6s ease-out forwards;
}

.engagement-button.saved::after {
    content: 'bookmark';
    font-family: 'Material Icons Outlined';
    animation: ghostFloat 0.6s ease-out forwards;
}

.engagement-button .material-icons-outlined {
    font-size: 1.5rem;
    text-shadow: 0 2px 8px rgba(255, 255, 255, 0.2);
    position: relative;
    transition: all 0.2s;
    opacity: 0.85;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.engagement-button:hover .material-icons-outlined {
    opacity: 1;
    transform: scale(1.1);
}

.engagement-button:active {
    transform: scale(0.9);
}

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

.engagement-buttons {
    animation: slideIn 0.5s ease-out;
}

.engagement-button:nth-child(1) { animation: slideIn 0.5s ease-out 0.1s both; }
.engagement-button:nth-child(2) { animation: slideIn 0.5s ease-out 0.2s both; }
.engagement-button:nth-child(3) { animation: slideIn 0.5s ease-out 0.3s both; }
.engagement-button:nth-child(4) { animation: slideIn 0.5s ease-out 0.4s both; }

@keyframes ghostFloat {
    0% {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
}

.engagement-button .count {
    font-size: 0.7rem;
    font-weight: 400;
    color: #ffffff;
    opacity: 0.8;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, opacity 0.2s;
}

.engagement-button.liked .count,
.engagement-button.commented .count {
    opacity: 1;
    transform: scale(1.1);
}

@keyframes countPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.count-changed {
    animation: countPop 0.3s ease-out;
}

/* Toast Messages */
.toast-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    z-index: 2000;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    animation: toastIn 0.3s ease-out;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Comments Panel */
.container-with-comments {
    display: flex;
    width: 100%;
    height: 100%;
    transition: all 0.3s ease-out;
}

.story-content {
    flex: 1;
    position: relative;
    transition: all 0.3s ease-out;
}

/* Desktop-only shrunk behavior - not needed on mobile since comments open from bottom */
@media (min-width: 602px) {
    .story-content.shrunk {
        flex: 0 0 50%;
        overflow: hidden;
    }

    .story-content.shrunk .video-mute-button {
        right: 0.5rem;
    }
}

.comments-panel {
    position: absolute;
    right: -50%;
    top: 0;
    width: 50%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

.comments-panel.open {
    right: 0;
}

.comments-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.comments-header h3 {
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
}

.close-comments {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
}

.comments-list {
    flex: 1 1 auto;
    padding: 0.8rem 0.8rem 5rem 0.8rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

/* Comment Styles */
.comment {
    padding: 0.7rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.comment-main {
    padding: 0.7rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: background-color 0.2s;
}

.comment-main.has-replies:hover {
    background: rgba(255, 255, 255, 0.08);
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
}

.comment-avatar {
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    background: #4a90e2;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
}

.comment-user {
    color: white;
    font-weight: 500;
    font-size: 0.8rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.comment-user:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.comment-time {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.7rem;
    margin-left: auto;
}

.comment-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.8rem;
    line-height: 1.3;
    word-wrap: break-word;
}

.comment-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    z-index: 1;
}

.comment-action {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 0.15rem;
    cursor: pointer;
    padding: 0.15rem;
    transition: all 0.2s;
}

.comment-action:hover {
    color: rgba(255, 255, 255, 0.9);
}

.comment-action .material-icons-outlined {
    font-size: 0.8rem;
}

.comment-action.active {
    transform: rotate(180deg);
}

.comment-action.liked {
    color: #4a90e2;
}

.comment-action.liked .material-icons-outlined {
    color: #4a90e2;
}

.comment-action.liked .count {
    color: #4a90e2;
    font-weight: 500;
}

.comment-action:active {
    transform: scale(0.95);
}

/* Reply Styles */
.comment-replies {
    margin-top: 0.8rem;
    display: none;
}

.comment-replies.show {
    display: block;
}

.nested-reply {
    margin-left: 2.5rem;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
    padding-left: 1rem;
    position: relative;
}

.nested-reply::before {
    content: '';
    position: absolute;
    left: -2rem;
    top: 1.2rem;
    width: 1.5rem;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.nested-reply .comment-avatar {
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.7rem;
}

.nested-reply .comment-text {
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

/* Comment Input */
.new-comment-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.4rem;
    background: rgba(0, 0, 0, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 0rem;
    align-items: flex-start;
    max-width: 100%;
    z-index: 2;
}

.comment-input-container {
    position: relative;
    flex: 1;
}

.comment-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 1rem;
    padding: 0.6rem 1rem;
    height: 2.4rem;
    width: calc(100% - 2.5rem);
    color: white;
    font-size: 0.65rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    outline: none;
    resize: none;
    line-height: 1.2;
    word-wrap: break-word;
}

.send-comment {
    background: none;
    border: none;
    color: #4a90e2;
    cursor: pointer;
    padding: 0.2rem;
    flex-shrink: 0;
    width: 2rem;
    height: 4rem;
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    right: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
}

.send-comment .material-icons-outlined {
    font-size: 0.9rem;
    transform: translateY(-0.1rem);
}

/* Reply Input */
.reply-input-container {
    margin-top: 0.8rem;
    display: flex;
    gap: 0.25rem;
    align-items: center;
    padding: 0 0.8rem;
    position: relative;
}

.reply-input {
    flex: 1;
    min-height: 2rem !important;
    height: 2rem !important;
    font-size: 0.65rem !important;
    padding: 0.4rem 0.8rem !important;
    margin-right: 2.8rem;
    width: calc(100% - 4rem);
}

.reply-input-container .send-comment {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    height: 2rem;
    width: 2rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.reply-input-container .send-comment .material-icons-outlined {
    font-size: 1rem;
}

/* Mention Dropdown */
.mention-dropdown {
    position: absolute;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    width: 200px;
    z-index: 1000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.mention-item {
    padding: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
    transition: background-color 0.2s;
    color: rgba(255, 255, 255, 0.9);
}

.mention-item.error,
.mention-item:empty {
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    justify-content: center;
}

.mention-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mention-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #4a90e2;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
}

.mention-info {
    flex: 1;
}

.mention-username {
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
}

.mention-fullname {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.7rem;
}

.mentioned-user {
    color: #4a90e2;
    font-weight: 500;
    cursor: pointer;
    display: inline;
}

.mentioned-user:hover {
    text-decoration: underline;
}

/* Engagement Button States */
.engagement-button.saved .material-icons-outlined {
    color: white !important;
    font-variation-settings: 'FILL' 1;
}

@keyframes saveAnimation {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.engagement-button.saved {
    animation: saveAnimation 0.3s ease-out;
}

.engagement-button.liked .material-icons-outlined {
    color: #ff4b4b;
}

.engagement-button.liked::after {
    content: 'favorite';
    font-family: 'Material Icons Outlined';
    animation: ghostFloat 0.6s ease-out forwards;
    color: #ff4b4b;
}

.engagement-button.commented .material-icons-outlined {
    color: #ffffff;
}

.engagement-button:not(.commented) .material-icons-outlined {
    color: rgba(255, 255, 255, 0.85);
}

.engagement-button.commented .count {
    color: #ffffff;
    opacity: 1;
    font-weight: 500;
}

/* Scrollbar Styling */
.comments-list {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

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

.comments-list::-webkit-scrollbar-track {
    background: transparent;
}

.comments-list::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.comments-list::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

/* Mobile Responsive Adjustments */
@media (max-width: 601px) {
    .engagement-buttons {
        right: 0.5rem;
        bottom: auto;
        top: 40%;
        transform: translateY(-50%);
        gap: 1rem;
        padding: 0.4rem 0.5rem;
        z-index: 1600;
        opacity: 1;
        visibility: visible;
        transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
    }

    .engagement-button {
        transform: scale(0.9);
        padding: 0.35rem;
    }

    .engagement-button .material-icons-outlined {
        font-size: 1.3rem;
    }

    .engagement-button .count {
        font-size: 0.65rem;
    }

    .comments-panel {
        position: fixed;
        top: auto;
        bottom: -50%;
        left: 0;
        right: 0;
        width: 100%;
        height: 50%;
        transform: translateY(0);
        transition: transform 0.3s ease-out;
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
        border-left: none;
        z-index: 1001;
    }

    .comments-panel.open {
        transform: translateY(-100%);
        right: 0;
    }

    .comments-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 2px;
    }

    .comments-list {
        height: calc(100% - 120px);
        overflow-y: auto;
    }

    .new-comment-overlay {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(0, 0, 0, 0.95);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding: 8px;
    }

    body.comments-open {
        overflow: hidden;
    }

    /* Hide engagement buttons when comments panel is open on mobile */
    body.comments-open .engagement-buttons {
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
    }

    @media (max-height: 600px) {
        .engagement-buttons {
            top: 45%;
            gap: 0.8rem;
        }
        
        .engagement-button {
            transform: scale(0.85);
        }
    }

    @media (max-width: 400px) {
        .engagement-buttons {
            gap: 0.5rem;
            padding: 0.3rem;
            right: 0.3rem;
        }
        
        .engagement-button {
            transform: scale(0.8);
            padding: 0.25rem;
        }
        
        .engagement-button .material-icons-outlined {
            font-size: 1.25rem;
        }
        
        .engagement-button .count {
            font-size: 0.6rem;
        }
    }

    @media (max-width: 350px) {
        .engagement-buttons {
            gap: 0.4rem;
            padding: 0.25rem;
        }
        
        .engagement-button {
            transform: scale(0.7);
            padding: 0.2rem;
        }
        
        .engagement-button .material-icons-outlined {
            font-size: 1.1rem;
        }
        
        .engagement-button .count {
            font-size: 0.55rem;
        }
    }
} 