/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-pure-black: #000000;
    --bg-dark: #050505;
    --bg-card: #0a0a0a;
    --bg-elevated: #111111;
    --bg-bubble-them: #1a1a1a;
    --bg-bubble-me: #7c3aed;
    --text-primary: #ffffff;
    --text-secondary: #5a5a5a;
    --text-muted: #3a3a3a;
    --accent: #8b5cf6;
    --accent-glow: rgba(139, 92, 246, 0.4);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.1);
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-pure-black);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    width: 100%;
    height: 100%;
    max-width: 430px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
}

/* Landscape Warning */
@media (orientation: landscape) and (max-height: 500px) {
    body::before {
        content: '📱 Rotate to portrait';
        position: fixed;
        inset: 0;
        background: #000;
        color: #fff;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 16px;
        font-weight: 500;
        letter-spacing: 1px;
        z-index: 9999;
    }
    #app { display: none; }
}

/* Phone Frame */
.phone-frame {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    background: var(--bg-pure-black);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Desktop - Premium Phone Look */
@media (min-width: 500px) {
    body {
        background: #000;
        padding: 20px;
    }

    #app {
        height: 95vh;
        max-height: 900px;
    }

    .phone-frame {
        border-radius: 54px;
        border: 8px solid #1a1a1a;
        box-shadow:
            0 0 0 1px rgba(255,255,255,0.05),
            0 25px 50px -12px rgba(0, 0, 0, 0.9),
            0 0 100px rgba(139, 92, 246, 0.08);
        position: relative;
    }

    /* Dynamic Island */
    .phone-frame::before {
        content: '';
        position: absolute;
        top: 14px;
        left: 50%;
        transform: translateX(-50%);
        width: 126px;
        height: 34px;
        background: #000;
        border-radius: 20px;
        z-index: 100;
    }

    /* Camera */
    .phone-frame::after {
        content: '';
        position: absolute;
        top: 22px;
        left: 50%;
        transform: translateX(-50%) translateX(42px);
        width: 10px;
        height: 10px;
        background: #1a1a1a;
        border-radius: 50%;
        z-index: 101;
        box-shadow: inset 0 0 2px rgba(139, 92, 246, 0.3);
    }
}

/* Status Bar */
.status-bar {
    height: 50px;
    padding: 0 28px;
    padding-top: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    flex-shrink: 0;
    position: relative;
    z-index: 50;
}

@media (min-width: 500px) {
    .status-bar {
        padding-top: 38px;
        height: 74px;
    }
}

.time {
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.3px;
}

.status-icons {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-icon {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    opacity: 0.9;
}

/* App Container */
.app-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: var(--bg-dark);
}

/* Screens */
.screen {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    background: var(--bg-dark);
}

.screen.active {
    display: flex;
    animation: screenIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ===== NAME INPUT SCREEN - ULTRA PREMIUM ===== */
.name-input-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px 32px;
    text-align: center;
    background: var(--bg-pure-black);
    position: relative;
    overflow: hidden;
}

/* Subtle gradient glow behind logo */
.name-input-container::before {
    content: '';
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.logo-container {
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.logo-image {
    max-width: 200px;
    height: auto;
    margin: 0 auto 20px;
    display: block;
    filter: drop-shadow(0 8px 32px rgba(139, 92, 246, 0.35));
}

.logo-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 28px;
    background: var(--accent);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 8px 32px rgba(139, 92, 246, 0.35),
        0 0 0 1px rgba(255,255,255,0.1) inset;
}

.logo-lucide {
    width: 36px;
    height: 36px;
    color: white;
}

.logo-text {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: 6px;
    color: #fff;
    text-transform: uppercase;
}

.logo-text span {
    color: var(--accent);
    font-weight: 300;
    margin: 0 2px;
}

.tagline {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 56px;
    font-weight: 400;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Name Form - Sleek */
.name-form {
    width: 100%;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    z-index: 1;
}

#player-name-input {
    width: 100%;
    padding: 18px 24px;
    font-size: 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    color: #fff;
    text-align: center;
    outline: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-weight: 500;
    letter-spacing: 0.5px;
}

#player-name-input::placeholder {
    color: var(--text-secondary);
    font-weight: 400;
}

#player-name-input:focus {
    border-color: var(--accent);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.name-submit-btn {
    padding: 18px 32px;
    font-size: 15px;
    font-weight: 600;
    background: var(--accent);
    border: none;
    border-radius: 14px;
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

.name-submit-btn .btn-icon {
    width: 18px;
    height: 18px;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.name-submit-btn:hover {
    background: #6d28d9;
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.4);
}

.name-submit-btn:hover .btn-icon {
    transform: translateX(4px);
}

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

.disclaimer {
    margin-top: 72px;
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    position: relative;
    z-index: 1;
}

/* ===== HOME SCREEN ===== */
.app-header {
    padding: 8px 24px 24px;
    background: transparent;
}

.app-header h1 {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #fff;
}

/* Contact List - Premium Cards */
.contact-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 24px;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 16px;
    margin-bottom: 8px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
}

.contact-item:hover {
    background: var(--bg-elevated);
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.contact-item:active {
    transform: translateY(0) scale(0.98);
}

.contact-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 14px;
    background: var(--bg-elevated);
    border: 2px solid var(--border-light);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.contact-info {
    flex: 1;
    min-width: 0;
}

.contact-name {
    font-weight: 600;
    font-size: 17px;
    margin-bottom: 4px;
    letter-spacing: -0.2px;
}

.contact-preview {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-meta {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.contact-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.contact-unread {
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    padding: 0 8px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
}

/* ===== LOCKED CHARACTER STYLES ===== */
.contact-item.locked {
    cursor: pointer;
    opacity: 0.85;
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(255, 140, 0, 0.03) 100%);
    border-color: rgba(255, 140, 0, 0.15);
}

.contact-item.locked:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.15);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(255, 140, 0, 0.08) 100%);
    border-color: rgba(255, 140, 0, 0.3);
}

.contact-item.locked:active {
    transform: scale(0.98);
}

.contact-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
    margin-right: 14px;
}

.contact-avatar-wrapper .contact-avatar {
    margin-right: 0;
}

.avatar-lock-icon {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
    border: 2px solid var(--bg-card);
}

.coming-soon-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    margin-left: 8px;
    vertical-align: middle;
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.3);
}

.contact-preview.locked-preview {
    color: var(--text-muted);
    font-style: italic;
    font-size: 13px;
}

.locked-label {
    color: rgba(255, 140, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== CHAT SCREEN ===== */
.chat-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: rgba(5, 5, 5, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.back-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 26px;
    cursor: pointer;
    padding: 8px 14px 8px 0;
    transition: all 0.2s;
    font-weight: 300;
}

.back-btn:hover {
    opacity: 0.7;
}

.back-btn:active {
    transform: scale(0.9);
}

.chat-contact-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
    background: var(--bg-elevated);
    border: 2px solid var(--border-light);
}

.chat-contact-details {
    display: flex;
    flex-direction: column;
}

.chat-name {
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.2px;
}

.chat-status {
    font-size: 12px;
    color: #2dd36f;
    font-weight: 500;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-pure-black);
}

.message {
    max-width: 78%;
    padding: 12px 16px;
    border-radius: 20px;
    font-size: 15px;
    line-height: 1.4;
    animation: msgIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    word-wrap: break-word;
}

@keyframes msgIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message.them {
    background: var(--bg-bubble-them);
    align-self: flex-start;
    border-bottom-left-radius: 6px;
}

.message.me {
    background: var(--bg-bubble-me);
    align-self: flex-end;
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 12px rgba(196, 30, 30, 0.25);
}

/* Image Messages */
.message.image-message {
    padding: 4px;
    background: transparent;
    box-shadow: none;
}

.message-image {
    max-width: 240px;
    max-height: 320px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: block;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.message-image:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

/* Video Messages */
.message.video-message {
    padding: 4px;
    background: transparent;
    box-shadow: none;
}

.video-container {
    position: relative;
    max-width: 260px;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.video-container:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.message-video {
    width: 100%;
    max-height: 360px;
    display: block;
    object-fit: cover;
    border-radius: 20px;
    background: var(--bg-elevated);
}

.video-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    border-radius: 20px;
}

.video-play-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.video-play-overlay .play-icon {
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #000;
    padding-left: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.video-container:hover .play-icon {
    transform: scale(1.1);
}

.video-error {
    width: 240px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 16px 20px;
    background: var(--bg-bubble-them);
    border-radius: 20px;
    align-self: flex-start;
    border-bottom-left-radius: 6px;
    animation: msgIn 0.3s ease;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typingPulse 1.4s infinite ease-in-out;
}

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

@keyframes typingPulse {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

/* ===== CHOICES / INPUT AREA ===== */
.chat-input-area {
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    background: rgba(10, 10, 10, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 45%;
    overflow-y: auto;
    flex-shrink: 0;
}

.choice-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: 16px 20px;
    border-radius: 16px;
    font-size: 15px;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-weight: 400;
    letter-spacing: -0.1px;
}

.choice-btn:hover {
    background: var(--bg-card);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.choice-btn:active {
    transform: translateY(0) scale(0.98);
}

.choice-btn.premium {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(139, 92, 246, 0.06) 100%);
    border-color: rgba(139, 92, 246, 0.3);
}

.choice-btn.premium:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.2);
}

.choice-btn.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.choice-btn.locked::after {
    content: " 🔒";
    font-size: 13px;
}

.choice-btn.continue-chapter {
    background: linear-gradient(135deg, var(--accent) 0%, #6d28d9 100%);
    border-color: var(--accent);
    color: #fff;
    text-align: center;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.choice-btn.continue-chapter:hover {
    background: linear-gradient(135deg, #a855f7 0%, var(--accent) 100%);
    box-shadow: 0 4px 24px var(--accent-glow);
    transform: translateY(-3px);
}

.choice-btn.secondary {
    background: transparent;
    border-color: var(--border-subtle);
    color: var(--text-secondary);
    text-align: center;
    font-size: 13px;
    padding: 12px 16px;
}

.choice-btn.secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--border-light);
    color: var(--text-primary);
}

/* Undo button */
.choice-btn.undo-btn {
    background: transparent;
    border: 1px dashed var(--border-light);
    color: var(--text-secondary);
    text-align: center;
    font-size: 13px;
    padding: 12px 16px;
    margin-top: 8px;
}

.choice-btn.undo-btn:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.chapter-coming-soon {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    font-style: italic;
    letter-spacing: 0.5px;
}

/* ===== IMAGE VIEWER ===== */
.image-viewer {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.98);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: viewerIn 0.25s ease;
    overflow: hidden;
    touch-action: none; /* Enable custom touch handling */
}

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

.image-viewer.hidden {
    display: none;
}

.image-viewer-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.image-viewer img {
    max-width: 94%;
    max-height: 88%;
    object-fit: contain;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
    animation: imgZoom 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: center center;
    transition: transform 0.1s ease-out;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: auto;
}

@keyframes imgZoom {
    from {
        transform: scale(0.92);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Zoom hint text */
.zoom-hint {
    position: absolute;
    bottom: max(32px, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.5px;
    opacity: 1;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.zoom-hint.hidden {
    opacity: 0;
}

.close-viewer {
    position: absolute;
    top: max(24px, env(safe-area-inset-top));
    right: 24px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    font-size: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 300;
}

.close-viewer:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

/* Home Indicator */
.home-indicator {
    height: max(20px, env(safe-area-inset-bottom));
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-pure-black);
    flex-shrink: 0;
    padding-bottom: 8px;
}

.home-indicator::after {
    content: '';
    width: 134px;
    height: 5px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 3px;
}

/* ===== SCROLLBAR - Minimal ===== */
::-webkit-scrollbar {
    width: 2px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Utilities */
.hidden {
    display: none !important;
}

.message-time {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    padding: 10px 0;
}

.date-separator {
    text-align: center;
    padding: 16px 0;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Time Skip Indicator */
.time-skip {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    margin: 16px 0;
    animation: chapterIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.time-skip .time-skip-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.time-skip .time-skip-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

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

/* ===== CHAPTER INDICATORS ===== */
.chapter-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px 16px;
    margin: 16px 0;
    animation: chapterIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes chapterIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.chapter-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.4;
}

.chapter-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.chapter-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 3px;
}

.chapter-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.chapter-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
    letter-spacing: 0.5px;
}

/* End chapter indicator styling */
.chapter-indicator.end {
    margin-top: 24px;
    padding: 32px 16px;
}

.chapter-indicator.end .chapter-label {
    font-size: 11px;
    color: var(--text-secondary);
}

.chapter-indicator.end .chapter-line {
    opacity: 0.2;
}

/* ===== MENU STYLES ===== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.menu-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

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

.menu-content {
    background: var(--bg-card);
    border-radius: 20px;
    width: 90%;
    max-width: 320px;
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.menu-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.menu-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.menu-close:hover {
    color: var(--text-primary);
}

.menu-options {
    padding: 8px;
}

.menu-option {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.menu-option:hover {
    background: rgba(255, 255, 255, 0.08);
}

.menu-option svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.menu-option:hover svg {
    color: var(--text-primary);
}

.menu-option.discord-link {
    color: #5865F2;
}

.menu-option.discord-link svg {
    color: #5865F2;
}

.menu-option.discord-link:hover {
    background: rgba(88, 101, 242, 0.15);
}

.menu-option.danger {
    color: #ff4444;
}

.menu-option.danger svg {
    color: #ff4444;
}

.menu-option.danger:hover {
    background: rgba(255, 68, 68, 0.15);
}

.menu-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 8px 16px;
}

.menu-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-subtle);
    text-align: center;
}

.version-text {
    font-size: 11px;
    color: var(--text-muted);
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-light);
    z-index: 2000;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s;
}

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

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
}

/* ===== MYSTERIOUS INTRO ENTITY ===== */

/* Mysterious name in header */
.chat-name.mysterious {
    background: linear-gradient(90deg, #9333ea, #a855f7, #9333ea);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: mysteriousShimmer 3s linear infinite;
    font-weight: 700;
    letter-spacing: 2px;
}

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

/* Mysterious message bubbles */
.message.mysterious-message {
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.15), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(147, 51, 234, 0.3);
    box-shadow:
        0 0 20px rgba(147, 51, 234, 0.15),
        inset 0 0 20px rgba(147, 51, 234, 0.05);
    animation: mysteriousPulse 3s ease-in-out infinite, messageIn 0.3s ease;
}

@keyframes mysteriousPulse {
    0%, 100% {
        box-shadow:
            0 0 20px rgba(147, 51, 234, 0.15),
            inset 0 0 20px rgba(147, 51, 234, 0.05);
    }
    50% {
        box-shadow:
            0 0 30px rgba(147, 51, 234, 0.25),
            inset 0 0 25px rgba(147, 51, 234, 0.1);
    }
}

/* Intro choice buttons */
.choice-btn.intro-choice {
    border: 1px solid rgba(147, 51, 234, 0.4);
    background: rgba(147, 51, 234, 0.1);
}

.choice-btn.intro-choice:hover {
    background: rgba(147, 51, 234, 0.2);
    border-color: rgba(147, 51, 234, 0.6);
    box-shadow: 0 0 20px rgba(147, 51, 234, 0.2);
}

/* Fade out transition for ending intro */
.screen.fade-out {
    animation: screenFadeOut 0.5s ease forwards;
}

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

/* ===== PROFILE MODAL ===== */
.profile-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.25s ease;
}

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

.profile-modal-content {
    background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg-card) 100%);
    border-radius: 28px;
    width: 90%;
    max-width: 340px;
    padding: 24px;
    text-align: center;
    position: relative;
    border: 1px solid var(--border-light);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    animation: profileSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.profile-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-size: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.profile-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.profile-header {
    margin-bottom: 20px;
}

.profile-large-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--accent);
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.3);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-large-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 40px rgba(139, 92, 246, 0.4);
}

.profile-info {
    margin-bottom: 24px;
}

.profile-name {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}

.profile-role {
    font-size: 14px;
    color: var(--accent);
    font-weight: 500;
    letter-spacing: 0.5px;
}

.profile-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 6px 14px;
    background: rgba(45, 211, 111, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(45, 211, 111, 0.2);
}

.profile-status-badge .status-dot {
    width: 8px;
    height: 8px;
    background: #2dd36f;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

.profile-status-badge span:last-child {
    font-size: 12px;
    color: #2dd36f;
    font-weight: 500;
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    padding: 20px 0;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 20px;
}

.profile-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.profile-stat .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.profile-stat .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.profile-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--bg-pure-black);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-action-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.profile-action-btn svg {
    color: var(--accent);
}

/* Make chat avatar clickable */
.chat-avatar {
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.chat-contact-info {
    cursor: pointer;
}

/* ===== SHARED MEDIA SECTION ===== */
.profile-shared {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
    width: 100%;
    box-sizing: border-box;
}

.shared-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

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

.shared-count {
    font-size: 12px;
    color: var(--text-secondary);
}

.shared-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding: 4px;
    width: 100%;
}

.shared-item {
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    background: var(--bg-elevated);
    transition: all 0.2s ease;
    min-width: 0;
    min-height: 60px;
}

.shared-item:hover {
    transform: scale(1.05);
    z-index: 1;
}

.shared-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.shared-item.video::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 50%, rgba(0,0,0,0.4) 100%);
}

.shared-item.video::before {
    content: '▶';
    position: absolute;
    bottom: 4px;
    right: 6px;
    font-size: 10px;
    color: white;
    z-index: 2;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Locked shared items */
.shared-item.locked {
    cursor: pointer;
}

.shared-item.locked::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1;
}

.shared-item.locked:hover {
    transform: none;
}

.shared-item .lock-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5;
    gap: 4px;
    pointer-events: none;
}

.shared-item .lock-overlay svg {
    width: 20px;
    height: 20px;
    color: var(--accent);
    opacity: 0.8;
}

.shared-item .lock-overlay span {
    font-size: 8px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Empty state for shared media */
.shared-empty {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
}

/* Scrollbar for shared grid */
.shared-grid::-webkit-scrollbar {
    width: 3px;
}

.shared-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}
