        .word-selection-popup {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: white;
            border-radius: 15px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            padding: 30px;
            max-width: 500px;
            width: 90%;
            z-index: 10000;
        }

        .word-selection-popup h3 {
            margin-bottom: 20px;
            color: #333;
        }

        .word-list {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .word-button {
            padding: 12px 20px;
            background: white;
            color: #333;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            cursor: pointer;
            font-size: 14px;
            transition: all 0.2s;
            text-align: left;
        }

        .word-button:hover {
            border-color: #0097b2;
            background: #f0f9fa;
        }

        .popup-actions {
            margin-top: 20px;
            display: flex;
            gap: 10px;
            justify-content: flex-end;
        }

        .popup-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: 9999;
        }

        .message-image {
            width: 100%;
            max-width: 500px;
            border-radius: 10px;
            margin: 10px 0;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            cursor: pointer;
            transition: transform 0.2s, box-shadow 0.2s;
        }
        
        .message-image:hover {
            transform: scale(1.02);
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
        }

        .message-image--detective-guide {
            width: 33%;
            min-width: 150px;
            max-width: 180px;
        }

        .message-avatar.clickable {
            cursor: pointer;
            transition: transform 0.2s ease, box-shadow 0.2s ease;
        }

        .message-avatar.clickable:hover {
            transform: scale(1.06);
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
        }

        .message-avatar.clickable:focus-visible {
            outline: 3px solid rgba(0, 151, 178, 0.5);
            outline-offset: 2px;
        }

        .message-content-wrapper {
            display: flex;
            flex-direction: column;
        }

        .message-text {
            word-wrap: break-word;
        }

        .message-text strong {
            font-weight: 600;
            color: #333;
        }

        .message-text em {
            font-style: italic;
        }

        /* Drawer Styles */
        .drawer {
            position: absolute;
            top: 0;
            bottom: 0;
            width: 280px;
            background: white;
            box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
            transform: translateX(-100%);
            transition: transform 0.3s ease;
            z-index: 1000;
            display: flex;
            flex-direction: column;
        }

        .drawer.open {
            transform: translateX(0);
        }

        .left-drawer {
            left: 0;
        }

        .right-drawer {
            right: 0;
            left: auto;
            transform: translateX(100%);
        }

        .right-drawer.open {
            transform: translateX(0);
        }

        .drawer-overlay {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.3);
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease;
            z-index: 999;
        }

        .drawer-overlay.active {
            opacity: 1;
            pointer-events: all;
        }

        .drawer-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px;
            border-bottom: 1px solid #e0e0e0;
            background: #f8f9fa;
        }

        .drawer-header h3 {
            font-size: 18px;
            color: #333;
            margin: 0;
        }

        .close-drawer {
            background: none;
            border: none;
            font-size: 24px;
            color: #666;
            cursor: pointer;
            padding: 0;
            width: 30px;
            height: 30px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            transition: background 0.2s;
        }

        .close-drawer:hover {
            background: #e0e0e0;
        }

        .drawer-content {
            flex: 1;
            overflow-y: auto;
            padding: 10px;
        }

        .drawer-item {
            padding: 15px;
            margin: 5px 0;
            background: #f8f9fa;
            border-radius: 10px;
            cursor: pointer;
            transition: background 0.2s, transform 0.1s;
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .drawer-item:hover {
            background: #e9ecef;
            transform: translateX(3px);
        }

        .drawer-item.active {
            background: #0097b2;
            color: white;
        }

        .drawer-item.active .drawer-item-icon {
            background: rgba(255, 255, 255, 0.2);
        }

        .drawer-item-icon {
            font-size: 24px;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: white;
            border-radius: 50%;
            flex-shrink: 0;
            overflow: hidden;
        }

        .drawer-item-icon img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .drawer-item-icon .drawer-item-initial {
            font-size: 18px;
            font-weight: 600;
            text-transform: uppercase;
        }

        .drawer-item-text {
            flex: 1;
        }

        .drawer-item-text .name {
            font-weight: 600;
            font-size: 14px;
            margin-bottom: 2px;
        }

        .drawer-item-text .status {
            font-size: 12px;
            opacity: 0.7;
        }

        /* Main Chat Area */
        .main-chat-area {
            flex: 1;
            display: flex;
            flex-direction: column;
            min-width: 0;
            min-height: 0;
            position: relative;
            overflow: hidden;
        }

        
        /* Clue detail styles */
        .clue-detail-image {
            width: 100%;
            max-width: 100%;
            border-radius: 10px;
            margin-bottom: 15px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            cursor: pointer;
            transition: transform 0.2s, box-shadow 0.2s;
        }
        
        .clue-detail-image:hover {
            transform: scale(1.02);
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
        }
        
        .clue-detail-text {
            padding: 15px;
            background: #f8f9fa;
            border-radius: 10px;
            font-size: 14px;
            line-height: 1.6;
            white-space: pre-wrap;
        }
        
        .clue-detail-text strong {
            font-weight: 600;
            color: #333;
        }
        
        .clue-detail-text em {
            font-style: italic;
        }
        
        /* Full-size image modal */
        .image-modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.9);
            z-index: 10001;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease;
        }
        
        .image-modal-overlay.active {
            opacity: 1;
            pointer-events: all;
        }
        
        .image-modal-content {
            max-width: 90%;
            max-height: 90%;
            object-fit: contain;
            border-radius: 10px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
        }
        
        .image-modal-close {
            position: absolute;
            top: 20px;
            right: 30px;
            background: rgba(255, 255, 255, 0.2);
            border: none;
            color: white;
            font-size: 32px;
            width: 50px;
            height: 50px;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background 0.2s;
            z-index: 10002;
        }
        
        .image-modal-close:hover {
            background: rgba(255, 255, 255, 0.3);
        }
        
        /* Tutorial/Spotlight Styles */
        .tutorial-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: 100000;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease;
        }
        
        .tutorial-overlay.active {
            opacity: 1;
            pointer-events: all;
        }
        
        .tutorial-spotlight {
            position: fixed;
            border: 3px solid #0097b2;
            border-radius: 12px;
            box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5), 
                        0 0 20px rgba(0, 151, 178, 0.6),
                        inset 0 0 20px rgba(0, 151, 178, 0.2);
            background: transparent;
            z-index: 100001;
            transition: all 0.3s ease;
            pointer-events: none;
            display: none;
        }
        
        .tutorial-spotlight.active {
            display: block;
        }

        .tutorial-overlay-light {
            background: rgba(0, 0, 0, 0.2) !important;
        }

        .tutorial-spotlight-light {
            box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.25),
                        0 0 25px rgba(0, 151, 178, 0.7),
                        inset 0 0 24px rgba(0, 151, 178, 0.25) !important;
        }
        
        .tutorial-tooltip {
            position: fixed;
            background: white;
            border-radius: 12px;
            padding: 20px;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
            z-index: 100002;
            max-width: 350px;
            min-width: 280px;
            font-size: 15px;
            line-height: 1.6;
            color: #333;
            pointer-events: auto;
        }
        
        .tutorial-tooltip::before {
            content: '';
            position: absolute;
            width: 0;
            height: 0;
            border: 12px solid transparent;
        }
        
        .tutorial-tooltip.tooltip-top::before {
            bottom: -24px;
            left: 50%;
            transform: translateX(-50%);
            border-top-color: white;
        }
        
        .tutorial-tooltip.tooltip-bottom::before {
            top: -24px;
            left: 50%;
            transform: translateX(-50%);
            border-bottom-color: white;
        }
        
        .tutorial-tooltip.tooltip-left::before {
            right: -24px;
            top: 50%;
            transform: translateY(-50%);
            border-left-color: white;
        }
        
        .tutorial-tooltip.tooltip-right::before {
            left: -24px;
            top: 50%;
            transform: translateY(-50%);
            border-right-color: white;
        }
        
        .tutorial-tooltip-title {
            font-weight: 600;
            font-size: 18px;
            margin-bottom: 10px;
            color: #0097b2;
        }
        
        .tutorial-tooltip-text {
            margin-bottom: 15px;
        }
        
        .tutorial-tooltip-button {
            background: #0097b2;
            color: white;
            border: none;
            padding: 12px 24px;
            border-radius: 8px;
            font-size: 15px;
            font-weight: 600;
            cursor: pointer;
            width: 100%;
            transition: background 0.2s;
            font-family: Georgia, 'Times New Roman', Times, serif;
        }
        
        .tutorial-tooltip-button:hover {
            background: #007a91;
        }
        
        .tutorial-tooltip-skip {
            background: transparent;
            color: #666;
            border: none;
            padding: 8px;
            margin-top: 10px;
            cursor: pointer;
            font-size: 13px;
            text-decoration: underline;
        }
        
        .tutorial-tooltip-skip:hover {
            color: #333;
        }
        
        /* Word highlighting styles */
        .highlight {
            border-bottom: 2px dotted rgba(212, 175, 100, 0.5);
            background: linear-gradient(180deg, 
                transparent 0%, 
                transparent 50%, 
                rgba(212, 175, 100, 0.2) 50%, 
                rgba(212, 175, 100, 0.2) 95%, 
                transparent 95%);
            cursor: pointer;
            position: relative;
            transition: all 0.2s ease;
            user-select: none;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
        }

        .highlight::after {
            content: '*';
            position: absolute;
            top: -0.2em;
            right: -0.4em;
            color: #d4af64;
            font-size: 0.65em;
            font-weight: 600;
            pointer-events: none;
        }
        
        .highlight:hover {
            background: linear-gradient(180deg, 
                transparent 0%, 
                transparent 50%, 
                rgba(212, 175, 100, 0.35) 50%, 
                rgba(212, 175, 100, 0.35) 95%, 
                transparent 95%);
            border-bottom-color: rgba(212, 175, 100, 0.8);
        }
        
        .highlight.loading {
            cursor: wait;
            opacity: 0.6;
            /* Override any animation from .loading class */
            animation: none !important;
            transform: none !important;
            width: auto !important;
            height: auto !important;
            border: none !important;
            border-radius: 0 !important;
            margin: 0 !important;
        }
        
        .explain-inline {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            color: #d4af64;
            font-size: 0.8em;
            font-weight: 500;
            margin-left: 4px;
            cursor: pointer;
            vertical-align: middle;
            opacity: 0;
            transition: opacity 0.2s ease;
        }
        
        .highlight:hover .explain-inline,
        .highlight.active .explain-inline {
            opacity: 1;
        }
        
        .explain-inline:hover {
            color: #1a5563;
        }
        
        .explain-inline::before {
            content: "💡";
            font-size: 0.9em;
        }
        
        /* Allow text selection in message text, but handle highlights specially */
        .message-text {
            user-select: text;
            -webkit-user-select: text;
            -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
            /* Don't use touch-action: manipulation here as it blocks text selection */
        }
        
        /* Prevent context menu on highlights only */
        .highlight {
            -webkit-touch-callout: none; /* Prevent context menu on iOS */
            touch-action: manipulation; /* Improve touch responsiveness */
        }
        
        /* Improve touch target size on mobile */
        @media (max-width: 768px) {
            .highlight {
                min-height: 24px; /* Ensure touch target is large enough */
                padding: 2px 0; /* Add some padding for easier tapping */
            }
        }

        /* Nina floating help button */
        .nina-floating-button {
            position: relative;
            width: 42px;
            height: 42px;
            padding: 0;
            border-radius: 50%;
            border: 2px solid rgba(212, 175, 100, 0.7);
            background: none;
            display: none; /* JS toggles to flex */
            align-items: center;
            justify-content: center;
            overflow: hidden;
            cursor: pointer;
            flex-shrink: 0;
            margin-left: auto;
            z-index: 1;
            box-shadow: none;
            transform: none;
            transition: all 0.3s ease;
        }

        .nina-floating-button-chat {
            position: absolute;
            right: 20px;
            bottom: 88px;
            margin-left: 0;
            z-index: 120;
        }

        .nina-floating-button:hover {
            border-color: #d4af64;
            transform: scale(1.08);
            box-shadow: 0 0 16px rgba(212, 175, 100, 0.4);
        }

        .nina-floating-button:active {
            transform: scale(1.02);
        }

        .nina-floating-button::after {
            content: "";
            position: absolute;
            bottom: 1px;
            right: 1px;
            width: 10px;
            height: 10px;
            background: #4ade80;
            border: 2px solid #1a5563;
            border-radius: 50%;
            z-index: 2;
        }

        .nina-avatar {
            width: 100%;
            height: 100%;
            border-radius: 999px;
            object-fit: cover;
            display: block;
        }

        @media (max-width: 768px) {
            .nina-floating-button {
                width: 36px;
                height: 36px;
                border-width: 1.5px;
            }

            .nina-floating-button-chat {
                right: 12px;
                bottom: calc(76px + env(safe-area-inset-bottom));
            }

            .nina-floating-button::after {
                width: 8px;
                height: 8px;
                bottom: 0;
                right: 0;
                border-width: 1.5px;
            }
        }

        /* Nina chat modal */
        .nina-chat-modal {
            position: fixed;
            inset: 0;
            display: none; /* JS toggles to flex */
            flex-direction: column;
            align-items: center;
            justify-content: flex-end;
            padding: 16px;
            z-index: 1600;
        }

        .nina-chat-modal::before {
            content: "";
            position: absolute;
            inset: 0;
            background: rgba(0, 0, 0, 0.45);
        }

        .nina-chat-header,
        .nina-chat-messages,
        .nina-chat-input-area {
            position: relative;
            z-index: 1;
            width: min(520px, 100%);
            background: white;
        }

        .nina-chat-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 14px 14px;
            border-radius: 14px 14px 0 0;
            border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        }

        .nina-chat-header-content {
            display: flex;
            align-items: center;
            gap: 10px;
            min-width: 0;
        }

        .nina-chat-avatar {
            width: 36px;
            height: 36px;
            border-radius: 999px;
            object-fit: cover;
            flex-shrink: 0;
            display: block;
        }

        .nina-chat-header h3 {
            margin: 0;
            font-size: 16px;
            line-height: 1.2;
        }

        .nina-chat-header p {
            margin: 2px 0 0 0;
            font-size: 12px;
            opacity: 0.75;
        }

        .nina-chat-close {
            background: transparent;
            border: none;
            color: #333;
            padding: 8px;
            width: 36px;
            height: 36px;
            border-radius: 10px;
            cursor: pointer;
            flex-shrink: 0;
            box-shadow: none;
            transform: none;
        }

        .nina-chat-close:hover {
            background: rgba(0, 0, 0, 0.06);
            box-shadow: none;
            transform: none;
        }

        .nina-chat-messages {
            padding: 14px;
            max-height: min(60vh, 520px);
            overflow-y: auto;
            overflow-x: hidden;
        }

        .nina-chat-input-area {
            display: flex;
            align-items: flex-end;
            gap: 10px;
            padding: 12px 14px 14px;
            border-radius: 0 0 14px 14px;
            border-top: 1px solid rgba(0, 0, 0, 0.06);
        }

        #ninaChatInput {
            flex: 1;
            resize: none;
            min-height: 40px;
            max-height: 120px;
            padding: 10px 12px;
            border: 1px solid rgba(0, 0, 0, 0.15);
            border-radius: 12px;
            font: inherit;
            outline: none;
        }

        #ninaChatInput:focus {
            border-color: #0097b2;
            box-shadow: 0 0 0 3px rgba(0, 151, 178, 0.15);
        }

        #ninaChatSendBtn {
            padding: 12px 16px;
            border-radius: 12px;
        }

        .nina-chat-message {
            display: flex;
            gap: 10px;
            margin-bottom: 10px;
            align-items: flex-start;
        }

        .nina-chat-message.user {
            justify-content: flex-end;
        }

        .nina-chat-message-avatar {
            width: 28px;
            height: 28px;
            border-radius: 999px;
            object-fit: cover;
            flex-shrink: 0;
            display: block;
        }

        .nina-chat-message-content {
            max-width: 80%;
            padding: 10px 12px;
            border-radius: 14px;
            background: #f5f3ef;
            color: #222;
            line-height: 1.35;
            word-wrap: break-word;
        }

        .nina-chat-message.user .nina-chat-message-content {
            background: #0097b2;
            color: white;
        }

        /* Character profile overlay (opened from message avatar) */
        .character-profile-overlay {
            position: fixed;
            inset: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(0, 0, 0, 0.45);
            z-index: 1700;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.25s ease;
            padding: 16px;
        }

        .character-profile-overlay.active {
            opacity: 1;
            pointer-events: auto;
        }

        .character-profile-card {
            width: min(420px, 100%);
            background: white;
            border-radius: 18px;
            box-shadow: 0 25px 70px rgba(0, 0, 0, 0.25);
            overflow: hidden;
        }

        .character-profile-header {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 14px 16px;
            border-bottom: 1px solid rgba(0, 0, 0, 0.08);
        }

        .character-profile-header h3 {
            margin: 0;
            font-size: 16px;
            color: #2f3a40;
        }

        .character-profile-back {
            width: 36px;
            height: 36px;
            padding: 0;
            border-radius: 10px;
            border: none;
            box-shadow: none;
            transform: none;
            background: transparent;
            color: #1a5563;
            font-size: 22px;
            line-height: 1;
            cursor: pointer;
        }

        .character-profile-back:hover {
            background: rgba(0, 0, 0, 0.06);
            box-shadow: none;
            transform: none;
        }

        .character-profile-body {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            padding: 24px 18px 10px;
        }

        .character-profile-avatar {
            width: 112px;
            height: 112px;
            border-radius: 999px;
            object-fit: cover;
            border: 3px solid rgba(0, 151, 178, 0.2);
            box-shadow: 0 8px 22px rgba(0, 0, 0, 0.15);
        }

        .character-profile-name {
            font-size: 20px;
            font-weight: 600;
            color: #1f2a31;
            text-align: center;
        }

        .character-profile-status {
            font-size: 13px;
            color: #5a6a72;
            text-align: center;
        }

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

        .character-profile-action {
            width: 100%;
            border-radius: 12px;
            padding: 13px 16px;
            font-size: 14px;
            font-weight: 600;
            text-transform: none;
        }

        .character-profile-action.primary {
            background: #0097b2;
            color: #fff;
        }

        .character-profile-action.secondary {
            background: #f5f7f8;
            border: 1px solid rgba(0, 0, 0, 0.12);
            color: #1a5563;
        }

        .character-profile-action.secondary:hover {
            background: #e9eef1;
        }

        .character-profile-action:disabled {
            background: #e2e7ea;
            color: #8c99a3;
            cursor: not-allowed;
            box-shadow: none;
            transform: none;
        }
    