/* =============================================
   PANEL-COMPONENTS.CSS - Panel Components & UI Styles
   =============================================
   This file contains styles for all panel components:
   - Header & navigation elements
   - Speech bubbles & narration
   - Chat interface & overlays
   - Choice displays & containers
   - Share modals & previews
   - Navigation halos & tap zones
   - Journey entry screens
   - Chapter completion displays
   - Progress bars & loading states
   - Buttons & action panels
   - Character cards & tags
   - Error messages
   ============================================= */


        /* Panel page header - hidden by default during story playback */
        .panel-page .header {
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease;
        }

        /* World preview / journey entry: show AppHeader (logo + profile) when journey entry screen is visible */
        #journeyEntryScreen .header {
            opacity: 1 !important;
            pointer-events: auto !important;
        }

        /* Panel Logo (top-left corner) */
        /* ── Panel chrome: logo + Open App + bookmark + page counter (column, centered) ── */
        .panel-logo {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
        }

        .panel-logo-link {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            text-decoration: none;
            padding: 4px 0;
            opacity: 0.75;
        }

        .panel-logo-text {
            font-family: 'NewSpirit-SemiBold', sans-serif !important;
            font-size: 1.15rem;
            color: white;
            letter-spacing: -0.02em;
        }

        /* Additional specificity to ensure New Spirit font applies */
        .panel-logo-link .panel-logo-text {
            font-family: 'NewSpirit-SemiBold', sans-serif !important;
        }

        .panel-logo-link:hover .panel-logo-text {
            color: white;
        }

        .panel-logo-row {
            display: flex;
            align-items: center;
            gap: 4px;
            margin-top: 3px;
            opacity: 0.75;
        }

        .panel-logo-row .bookmark-btn {
            margin: 0;
            padding: 4px 4px 4px 0px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: transparent;
            border: none;
            border-radius: 4px;
            -webkit-appearance: none;
            appearance: none;
        }

        .panel-logo-row .bookmark-btn svg {
            width: 16px !important;
            height: 18px !important;
        }

        .panel-page-counter {
            font-size: 14px;
            color: rgba(255, 255, 255, 0.95);
            text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
            line-height: 18px;
        }

        .overlay-menu-logo .logo {
            color: rgba(255, 255, 255, 0.8);
            text-decoration: none;
            transition: color 0.2s ease;
            position: relative;
        }
        
        .overlay-menu-logo .logo i {
            font-size: 1.3rem;
        }
        
        .overlay-menu-logo .logo:hover {
            color: rgba(255, 255, 255, 1);
        }
        
        .overlay-menu-logo .logo::after {
            content: '';
            position: absolute;
            bottom: -4px;
            left: 0;
            width: 0;
            height: 2px;
            background: white;
            transition: width 0.3s ease;
        }
        
        .overlay-menu-logo .logo:hover::after {
            width: 100%;
        }

        /* Panel logo - clean styling without glow */
        .panel-logo .logo {
            font-family: 'Outfit', sans-serif;
            font-size: 1.2rem;
            color: rgba(255, 255, 255, 0.8);
            text-decoration: none;
            transition: all 0.3s ease;
            position: relative;
            transform-origin: center;
            font-weight: 500;
            letter-spacing: -0.02em;
        }
        .panel-logo .logo:hover {
            color: rgba(255, 255, 255, 1);
        }
        
        .panel-logo .logo::after {
            content: '';
            position: absolute;
            bottom: -4px;
            left: 0;
            width: 0;
            height: 2px;
            background: white;
            transition: width 0.3s ease;
        }
        
        .panel-logo .logo:hover::after {
            width: 100%;
        }

        /* Page counter - clean styling without glow */
        #pageCounter {
            font-size: 15px;
            color: rgba(255, 255, 255, 0.85) !important;
            text-align: left;
            transition: all 0.3s ease;
        }

        .restart-btn {
            background-color: rgba(255, 255, 255, 0.1);
            color: rgba(255, 255, 255, 0.8);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 6px;
            padding: 8px 12px;
            cursor: pointer;
            transition: all 0.2s ease;
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            justify-content: center;
            min-width: 36px;
            height: 36px;
        }

        .restart-btn:hover {
            background-color: rgba(255, 255, 255, 0.2);
            color: rgba(255, 255, 255, 1);
            border-color: rgba(255, 255, 255, 0.4);
        }

        .restart-btn:active {
            transform: scale(0.95);
        }
        
        .restart-btn i {
            font-size: 1rem;
        }
        
        /* Speech Bubbles */
        .speech-bubble-v2 {
            background: transparent;
            color: #000000;
            padding: 4px 6px;
            /* border-radius: 15px; */
            font-family: 'Shantell Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
            font-size: 16px;
            line-height: 1.55;
            min-width: 80px;
            min-height: 40px;
            word-wrap: break-word;
            /* overflow: visible to allow feedback controls to render properly */
            overflow: visible;
            animation: bubbleFadeIn 0.4s ease-out forwards;
            opacity: 0;
            /* transform: scale(0.8); */
            z-index: 20;  /* Above tap-zone (z-index: 15) so feedback controls work */
            position: relative;  /* Ensure stacking context */
            isolation: isolate; /* Allow backdrop-filter in children */
        }
        
        /* Webkit scrollbar styling for text content */
        .speech-bubble-v2 .speech-bubble-text::-webkit-scrollbar {
            width: 4px;
        }

        .speech-bubble-v2 .speech-bubble-text::-webkit-scrollbar-track {
            background: transparent;
        }

        .speech-bubble-v2 .speech-bubble-text::-webkit-scrollbar-thumb {
            background: rgba(0, 0, 0, 0.3);
            border-radius: 2px;
        }

        .speech-bubble-v2 .speech-bubble-text::-webkit-scrollbar-thumb:hover {
            background: rgba(0, 0, 0, 0.5);
        }

        .speech-bubble-v2 .speech-bubble-text {
            scrollbar-width: thin;
            scrollbar-color: rgba(0, 0, 0, 0.3) transparent;
        }
        
        /* Old non-comic spoken/thought/whisper/narration/tail rules removed —
           comic bubble styles are now the default (see below). */

        /* =============================================
           TEXT FEEDBACK CONTROLS
           Minimal thumbs up/down with expandable category pills
           ============================================= */

        .text-feedback-controls {
            display: flex;
            float: right;
            flex-direction: row;
            align-items: center;
            gap: 4px;
            pointer-events: auto;
            margin-left: 8px;
            margin-top: 6px;
        }

        /* Larger gap on mobile */
        @media (max-width: 768px) {
            .text-feedback-controls {
                gap: 6px;
            }
        }

        /* Thumbs buttons - transparent, responsive size */
        .text-feedback-btn {
            width: 18px;
            height: 18px;
            border: none;
            border-radius: 4px;
            background: transparent;
            color: #000;
            cursor: pointer;
            transition: all 0.15s ease;
            padding: 0;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .text-feedback-btn svg {
            width: 18px !important;
            height: 18px !important;
            display: block;
        }

        /* Larger on mobile for better tap targets */
        @media (max-width: 768px) {
            .text-feedback-btn {
                width: 28px;
                height: 28px;
            }

            .text-feedback-btn svg {
                width: 28px !important;
                height: 28px !important;
            }
        }

        .text-feedback-btn:hover {
            opacity: 0.7;
        }

        .text-feedback-btn:active {
            transform: scale(0.95);
        }

        .text-feedback-btn.text-feedback-up.active {
            color: #4CAF50;
        }

        .text-feedback-btn.text-feedback-down.active {
            color: #f44336;
        }

        /* Feedback onboarding toast */
        .text-feedback-onboarding {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 1000;
            background: rgba(0, 0, 0, 0.8);
            color: white;
            padding: 12px 20px;
            border-radius: 10px;
            font-family: 'Outfit', sans-serif;
            font-size: 14px;
            line-height: 1.4;
            max-width: 300px;
            text-align: center;
            animation: toastFadeIn 0.3s ease-out;
        }

        .text-feedback-onboarding.fade-out {
            opacity: 0;
            transition: opacity 0.3s ease;
        }

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

        /* Pills container - positioned in the speech bubble */
        .speech-bubble-v2 .text-feedback-pills {
            position: absolute;
            left: 0;
            display: flex;
            flex-direction: row;
            flex-wrap: wrap;
            gap: 6px;
            padding: 0;
            background: transparent;
            z-index: 60;
            pointer-events: auto;
            isolation: isolate;
            max-width: calc(100vw - 16px);
        }

        /* Pills below the bubble (when bubble is in top half) */
        .speech-bubble-v2 .text-feedback-pills.pills-below {
            top: calc(100% - 10px);
            padding-top: 15px;
        }

        /* Pills above the bubble (when bubble is in bottom half) */
        .speech-bubble-v2 .text-feedback-pills.pills-above {
            bottom: calc(100% - 10px);
            padding-bottom: 15px;
        }

        .text-feedback-pills.pills-visible.pills-below {
            animation: pillsSlideDown 0.2s ease-out;
        }

        .text-feedback-pills.pills-visible.pills-above {
            animation: pillsSlideUp 0.2s ease-out;
        }

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

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

        /* Individual pill buttons — values match shared-components SpeechBubble feedbackPill (speechBubbleStyles.ts) */
        .text-feedback-pill {
            display: inline-flex;
            align-items: center;
            padding: 4px 10px;
            border: none;
            border-radius: 12px;
            font-family: 'Outfit', sans-serif;
            font-size: 11px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.12s ease;
            white-space: nowrap;
            background: rgb(0 0 0 / 50%);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            color: white;
            transform: translateZ(0); /* Force GPU layer for backdrop-filter */
        }

        .text-feedback-pill:hover {
            transform: scale(1.05);
            background: rgb(0 0 0 / 65%);
        }

        .text-feedback-pill:active {
            transform: scale(0.95);
        }

        .text-feedback-tag-pill.tag-active {
            background: rgb(255 255 255 / 85%);
            color: #111;
            font-weight: 600;
        }

        /* Both positive and negative use same styling now */
        .text-feedback-pill.pill-positive,
        .text-feedback-pill.pill-negative {
            background: rgb(0 0 0 / 50%);
            color: white;
        }

        .text-feedback-pill.pill-positive:hover,
        .text-feedback-pill.pill-negative:hover {
            background: rgb(0 0 0 / 65%);
        }

        /* Confirmation message */
        .text-feedback-confirmation {
            position: absolute;
            bottom: calc(100% + 4px);
            right: 0;
            padding: 4px 8px;
            border-radius: 6px;
            font-size: 10px;
            font-weight: 600;
            white-space: nowrap;
            animation: confirmPop 0.2s ease-out;
            z-index: 55;
        }

        .text-feedback-confirmation.success {
            background: #4CAF50;
            color: white;
        }

        .text-feedback-confirmation.error {
            background: #f44336;
            color: white;
        }

        .text-feedback-confirmation.fade-out {
            animation: confirmFadeOut 0.25s ease-out forwards;
        }

        @keyframes confirmPop {
            from { opacity: 0; transform: scale(0.9); }
            to { opacity: 1; transform: scale(1); }
        }

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

        /* Narration bubble adjustments - more visible on dark backgrounds */
        .speech-bubble-v2.narration .text-feedback-btn {
            background: rgba(255, 255, 255, 0.95);
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
        }

        /* Mobile adjustments */
        @media (max-width: 480px) {
            .text-feedback-btn {
                width: 20px;
                height: 20px;
            }

            .text-feedback-btn svg {
                width: 11px;
                height: 11px;
            }

            .text-feedback-pills {
                max-width: 240px;
                padding-left: 4px;
            }

            .text-feedback-pill {
                padding: 4px 8px;
                font-size: 10px;
            }
        }

        /* Error message box styling */
        .error-message-box {
            position: fixed;
            top: 20px;
            left: 50%;
            transform: translateX(-50%);
            background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
            color: white;
            border-radius: 12px;
            padding: 16px 20px;
            display: flex;
            align-items: center;
            gap: 12px;
            max-width: 400px;
            min-width: 300px;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
            z-index: 1000;
            font-family: 'Shantell Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            animation: errorSlideIn 0.3s ease-out;
        }

        .error-icon {
            font-size: 20px;
            flex-shrink: 0;
        }

        .error-content {
            flex: 1;
        }

        .error-title {
            font-weight: bold;
            font-size: 14px;
            margin-bottom: 4px;
        }

        .error-text {
            font-size: 13px;
            line-height: 1.4;
            opacity: 0.95;
        }

        .error-dismiss-btn {
            background: none;
            border: none;
            color: white;
            font-size: 18px;
            cursor: pointer;
            padding: 4px;
            border-radius: 50%;
            width: 24px;
            height: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background-color 0.2s ease;
            flex-shrink: 0;
        }

        .error-dismiss-btn:hover {
            background-color: rgba(255, 255, 255, 0.2);
        }

        .jump-to-latest-btn {
            border-radius: 20px;
            color: #ffffff;
            padding: 8px 16px;
            font-family: 'Outfit-Medium';
            font-size: 14.4px;
            cursor: pointer;
            transition: all 0.3s ease;
            border: 1px solid rgba(255, 255, 255, 0.2);
            background-color: transparent;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
            backdrop-filter: blur(25px);
            -webkit-backdrop-filter: blur(25px);
            white-space: nowrap;
        }

        .jump-to-latest-btn:hover {
            opacity: 1;
            background-color: rgba(255, 255, 255, 0.12);
        }


        /* Position action bubbles with same inset as narration */
        .speech-bubble-v2.action {
            inset: 0px auto auto 0px !important;
        }
        
        /* Old action bubble base styles removed — comic styles are now default (see below). */
        
        .speech-bubble-character {
            /* Font family, weight, style, size, and line-height are set in
               speech-bubble-react.css (generated from speechBubbleStyles.ts).
               No !important here so that file can override cleanly. */
            display: block;
            margin-bottom: 5px;
            text-transform: uppercase;
            /* Color is set dynamically per-character in JS */
        }

        .speech-bubble-you-tag {
            display: inline-flex !important;
            align-items: center !important;
            font-size: 8px !important;
            font-weight: 700 !important;
            font-style: normal !important;
            font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif !important;
            color: #1a1a2e !important;
            background: linear-gradient(135deg, #f5c542 0%, #d4a438 100%) !important;
            border: none !important;
            border-radius: 6px !important;
            padding: 2px 5px !important;
            letter-spacing: 0.3px !important;
            text-transform: none !important;
            cursor: pointer !important;
            line-height: normal !important;
            text-shadow: none !important;
            flex-shrink: 0 !important;
            box-shadow: none !important;
        }

        .speech-bubble-you-tag:hover {
            background: linear-gradient(135deg, #f7d060 0%, #e0b040 100%) !important;
        }

        .speech-bubble-text {
            line-height: 1.4;
            font-family: 'Shantell Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
            word-wrap: break-word;
            word-break: break-word;
            overflow-wrap: break-word;
        }

        /* Markdown styling within speech bubble text */
        .speech-bubble-text p {
            margin: 0 0 0.5em 0;
        }

        .speech-bubble-text p:last-child {
            margin-bottom: 0;
        }

        .speech-bubble-text strong {
            font-weight: 700;
        }

        .speech-bubble-text em {
            font-style: italic;
        }

        .speech-bubble-text code {
            background: rgba(0, 0, 0, 0.1);
            padding: 0.1em 0.3em;
            border-radius: 3px;
            font-family: monospace;
            font-size: 0.9em;
        }
        
        /* Chat overlay styles */
        /* Chat Speech Bubble - Comic Style */
        .chat-speech-bubble {
            position: absolute;
            top: 1%;
            right: 1%;
            width: 76%;
            /* min-height: 45%; */
            max-height: 80%;
            background: white;
            border-radius: 30px;
            padding: 8px;
            z-index: 100;
            display: none;
            flex-direction: column;
            overflow-y: auto;
            border: 3px solid #000; /* Added black border */
        }

        .chat-character-message {
            font-family: 'Shantell Sans', sans-serif;
            font-size: 17px;
            line-height: 1.4;
            color: #000;
            flex: 1;
            white-space: pre-wrap;
            word-wrap: break-word;
        }

        /* Loading dots animation */
        .chat-loading-dots {
            display: inline-flex;
            align-items: center;
            gap: 4px;
        }

        .chat-loading-dots span {
            width: 8px;
            height: 8px;
            background-color: #000;
            border-radius: 50%;
            animation: chat-loading-bounce 1.4s infinite ease-in-out both;
        }

        .chat-loading-dots span:nth-child(1) {
            animation-delay: -0.32s;
        }

        .chat-loading-dots span:nth-child(2) {
            animation-delay: -0.16s;
        }

        /* Chat Input Container - using custom-choice-container style */
        .chat-input-wrapper {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            width: 100%;
            height: auto;
            z-index: 101; /* Above tap-zone (z-index: 15) - uses fixed position to escape image-container stacking context */
            display: flex;
            flex-direction: column;
            background: linear-gradient(
                0deg,
                color-mix(in srgb, var(--container-bg-color, rgba(0, 0, 0, 1)) 95%, transparent) 0%,
                color-mix(in srgb, var(--container-bg-color, rgba(0, 0, 0, 1)) 85%, transparent) 60%,
                color-mix(in srgb, var(--container-bg-color, rgba(0, 0, 0, 1)) 40%, transparent) 90%,
                transparent 100%
            );
            backdrop-filter: blur(1px);
            -webkit-backdrop-filter: blur(1px);
            padding: 30px 0px 20px 0px;
            box-sizing: border-box;
            pointer-events: none;
        }

        .chat-custom-choice-container {
            display: flex;
            align-items: center;
            gap: 12px;
            width: calc(100% - 40px);
            max-width: 100%;
            margin: 0 auto;
            background-color: rgba(255, 255, 255, 0.15);
            border: 1px solid rgba(255, 255, 255, 0.3);
            backdrop-filter: blur(4px);
            -webkit-backdrop-filter: blur(4px);
            border-radius: 12px;
            padding: 16px 20px;
            pointer-events: auto;
        }

        .chat-custom-choice-container:focus-within {
            background-color: rgba(255, 255, 255, 0.25);
            border-color: rgba(255, 255, 255, 0.5);
        }

        .chat-custom-input {
            flex: 1;
            background: transparent;
            border: none;
            color: white;
            font-size: 18px;
            line-height: 1.4;
            outline: none;
            padding: 0;
            font-family: 'Shantell Sans', sans-serif;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
            resize: none;
            overflow-y: auto;
            min-height: 24px;
            max-height: 120px;
            word-wrap: break-word;
            white-space: pre-wrap;
        }

        .chat-custom-input::placeholder {
            color: rgba(255, 255, 255, 0.7);
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
        }

        .chat-custom-send {
            background-color: color-mix(in srgb, var(--container-bg-color, rgba(0, 0, 0, 1)) 80%, transparent);
            border-radius: 6px;
            color: white;
            cursor: pointer;
            padding: 8px 12px;
            width: 48px;
            height: 48px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s ease;
            border: 1px solid rgba(255, 255, 255, 0.2);
        }

        .chat-custom-send:hover {
            background-color: color-mix(in srgb, var(--container-bg-color, rgba(0, 0, 0, 1)) 90%, transparent);
            border-color: rgba(255, 255, 255, 0.4);
        }

        .chat-custom-send::after {
            content: '';
            width: 0;
            height: 0;
            border-left: 6px solid currentColor;
            border-top: 4px solid transparent;
            border-bottom: 4px solid transparent;
        }

        /* End Chat Button */
        .chat-end-button {
            align-self: flex-end;
            margin-bottom: 12px;
            margin-right: 20px;
            background: rgb(255 255 255 / 18%);
            border: 1px solid rgba(255, 255, 255, 0.3);
            border-radius: 20px;
            padding: 8px 16px;
            color: white;
            font-family: 'Outfit', sans-serif;
            font-size: 14px;
            cursor: pointer;
            transition: all 0.2s ease;
            backdrop-filter: blur(4px);
            -webkit-backdrop-filter: blur(4px);
            pointer-events: auto;
        }

        .chat-end-button:hover {
            background: rgba(255, 255, 255, 0.3);
            border-color: rgba(255, 255, 255, 0.5);
            transform: translateY(-1px);
        }

        /* Chat choice styles */
        .chat-choice-container {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 16px;
            z-index: 25;
            width: 100%;
            max-width: none;
        }

        .chat-circle {
            width: 80px;
            height: 80px;
            border: 3px solid white;
            border-radius: 50%;
            cursor: pointer;
            background: transparent;
            animation: chatPulse 2s ease-in-out infinite;
        }

        .chat-circle:hover {
            animation: none;
            transform: scale(1.1);
            box-shadow: 0 0 25px rgba(255, 255, 255, 0.6);
        }

        .chat-label {
            color: white;
            font-size: 18px;
            font-family: 'Shantell Sans', sans-serif;
            text-align: center;
            text-shadow: 1px 1px 0 #000,
                -1px -1px 0 #000,
                1px -1px 0 #000,
                -1px 1px 0 #000,
                0 0 3px rgba(0, 0, 0, 0.8);
        }

        /* Choice display styles */
        .choice-container {
            background-color: #ffffff08;
            border: none;
            border-radius: 8px;
            padding: 24px;
            text-align: center;
            min-height: 100px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: safe center;
            color: #fff;
            position: relative;
            z-index: 2; /* Ensure it stays above the blurred background */
            margin: 24px 16px 32px 16px;
            max-width: calc(100vw - 32px);
            max-height: 80vh;
            overflow-y: auto;
            overscroll-behavior: contain;
            -webkit-overflow-scrolling: touch;
        }
        
        /* Choice container overlay when there's a background image */
        .choice-container-overlay {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            text-align: center;
            min-height: 200px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: safe center;
            padding: 24px 16px calc(32px + env(safe-area-inset-bottom, 0px)) 16px;
            color: #fff;
            margin: 0;
            max-width: 100%;
            max-height: 90dvh;
            overflow-y: auto;
            overscroll-behavior: contain;
            -webkit-overflow-scrolling: touch;
            z-index: 25;
            background: linear-gradient(to top, 
                color-mix(in srgb, rgb(33 30 30) 95%, transparent) 0%, 
                color-mix(in srgb, var(--container-bg-color, rgb(0 0 0)) 85%, transparent) 15%, 
                color-mix(in srgb, var(--container-bg-color, rgb(0 0 0)) 70%, transparent) 30%, 
                color-mix(in srgb, var(--container-bg-color, rgba(0, 0, 0, 1)) 50%, transparent) 45%, 
                color-mix(in srgb, var(--container-bg-color, rgba(0, 0, 0, 1)) 30%, transparent) 60%, 
                color-mix(in srgb, var(--container-bg-color, rgba(0, 0, 0, 1)) 15%, transparent) 75%, 
                color-mix(in srgb, var(--container-bg-color, rgba(0, 0, 0, 1)) 5%, transparent) 90%, 
                transparent 100%);
        }
        
        .choice-container.no-choice {
            color: #6c757d;
            font-style: italic;
        }
        
        .choice-question {
            font-size: 16px;
            margin-bottom: 16px;
            color: rgba(255, 255, 255, 0.95);
            text-align: center;
            font-family: 'ShantellSans-Regular', 'Shantell Sans', sans-serif;
            font-style: italic;
            letter-spacing: 0.01em;
            line-height: 1.5;
            text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8), 0 2px 12px rgba(0, 0, 0, 0.5);
        }
        
        /* Stagger entrance animation — choices cascade up on appear */
        @keyframes choiceSlideUp {
            from { opacity: 0; transform: translateY(16px); }
            to   { opacity: 1; transform: translateY(0); }
        }

        .choice-options {
            display: flex;
            flex-direction: column;
            gap: 8px;
            width: 100%;
            align-items: center;
            counter-reset: choice-counter;
        }
        
        .choice-option {
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(255, 255, 255, 0.18);
            border-radius: 16px;
            padding: 14px 18px;
            text-align: left;
            cursor: pointer;
            transition: all 0.2s ease;
            color: rgba(255, 255, 255, 0.95);
            font-family: 'ShantellSans-Regular', 'Shantell Sans', sans-serif;
            font-size: 16px;
            line-height: 1.45;
            width: 100%;
            max-width: 480px;
            z-index: 20;
            position: relative;
            counter-increment: choice-counter;
            box-sizing: border-box;
            display: flex;
            align-items: center;
            gap: 12px;
            text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
        }

        .choice-option::before {
            content: counter(choice-counter, upper-alpha);
            flex-shrink: 0;
            width: 28px;
            height: 28px;
            border: 1.5px solid rgba(255, 255, 255, 0.35);
            border-radius: 50%;
            font-family: 'ShantellSans-Regular', 'Shantell Sans', sans-serif;
            font-size: 12px;
            font-weight: normal;
            color: rgba(255, 255, 255, 0.7);
            transition: all 0.2s ease;
            line-height: 25px;
            text-align: center;
            box-sizing: border-box;
        }

        .choice-option:hover::before {
            border-color: rgba(255, 255, 255, 0.8);
            color: rgba(255, 255, 255, 1);
            background-color: rgba(255, 255, 255, 0.1);
        }
        
        .choice-option:hover {
            background-color: #4a4a4a;
            border-color: #5a5a5a;
            transform: translateY(-1px);
        }

        /* Disable hover effects on touch devices to avoid first-tap hover state */
        /* Glassmorphic styles for overlay choice elements */
        .choice-container-overlay .choice-option,
        .choice-container-overlay .custom-choice-container {
            background: rgba(255, 255, 255, 0.06);
            border: 1px solid rgba(255, 255, 255, 0.15);
            backdrop-filter: blur(25px);
            -webkit-backdrop-filter: blur(25px);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        }

        .choice-container-overlay .choice-option:hover,
        .choice-container-overlay .custom-choice-container:hover,
        .choice-container-overlay .custom-choice-container:focus-within {
            background-color: transparent;
            box-shadow:
                0 6px 20px rgba(0, 0, 0, 0.3),
                0 2px 6px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
        }

        .choice-container-overlay .choice-option:hover {
            transform: translateY(-1px);
        }

        /* Text shadow for overlay choice text */
        .choice-container-overlay .choice-option,
        .choice-container-overlay .custom-choice-input {
            text-shadow: 1px 1px 0 #000,
                -1px -1px 0 #000,
                1px -1px 0 #000,
                -1px 1px 0 #000,
                0 0 3px rgba(0, 0, 0, 0.8);
        }

        .choice-container-overlay .choice-option::before {
            text-shadow: none;
        }
        

        /* Tactile press feedback — immediate scale on touch */
        .choice-option:active {
            transform: scale(0.97);
            background: rgba(255, 255, 255, 0.15);
            border-color: rgba(255, 255, 255, 0.3);
            transition: transform 0.08s ease, background 0.08s ease;
        }

        /* Disabled state — clearly dims all options while story generates */
        .choice-option[tabindex="-1"] {
            opacity: 0.45;
            pointer-events: none;
        }

        /* Selected state for undo choices (matches choice-completed green) */
        .choice-option.choice-selected {
            background-color: rgba(34, 197, 94, 0.3);
            border-color: rgba(34, 197, 94, 0.6);
            border-width: 2px;
            box-shadow: 0 0 12px rgba(34, 197, 94, 0.4);
        }

        .choice-option.choice-selected::before {
            border-color: rgba(34, 197, 94, 0.9);
            background-color: rgba(34, 197, 94, 0.4);
            color: #fff;
        }

        .choice-container-overlay .choice-option.choice-selected {
            background-color: rgba(34, 197, 94, 0.25);
            border: none;
            box-shadow:
                0 4px 20px rgba(34, 197, 94, 0.4),
                0 2px 8px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.15),
                inset 0 0 0 1px rgba(34, 197, 94, 0.5);
        }

        .choice-container-overlay .choice-option.choice-selected::before {
            border-color: rgba(34, 197, 94, 1);
            background-color: rgba(34, 197, 94, 0.6);
        }

        .choice-option-type {
            font-size: 12px;
            color: #888;
            text-transform: uppercase;
            font-weight: 600;
            margin-bottom: 4px;
        }
        
        .choice-option-text {
            font-size: 16px;
            line-height: 1.4;
            /* Lead with self-hosted name (`panel_v2.css`); "Shantell Sans" is Google Fonts only */
            font-family: 'ShantellSans-Regular', 'Shantell Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
            word-wrap: break-word;
            overflow-wrap: break-word;
            width: 100%;
            text-align: left;
        }
        
        /* Custom choice input styles — matches choice-option sizing exactly */
        .custom-choice-container {
            display: flex;
            align-items: center;
            gap: 8px;
            width: 100%;
            max-width: 480px;
            border: 1px solid rgba(255, 255, 255, 0.18);
            border-radius: 16px;
            padding: 14px 18px;
            transition: border-color 0.2s ease, background 0.2s ease;
            box-sizing: border-box;
            /* Extra top gap + "— or —" pseudo-separator */
            margin-top: 10px;
            position: relative;
        }

        /* "— or —" divider that floats above the custom input */
        .choice-container-overlay .custom-choice-container::before {
            content: '— or —';
            position: absolute;
            top: -18px;
            left: 50%;
            transform: translateX(-50%);
            font-size: 10px;
            font-family: 'Outfit', sans-serif;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: rgba(255, 255, 255, 0.35);
            white-space: nowrap;
            pointer-events: none;
        }
        
        .custom-choice-container:focus-within {
            background: rgba(255, 255, 255, 0.1);
            border-color: rgba(255, 255, 255, 0.35);
        }

        /* Dims the input while disabled (matches choice-option[tabindex="-1"]) */
        .custom-choice-container:has(.custom-choice-input:disabled) {
            opacity: 0.45;
            pointer-events: none;
        }
        
        /* Placeholder styling for overlay custom choice input */
        .choice-container-overlay .custom-choice-input::placeholder {
            color: rgba(255, 255, 255, 1.0);
            text-shadow: 1px 1px 0 #000,
                -1px -1px 0 #000,
                1px -1px 0 #000,
                -1px 1px 0 #000,
                0 0 3px rgba(0, 0, 0, 0.8);
        }
        
        .custom-choice-input {
            flex: 1;
            background: transparent;
            border: none;
            color: #fff;
            font-size: 16px;
            line-height: 1.4;
            outline: none;
            padding: 0;
            font-family: 'ShantellSans-Regular', 'Shantell Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
            resize: none;
            min-height: 24px;
            max-height: 45vh; /* Allow expansion up to 45% of viewport height */
            overflow-y: auto;
            transition: height 0.2s ease;
        }
        
        .custom-choice-input::placeholder {
            color: rgba(255, 255, 255, 0.9);
            font-style: normal;
        }
        
        .custom-choice-send {
            background-color: rgba(255, 255, 255, 0.9);
            border-radius: 50%;
            color: black;
            cursor: pointer;
            padding: 0;
            font-size: 16px;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            width: 36px;
            height: 36px;
            min-width: 36px;
            position: relative;
        }
        
        .custom-choice-send:hover {
            background-color: color-mix(in srgb, var(--container-bg-color, rgba(0, 0, 0, 1)) 90%, transparent);
        }
        
        .custom-choice-send::after {
            content: '';
            width: 0;
            height: 0;
            border-left: 6px solid currentColor;
            border-top: 4px solid transparent;
            border-bottom: 4px solid transparent;
            transition: transform 0.2s ease;
        }
        
        .custom-choice-send:disabled::after {
            opacity: 0.5;
            transform: none;
        }
        
        .choice-loading {
            color: #ffeaa7;
            font-style: italic;
            font-size: 16px;
            text-align: center;
            padding: 20px;
        }
        
        .choice-loading::after {
            content: '';
            display: inline-block;
            width: 20px;
            height: 20px;
            border: 2px solid #ffeaa7;
            border-radius: 50%;
            border-top-color: transparent;
            animation: spin 1s ease-in-out infinite;
            margin-left: 10px;
        }
        
        /* Choice loading overlay - replaces the ugly green choice-made box */
        .choice-loading-overlay {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            border-radius: 12px;
            padding: 24px;
            text-align: center;
            color: #fff;
            z-index: 20;
            min-width: 300px;
            max-width: 400px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
            border: 1px solid rgba(255, 255, 255, 0.1);
        }
        
        /* Completed choice display - shows when choice has been made */
        .choice-completed-display {
            background-color: rgba(34, 197, 94, 0.1);
            border: 2px solid rgba(34, 197, 94, 0.3);
            border-radius: 12px;
            padding: 20px;
            text-align: center;
            color: #fff;
            position: relative;
            margin: 20px auto;
            max-width: 90vw;
            max-height: 80vh;
            overflow-y: auto;
            animation: choiceCompletedFadeIn 0.5s ease-out;
        }
        /* Completed choice display overlay when there's a background image */
        .choice-completed-display-overlay {
            position: absolute;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            padding: 20px;
            text-align: center;
            color: #fff;
            margin: 0;
            width: 100%;
            max-width: 500px;
            max-height: 60vh;
            overflow-y: auto;
            z-index: 2000;
        }
        
        .choice-completed-icon {
            font-size: 2rem;
            color: #22c55e;
            margin-bottom: 12px;
            animation: choiceCompletedPulse 2s ease-in-out infinite;
        }
        
        .choice-completed-question {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 16px;
            color: rgba(255, 255, 255, 0.9);
            font-family: 'Shantell Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
            text-shadow: 1px 1px 0 #000,
                -1px -1px 0 #000,
                1px -1px 0 #000,
                -1px 1px 0 #000,
                0 0 3px rgba(0, 0, 0, 0.8) !important;
        }
        
        .choice-completed-answer {
            font-size: 18px;
            font-weight: 700;
            color: white;
            background: rgba(34, 197, 94, 0.6);
            border: 1px solid rgba(34, 197, 94, 0.4);
            border-radius: 8px;
            padding: 12px 16px;
            margin: 0 auto;
            max-width: 80%;
            word-wrap: break-word;
            text-shadow: 1px 1px 0 #000,
                -1px -1px 0 #000,
                1px -1px 0 #000,
                -1px 1px 0 #000,
                0 0 3px rgba(0, 0, 0, 0.8) !important;
            font-family: 'Shantell Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
        }

        .choice-completed-note {
            font-size: 12px;
            color: rgba(255, 255, 255, 0.6);
            margin-top: 12px;
            font-style: italic;
            font-family: 'Shantell Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
        }

        .choice-loading-text {
            font-size: 16px;
            color: rgba(255, 255, 255, 0.9);
            margin-bottom: 16px;
            font-weight: 500;
            font-family: 'ShantellSans-Regular', 'Shantell Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
        }
        
        .choice-loading-bar {
            width: 100%;
            height: 6px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 3px;
            overflow: hidden;
            position: relative;
        }
        
        .choice-loading-fill {
            height: 100%;
            background: linear-gradient(90deg, 
                rgba(255, 255, 255, 0.3) 0%, 
                rgba(255, 255, 255, 0.6) 50%, 
                rgba(255, 255, 255, 0.3) 100%
            );
            border-radius: 3px;
            width: 0%;
            transition: width 0.1s ease-out;
            position: relative;
        }
        
        .choice-loading-fill::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: linear-gradient(90deg, 
                transparent 0%,
                rgba(255, 255, 255, 0.4) 50%,
                transparent 100%
            );
            animation: shimmer 2s infinite;
        }
        
        .story-generation-message {
            margin-top: 20px;
            padding: 15px;
            background-color: #2a4a2a;
            border: 1px solid #4a6a4a;
            border-radius: 8px;
            text-align: center;
        }
        
        .story-generation-text {
            font-size: 16px;
            color: #ffeaa7;
            font-weight: 600;
            margin-bottom: 8px;
        }
        
        .story-generation-note {
            font-size: 14px;
            color: #888;
            font-style: italic;
        }
        
        /* World creator link styling */
        .world-creator-link {
            color: rgba(255, 255, 255, 1);
            text-decoration: none;
            transition: all 0.2s ease;
            cursor: pointer;
        }
        
        .world-creator-link:hover {
            text-decoration: underline;
        }
        
        /* Image tap zones for navigation */
        

        /* Share Modal Styles - Simple and Clean */
        .share-modal-backdrop {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            width: 100%;
            height: 100vh;
            height: 100dvh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding:
                max(16px, env(safe-area-inset-top))
                max(16px, env(safe-area-inset-right))
                max(16px, env(safe-area-inset-bottom))
                max(16px, env(safe-area-inset-left));
            box-sizing: border-box;
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            z-index: 10000;
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
            transition: opacity 0.3s ease, visibility 0.3s;
        }
        
        .share-modal-backdrop.visible {
            opacity: 1;
            visibility: visible;
            pointer-events: auto;
        }
        
        .share-modal-backdrop .share-modal {
            position: relative;
            inset: auto;
            width: auto; /* ShareManager may set this dynamically */
            max-width: 95vw;
            min-width: 280px;
            max-height: 90vh;
            background: transparent; /* remove gradient box */
            border-radius: 16px;
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            display: flex;
            flex-direction: column;
            overflow: hidden;
            transform: scale(0.92) translateY(20px);
            opacity: 0;
            transition: transform 0.3s ease, opacity 0.3s ease;
        }

        .share-modal-backdrop.visible .share-modal {
            transform: scale(1) translateY(0);
            opacity: 1;
        }

        /* Legacy desktop rules removed: backdrop flex-centers on all sizes */

        /* Keep inner content free to animate if needed (no transform overrides) */
        
        .share-modal-header {
            position: relative;
            padding: 12px 16px 6px;
            text-align: center;
        }
        
        .share-modal-handle {
            position: absolute;
            top: 6px;
            left: 50%;
            transform: translateX(-50%);
            width: 28px;
            height: 3px;
            background: rgba(255, 255, 255, 0.3);
            border-radius: 2px;
        }
        
        .share-modal-header h3 {
            margin: 8px 0 0;
            color: rgba(255, 255, 255, 0.9);
            font-size: 0.9rem;
            font-weight: 600;
            font-family: 'Shantell Sans', -apple-system, BlinkMacSystemFont, sans-serif;
        }
        
        .share-modal-close {
            position: absolute;
            top: 8px;
            right: 12px;
            background: none;
            border: none;
            color: rgba(255, 255, 255, 0.6);
            font-size: 0.9rem;
            cursor: pointer;
            padding: 4px;
            border-radius: 50%;
            transition: all 0.2s ease;
            width: 20px;
            height: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .share-modal-close:hover {
            color: rgba(255, 255, 255, 0.9);
            background: rgba(255, 255, 255, 0.1);
        }
        
        .share-modal-content {
            flex: 1;
            padding: 6px 16px 16px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        .share-modal-frame {
            width: 100%;
            border-radius: 14px;
            box-sizing: border-box;
        }
        
        .share-preview-section {
            display: flex;
            flex-direction: column;
            align-items: center;
            margin-bottom: 16px;
            position: relative;
            max-width: 100%;
        }
        /* Keep section from stretching modal vertically */
        .share-modal .share-preview-section { overflow: hidden; }
        
        /* Modal preview image: small, contained, no forced full-width */
        .share-modal .share-preview-image {
            height: auto;
            object-fit: contain;
            border-radius: 12px;
        }
        
        .share-preview-title {
            position: absolute;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            color: rgb(255, 255, 255);
            font-size: 0.6rem;
            font-weight: 700;
            margin: 0;
            font-family: 'Shantell Sans', -apple-system, BlinkMacSystemFont, sans-serif;
            text-shadow:
                1px 1px 0 #000,
                -1px -1px 0 #000,
                1px -1px 0 #000,
                -1px 1px 0 #000,
                0 0 4px rgba(0, 0, 0, 0.9);
            text-align: center;
            z-index: 10;
            max-width: 110px;
        }
        
        .share-platforms {
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
        }
        
        .share-platform-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 50px;
            height: 50px;
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 50%;
            color: rgba(255, 255, 255, 0.8);
            cursor: pointer;
            transition: all 0.3s ease;
            text-decoration: none;
            backdrop-filter: blur(4px);
            -webkit-backdrop-filter: blur(4px);
        }
        
        .share-platform-btn:hover {
            background: rgba(255, 255, 255, 0.2);
            border-color: rgba(255, 255, 255, 0.4);
            transform: translateY(-2px) scale(1.1);
            color: rgba(255, 255, 255, 1);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        }
        
        .share-platform-btn i {
            font-size: 1.25rem;
        }
        
        /* Platform-specific colors on hover */
        .share-platform-btn.reddit:hover { 
            background: rgba(255, 69, 0, 0.3); 
            border-color: rgba(255, 69, 0, 0.5);
        }
        .share-platform-btn.discord:hover { 
            background: rgba(114, 137, 218, 0.3); 
            border-color: rgba(114, 137, 218, 0.5);
        }
        .share-platform-btn.twitter:hover { 
            background: rgba(29, 161, 242, 0.3); 
            border-color: rgba(29, 161, 242, 0.5);
        }
        .share-platform-btn.text:hover { 
            background: rgba(34, 197, 94, 0.3); 
            border-color: rgba(34, 197, 94, 0.5);
        }
        .share-platform-btn.copy-link:hover {
            background: rgba(255, 255, 255, 0.25);
            border-color: rgba(255, 255, 255, 0.5);
        }

        /* Share Type Selection Modal */
        .share-type-modal-backdrop {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.6);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            z-index: 10000;
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.3s ease, visibility 0.3s;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .share-type-modal-backdrop.visible {
            opacity: 1;
            visibility: visible;
        }

        .share-type-modal {
            background: rgba(30, 30, 35, 0.95);
            border-radius: 20px;
            padding: 24px;
            min-width: 300px;
            max-width: 90vw;
            border: 1px solid rgba(255, 255, 255, 0.1);
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
            transform: scale(0.9);
            opacity: 0;
            transition: transform 0.3s ease, opacity 0.3s ease;
        }

        .share-type-modal-backdrop.visible .share-type-modal {
            transform: scale(1);
            opacity: 1;
        }

        .share-type-modal-title {
            color: rgba(255, 255, 255, 0.9);
            font-size: 1.1rem;
            font-weight: 600;
            margin: 0 0 20px 0;
            text-align: center;
            font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
        }

        .share-type-options {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .share-type-option {
            display: flex;
            align-items: center;
            gap: 16px;
            padding: 16px 20px;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 14px;
            cursor: pointer;
            transition: all 0.2s ease;
            text-align: left;
        }

        .share-type-option:hover {
            background: rgba(255, 255, 255, 0.1);
            border-color: rgba(255, 255, 255, 0.2);
            transform: translateY(-2px);
        }

        .share-type-option:active {
            transform: translateY(0);
        }

        .share-type-icon {
            width: 44px;
            height: 44px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 12px;
            flex-shrink: 0;
        }

        .share-type-icon svg {
            width: 24px;
            height: 24px;
            stroke: rgba(255, 255, 255, 0.8);
        }

        .share-type-text {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .share-type-label {
            color: rgba(255, 255, 255, 0.95);
            font-size: 1rem;
            font-weight: 600;
            font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
        }

        .share-type-desc {
            color: rgba(255, 255, 255, 0.5);
            font-size: 0.85rem;
            font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
        }

        /* Private World Modal Styles */
        .private-world-modal .share-type-modal-content {
            text-align: center;
        }

        .private-world-icon {
            width: 64px;
            height: 64px;
            margin: 0 auto 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(255, 193, 7, 0.15);
            border-radius: 50%;
        }

        .private-world-icon svg {
            width: 32px;
            height: 32px;
            stroke: #ffc107;
        }

        .private-world-desc {
            color: rgba(255, 255, 255, 0.6);
            font-size: 0.9rem;
            line-height: 1.5;
            margin: 0 0 24px 0;
            font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
        }

        .private-world-options {
            display: flex;
            gap: 12px;
            margin-bottom: 16px;
        }

        .private-world-btn {
            flex: 1;
            padding: 14px 20px;
            border-radius: 12px;
            font-size: 0.95rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
            border: none;
        }

        .private-world-btn.primary {
            background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
            color: white;
        }

        .private-world-btn.primary:hover:not(:disabled) {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
        }

        .private-world-btn.secondary {
            background: rgba(255, 255, 255, 0.1);
            color: rgba(255, 255, 255, 0.9);
            border: 1px solid rgba(255, 255, 255, 0.2);
        }

        .private-world-btn.secondary:hover:not(:disabled) {
            background: rgba(255, 255, 255, 0.15);
            border-color: rgba(255, 255, 255, 0.3);
        }

        .private-world-btn:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        .private-world-cancel {
            background: transparent;
            border: none;
            color: rgba(255, 255, 255, 0.5);
            font-size: 0.85rem;
            cursor: pointer;
            padding: 8px 16px;
            transition: color 0.2s ease;
            font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
        }

        .private-world-cancel:hover {
            color: rgba(255, 255, 255, 0.8);
        }

        /* Mobile-specific adjustments */
        @media (max-width: 480px) {
            .share-type-modal {
                min-width: unset;
                width: calc(100vw - 32px);
                padding: 20px;
            }

            .share-type-option {
                padding: 14px 16px;
            }

            .share-type-icon {
                width: 40px;
                height: 40px;
            }

            .share-type-icon svg {
                width: 20px;
                height: 20px;
            }

            /* Private world modal mobile adjustments */
            .private-world-options {
                flex-direction: column;
            }

            .private-world-icon {
                width: 56px;
                height: 56px;
            }

            .private-world-icon svg {
                width: 28px;
                height: 28px;
            }
        }

        /* Share Preview Styles - for when panels are shared externally */
        .share-preview {
            display: none; /* Hidden by default, shown only for share previews */
            background: white;
            color: #333;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
            max-width: 600px;
            margin: 0 auto;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
        }
        
        .share-preview-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 20px;
            background: white;
            border-bottom: 1px solid #e5e5e5;
        }
        
        .share-preview-title {
            font-size: 18px;
            font-weight: 600;
            color: #fffafa;
            margin: 0;
        }
        
        .share-preview-logo {
            width: 32px;
            height: 32px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: bold;
            font-size: 14px;
        }
        
        .share-preview .share-preview-image-container {
            position: relative;
            width: 75%;
            max-height: 400px;
            overflow: hidden;
            background: #f8f9fa;
        }
        
        .share-preview .share-preview-image {
            width: 100%;
            height: auto;
            display: block;
            object-fit: cover;
        }
        
        .share-preview-speech-bubbles {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            pointer-events: none;
        }
        
        /* Position the first three example bubbles (preview only) */
        .share-preview-speech-bubbles .share-preview-speech-bubble:nth-child(1) {
            top: 60px;
            left: 40px;
        }
        .share-preview-speech-bubbles .share-preview-speech-bubble:nth-child(2) {
            top: 120px;
            left: 60px;
        }
        .share-preview-speech-bubbles .share-preview-speech-bubble:nth-child(3) {
            top: 180px;
            left: 80px;
        }

        .share-preview-speech-bubble {
            position: absolute;
            background: rgba(255, 255, 255, 0.95);
            border: 2px solid #333;
            border-radius: 12px;
            padding: 8px 12px;
            font-size: 14px;
            line-height: 1.3;
            max-width: 200px;
            word-wrap: break-word;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        }
        
        .share-preview-speech-bubble.character {
            background: rgba(255, 255, 255, 0.95);
        }
        
        .share-preview-speech-bubble.narration {
            background: rgba(0, 0, 0, 0.8);
            color: white;
            border-color: #333;
        }
        
        .share-preview-speech-bubble .character-name {
            font-weight: bold;
            font-size: 12px;
            margin-bottom: 4px;
            color: #666;
        }
        
        .share-preview-speech-bubble.narration .character-name {
            color: rgba(255, 255, 255, 0.8);
        }
        
        .share-preview-footer {
            background: #f8f9fa;
            padding: 12px 20px;
            border-top: 1px solid #e5e5e5;
        }
        
        .share-preview-author {
            font-size: 14px;
            color: #666;
            margin: 0;
        }
        
        .share-preview-author a {
            color: #667eea;
            text-decoration: none;
            font-weight: 500;
        }
        
        .share-preview-author a:hover {
            text-decoration: underline;
        }
        
        .share-preview-domain {
            font-size: 12px;
            color: #999;
            margin: 4px 0 0 0;
        }
        
        /* Show share preview only when it's a share URL */
        .share-preview.show {
            display: block;
        }
        
        /* Hide regular content when showing share preview */
        /* The share preview is now only for platform link previews, not for direct navigation */
        
        /* Mobile responsive adjustments */

        
        /* Mobile responsiveness for share modal */
        .tap-zone {
            position: absolute;
            top: 0;
            bottom: 0;
            opacity: 0;
            transition: opacity 0.2s ease;
            pointer-events: auto;
            z-index: 15;
            cursor: pointer;
            -webkit-tap-highlight-color: transparent;
            -webkit-touch-callout: none;
            -webkit-user-select: none;
            -khtml-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
        }
        
        .tap-zone.left {
            left: 0;
            width: 25%;
        }
        
        .tap-zone.right {
            right: 0;
            width: 60%;
        }
        
        .tap-zone.disabled {
            opacity: 0.3;
            cursor: not-allowed !important;
        }
        
        .container:hover .tap-zone {
            opacity: 1;
        }
        
        /* Navigation Halo Indicators */
        .navigation-halo {
            position: fixed;
            top: 50%;
            transform: translateY(-50%);
            width: 50px;
            height: 50px;
            border-radius: 50%;
            pointer-events: auto;
            z-index: 100;
            opacity: 0;
            transition: opacity 0.3s ease, transform 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            color: rgba(255, 255, 255, 0.8);
            -webkit-tap-highlight-color: transparent;
            -webkit-touch-callout: none;
            -webkit-user-select: none;
            -khtml-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
        }

        .navigation-halo.left {
            left: 0px;
        }

        .navigation-halo.right {
            right: 0px;
        }

        .navigation-halo.visible {
            opacity: 1;
        }

        /* Hide halos entirely when choice panel is active — they're irrelevant there */
        /* Exclude .loading-spinner so the generation spinner stays visible after a choice is made */
        body.action-bar-blocked .navigation-halo:not(.loading-spinner) {
            opacity: 0 !important;
            pointer-events: none !important;
        }

        /* Pulse animation to help first-time users discover the nav arrows */
        @keyframes haloFirstTimePulse {
            0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
            50% { opacity: 1; transform: translateY(-50%) scale(1.12); background: rgba(0, 0, 0, 0.5); }
        }

        .navigation-halo.visible.first-time-pulse {
            animation: haloFirstTimePulse 1.2s ease-in-out 3;
        }
        
        /* Only show hover effects when halo is visible */
        /* .navigation-halo.visible:hover {
            color: rgba(255, 255, 255, 1);
            opacity: 1;
            transform: scale(1.1);
        } */
        
        /* SVG arrow icons */
        .navigation-halo svg {
            width: 22px;
            height: 22px;
            fill: currentColor;
            filter:
                drop-shadow(0 0 4px rgba(0, 0, 0, 0.9))
                drop-shadow(0 2px 6px rgba(0, 0, 0, 0.7));
            transition: transform 0.15s ease;
        }
        
        /* .navigation-halo.visible:hover svg {
            transform: scale(1.1);
        } */

        /* Next Chapter hint text (shown when navigating to chapter end panel) */
        .next-chapter-hint {
            position: absolute;
            top: 100%;
            right: 10px;
            margin-top: 6px;
            font-family: 'Outfit', sans-serif;
            font-size: 0.55rem;
            font-weight: 600;
            color: rgba(255, 255, 255, 0.8);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            white-space: nowrap;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease;
            text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
        }

        /* Next chapter state - larger arrow with animation, no circle */
        .navigation-halo.right.next-chapter {
            width: 70px;
            height: 70px;
            top: calc(50vh - 35px);
            background: transparent;
            border: none;
            backdrop-filter: none;
            -webkit-backdrop-filter: none;
        }

        .navigation-halo.right.next-chapter.visible {
            opacity: 1;
        }

        .navigation-halo.right.next-chapter svg {
            width: 36px;
            height: 36px;
            animation: nextChapterArrowBounce 1.5s ease-in-out infinite;
            filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 12px rgba(255, 255, 255, 0.3));
        }

        .navigation-halo.right.next-chapter .next-chapter-hint {
            opacity: 1;
        }

        @keyframes nextChapterArrowBounce {
            0%, 100% {
                transform: translateX(0);
            }
            50% {
                transform: translateX(6px);
            }
        }

        /* Hide first-time-hint when in next-chapter mode */
        .navigation-halo.right.next-chapter .first-time-hint {
            display: none;
        }

        /* Loading spinner for next panel (right halo) */
        #loadingSpinner {
            opacity: 0;
            pointer-events: none;
            cursor: default;
            /* Match `.navigation-halo` (top: 50%) — 50vh drifts when mobile browser chrome resizes */
            top: 50%;
            transform: translateY(-50%);
            background: transparent;
            border: none;
            outline: none;
            box-shadow: none;
            backdrop-filter: none;
            -webkit-backdrop-filter: none;
            transition: none !important;
            /* break out of halo's flex centering to avoid layout jitter */
            display: block !important;
            align-items: initial !important;
            justify-content: initial !important;
            contain: layout paint;
            will-change: opacity;
        }
        
        #loadingSpinner.visible {
            opacity: 0.7;
        }

        /* Prevent hover from replacing centering transform (was causing vertical jump). */
        #loadingSpinner.visible:hover {
            transform: translateY(-50%) scale(1) !important;
            opacity: 0.7 !important;
        }
        
        #loadingSpinner .spinner-icon {
            width: 100%;
            height: 100%;
            display: block; /* prevent baseline alignment jitter in flex container */
            transform-origin: 50% 50%;
            transform-box: fill-box;
            transition: none !important;
        }

        #loadingSpinner svg {
            display: block; /* remove inline svg baseline gap */
            transition: none !important;
            transform: none !important;
        }

        #loadingSpinner .spinner-icon .spinner-arc {
            vector-effect: non-scaling-stroke;
        }

        /* Rotate the group around center to avoid dash/offset rendering drift */
        #loadingSpinner .spinner-icon .spinner-rotor {
            transform-origin: 12px 12px;
            animation: spinnerRotate 1.4s linear infinite;
        }

        /* dash animation removed */

        /* Continue button for stuck generation (appears after timeout, replaces spinner) */
        .generation-retry-btn {
            position: fixed;
            /* Match navigation-halo positioning exactly */
            right: 0px;
            top: 50%;
            transform: translateY(-50%);
            display: flex;
            align-items: center;
            padding: 10px 16px;
            background: rgba(255, 255, 255, 0.15);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.25);
            border-radius: 20px;
            color: rgba(255, 255, 255, 0.9);
            font-family: 'Outfit', sans-serif;
            font-size: 0.7rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            cursor: pointer;
            z-index: 101;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease, background 0.2s ease;
        }

        .generation-retry-btn.visible {
            opacity: 1;
            pointer-events: auto;
        }

        .generation-retry-btn:hover {
            background: rgba(255, 255, 255, 0.25);
        }

        .generation-retry-btn:active {
            transform: translateY(-50%) scale(0.95);
        }

        .generation-retry-btn.loading {
            pointer-events: none;
            opacity: 0.6;
        }

        .generation-retry-btn .continue-arrow {
            width: 16px;
            height: 16px;
            margin-left: 2px;
            margin-right: -4px;
        }

        /* Mobile responsive adjustments for halos */
        /* Mobile responsive */
        /* Visual feedback for tap */
        .tap-feedback {
            position: absolute;
            width: 60px;
            height: 60px;
            border-radius: 50%;
            pointer-events: none;
            transform: translate(-50%, -50%) scale(0);
            animation: tapRipple 0.4s ease-out;
            z-index: 15;
        }
        
        /* Action panel styling - matches narration text styling exactly */
        .action-display {
            background-color: rgba(229, 229, 160, 0);
            color: white;
            border: none;
            border-radius: 0;
            padding: 10px;
            margin: 5px 0;
            text-shadow: 
                1px 1px 0 #000,
                -1px -1px 0 #000,
                1px -1px 0 #000,
                -1px 1px 0 #000,
                0 0 3px rgba(0, 0, 0, 0.8);
            font-size: 18px;
            line-height: 1.3;
            font-family: 'Shantell Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
        }

        .action-display strong {
            color: white;
            text-shadow: 
                1px 1px 0 #000,
                -1px -1px 0 #000,
                1px -1px 0 #000,
                -1px 1px 0 #000,
                0 0 3px rgba(0, 0, 0, 0.8);
        }
        
        /* Chapter Completion Display Styles - darker, less purple, more opaque */
        .chapter-completion-display {
            width: 92%;
            max-width: 562px;
            max-height: 74%;
            min-height: 48vh;
            aspect-ratio: 8 / 9;
            text-align: center;
            padding: 40px 32px 24px 32px;
            background: linear-gradient(145deg, 
                rgba(45, 45, 65, 0.96) 0%, 
                rgba(35, 35, 55, 0.94) 100%);
            border: 3px solid rgba(255, 215, 180, 0.3);
            border-radius: 15px;
            box-shadow: 
                0 0 40px rgba(74, 59, 107, 0.6),
                0 0 20px rgba(123, 97, 172, 0.4),
                inset 0 0 30px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
            overflow-y: auto;
            /* Disable vertical swipe gestures on chapter completion display */
            touch-action: pan-x;
            margin: 0 auto;
            position: relative;
            animation: shimmer-border 4s ease-in-out infinite;
        }
        
        
        
        .chapter-title h2 {
            font-family: 'Outfit', sans-serif;
            font-size: 28px;
            font-weight: 600;
            color: rgba(255, 255, 255, 0.95);
            margin: 0 0 20px 0;
            letter-spacing: 1px;
            position: relative;
            z-index: 1;
        }
        
        .chapter-divider {
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 20px 0;
            color: rgba(255, 248, 240, 0.9);
            position: relative;
            z-index: 1;
        }
        
        .chapter-divider::before,
        .chapter-divider::after {
            content: '';
            flex: 1;
            height: 2px;
            background: linear-gradient(90deg, 
                transparent 0%, 
                rgba(255, 215, 180, 0.4) 30%, 
                rgba(255, 215, 180, 0.7) 50%, 
                rgba(255, 215, 180, 0.4) 70%, 
                transparent 100%);
            margin: 0 15px;
            border-radius: 1px;
            box-shadow: 0 0 8px rgba(255, 215, 180, 0.3);
        }
        
        .chapter-divider-symbol {
            font-size: 24px;
            color: rgba(255, 255, 255, 0.9);
        }
        
        .chapter-summary h3 {
            font-family: 'Outfit', sans-serif;
            font-size: 20px;
            font-weight: 600;
            color: rgba(255, 255, 255, 0.95);
            margin: 25px 0 15px 0;
            letter-spacing: 0.5px;
            position: relative;
            z-index: 1;
        }
        
        .chapter-summary p {
            font-family: 'Outfit', sans-serif;
            font-size: 16px;
            line-height: 1.7;
            color: rgba(255, 255, 255, 0.85);
            margin: 0 0 25px 0;
            padding: 0 10px;
            text-align: left;
            position: relative;
            z-index: 1;
        }

        /* Continue button styling */
        .chapter-continue-btn {
            background: rgba(255, 215, 180, 0.15);
            border: 2px solid rgba(255, 215, 180, 0.4);
            border-radius: 25px;
            color: rgba(255, 248, 240, 0.9);
            padding: 12px 24px;
            font-family: 'Outfit', sans-serif;
            font-size: 16px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s ease;
            backdrop-filter: blur(4px);
            -webkit-backdrop-filter: blur(4px);
            text-shadow: 0 0 4px rgba(255, 215, 180, 0.6);
            box-shadow: 0 0 8px rgba(255, 215, 180, 0.3);
            margin-top: 10px;
        }

        .chapter-continue-btn:hover {
            background: rgba(255, 215, 180, 0.25);
            border-color: rgba(255, 215, 180, 0.6);
            color: rgba(255, 248, 240, 1);
            text-shadow: 0 0 6px rgba(255, 215, 180, 0.8);
            box-shadow: 0 0 12px rgba(255, 215, 180, 0.5);
            transform: translateY(-2px);
        }

        .chapter-continue-btn:active {
            transform: translateY(0);
        }
        .chapter-continue-btn[data-navigation-disabled="true"] {
            background: rgba(100, 100, 100, 0.15) !important;
            border-color: rgba(100, 100, 100, 0.3) !important;
            color: rgba(150, 150, 150, 0.6) !important;
            text-shadow: none !important;
            box-shadow: none !important;
            cursor: not-allowed !important;
            transform: none !important;
        }
        .chapter-continue-btn[data-navigation-disabled="true"]:hover {
            background: rgba(100, 100, 100, 0.15) !important;
            border-color: rgba(100, 100, 100, 0.3) !important;
            color: rgba(150, 150, 150, 0.6) !important;
            text-shadow: none !important;
            box-shadow: none !important;
            transform: none !important;
        }

        /* Flashy text animations - leave the box alone */
        .chapter-title h2 {
            opacity: 0;
            animation: flashyTextIn 0.7s ease-out 0.2s forwards;
        }

        .chapter-divider-symbol {
            opacity: 0;
            animation: sparkleIn 0.56s ease-out 0.7s forwards;
        }

        .chapter-summary h3 {
            opacity: 0;
            animation: glowIn 0.56s ease-out 0.98s forwards;
        }

        .chapter-summary p {
            opacity: 0;
            animation: fadeUpGlow 0.56s ease-out 1.01s forwards;
        }

        .chapter-continue-btn {
            opacity: 0;
            animation: buttonPulseIn 0.45s ease-out 1.34s forwards;
        }

        /* Chapter disappear animation with particles */
        .chapter-completion-display.disappearing {
            animation: chapterDisappear 1.2s ease-in forwards;
        }

        .chapter-completion-display.disappearing .chapter-title h2,
        .chapter-completion-display.disappearing .chapter-divider-symbol,
        .chapter-completion-display.disappearing .chapter-summary h3,
        .chapter-completion-display.disappearing .chapter-summary p,
        .chapter-completion-display.disappearing .chapter-continue-btn {
            animation: none !important;
            opacity: 1;
        }

        /* Floating particles */
        .journal-particle {
            position: absolute;
            pointer-events: none;
            width: 6.5px;
            height: 6.5px;
            background: radial-gradient(circle, rgba(255, 245, 235, 1) 0%, rgba(255, 235, 215, 0.9) 70%, transparent 100%);
            border-radius: 50%;
            z-index: 1000;
            opacity: 1;
            box-shadow: 0 0 4px rgba(255, 245, 235, 0.8);
            transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), left 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), top 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.3s ease-out;
        }

        /* Journal button glow when receiving particles */
        .journal-book-symbol.receiving-particles {
            animation: journalReceiveGlow 2.0s ease-out;
        }

        .continue-prompt em {
            font-family: 'Outfit', sans-serif;
            font-size: 14px;
            color: rgba(255, 215, 180, 0.7);
            opacity: 0.7;
            font-style: italic;
            position: relative;
            z-index: 1;
        }
        
        /* Make narration box special for chapter completion - transparent overlay */
        .narration-box.chapter-completion {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            z-index: 50;
            display: flex !important;
            align-items: center;
            justify-content: center;
            background: transparent;
            border: none;
            /* Disable vertical swipe gestures on chapter completion panels */
            touch-action: pan-x;
        }
        
        
        /* Mobile responsive styles for chapter completion display */
        /* Original Chapter Completion Overlay Styles (now unused) */
        .chapter-completion-overlay {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 100;
            pointer-events: none;
        }
        
        .ornate-page {
            background: rgba(248, 245, 235, 0.98);
            border: 3px solid #8B4513;
            border-radius: 15px;
            box-shadow: 
                0 0 30px rgba(0, 0, 0, 0.7),
                inset 0 0 20px rgba(139, 69, 19, 0.1);
            max-width: 600px;
            max-height: 80vh;
            overflow-y: auto;
            position: relative;
            backdrop-filter: blur(8px);
            margin: 20px;
            animation: ornatePageFadeIn 0.8s ease-out forwards;
            opacity: 0;
            transform: translateY(20px) scale(0.98);
        }
        
        .ornate-border-top,
        .ornate-border-bottom {
            height: 20px;
            background: linear-gradient(90deg, 
                transparent 0%, 
                #8B4513 20%, 
                #CD853F 50%, 
                #8B4513 80%, 
                transparent 100%);
            position: relative;
        }
        
        .ornate-border-top::before,
        .ornate-border-bottom::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 60px;
            height: 8px;
            background: #CD853F;
            border-radius: 4px;
            box-shadow: 0 0 5px rgba(139, 69, 19, 0.5);
        }
        
        .ornate-content {
            padding: 40px 50px;
            text-align: center;
            background: 
                radial-gradient(circle at top left, rgba(205, 133, 63, 0.05) 0%, transparent 50%),
                radial-gradient(circle at top right, rgba(205, 133, 63, 0.05) 0%, transparent 50%),
                radial-gradient(circle at bottom left, rgba(205, 133, 63, 0.05) 0%, transparent 50%),
                radial-gradient(circle at bottom right, rgba(205, 133, 63, 0.05) 0%, transparent 50%);
        }
        
        .chapter-completion-title h1 {
            font-family: 'Times New Roman', serif;
            font-size: 48px;
            font-weight: 300;
            color: #2C1810;
            margin: 0;
            letter-spacing: 3px;
            text-transform: uppercase;
        }
        
        .chapter-completion-title h2 {
            font-family: 'Times New Roman', serif;
            font-size: 32px;
            font-weight: 300;
            color: #8B4513;
            margin: 8px 0 0 0;
            letter-spacing: 2px;
            text-transform: uppercase;
        }
        
        .ornate-divider {
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 30px 0;
            gap: 15px;
        }
        
        .divider-line {
            flex: 1;
            height: 2px;
            background: linear-gradient(90deg, transparent 0%, #8B4513 50%, transparent 100%);
        }
        
        .divider-ornament {
            font-size: 24px;
            color: #CD853F;
            text-shadow: 0 0 5px rgba(139, 69, 19, 0.3);
            animation: ornamentGlow 3s ease-in-out infinite alternate;
        }
        
        .chapter-summary-section h3 {
            font-family: 'Times New Roman', serif;
            font-size: 24px;
            font-weight: 400;
            color: #2C1810;
            margin-bottom: 20px;
            letter-spacing: 1px;
        }
        
        .summary-text {
            background: rgba(255, 255, 255, 0.4);
            border: 2px solid #CD853F;
            border-radius: 10px;
            padding: 25px;
            font-family: 'Times New Roman', serif;
            font-size: 18px;
            line-height: 1.7;
            color: #2C1810;
            text-align: left;
            box-shadow: inset 0 2px 10px rgba(139, 69, 19, 0.1);
            margin-bottom: 30px;
        }
        
        .continue-prompt p {
            font-family: 'Times New Roman', serif;
            font-size: 16px;
            font-style: italic;
            color: #8B4513;
            margin: 0;
            opacity: 0.8;
        }
        
        /* ==========================================
           Journey Entry Screen
           ========================================== */

        .journey-entry-screen {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            height: 100vh;
            height: 100dvh;
            background-color: #0a0a0a;
            z-index: 3000;
            overflow: hidden;
            flex-direction: column;
        }

        /* Blurred background layer - GPU accelerated to prevent flickering */
        .journey-entry-bg-blur {
            position: absolute;
            top: -20px;
            left: -20px;
            right: -20px;
            bottom: -20px;
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            filter: blur(40px) brightness(0.4);
            opacity: 0.8;
            z-index: 0;
            /* GPU acceleration to prevent flickering */
            transform: translateZ(0);
            will-change: transform;
            backface-visibility: hidden;
            -webkit-backface-visibility: hidden;
        }

        .journey-entry-content {
            position: relative;
            z-index: 1;
            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: column;
            align-items: center;
            /* Padding synced from journeyEntryStyles via journey-entry-layout.css */
            overflow-y: auto;
            overflow-x: hidden;
            scrollbar-width: none;
            -ms-overflow-style: none;
        }

        /* Thumbnail island: width so .world-thumbnail-card (from worldThumbnailStyles.ts) can size */
        .journey-entry-thumbnail-island {
            width: 100%;
            flex-shrink: 0;
        }

        .journey-entry-content::-webkit-scrollbar {
            display: none;
        }

        /* Fixed Bottom Bar for Button – padding synced from journeyEntryStyles via journey-entry-layout.css; bottom uses safe-area */
        .journey-bottom-bar {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
            background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 50%, transparent 100%);
            z-index: 10;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .start-journey-button-wrapper {
            width: 100%;
            display: flex;
            justify-content: center;
            margin: 0;
            padding: 0;
        }
        .journey-bottom-bar .start-journey-button-island {
            margin: 0;
            padding: 0;
        }

        .start-journey-button-island {
            width: 100%;
            max-width: 280px;
        }

        /* Pulse animation on the button only (prod: animation was on #startJourneyBtn when it was the button) */
        .journey-bottom-bar .start-journey-button {
            animation: pulse 2s infinite;
        }

        /* Hero Card with Cover Image */
        .journey-hero-card {
            width: 100%;
            max-width: 400px;
            aspect-ratio: 1 / 1;
            border-radius: 24px;
            overflow: hidden;
            box-shadow:
                0 20px 60px rgba(0, 0, 0, 0.5),
                0 8px 24px rgba(0, 0, 0, 0.3);
            flex-shrink: 0;
            margin-bottom: 24px;
        }

        .journey-hero-image {
            width: 100%;
            height: 100%;
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
        }

        /* Info Section */
        .journey-info-section {
            width: 100%;
            max-width: 400px;
            text-align: center;
            flex-shrink: 0;
        }

        .journey-entry-title {
            font-family: 'NewSpirit-SemiBold', sans-serif;
            font-size: 1.6rem;
            color: white;
            margin: 0 0 8px 0;
            letter-spacing: -0.01em;
            line-height: 1.2;
        }

        .journey-entry-creator {
            font-size: 0.95rem;
            color: rgba(255, 255, 255, 0.7);
            margin: 0 0 16px 0;
            font-weight: 400;
            text-align: center;
        }

        .journey-entry-creator .creator-link {
            color: rgba(255, 255, 255, 0.9);
            text-decoration: none;
            font-weight: 500;
        }

        .journey-entry-creator .creator-link:hover {
            text-decoration: underline;
        }

        .journey-entry-description {
            font-size: 0.95rem;
            color: rgba(255, 255, 255, 0.65);
            margin: 0 0 20px 0;
            line-height: 1.5;
            font-weight: 400;
            text-align: left;
        }

        /* Stats Row - horizontal inline style */
        .journey-stats-row {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            margin: 0 0 16px 0;
            flex-wrap: wrap;
        }

        .journey-stat {
            display: flex;
            align-items: baseline;
            gap: 4px;
        }

        .journey-stat-value {
            color: rgba(255, 255, 255, 0.9);
            font-size: 0.95rem;
            font-weight: 600;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
        }

        .journey-stat-label {
            color: rgba(255, 255, 255, 0.5);
            font-size: 0.85rem;
            font-weight: 400;
        }

        .journey-stat-divider {
            color: rgba(255, 255, 255, 0.3);
            font-size: 0.85rem;
        }

        /* Tags */
        .journey-entry-tags {
            display: flex;
            flex-wrap: nowrap;
            justify-content: flex-start;
            gap: 8px;
            margin: 0 0 24px 0;
            overflow-x: auto;
            padding: 0.5rem 0rem;
            scroll-behavior: smooth;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: none;
            -ms-overflow-style: none;
        }
        .journey-entry-tags::-webkit-scrollbar {
            display: none;
        }

        /* Loading Section */
        .journey-entry-loading {
            width: 100%;
            margin-top: 8px;
        }

        .loading-bar-container {
            width: 100%;
            max-width: 280px;
            margin: 0 auto 12px auto;
        }

        .loading-bar {
            width: 100%;
            height: 4px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 2px;
            overflow: hidden;
        }

        .loading-bar-fill {
            height: 100%;
            width: 0%;
            background: linear-gradient(90deg,
                rgba(255, 255, 255, 0.6) 0%,
                rgba(255, 255, 255, 0.8) 50%,
                rgba(255, 255, 255, 0.6) 100%
            );
            background-size: 200% 100%;
            animation: shimmerBar 1.5s ease-in-out infinite;
            border-radius: 2px;
            transition: width 0.4s ease-out;
        }

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

        .loading-status-text {
            color: rgba(255, 255, 255, 0.5);
            font-size: 0.85rem;
            margin: 0;
            font-weight: 400;
            text-align: center;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
        }

        /* Start Journey Button */
        .start-journey-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            width: 100%;
            max-width: 280px;
            margin: 0 auto;
            padding: 14px 28px;
            background: white;
            color: #0a0a0a;
            border: none;
            border-radius: 14px;
            font-size: 1rem;
            font-weight: 600;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            cursor: pointer;
            transition: all 0.2s ease;
            box-shadow: 0 4px 16px rgba(255, 255, 255, 0.15);
        }

        .start-journey-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 24px rgba(255, 255, 255, 0.2);
        }

        .start-journey-btn:active {
            transform: translateY(0);
        }

        .start-journey-btn i {
            font-size: 0.9rem;
        }

        /* Similar Worlds Section */
        .journey-entry-screen .similar-worlds-section {
            width: 100%;
            max-width: 100vw;
            margin-top: 0px;
            padding: 0;
        }

        .journey-entry-screen .similar-worlds-title {
            font-family: 'Outfit', sans-serif;
            text-align: left;
            /* margin-bottom, font-size, font-weight, color synced from journeyEntryStyles via journey-entry-layout.css */
        }

        .journey-entry-screen .carousel-items {
            padding: 0 20px;
            scroll-snap-type: x mandatory;
            touch-action: pan-x pan-y;
        }

        .journey-entry-screen .carousel-items > * {
            scroll-snap-align: start;
        }

        /* World card styles for journey entry screen */
        .journey-entry-screen .similar-worlds-section .world-card {
            text-align: left;
            flex-shrink: 0;
        }

        .journey-entry-screen .similar-worlds-section .world-info {
            text-align: left;
        }

        .journey-entry-screen .similar-worlds-section {
            box-sizing: border-box;
            /* margin-top, padding-left, padding-right from journeyEntryStyles via journey-entry-layout.css */
        }
        /* Match prod: no extra bottom padding so scroll ends with same space above bottom bar */
        .journey-entry-screen .similar-worlds-section .carousel-items {
            padding-bottom: 0 !important;
        }

        /* Content column: all three island mount-points share the same max-width as prod.
           journey-entry-layout.css sets width:100% + max-width; panel-components adds structure below. */
        .journey-entry-info-island,
        .journey-entry-characters-island {
            width: 100%;
            max-width: 400px;
        }
        .journey-entry-characters-section {
            width: 100%;
            min-width: 0;
        }
        .journey-entry-characters {
            width: 100%;
            min-width: 0;
        }
        .journey-entry-characters .horizontal-carousel {
            width: 100%;
            min-width: 0;
        }
        .journey-entry-characters .horizontal-carousel .carousel-items {
            width: 100%;
            min-width: 0;
            flex-wrap: nowrap;
            justify-content: flex-start;
            gap: 0;
            padding: 0;
            overflow-x: auto;
            overflow-y: hidden;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: none;
            -ms-overflow-style: none;
        }
        .journey-entry-characters .horizontal-carousel .carousel-items::-webkit-scrollbar {
            display: none;
        }
        .journey-entry-characters-header {
            width: 100%;
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
        }
        .journey-entry-characters-section .section-head-subtitle {
            font-family: 'Outfit', sans-serif;
            font-weight: 400;
            font-size: 0.78rem;
            color: rgba(255, 255, 255, 0.4);
            letter-spacing: 0.01em;
            font-style: italic;
            margin-top: 1px;
        }
        /* Tighten section-head padding inside journey entry */
        .journey-entry-characters-section .section-head {
            padding-left: 0;
            padding-right: 0;
            margin-bottom: 0;
        }
        .journey-entry-characters-section .section-head-title {
            margin-bottom: 0;
            line-height: 1.1;
        }
        /* Less space between header and avatars */
        .journey-entry-characters-section .journey-entry-characters-header {
            margin-bottom: 4px;
        }
        /* Edit button — align down to sit level with the avatar row, flush right */
        .journey-entry-characters-header .section-edit-btn {
            align-self: flex-end;
            margin-bottom: 2px;
            margin-right: 0 !important;
        }
        .journey-entry-characters-section .character-avatar-card {
            padding: 0;
        }
        .journey-entry-characters-section .character-avatar-wrapper {
            width: 64px;
            height: 64px;
        }
        .journey-entry-characters-section .character-avatar-name {
            font-size: 0.8rem;
            max-width: 120px;
            white-space: normal;
            overflow: visible;
            text-overflow: clip;
        }
        .journey-entry-characters-section .character-avatar-info {
            margin-top: 6px;
        }
        /* Main character: golden ring + "You" badge (prod parity; CharacterAvatarCard shared component) */
        .journey-entry-characters-section .character-avatar-card.main-character .character-avatar-wrapper {
            border: 2px solid #f5c542;
            box-shadow: 0 0 8px rgba(245, 197, 66, 0.4);
        }
        .journey-entry-characters-section .character-avatar-badge--main {
            bottom: -2px;
            left: 50%;
            transform: translateX(-50%);
            background: linear-gradient(135deg, #f5c542 0%, #d4a438 100%);
            color: #1a1a2e;
            font-size: 8px;
            font-weight: 700;
            padding: 2px 5px;
            border-radius: 6px;
            letter-spacing: 0.3px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
            z-index: 1;
        }

        /* Journey entry tags: centered like prod; same max-width so tags scroll/cut off inside */
        .journey-entry-tags-island {
            width: 100%;
            max-width: 400px;
        }
        .journey-entry-tags-island .horizontal-carousel {
            width: 100%;
            min-width: 0;
        }
        .journey-entry-tags-island .horizontal-carousel .carousel-items {
            width: 100%;
            min-width: 0;
            flex-wrap: nowrap;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: none;
            -ms-overflow-style: none;
        }
        .journey-entry-tags-island .horizontal-carousel .carousel-items::-webkit-scrollbar {
            display: none;
        }

        /* Mobile responsive adjustments for journey entry */
        @media (max-width: 480px) {
            .journey-hero-card {
                max-width: 240px;
                border-radius: 20px;
            }

            .journey-entry-title {
                font-size: 1.3rem;
            }

            .journey-entry-content {
                padding: 72px 16px 90px 16px;
            }
        }

        @media (min-width: 768px) {
            .journey-hero-card {
                max-width: 360px;
            }

            .journey-entry-title {
                font-size: 1.8rem;
            }

            .journey-info-section,
            .journey-entry-info-island,
            .journey-entry-characters-island,
            .journey-entry-characters-section,
            .journey-entry-tags-island {
                max-width: 500px;
            }
        }


        /* Mobile responsive adjustments */
        /* Create World Button */
        .create-world-button {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            padding: 6px 16px;
            border-radius: 20px;
            background: linear-gradient(135deg, rgba(139, 92, 246, 0.8), rgba(249, 115, 22, 0.8));
            color: white;
            text-decoration: none;
            transition: all 0.2s ease;
            border: none;
            font-size: 0.9rem;
            font-weight: 600;
            white-space: nowrap;
            box-shadow: 0 4px 12px rgba(240, 101, 149, 0.3);
        }

        .create-world-button:hover {
            background: linear-gradient(135deg, rgba(139, 92, 246, 0.8), rgba(249, 115, 22, 0.8));
            filter: brightness(1.1);
            transform: translateY(-1px);
            box-shadow: 0 6px 16px rgba(240, 101, 149, 0.4);
        }

        /* Character Card Styles */
        .character-container {
            display: flex;
            justify-content: center;
            align-items: center;
            width: auto;
            height: auto;
            max-width: 100vw;
            /* Use dynamic viewport height for mobile compatibility */
            max-height: 100vh; /* Fallback for older browsers */
            max-height: 100dvh; /* Dynamic viewport height - adjusts for mobile UI */
            position: relative;
            z-index: 10;
        }

        .character-card {
            width: auto;
            height: auto;
            max-width: 100vw;
            /* Use dynamic viewport height for mobile compatibility */
            max-height: 100vh; /* Fallback for older browsers */
            max-height: 100dvh; /* Dynamic viewport height - adjusts for mobile UI */
            display: block;
            position: relative;
            background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.6));
            overflow: hidden;
            transition: all 0.3s ease;
            /* Maintain aspect ratio like images */
            aspect-ratio: 9 / 16;
            object-fit: contain;}

        .character-image {
            width: 100%;
            height: 100%;
            position: relative;
            overflow: hidden;
            background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
        }
        .character-image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            object-position: center top;
        }

        .character-placeholder {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 100%;
            height: 100%;
            font-family: 'Impact', 'Arial Black', sans-serif;
            font-size: 4rem;
            font-weight: 900;
            color: rgba(255, 255, 255, 0.6);
            background: linear-gradient(135deg, #1a1a1a, #333);
        }

        .character-info {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            padding: 20px;
            background: linear-gradient(
                to top,
                rgba(0, 0, 0, 0.9) 0%,
                rgba(0, 0, 0, 0.7) 50%,
                rgba(0, 0, 0, 0.3) 80%,
                transparent 100%
            );
            color: white;
        }

        .character-name {
            font-family: 'Shantell Sans', 'Impact', 'Arial Black', sans-serif;
            font-size: clamp(1.8rem, 5vw, 2.8rem);
            font-weight: 900;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            margin-bottom: 8px;
            line-height: 1;
            color: white;
            text-shadow: 
                2px 2px 0 #000,
                -1px -1px 0 #000,
                1px -1px 0 #000,
                -1px 1px 0 #000,
                0 0 5px rgba(0,0,0,0.8);
        }

        .character-description {
            font-family: 'Shantell Sans', 'Georgia', serif;
            font-size: 1.2rem;
            font-style: italic;
            line-height: 1.3;
            margin-bottom: 6px;
            color: rgba(255, 255, 255, 0.9);
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
        }

        .character-backstory {
            font-family: 'Shantell Sans', 'Arial', sans-serif;
            font-size: 1rem;
            line-height: 1.4;
            color: rgba(255, 255, 255, 0.95);
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
        }

        /* Creator Pill Styles */
        .creator-pill {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            background: rgba(255, 255, 255, 0.15);
            color: rgba(255, 255, 255, 0.95);
            padding: 8px 16px;
            border-radius: 24px;
            font-size: 0.9rem;
            font-weight: 500;
            text-decoration: none;
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
            transition: all 0.3s ease;
            font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
        }

        .creator-pill:hover {
            background: rgba(255, 255, 255, 0.25);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
            color: white;
        }

        .creator-profile-icon {
            width: 28px;
            height: 28px;
            border-radius: 18px; /* Match the pill's rounded corners */
            background-color: rgba(255, 255, 255, 0.3);
            display: flex;
            align-items: center;
            justify-content: center;
            color: rgba(255, 255, 255, 0.95);
            font-size: 0.75rem;
            font-weight: 600;
            border: 1px solid rgba(255, 255, 255, 0.2);
            flex-shrink: 0;
        }

        .journey-entry-creator {
            margin: 0 0 20px 0;
        }

        /* Description Container Styles */
        .journey-entry-description-container {
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-radius: 12px;
            padding: 16px 20px;
            margin: 20px 0 20px 0;
            backdrop-filter: blur(10px);
        }

        .journey-entry-description-container .journey-entry-description {
            margin: 0;
            color: rgba(255, 255, 255, 0.95);
            text-shadow: none;
            font-size: 1.05rem;
            line-height: 1.6;
        }

        /* Improved Similar Worlds Section */
        .journey-entry-loading .similar-worlds-section {
            margin-top: 0;
            padding-top: 15px;
            width: 80%;
            max-width: none;
        }

        .journey-entry-loading .carousel {
            width: 100%;
            display: flex;
            justify-content: center;
        }

        .journey-entry-loading .similar-worlds-title {
            font-family: 'NewSpirit-SemiBold', sans-serif;
            font-size: 1.2rem;
            color: rgba(255, 255, 255, 0.9);
            margin-bottom: 20px;
            text-align: center;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
        }

        /* Journey Info Container */
        .journey-info-container {
            text-align: center;
        }

        /* Updated Creator Link Styles */
        .journey-entry-creator {
            margin: 6px 0 16px 0;
            font-size: 0.9rem;
            color: rgba(255, 255, 255, 0.8);
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
        }

        .creator-link {
            color: rgba(255, 255, 255, 0.95);
            text-decoration: underline;
            transition: color 0.2s ease;
        }

        .creator-link:hover {
            color: white;
            text-decoration: underline;
        }

        /* Interaction Count for Continue Cards - positioned left instead of right */
        .continue-card .interaction-count {
            left: 8px;
            right: auto;
        }

        /* World Stats Bar */
        .world-stats-bar {
            display: flex;
            justify-content: space-between;
            gap: 12px;
            margin: 20px 0;
            padding: 16px 20px;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 16px;
            backdrop-filter: blur(10px);
        }
        
        .stat-item {
            display: flex;
            align-items: center;
            gap: 10px;
            flex: 1;
            min-width: 0; /* Allow text to truncate if needed */
        }
        
        .stat-icon {
            flex-shrink: 0;
            width: 24px;
            height: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .stat-icon svg {
            width: 18px;
            height: 18px;
            fill: rgba(255, 255, 255, 0.8);
        }
        
        .stat-content {
            display: flex;
            flex-direction: column;
            min-width: 0;
        }
        
        .stat-value {
            font-size: 0.85rem;
            font-weight: 600;
            color: rgba(255, 255, 255, 0.95);
            line-height: 1.1;
            font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
        }
        
        .stat-label {
            font-size: 0.7rem;
            color: rgba(255, 255, 255, 0.6);
            line-height: 1;
            font-weight: 400;
            font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
        }

        /* Mobile responsive adjustments */
        /* Tag Pill Styles */
        .journey-entry-tags {
            display: flex;
            flex-wrap: nowrap;
            justify-content: flex-start;
            gap: 8px;
            margin-top: 12px;
            margin-bottom: 16px;
            padding: 0.5rem 0rem;
            max-width: 100%;
            overflow-x: auto;
            scroll-behavior: smooth;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: none;
            -ms-overflow-style: none;
        }

        /* Mobile-specific chat input improvements */
        @media only screen and (max-width: 768px) {
            .chat-input-wrapper {
                /* Add safe area for devices with notches */
                padding-bottom: max(20px, env(safe-area-inset-bottom));
                /* Smooth transition when keyboard appears */
                transition: transform 0.3s ease-out;
            }

            .chat-custom-input {
                /* Ensure font size is 16px minimum to prevent iOS zoom */
                font-size: max(16px, 18px);
                /* Prevent pull-to-refresh when scrolling input */
                overscroll-behavior-y: contain;
                /* Smooth scrolling */
                -webkit-overflow-scrolling: touch;
            }

            .chat-custom-choice-container {
                /* Better touch targets on mobile */
                min-height: 48px;
                /* Prevent user-select issues */
                -webkit-user-select: text;
                user-select: text;
                /* Prevent tap highlight */
                -webkit-tap-highlight-color: transparent;
            }
        }

        /* =============================================
           CHAPTER END OVERLAY
           Glass-morphic design consistent with panel overlays
           ============================================= */

        .chapter-end-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 32px;
            padding: 56px 24px 140px 24px;
            box-sizing: border-box;
            z-index: 2500;
            background: #00000042;
            backdrop-filter: blur(100px);
            -webkit-backdrop-filter: blur(100px);
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            /* Animation is now applied via specific directional classes */
        }

        /* Directional slide animations for chapter end overlay */
        @keyframes chapterEndSlideInFromRight {
            from { opacity: 0; transform: translateX(100%); }
            to { opacity: 1; transform: translateX(0); }
        }

        @keyframes chapterEndSlideInFromLeft {
            from { opacity: 0; transform: translateX(-100%); }
            to { opacity: 1; transform: translateX(0); }
        }

        @keyframes chapterEndSlideOutToLeft {
            from { opacity: 1; transform: translateX(0); }
            to { opacity: 0; transform: translateX(-100%); }
        }

        @keyframes chapterEndSlideOutToRight {
            from { opacity: 1; transform: translateX(0); }
            to { opacity: 0; transform: translateX(100%); }
        }

        /* Default animation (backward compat) */
        @keyframes chapterEndSlideIn {
            from { opacity: 0; transform: translateX(100%); }
            to { opacity: 1; transform: translateX(0); }
        }

        /* Animation classes */
        .chapter-end-overlay.slide-in-from-right {
            animation: chapterEndSlideInFromRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }

        .chapter-end-overlay.slide-in-from-left {
            animation: chapterEndSlideInFromLeft 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }

        .chapter-end-overlay.slide-out-to-left {
            animation: chapterEndSlideOutToLeft 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
        }

        .chapter-end-overlay.slide-out-to-right {
            animation: chapterEndSlideOutToRight 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
        }

        /* Remove gradient background for chapter end overlay - it has its own full-screen overlay */
        .choice-container-overlay:has(.chapter-end-overlay) {
            background: transparent !important;
        }

        /* --- Header --- */
        .chapter-end-header {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
            text-align: center;
            animation: chapterEndContentFade 0.6s ease-out 0.2s both;
        }

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

        .chapter-end-label {
            font-family: 'Outfit', sans-serif;
            font-size: 0.78rem;
            font-weight: 600;
            color: rgba(255, 255, 255, 0.4);
            letter-spacing: 2px;
            text-transform: uppercase;
        }

        .chapter-end-title {
            font-family: 'NewSpirit-Medium', 'Shantell Sans', serif;
            font-size: 1.7rem;
            font-weight: 500;
            color: white;
            text-align: center;
            line-height: 1.25;
            margin: 0;
            max-width: 320px;
        }

        .chapter-end-divider {
            width: 32px;
            height: 2px;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
            margin-top: 2px;
            border-radius: 1px;
        }

        /* --- Feedback section --- */
        .chapter-end-feedback {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 12px;
            animation: chapterEndContentFade 0.6s ease-out 0.28s both;
        }

        .chapter-end-feedback-label {
            font-family: 'Outfit', sans-serif;
            font-size: 0.85rem;
            font-weight: 500;
            color: rgba(255, 255, 255, 0.45);
        }

        .chapter-end-feedback-btns {
            display: flex;
            gap: 16px;
        }

        .chapter-end-feedback-btn {
            width: 52px;
            height: 52px;
            border-radius: 50%;
            border: 1px solid rgba(255, 255, 255, 0.1);
            background: rgba(255, 255, 255, 0.05);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
            padding: 0;
        }

        .chapter-end-feedback-btn svg {
            width: 22px;
            height: 22px;
            fill: none;
            stroke: rgba(255, 255, 255, 0.45);
            stroke-width: 1.5;
            transition: all 0.25s ease;
        }

        .chapter-end-feedback-btn:hover {
            border-color: rgba(255, 255, 255, 0.2);
            background: rgba(255, 255, 255, 0.1);
            transform: translateY(-2px);
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
        }

        .chapter-end-feedback-btn:hover svg {
            stroke: rgba(255, 255, 255, 0.85);
        }

        .chapter-end-feedback-btn:active {
            transform: scale(0.95);
        }

        .chapter-end-feedback-btn.selected {
            border-color: rgba(255, 255, 255, 0.4);
            background: rgba(255, 255, 255, 0.15);
            box-shadow: 0 0 20px rgba(255, 255, 255, 0.08),
                        inset 0 1px 0 rgba(255, 255, 255, 0.1);
        }

        .chapter-end-feedback-btn.selected svg {
            stroke: white;
            fill: rgba(255, 255, 255, 0.1);
        }

        .chapter-end-feedback-btn.feedback-positive {
            border-color: rgba(34, 197, 94, 0.6);
            background: rgba(34, 197, 94, 0.2);
        }

        .chapter-end-feedback-btn.feedback-positive svg {
            stroke: rgb(34, 197, 94);
        }

        .chapter-end-feedback-btn.feedback-negative {
            border-color: rgba(239, 68, 68, 0.6);
            background: rgba(239, 68, 68, 0.2);
        }

        .chapter-end-feedback-btn.feedback-negative svg {
            stroke: rgb(239, 68, 68);
        }

        /* --- Direction section --- */
        /* Chapter summary (editable recap) */
        .chapter-end-summary {
            width: 100%;
            max-width: 420px;
            animation: chapterEndContentFade 0.6s ease-out 0.3s both;
        }

        .chapter-end-summary-label {
            font-family: 'Outfit', sans-serif;
            font-size: 0.75rem;
            font-weight: 400;
            color: rgba(255, 255, 255, 0.3);
            text-transform: lowercase;
            letter-spacing: 0.08em;
            text-align: center;
            margin-bottom: 8px;
        }

        .chapter-end-summary-text {
            font-family: 'Outfit', sans-serif;
            font-size: 0.92rem;
            font-weight: 400;
            color: rgba(255, 255, 255, 0.6);
            line-height: 1.6;
            text-align: center;
        }

        .chapter-end-summary-input {
            width: 100%;
            padding: 12px 14px;
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid rgba(255, 255, 255, 0.08);
            border-radius: 12px;
            color: rgba(255, 255, 255, 0.7);
            font-family: 'Outfit', sans-serif;
            font-size: 0.92rem;
            line-height: 1.6;
            resize: none;
            overflow: hidden;
            box-sizing: border-box;
            text-align: center;
            transition: all 0.2s ease;
            field-sizing: content;
        }

        .chapter-end-summary-input:focus {
            outline: none;
            border-color: rgba(255, 255, 255, 0.25);
            background: rgba(255, 255, 255, 0.06);
            color: rgba(255, 255, 255, 0.9);
            box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
        }

        .chapter-end-direction {
            width: 100%;
            max-width: 420px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
            animation: chapterEndContentFade 0.6s ease-out 0.36s both;
        }

        .chapter-end-direction-label {
            font-family: 'Outfit', sans-serif;
            font-size: 0.85rem;
            font-weight: 500;
            color: rgba(255, 255, 255, 0.45);
        }

        /* Chosen direction display (completed state) */
        .chapter-end-chosen-direction {
            font-family: 'Outfit', sans-serif;
            font-size: 0.92rem;
            font-weight: 400;
            color: rgba(255, 255, 255, 0.7);
            line-height: 1.55;
            text-align: center;
            padding: 16px 20px;
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid rgba(255, 255, 255, 0.08);
            border-radius: 16px;
            width: 100%;
            box-sizing: border-box;
        }

        /* Steer toggle button */
        .chapter-end-steer-toggle {
            display: flex;
            align-items: center;
            gap: 6px;
            background: none;
            border: none;
            cursor: pointer;
            padding: 8px 0;
            font-family: 'Outfit', sans-serif;
            font-size: 0.85rem;
            font-weight: 400;
            color: rgba(255, 255, 255, 0.4);
            transition: color 0.2s ease;
        }

        .chapter-end-steer-toggle:hover {
            color: rgba(255, 255, 255, 0.6);
        }

        .chapter-end-steer-chevron {
            transition: transform 0.25s ease;
        }

        .chapter-end-steer-toggle.open .chapter-end-steer-chevron {
            transform: rotate(180deg);
        }

        .chapter-end-steer-content {
            width: 100%;
        }

        .chapter-end-custom-input {
            width: 100%;
            min-height: 72px;
            padding: 12px 14px;
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid rgba(255, 255, 255, 0.08);
            border-radius: 12px;
            color: white;
            font-family: 'Outfit', sans-serif;
            font-size: 0.9rem;
            line-height: 1.55;
            resize: none;
            box-sizing: border-box;
            transition: all 0.2s ease;
        }

        .chapter-end-custom-input:focus {
            outline: none;
            border-color: rgba(255, 255, 255, 0.25);
            background: rgba(255, 255, 255, 0.06);
            box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
        }

        .chapter-end-custom-input::placeholder {
            color: rgba(255, 255, 255, 0.25);
        }

        /* --- Recommendations section --- */
        .chapter-end-recommendations {
            width: 100%;
            max-width: 420px;
            display: flex;
            flex-direction: column;
            gap: 14px;
            animation: chapterEndContentFade 0.6s ease-out 0.44s both;
        }

        .chapter-end-recommendations-label {
            font-family: 'Outfit', sans-serif;
            font-size: 0.85rem;
            font-weight: 500;
            color: rgba(255, 255, 255, 0.45);
            text-align: center;
        }

        .chapter-end-recommendations-scroll {
            display: flex;
            gap: 12px;
            overflow-x: auto;
            padding: 4px 0 12px 0;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: none;
        }

        .chapter-end-recommendations-scroll::-webkit-scrollbar {
            display: none;
        }

        .chapter-end-rec-card {
            flex-shrink: 0;
            width: 140px;
            display: flex;
            flex-direction: column;
            gap: 10px;
            cursor: pointer;
            transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
            text-decoration: none;
        }

        .chapter-end-rec-card:hover {
            transform: translateY(-3px);
        }

        .chapter-end-rec-card:active {
            transform: scale(0.97);
        }

        .chapter-end-rec-thumb {
            width: 140px;
            height: 88px;
            border-radius: 12px;
            overflow: hidden;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.06);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
        }

        .chapter-end-rec-thumb img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: filter 0.3s ease;
        }

        .chapter-end-rec-card:hover .chapter-end-rec-thumb img {
            filter: brightness(1.1);
        }

        .chapter-end-rec-thumb-placeholder {
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(255, 255, 255, 0.04);
        }

        .chapter-end-rec-thumb-placeholder svg {
            width: 24px;
            height: 24px;
            fill: none;
            stroke: rgba(255, 255, 255, 0.15);
            stroke-width: 1.5;
        }

        .chapter-end-rec-title {
            font-family: 'Outfit', sans-serif;
            font-size: 0.8rem;
            font-weight: 500;
            color: rgba(255, 255, 255, 0.6);
            line-height: 1.35;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
            padding: 0 2px;
        }

        /* --- Begin Chapter CTA --- reuses .start-journey-btn shape */
        .chapter-end-begin-btn {
            position: fixed;
            bottom: 32px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 2600;
            animation: pulse 2s infinite;
        }

        /* Override base .start-journey-btn hover/active to preserve centering */
        .chapter-end-begin-btn:hover {
            transform: translateX(-50%) translateY(-2px) !important;
        }

        .chapter-end-begin-btn:active {
            transform: translateX(-50%) scale(0.98) !important;
        }

        /* --- Chapter End Feedback Input --- */
        .chapter-end-feedback-input-container {
            width: 100%;
            margin-top: 12px;
            animation: fadeSlideIn 0.2s ease-out;
        }

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

        .chapter-end-feedback-input {
            width: 100%;
            padding: 12px 16px;
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-radius: 12px;
            color: #fff;
            font-size: 0.9rem;
            font-family: inherit;
            resize: none;
            min-height: 60px;
            transition: border-color 0.2s, background 0.2s;
        }

        .chapter-end-feedback-input::placeholder {
            color: rgba(255, 255, 255, 0.4);
        }

        .chapter-end-feedback-input:focus {
            outline: none;
            border-color: rgba(255, 255, 255, 0.3);
            background: rgba(255, 255, 255, 0.1);
        }

        .chapter-end-feedback-submit {
            margin-top: 8px;
            padding: 8px 16px;
            background: rgba(255, 255, 255, 0.15);
            border: none;
            border-radius: 8px;
            color: #fff;
            font-size: 0.85rem;
            cursor: pointer;
            transition: background 0.2s;
        }

        .chapter-end-feedback-submit:hover {
            background: rgba(255, 255, 255, 0.25);
        }

        .chapter-end-feedback-submit:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        /* --- Mobile responsive --- */
        @media (max-width: 480px) {
            .chapter-end-overlay {
                padding: 44px 20px 130px 20px;
                gap: 28px;
            }

            .chapter-end-title {
                font-size: 1.5rem;
                max-width: 280px;
            }

            .chapter-end-direction,
            .chapter-end-recommendations {
                max-width: 100%;
            }

            .chapter-end-begin-btn {
                bottom: 28px;
            }
        }

        /* ══════════════════════════════════════════════════════════════════════
           SPEECH BUBBLE STYLES — comic bubble design (permanent)
           ══════════════════════════════════════════════════════════════════════ */

        /* ── Speech bubble base ──────────────────────────────────────────── */
        .speech-bubble-v2 {
            padding: 12px 18px;
            border-radius: 24px;
            font-size: 16px;
            line-height: 1.5;
            transition: background 0.4s ease, color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
        }

        /* ── Spoken bubbles: white with border + rounded ─────────────────── */
        .speech-bubble-v2.spoken {
            background: rgba(255, 255, 255, 0.92) !important;
            border: 1.5px solid rgba(0, 0, 0, 0.7) !important;
            border-radius: 16px !important;
            padding: 12px 20px !important;
            box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
        }

        .speech-bubble-v2.thought {
            background: rgba(255, 255, 255, 0.85) !important;
            border: 1.5px solid rgba(0, 0, 0, 0.5) !important;
            border-radius: 16px !important;
            padding: 12px 20px !important;
            box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
        }

        /* ── Narration: rectangular caption box ──────────────────────────── */
        .speech-bubble-v2.narration {
            background: rgba(255, 255, 255, 0.96) !important;
            border: 2px solid #000 !important;
            border-radius: 0 !important;
            box-shadow: none !important;
            color: #111 !important;
            font-family: 'ShantellSans-Regular', 'Shantell Sans', sans-serif !important;
            font-size: 14px !important;
            font-style: normal !important;
            line-height: 1.55 !important;
            letter-spacing: 0.01em !important;
            padding: 8px 12px !important;
            max-width: 92% !important;
            max-height: 40vh !important;
            right: 0 !important;
            left: auto !important;
            top: 0 !important;
            animation: bubbleFadeIn 0.3s ease-out forwards !important;
            opacity: 0 !important;
        }

        .speech-bubble-v2.narration::before,
        .speech-bubble-v2.narration::after {
            display: none !important;
        }

        /* ── Speech bubble tails (CSS triangles) ─────────────────────────── */
        .speech-bubble-v2.spoken[data-corner="bottomLeft"]::before,
        .speech-bubble-v2.thought[data-corner="bottomLeft"]::before {
            content: '';
            position: absolute;
            bottom: -17px;
            left: 18px;
            width: 0; height: 0;
            border-left: 0 solid transparent;
            border-right: 14px solid transparent;
            border-top: 17px solid #000;
        }
        .speech-bubble-v2.spoken[data-corner="bottomLeft"]::after,
        .speech-bubble-v2.thought[data-corner="bottomLeft"]::after {
            content: '';
            position: absolute;
            bottom: -13px;
            left: 20px;
            width: 0; height: 0;
            border-left: 0 solid transparent;
            border-right: 11px solid transparent;
            border-top: 13px solid rgba(255, 255, 255, 0.96);
        }

        .speech-bubble-v2.spoken[data-corner="bottomRight"]::before,
        .speech-bubble-v2.thought[data-corner="bottomRight"]::before {
            content: '';
            position: absolute;
            bottom: -17px;
            right: 18px;
            width: 0; height: 0;
            border-left: 14px solid transparent;
            border-right: 0 solid transparent;
            border-top: 17px solid #000;
        }
        .speech-bubble-v2.spoken[data-corner="bottomRight"]::after,
        .speech-bubble-v2.thought[data-corner="bottomRight"]::after {
            content: '';
            position: absolute;
            bottom: -13px;
            right: 20px;
            width: 0; height: 0;
            border-left: 11px solid transparent;
            border-right: 0 solid transparent;
            border-top: 13px solid rgba(255, 255, 255, 0.96);
        }

        /* ── Action bubble: centered pill ────────────────────────────────── */
        .speech-bubble-v2.action {
            inset: auto !important;
            top: 8px !important;
            left: 50% !important;
            transform: translateX(-50%) !important;
            right: auto !important;
            background: rgba(0, 0, 0, 0.65) !important;
            backdrop-filter: blur(12px) !important;
            -webkit-backdrop-filter: blur(12px) !important;
            color: rgba(255, 255, 255, 0.95) !important;
            border: 1px solid rgba(255, 255, 255, 0.15) !important;
            border-radius: 20px !important;
            padding: 10px 20px !important;
            text-align: center !important;
            width: auto !important;
            max-width: 80% !important;
            max-height: 40vh !important;
            text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
            font-family: 'ShantellSans-Regular', 'Shantell Sans', sans-serif !important;
            font-style: italic !important;
            font-size: 15px !important;
            line-height: 1.45 !important;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
        }

        .speech-bubble-v2.action .speech-bubble-text {
            color: rgba(255, 255, 255, 0.95) !important;
            text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
            font-size: 15px !important;
            line-height: 1.45 !important;
        }

        /* ── Character name label ────────────────────────────────────────── */
        .speech-bubble-character {
            font-family: 'ShantellSans-SemiBoldItalic', 'ShantellSans-SemiBold', 'Shantell Sans', sans-serif !important;
            font-size: 15px !important;
            line-height: 18px !important;
            font-weight: bold !important;
            margin-bottom: 4px;
            letter-spacing: 0.08em;
        }

        /* ── Feedback buttons: compact ───────────────────────────────────── */
        .text-feedback-btn {
            width: 16px;
            height: 16px;
            color: inherit;
            opacity: 0.5;
        }

        .text-feedback-btn svg {
            width: 16px !important;
            height: 16px !important;
        }

        @media (max-width: 768px) {
            .text-feedback-btn {
                width: 20px;
                height: 20px;
            }
            .text-feedback-btn svg {
                width: 20px !important;
                height: 20px !important;
            }
        }

        .speech-bubble-v2.narration .text-feedback-controls {
            margin-top: 2px;
            margin-left: 4px;
        }
        .speech-bubble-v2.narration .text-feedback-btn {
            background: transparent;
            box-shadow: none;
            width: 12px;
            height: 12px;
            opacity: 0.35;
        }
        .speech-bubble-v2.narration .text-feedback-btn svg {
            width: 12px !important;
            height: 12px !important;
        }

        /* ── Choice styling ──────────────────────────────────────────────── */
        .choice-question {
            font-size: 14px;
            margin-bottom: 16px;
            color: rgba(255, 255, 255, 0.92);
            font-family: 'ShantellSans-Regular', 'Shantell Sans', sans-serif;
            font-style: normal;
            letter-spacing: 0.01em;
            line-height: 1.5;
            text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
        }

        .choice-options {
            gap: 10px;
        }

        .choice-option {
            background: rgba(30, 30, 30, 0.65);
            border: 1px solid rgba(255, 255, 255, 0.22);
            border-radius: 20px;
            padding: 12px 18px;
            color: rgba(255, 255, 255, 0.95);
            font-family: 'ShantellSans-Regular', 'Shantell Sans', sans-serif;
            font-size: 14px;
            line-height: 1.45;
            max-width: 460px;
            gap: 10px;
            text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
        }

        .choice-option::before {
            width: 22px;
            height: 22px;
            border-color: rgba(255, 255, 255, 0.3);
            font-family: 'ShantellSans-Regular', 'Shantell Sans', sans-serif;
            font-weight: normal;
            color: rgba(255, 255, 255, 0.6);
            line-height: 19px;
        }

        .choice-option:hover::before {
            border-color: rgba(255, 255, 255, 0.6);
            color: rgba(255, 255, 255, 0.9);
            background-color: transparent;
        }

        .choice-option:hover {
            background: rgba(40, 40, 40, 0.75);
            border-color: rgba(255, 255, 255, 0.35);
            transform: none;
        }

        .custom-choice-container {
            border-radius: 20px;
            max-width: 460px;
            background: rgba(30, 30, 30, 0.55);
            border-color: rgba(255, 255, 255, 0.2);
            color-scheme: light;
        }

        .custom-choice-input {
            color-scheme: light;
        }

        .choice-container-overlay .choice-option,
        .choice-container-overlay .custom-choice-container {
            background: rgba(20, 20, 20, 0.7);
            border: 1px solid rgba(255, 255, 255, 0.2);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        }

        .choice-container-overlay .choice-option:hover,
        .choice-container-overlay .custom-choice-container:hover {
            background: rgba(30, 30, 30, 0.8);
            border-color: rgba(255, 255, 255, 0.3);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
        }

        /* Green glow when user is typing a custom response */
        .choice-container-overlay .custom-choice-container:focus-within,
        .custom-choice-container:focus-within {
            background: rgba(34, 197, 94, 0.08);
            border-color: rgba(34, 197, 94, 0.5);
            box-shadow: 0 0 12px rgba(34, 197, 94, 0.25), 0 0 4px rgba(34, 197, 94, 0.15);
        }

        .custom-choice-container:focus-within .custom-choice-input {
            color: rgba(255, 255, 255, 0.95);
        }

        .custom-choice-container:focus-within .custom-choice-input::placeholder {
            color: rgba(255, 255, 255, 0.45);
        }

        /* ── Completed choice display: minimal redesign ────────────────── */
        .choice-completed-display,
        .choice-completed-display-overlay {
            background: transparent;
            border: none;
            padding: 16px 20px;
            text-align: center;
        }

        .choice-completed-icon {
            display: none;
        }

        .choice-completed-question {
            font-size: 13px;
            font-weight: 400;
            color: rgba(255, 255, 255, 0.5);
            margin-bottom: 8px;
            font-family: 'Outfit', sans-serif;
            font-style: normal;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
        }

        .choice-completed-answer {
            font-size: 16px;
            font-weight: 500;
            color: rgba(34, 197, 94, 0.95);
            background: none;
            border: none;
            border-radius: 0;
            padding: 0;
            margin: 0 auto;
            max-width: 90%;
            font-family: 'ShantellSans-Regular', 'Shantell Sans', sans-serif;
            font-style: italic;
            text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
        }

        .choice-completed-note {
            display: none;
        }

        /* ══════════════════════════════════════════════════════════════════
           AUTO-ADAPTIVE — dark bubbles on light backgrounds
           Triggered by JS adding .comic-light-bg to body when image is light.
           ══════════════════════════════════════════════════════════════════ */

        /* Spoken bubbles: invert to dark */
        body.comic-light-bg .speech-bubble-v2.spoken {
            background: rgba(20, 20, 25, 0.88) !important;
            border-color: rgba(0, 0, 0, 0.3) !important;
            color: rgba(255, 255, 255, 0.95) !important;
            box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
        }

        body.comic-light-bg .speech-bubble-v2.spoken .speech-bubble-text {
            color: rgba(255, 255, 255, 0.95) !important;
        }

        /* Thought bubbles: invert to dark */
        body.comic-light-bg .speech-bubble-v2.thought {
            background: rgba(25, 25, 30, 0.82) !important;
            border-color: rgba(0, 0, 0, 0.25) !important;
            color: rgba(255, 255, 255, 0.92) !important;
            box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
        }

        body.comic-light-bg .speech-bubble-v2.thought .speech-bubble-text {
            color: rgba(255, 255, 255, 0.92) !important;
        }

        /* Narration: invert to dark */
        body.comic-light-bg .speech-bubble-v2.narration {
            background: rgba(15, 15, 20, 0.9) !important;
            border-color: rgba(255, 255, 255, 0.2) !important;
            color: rgba(255, 255, 255, 0.95) !important;
        }

        /* Character name label: light text on dark bubble */
        body.comic-light-bg .speech-bubble-character {
            color: rgba(255, 255, 255, 0.85) !important;
        }

        /* Tail triangles: match dark bubble bg */
        body.comic-light-bg .speech-bubble-v2.spoken[data-corner="bottomLeft"]::before,
        body.comic-light-bg .speech-bubble-v2.thought[data-corner="bottomLeft"]::before {
            border-top-color: rgba(0, 0, 0, 0.3) !important;
        }
        body.comic-light-bg .speech-bubble-v2.spoken[data-corner="bottomLeft"]::after,
        body.comic-light-bg .speech-bubble-v2.thought[data-corner="bottomLeft"]::after {
            border-top-color: rgba(20, 20, 25, 0.88) !important;
        }

        body.comic-light-bg .speech-bubble-v2.spoken[data-corner="bottomRight"]::before,
        body.comic-light-bg .speech-bubble-v2.thought[data-corner="bottomRight"]::before {
            border-top-color: rgba(0, 0, 0, 0.3) !important;
        }
        body.comic-light-bg .speech-bubble-v2.spoken[data-corner="bottomRight"]::after,
        body.comic-light-bg .speech-bubble-v2.thought[data-corner="bottomRight"]::after {
            border-top-color: rgba(20, 20, 25, 0.88) !important;
        }

        /* Feedback buttons: lighter for dark bubbles */
        body.comic-light-bg .text-feedback-btn {
            color: rgba(255, 255, 255, 0.5) !important;
        }
    