        :root {
            /* Keep jewel tones for question slides (untouched) */
            --ruby: #D32F2F;
            --sapphire: #1976D2;
            --emerald: #388E3C;
            --gold: #FBC02D;

            /* Renmory Watercolor palette */
            --bg-dark: #F3EDDE;
            --bg-darker: #EDE7D9;
            --sidebar-bg: rgba(243, 237, 222, 0.70);
            --card-bg: rgba(243, 237, 222, 0.75);
            --toolbar-bg: rgba(210, 196, 175, 0.95);
            --carousel-bg: rgba(225, 213, 193, 0.90);
            --text-primary: #4a4a4a;
            --text-secondary: #8b7e6a;
            --text-heading: #5d4037;
            --border-warm: rgba(180, 130, 100, 0.2);
            --border-medium: rgba(180, 130, 100, 0.35);
            /* shadows removed — design system prohibits all shadows */
            --pink: rgba(240, 98, 146, 0.9);
            --green-accent: rgba(174, 213, 129, 0.9);
            --gold-accent: rgba(255, 183, 77, 0.9);
            --slide-aspect: 16/10;
        }

        * {
            box-sizing: border-box;
        }

        body {
            margin: 0;
            padding: 0;
            background-color: #F3EDDE;
            background-image: url('/wedding_theme_elements/watercolor_background.webp');
            background-size: cover;
            background-attachment: fixed;
            background-position: center;
            background-blend-mode: luminosity;
            min-height: 100vh;
            min-height: 100dvh;
            font-family: 'Noto Serif TC', 'SatsukiGendaiMincho', serif;
            color: var(--text-primary);
            padding-bottom: env(safe-area-inset-bottom, 0px);
        }

        h1, h2 { font-family: 'ChenYuluoyan', 'SatsukiGendaiMincho', 'Noto Serif TC', serif; }
        h3, h4, h5, h6 { font-family: 'Noto Serif TC', 'SatsukiGendaiMincho', serif; }
        button { font-family: 'Noto Serif TC', 'SatsukiGendaiMincho', serif; }
        input:not([type="radio"]):not([type="checkbox"]) { font-family: 'Noto Serif TC', 'SatsukiGendaiMincho', serif; }

        /* Simplified Chinese */
        :lang(zh-CN) body,
        :lang(zh-CN) h1, :lang(zh-CN) h2,
        :lang(zh-CN) h3, :lang(zh-CN) h4, :lang(zh-CN) h5, :lang(zh-CN) h6,
        :lang(zh-CN) button,
        :lang(zh-CN) input:not([type="radio"]):not([type="checkbox"]) {
            font-family: 'Noto Serif SC', 'PingFang SC', 'Microsoft YaHei', serif;
        }

        /* Thai */
        :lang(th) body,
        :lang(th) h1, :lang(th) h2,
        :lang(th) h3, :lang(th) h4, :lang(th) h5, :lang(th) h6,
        :lang(th) button,
        :lang(th) input:not([type="radio"]):not([type="checkbox"]) {
            font-family: 'Sarabun', 'Noto Serif TC', serif;
        }

        /* Global warm scrollbars */
        *::-webkit-scrollbar { width: 6px; height: 6px; }
        *::-webkit-scrollbar-track { background: transparent; }
        *::-webkit-scrollbar-thumb { background: rgba(180, 130, 100, 0.25); border-radius: 3px; }
        *::-webkit-scrollbar-thumb:hover { background: rgba(180, 130, 100, 0.4); }

        /* Top Toolbar */
        .top-toolbar {
            background: var(--toolbar-bg);
            border-bottom: 1px solid var(--border-medium);
            padding: 0.5rem 1.5rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 100;
            min-height: 60px;
        }

        .toolbar-left {
            display: flex;
            align-items: center;
            gap: 1rem;
        }

        .back-btn {
            width: 44px;
            height: 44px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: none;
            border: 2px solid transparent;
            color: var(--text-secondary);
            font-size: 1.5rem;
            cursor: pointer;
            padding: 0;
            transition: all 0.2s;
            flex-shrink: 0;
            border-radius: 50px;
            box-shadow: none;
        }

        .back-btn:hover {
            color: var(--text-primary);
            border-color: var(--border-medium);
        }

        #quizTitle {
            background: transparent;
            border: 2px solid transparent;
            color: var(--text-primary);
            font-size: 1.2rem;
            padding: 0.5rem 0.75rem;
            border-radius: 8px;
            min-width: 250px;
            font-family: inherit;
            line-height: normal;
            margin: 0;
            vertical-align: middle;
        }

        #quizTitle:hover {
            border-color: var(--border-medium);
        }

        #quizTitle:focus {
            border-color: rgba(141, 110, 99, 0.6);
            outline: none;
        }

        .toolbar-right {
            display: flex;
            align-items: center;
            gap: 0.75rem;
        }

        .toolbar-btn {
            width: 44px;
            height: 44px;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0;
            border: none;
            border-radius: 50px;
            font-family: inherit;
            font-size: 1.1rem;
            cursor: pointer;
            transition: all 0.15s;
            box-shadow: none;
            flex-shrink: 0;
        }

        .toolbar-btn:active {
            transform: scale(0.95);
            box-shadow: none;
        }

        .save-btn {
            background: var(--green-accent);
            color: #fff;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 0.25rem;
        }

        .save-btn.loading {
            pointer-events: none;
            opacity: 0.8;
        }

        .save-btn .spinner {
            display: none;
            width: 16px;
            height: 16px;
            border: 2px solid rgba(255, 255, 255, 0.3);
            border-top-color: #fff;
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }

        .save-btn.loading .spinner {
            display: inline-block;
        }

        .save-btn.loading .save-text {
            display: none;
        }

        @keyframes spin {
            to {
                transform: rotate(360deg);
            }
        }

        .play-btn {
            background: var(--gold-accent);
            color: #fff;
        }

        .logout-btn {
            background: var(--pink);
            color: #fff;
        }

        .lang-btn {
            background: rgba(142, 175, 197, 0.9);
            color: #fff;
            font-size: 1.2rem;
            font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
        }

        /* Main Layout */
        .dashboard-grid {
            display: grid;
            grid-template-columns: 180px 1fr;
            height: calc(100vh - 60px);
            height: calc(100dvh - 60px);
            margin-top: 60px;
        }

        /* Slide Carousel Sidebar */
        .slide-carousel {
            background: var(--carousel-bg);
            border-right: 1px solid var(--border-medium);
            padding: 1rem 0.75rem;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }

        .slide-item {
            display: flex;
            align-items: center;
            gap: 0.25rem;
            position: relative;
        }

        .slide-item {
            transition: transform 0.15s ease-out;
        }

        .slide-item.shift-down {
            transform: translateY(calc(100% + 0.75rem));
        }

        .slide-item.shift-up {
            transform: translateY(calc(-100% - 0.75rem));
        }

        .slide-thumbnail.dragging {
            opacity: 0.4;
            transform: scale(0.95);
        }

        .slide-carousel.dragging-active .slide-item:not(.shift-down):not(.shift-up) {
            transition: transform 0.15s ease-out;
        }

        .thumb-actions {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.25rem;
        }

        .thumb-actions .slide-index-number {
            opacity: 1;
        }

        .thumb-action-btn {
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.15s;
        }

        .thumb-actions.visible .thumb-action-btn {
            opacity: 1;
            pointer-events: auto;
        }

        .thumb-action-btn {
            width: 22px;
            height: 22px;
            padding: 0;
            border: none;
            background: transparent;
            cursor: pointer;
            color: var(--text-secondary);
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: none;
            transition: color 0.15s, transform 0.1s;
        }

        .thumb-action-btn:active {
            transform: translateY(0);
        }

        .thumb-action-btn:hover {
            color: var(--text-primary);
        }

        .thumb-action-btn.destructive {
            color: rgba(240, 98, 146, 0.9);
        }

        .thumb-action-btn svg {
            width: 16px;
            height: 16px;
            stroke: currentColor;
            fill: none;
            stroke-width: 1.6;
            stroke-linecap: round;
            stroke-linejoin: round;
        }

        .slide-thumbnail {
            background: rgba(243, 237, 222, 0.80);
            border: 3px solid transparent;
            border-radius: 6px;
            padding: 0.5rem;
            cursor: pointer;
            transition: all 0.2s;
            position: relative;
            flex: 1;
            aspect-ratio: var(--slide-aspect);
            width: 100%;
            height: auto;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        .slide-thumbnail:hover {
            border-color: var(--border-medium);
        }

        .slide-thumbnail.active {
            border-color: rgba(141, 110, 99, 0.6);
            
        }

        .slide-index-number {
            color: var(--text-secondary);
            font-size: 0.75rem;
            font-weight: normal;
            width: 22px;
            height: 22px;
            display: flex;
            align-items: center;
            justify-content: center;
            text-align: center;
        }

        /* NOTE: background is set by theme CSS files */
        .slide-preview {
            aspect-ratio: var(--slide-aspect);
            border-radius: 4px;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            padding: 0.35rem;
            flex: 1;
        }

        .preview-question {
            font-size: 0.45rem;
            color: #000;
            text-align: center;
            margin-bottom: 0.25rem;
            padding: 0 0.2rem;
            line-height: 1.1;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        .preview-answers {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 2px;
            flex: 1;
            margin-top: 0.15rem;
        }

        .preview-answer {
            border-radius: 2px;
        }

        .preview-answer.c1 {
            background: rgb(240, 98, 146);
        }

        .preview-answer.c2 {
            background: rgb(174, 213, 129);
        }

        .preview-answer.c3 {
            background: rgb(255, 183, 77);
        }

        .preview-answer.c4 {
            background: rgb(77, 182, 172);
        }

        .add-slide-btn {
            background: transparent;
            border: 2px dashed var(--border-medium);
            border-radius: 6px;
            color: var(--text-secondary);
            padding: 1.5rem;
            cursor: pointer;
            font-family: inherit;
            font-size: 1.5rem;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .add-slide-btn:hover {
            border-color: rgba(141, 110, 99, 0.5);
            color: var(--text-primary);
            background: rgba(255, 255, 255, 0.3);
        }

        /* Main Editor Area */
        .main-editor {
            overflow-y: auto;
            padding: 2rem;
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .slide-container {
            width: 100%;
            max-width: 900px;
        }

        /* Question Slide (Styled like actual quiz - Match Prototype) */
        /* NOTE: background-color and background-image are set by theme CSS files */
        .question-slide {
            border: none;
            border-radius: 8px;
            padding: 0.75rem 2.5rem;
            margin-bottom: 2rem;
            position: relative;
            width: 100%;
            aspect-ratio: 16 / 10;
            display: flex;
            flex-direction: column;
            justify-content: flex-start;
            gap: 0.5rem;
            overflow: hidden;
        }

        .slide-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 1rem;
        }

        .question-number-badge {
            background: var(--ruby);
            color: #fff;
            padding: 0.25rem 0.75rem;
            font-size: 0.85rem;
            border: 2px solid #000;
        }

        .slide-actions {
            display: flex;
            gap: 0.5rem;
        }

        .slide-action-btn {
            background: #fff;
            border: 2px solid #000;
            padding: 0.25rem 0.5rem;
            cursor: pointer;
            font-size: 0.85rem;
            transition: all 0.15s;
        }

        .slide-action-btn:hover {
            background: #f0f0f0;
        }

        .slide-action-btn.delete {
            background: var(--ruby);
            color: #fff;
        }

        /* Question Input - Match Prototype Header Style */
        .question-input-container {
            background: transparent;
            border: none;
            padding: 0;
            margin-top: 1rem;
            margin-bottom: 0.25rem;
            box-shadow: none;
            flex-shrink: 0;
        }

        .question-input {
            margin: 0 auto;
            display: block;
            border: none;
            font-size: 1.75rem;
            font-family: 'Noto Serif TC', 'SatsukiGendaiMincho', serif;
            text-align: center;
            background: transparent;
            color: #000;
            box-shadow: none;
            
            line-height: 1.3;
            word-wrap: normal;
            overflow-wrap: normal;
            white-space: nowrap;
            padding: 0 1rem;
            resize: none;
            overflow: hidden;
            text-overflow: ellipsis;
            width: 95%;
        }

        .question-input:focus {
            outline: none;
        }

        .question-input::placeholder {
            color: #999;
            text-shadow: none;
        }

        /* Media Upload Area - Match Prototype Media Container */
        .media-upload-area {
            background: #000;
            border: 4px solid #000;
            border-radius: 0;
            padding: 1rem;
            text-align: center;
            margin: 0 auto 0.75rem;
            cursor: pointer;
            transition: all 0.2s;
            max-width: 180px;
            max-height: 187px;
            aspect-ratio: 16/10;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            
            flex-shrink: 1;
        }

        .media-upload-area:hover {
            border-color: var(--sapphire);
        }

        /* NEW MEDIA WORKFLOW STYLES */
        .media-selection-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
            width: 100%;
            max-width: 500px;
            margin: 0.5rem auto 0.5rem;
        }

        /* Shared Button Styles */
        .media-option,
        .question-ideas-btn,
        .timer-btn {
            background: rgba(211, 215, 215, 0.4);
            /* Semi-transparent grey */
            border: 3px solid #333;
            
            cursor: pointer;
            font-family: inherit;
        }

        /* Timer Button Styles */
        .timer-btn {
            padding: 0.5rem 1rem;
            border-radius: 4px;
            font-size: 0.9rem;
            font-weight: bold;
            color: #333;
            white-space: nowrap;
            display: inline-flex;
            align-items: center;
            gap: 0.25rem;
        }

        .timer-btn:hover {
            background: rgba(211, 215, 215, 0.6);
        }

        .timer-btn:active {
            transform: translateY(1px);
            
        }



        .media-option {
            padding: 1rem;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
            text-align: center;
            aspect-ratio: 16/10;
        }

        .media-icon {
            font-size: 2.5rem;
            line-height: 1;
        }

        .media-label {
            font-family: 'Noto Serif TC', 'SatsukiGendaiMincho', serif;
            font-size: 0.9rem;
            color: #333;
            line-height: 1.2;
        }

        /* Filled State */
        .filled-media-wrapper {
            width: 100%;
            max-width: 180px;
            margin: 0.5rem auto 0.5rem;
            display: flex;
            flex-direction: column;
        }

        .filled-media-container {
            background: transparent;
            aspect-ratio: 16/10;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }

        .filled-media-container img {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }

        .media-action-bar {
            display: flex;
            background: #fff;
            height: 48px;
        }

        .media-action-btn {
            flex: 1;
            border: none;
            background: #ffe5b4;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.25rem;
            transition: background 0.15s;
        }

        .media-action-btn:first-child {
            border-right: 1px solid rgba(0, 0, 0, 0.1);
        }

        .media-action-btn:last-child {
            border-left: 1px solid rgba(0, 0, 0, 0.1);
        }

        .media-action-btn:hover {
            background: #fff;
        }

        .media-action-btn.delete-btn:hover {
            background: #ffcdd2;
            color: var(--ruby);
        }

        .media-upload-area.has-image {
            padding: 0;
        }

        .media-upload-area img {
            max-width: 100%;
            max-height: 100%;
            width: 100%;
            height: 100%;
            object-fit: contain;
            border: none;
            
        }

        .character-result {
            width: 400px;
            height: 480px;
            position: absolute;
            top: 0;
            left: 0;
        }

        /* Animation Keyframes */
        @keyframes sprite-walk {
            from {
                transform: translateX(0);
            }

            to {
                transform: translateX(-400px);
            }
        }

        @keyframes couple-walk {
            0%, 24.99% { transform: translateX(0); }
            25%, 49.99% { transform: translateX(-120px); }
            50%, 74.99% { transform: translateX(-240px); }
            75%, 100% { transform: translateX(-360px); }
        }

        /* Default Animation (Idle) */
        .character-result.animate {
            animation: sprite-walk 0.8s steps(4) infinite;
        }

        /* States (Rows) */
        .character-result.state-idle {
            top: 0;
        }

        .character-result.state-thinking {
            top: -120px;
        }

        .character-result.state-incorrect {
            top: -240px;
        }

        .character-result.state-correct {
            top: -360px;
        }

        .upload-icon {
            font-size: 1.5rem;
            color: var(--green-accent);
            margin-bottom: 0.25rem;
        }

        .upload-text {
            color: var(--text-secondary);
            font-size: 0.75rem;
            font-family: inherit;
        }

        /* Answer Cards Grid - Match Prototype */
        .answers-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
            flex-shrink: 0;
            width: 100%;
            box-sizing: border-box;
        }

        .answer-card {
            display: flex;
            justify-content: flex-start;
            align-items: center;
            padding: 0 16px;
            font-family: 'Noto Serif TC', 'SatsukiGendaiMincho', serif;
            font-size: 1.75rem;
            min-height: 80px;
            cursor: pointer;
            transition: transform 0.1s;
            position: relative;
        }

        .answer-input {
            flex: 1;
            min-width: 0;
            background: transparent;
            border-radius: 4px;
            padding: 8px 0 8px 0;
            margin: 0;
            font-size: 2.25rem;
            line-height: 1.5;
            font-family: 'Noto Serif TC', 'SatsukiGendaiMincho', serif;
            color: #fff;
            transition: all 0.2s;
            border: none;
            outline: none;
            box-shadow: none;
            white-space: nowrap;
            height: auto;
            transform: none;
            resize: none;
        }

        /* Textarea-specific styling.
         * overflow: visible is intentional — it allows Noto Serif TC descenders
         * (j, g, y, etc.) to paint past the textarea border-box without being
         * clipped. The JS auto-resize (autoResizeTextarea) already manages height
         * via scrollHeight, so there are no scrollbar or layout side-effects.
         */
        textarea.answer-input {
            overflow: visible;
            resize: none;
            /* Extra bottom clearance so the JS-set height leaves room for descenders */
            padding-bottom: 12px;
        }

        /* Force removal of global borders/shadows from inputs on dashboard */
        .question-slide .question-input,
        .question-slide .answer-input {
            border: none !important;
            box-shadow: none !important;
            outline: none !important;
        }

        .question-slide .question-input-container {
            border: none !important;
            box-shadow: none !important;
        }

        .answer-card.choice-4 .answer-input {
            color: #000;
            background: transparent;
        }

        .answer-input:focus {
            background: transparent;
        }

        .answer-card.choice-4 .answer-input:focus {
            background: transparent;
        }

        .answer-input::placeholder {
            color: rgba(255, 255, 255, 0.6);
        }

        .answer-card.choice-4 .answer-input::placeholder {
            color: rgba(0, 0, 0, 0.5);
        }

        /* Mobile carousel - hidden on desktop */
        .mobile-carousel-container {
            display: none;
            position: relative;
        }

        .mobile-carousel-header {
            display: none;
            justify-content: space-between;
            align-items: center;
            padding: 0 0.75rem;
            margin-bottom: 0.25rem;
        }

        .mobile-carousel-title {
            color: var(--text-secondary);
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .rearrange-btn {
            background: transparent;
            border: 2px solid var(--border-medium);
            color: var(--text-secondary);
            padding: 0.35rem 0.65rem;
            font-family: inherit;
            font-size: 0.75rem;
            cursor: pointer;
            border-radius: 4px;
            transition: all 0.15s;
            display: none;
            align-items: center;
            gap: 0.35rem;
        }

        .rearrange-btn:hover {
            border-color: var(--border-medium);
            color: var(--text-primary);
            background: rgba(255, 255, 255, 0.3);
        }

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

        /* Fixed buttons on the right side of mobile carousel */
        .mobile-carousel-fixed-buttons {
            position: absolute;
            right: 0.75rem;
            top: 0;
            bottom: 0;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            background: linear-gradient(to right, transparent 0%, var(--sidebar-bg) 20%, var(--sidebar-bg) 100%);
            padding-left: 1.5rem;
            z-index: 10;
            pointer-events: none;
        }

        .mobile-carousel-fixed-buttons>* {
            pointer-events: auto;
        }

        .mobile-carousel-add-btn {
            background: transparent;
            border: 2px dashed var(--border-medium);
            border-radius: 6px;
            color: var(--text-secondary);
            cursor: pointer;
            font-family: inherit;
            font-size: 1.5rem;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 62.5px;
            height: 62.5px;
            flex-shrink: 0;
            padding: 0;
        }

        .mobile-carousel-add-btn:hover {
            border-color: rgba(141, 110, 99, 0.5);
            color: var(--text-primary);
            background: rgba(255, 255, 255, 0.3);
        }

        .mobile-carousel-rearrange-btn {
            background: transparent;
            border: 2px solid var(--border-medium);
            color: var(--text-secondary);
            cursor: pointer;
            border-radius: 6px;
            transition: all 0.15s;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 62.5px;
            height: 62.5px;
            flex-shrink: 0;
            padding: 0;
        }

        .mobile-carousel-rearrange-btn:hover {
            border-color: rgba(141, 110, 99, 0.5);
            color: var(--text-primary);
            background: rgba(255, 255, 255, 0.3);
        }

        .mobile-carousel-rearrange-btn:active {
            transform: scale(0.95);
        }

        .mobile-carousel-rearrange-btn svg {
            width: 20px;
            height: 20px;
            stroke: currentColor;
            fill: none;
            stroke-width: 2;
            stroke-linecap: round;
        }

        .correct-indicator {
            position: absolute;
            right: 0.75rem;
            top: 50%;
            transform: translateY(-50%);
            width: 28px;
            height: 28px;
            border: 2px solid rgba(255, 255, 255, 0.5);
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
        }

        .answer-card.choice-4 .correct-indicator {
            border-color: rgba(0, 0, 0, 0.4);
        }

        .correct-indicator.selected {
            background: #fff;
            border-color: #fff;
        }

        .correct-indicator.selected::after {
            content: '✓';
            color: var(--emerald);
            font-weight: bold;
            font-size: 1.1rem;
        }

        /* Welcome Screen */
        .welcome-screen {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100%;
            color: var(--text-secondary);
            text-align: center;
            padding: 2rem;
        }

        .welcome-screen h2 {
            font-size: 2.5rem;
            margin-bottom: 1rem;
            color: var(--text-heading);
            font-family: 'ChenYuluoyan', 'Noto Serif TC', serif;
        }

        .welcome-screen p {
            margin-bottom: 1.5rem;
        }

        .new-quiz-btn {
            background: var(--pink);
            color: #fff;
            border: none;
            border-radius: 50px;
            padding: 1rem 2rem;
            font-size: 1.1rem;
            font-family: inherit;
            cursor: pointer;
            box-shadow: none;
            transition: all 0.15s;
        }

        .new-quiz-btn:hover {
            transform: translateY(-2px);
            box-shadow: none;
        }

        .new-quiz-btn:active {
            transform: translateY(0);
            box-shadow: none;
        }

        /* Quiz Selector Modal */
        .quiz-selector-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(93, 64, 55, 0.3);
            z-index: 200;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .quiz-selector-overlay.hidden {
            display: none;
        }

        .quiz-selector-modal {
            background: rgba(248, 242, 230, 0.84);
            -webkit-backdrop-filter: blur(10px);
            backdrop-filter: blur(10px);
            border: none;
            border-radius: 24px;
            padding: 1.5rem;
            max-width: 500px;
            width: 90%;
            max-height: 80vh;
            overflow-y: auto;
            
        }

        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem;
            padding-bottom: 0.75rem;
            border-bottom: 1px solid var(--border-warm);
        }

        .modal-header h3 {
            color: var(--text-heading);
            margin: 0;
            font-family: 'Noto Serif TC', 'SatsukiGendaiMincho', serif;
        }

        .modal-close {
            background: none;
            border: 1px solid var(--text-secondary);
            border-radius: 50%;
            color: var(--text-secondary);
            font-size: 1rem;
            line-height: 1;
            cursor: pointer;
            width: 28px;
            height: 28px;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0;
            flex-shrink: 0;
        }

        .modal-close:hover {
            border-color: var(--text-primary);
            color: var(--text-primary);
            background: rgba(255,255,255,0.05);
        }


        /* Generic Modal Styles (for regeneration confirm etc) */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(93, 64, 55, 0.3);
            z-index: 200;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .modal-overlay.hidden {
            display: none !important;
        }

        .confirm-modal {
            background: rgba(248, 242, 230, 0.84);
            -webkit-backdrop-filter: blur(10px);
            backdrop-filter: blur(10px);
            border: none;
            border-radius: 24px;
            padding: 1.5rem;
            max-width: 450px;
            width: 90%;
            
            display: flex;
            flex-direction: column;
            color: var(--text-primary);
        }

        .confirm-modal h3 {
            margin-top: 0;
            color: var(--text-heading);
        }

        .confirm-actions {
            display: flex;
            justify-content: flex-end;
            gap: 1rem;
            margin-top: 1.5rem;
        }

        .confirm-btn {
            padding: 0.5rem 1rem;
            border: none;
            border-radius: 50px;
            font-family: inherit;
            font-size: 0.9rem;
            cursor: pointer;
            transition: all 0.15s;
            font-weight: bold;
        }

        .confirm-btn:hover {
            transform: translateY(-2px);
            
        }

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

        .confirm-btn.primary {
            background: var(--pink);
            color: #fff;
        }

        .confirm-btn.secondary {
            background: rgba(243, 237, 222, 0.85);
            color: var(--text-primary);
        }

        /* Override inline dark styles on regen modal */
        #regenModalMessage {
            color: var(--text-secondary) !important;
        }

        #regenModalMessage strong {
            color: var(--pink) !important;
        }

        .animations-link {
            color: var(--pink);
        }

        /* Dashboard Sections */
        .dashboard-section {
            margin-bottom: 1.5rem;
        }

        .section-header {
            color: var(--text-heading);
            font-size: 1rem;
            margin: 0 0 0.75rem 0;
            padding-bottom: 0.5rem;
            border-bottom: 1px solid var(--border-warm);
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .section-header-icon {
            font-size: 1.1rem;
        }

        /* Character Section */
        .character-section {
            margin-bottom: 1.25rem;
        }

        .character-subheader {
            color: var(--text-secondary);
            font-size: 0.85rem;
            margin: 0 0 0.5rem 0;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

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

        .upload-box {
            width: 100px;
            height: 120px;
            background: rgba(243, 237, 222, 0.50);
            border: 2px dashed var(--border-medium);
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            overflow: hidden;
            flex-shrink: 0;
        }

        .upload-box:hover {
            border-color: rgba(141, 110, 99, 0.5);
            background: rgba(243, 237, 222, 0.70);
        }

        .upload-box.has-image {
            border-style: solid;
            border-color: var(--green-accent);
        }

        .upload-content {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.25rem;
        }

        .upload-plus {
            font-size: 1.5rem;
            color: var(--text-secondary);
            line-height: 1;
        }

        .upload-label {
            font-size: 0.6rem;
            color: var(--text-secondary);
            text-align: center;
        }

        .upload-box:hover .upload-plus,
        .upload-box:hover .upload-label {
            color: var(--text-primary);
        }

        .upload-preview {
            width: 100%;
            height: 100%;
            object-fit: cover;
            border-radius: 6px;
        }

        .upload-preview.hidden {
            display: none;
        }

        .arrow-indicator {
            color: var(--text-secondary);
            font-size: 1.25rem;
            flex-shrink: 0;
        }

        .arrow-divider {
            color: var(--text-secondary);
            font-size: 1.25rem;
            flex-shrink: 0;
        }

        .result-box {
            width: 100px;
            height: 120px;
            background: transparent;
            border: 2px solid var(--border-medium);
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            overflow: hidden;
            flex-shrink: 0;
        }

        .result-box.has-result {
            border-color: var(--gold-accent);
            background: rgba(255, 183, 77, 0.1);
        }

        .result-box.has-result.has-history {
            cursor: pointer;
            transition: border-color 0.2s, box-shadow 0.2s;
        }

        .result-box.has-result.has-history:hover {
            border-color: var(--pink);
            box-shadow: 0 0 0 2px rgba(240, 98, 146, 0.15);
        }

        .result-box .history-badge {
            position: absolute;
            bottom: 3px;
            right: 3px;
            background: rgba(180, 130, 100, 0.85);
            color: #fff;
            font-size: 0.55rem;
            padding: 1px 5px;
            border-radius: 8px;
            z-index: 2;
            pointer-events: none;
            line-height: 1.4;
        }

        .result-placeholder {
            font-size: 1.5rem;
            opacity: 0.3;
        }

        .result-placeholder.hidden {
            display: none;
        }

        .placeholder-text {
            font-size: 0.7rem;
            color: var(--text-secondary);
            text-align: center;
            line-height: 1.4;
        }

        .character-result {
            position: absolute;
            top: 0;
            left: 0;
            max-width: none;
            width: 400px;
            height: 480px;
        }

        .character-result.preview {
            width: 100%;
            height: 100%;
        }

        .character-result.hidden {
            display: none;
        }

        /* Loading Spinner */
        .loading-spinner {
            width: 24px;
            height: 24px;
            border: 3px solid var(--border-medium);
            border-top-color: var(--pink);
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        .loading-spinner.hidden {
            display: none;
        }

        .loader {
            width: 24px;
            height: 24px;
            border: 3px solid var(--border-medium);
            border-top-color: var(--pink);
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        .loader.hidden {
            display: none;
        }

        .regenerate-container {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }

        .regenerate-btn {
            background: rgba(243, 237, 222, 0.65);
            border: 2px solid var(--border-medium);
            color: var(--text-secondary);
            width: 40px;
            height: 40px;
            border-radius: 50%;
            cursor: pointer;
            font-size: 1.25rem;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: none;
            transition: all 0.2s;
        }

        .regenerate-btn:hover {
            border-color: rgba(141, 110, 99, 0.5);
            color: var(--text-primary);
            background: rgba(243, 237, 222, 0.80);
            transform: rotate(30deg);
        }

        .regenerate-btn:active {
            transform: rotate(60deg) scale(0.95);
        }

        .regenerate-btn.hidden {
            display: none;
        }

        .quiz-list-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0.75rem;
            background: transparent;
            border: none;
            border-bottom: 1px solid var(--border-warm);
            border-radius: 0;
            margin-bottom: 0;
            cursor: pointer;
            transition: background 0.15s;
        }

        .quiz-list-item:first-child {
            border-radius: 8px 8px 0 0;
        }

        .quiz-list-item:last-child {
            border-bottom: none;
            border-radius: 0 0 8px 8px;
        }

        .quiz-list-item:only-child {
            border-radius: 8px;
            border-bottom: none;
        }

        .quiz-list-item:hover {
            background: rgba(243, 237, 222, 0.55);
        }

        .quiz-list-item.active {
            background: rgba(240, 98, 146, 0.10);
            border-left: 3px solid rgba(240, 98, 146, 0.7);
            padding-left: calc(0.75rem - 3px);
        }

        .quiz-list-item-name {
            color: var(--text-primary);
            flex: 1;
        }

        .quiz-delete-btn {
            background: none;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            padding: 0.25rem;
            transition: color 0.2s;
            box-shadow: none;
        }

        .quiz-delete-btn:hover {
            color: var(--pink);
        }

        .quiz-delete-btn:active {
            transform: translateY(0);
        }

        .quiz-delete-btn svg {
            width: 16px;
            height: 16px;
            stroke: currentColor;
            fill: none;
            stroke-width: 1.6;
            stroke-linecap: round;
            stroke-linejoin: round;
        }

        .create-new-btn {
            width: 100%;
            margin-top: 0.75rem;
            background: var(--pink);
            color: #fff;
            border: none;
            border-radius: 50px;
            padding: 0.75rem;
            font-family: inherit;
            font-size: 1rem;
            cursor: pointer;
            box-shadow: none;
            transition: all 0.15s;
        }

        .create-new-btn:hover {
            background: rgba(240, 98, 146, 1);
        }

        .quiz-list-empty {
            color: var(--text-secondary);
            text-align: center;
            padding: 1rem;
            font-size: 0.9rem;
        }

        /* Mobile Styles */
        @media (max-width: 768px) {
            html {
                overflow: hidden;
                height: 100%;
            }

            body {
                overflow: hidden;
                max-width: 100vw;
                height: 100dvh;
                width: 100%;
                background-color: #F3EDDE;
                background-image: url('/wedding_theme_elements/watercolor_background.webp');
                background-size: cover;
                background-attachment: fixed;
            }

            .mobile-carousel-header {
                display: none;
            }

            .rearrange-btn {
                display: none;
            }

            .dashboard-grid {
                grid-template-columns: 1fr;
                grid-template-rows: 1fr auto;
                height: calc(100dvh - 60px);
                max-height: calc(100dvh - 60px);
                max-width: 100vw;
                overflow: hidden;
                width: 100%;
            }

            /* Hide the sidebar carousel on mobile */
            .slide-carousel {
                display: none;
            }

            /* Main editor takes full height minus carousel */
            .main-editor {
                overflow: hidden;
                padding: 0;
                height: 100%;
                position: relative;
                max-width: 100vw;
                width: 100%;
                box-sizing: border-box;
            }

            /* Slide container fills the space and prevents scrolling */
            .slide-container {
                height: 100%;
                overflow: hidden;
                padding: 1rem 0.5rem 0.5rem 0.5rem;
                display: flex;
                flex-direction: column;
                max-width: 100vw;
                width: 100%;
                box-sizing: border-box;
            }

            /* Each question slide fills the viewport */
            .question-slide {
                padding: 0.75rem 1rem 0.5rem 1rem;
                aspect-ratio: auto;
                flex: 1 1 0;
                height: 100% !important;
                min-height: 0;
                margin-bottom: 0;
                display: none;
                overflow-x: hidden;
                overflow-y: auto;
                max-width: 100vw;
                width: 100%;
                box-sizing: border-box;
                flex-direction: column;
            }

            /* Only show the active slide */
            .question-slide.mobile-active {
                display: flex !important;
            }

            /* Push answers to bottom */
            .answers-grid {
                margin-top: auto;
            }

            .media-selection-grid {
                max-width: 100%;
                gap: 8px;
                min-height: 150px;
                align-items: stretch;
                margin-top: 0.5rem;
            }

            .media-option {
                padding: 0.5rem;
                aspect-ratio: auto !important;
                height: 100%;
            }

            .media-icon {
                font-size: 1.5rem;
            }

            .media-label {
                font-size: 0.8rem;
            }

            .filled-media-wrapper {
                max-width: 192px;
                margin-top: 0.5rem;
            }

            .media-action-bar {
                height: 44px;
            }

            .top-toolbar {
                padding: 0.75rem 0.75rem;
                min-height: 70px;
            }

            .toolbar-left {
                flex: 1;
                min-width: 0;
                gap: 0.5rem;
            }

            #quizTitle {
                min-width: 0;
                width: 100%;
                flex: 1;
                font-size: 1rem;
            }

            .toolbar-right {
                gap: 0.5rem;
                flex-shrink: 0;
            }

            .toolbar-btn,
            .back-btn {
                width: 44px;
                height: 44px;
                min-width: 44px;
                font-size: 1.1rem;
                padding: 0;
            }

            .back-btn {
                border: none;
                
                border-radius: 50px;
                color: var(--text-primary);
                background: rgba(255, 255, 255, 0.6);
            }

            .answer-card {
                padding: 14px 10px;
                font-size: 1.3rem;
                min-height: 127.5px;
                align-items: flex-start;
                min-width: 0;
                max-width: 100%;
                box-sizing: border-box;
                overflow: visible;
            }

            /* On mobile, allow text wrapping in textarea */
            textarea.answer-input {
                white-space: normal;
                word-wrap: break-word;
                overflow-wrap: break-word;
                overflow-y: visible;
                text-overflow: clip;
                font-size: 1.5rem !important;
                line-height: 1.3;
                height: auto;
                min-height: calc(1.5rem * 1.3);
                max-height: calc(1.5rem * 1.3 * 4);
                transform: translateY(0);
                padding: 0;
                padding-top: 2px;
                padding-right: 4px;
                margin: 0;
                flex: 1;
                min-width: 0;
                max-width: calc(100% - 32px);
                box-sizing: border-box;
            }

            input.answer-input {
                font-size: 1.3rem !important;
            }

            /* Ensure grid doesn't overflow */
            .answers-grid {
                gap: 6px;
                width: 100%;
                max-width: 100%;
                box-sizing: border-box;
                overflow: hidden;
                margin-top: auto;
            }

            /* Adjust correct indicator on mobile */
            .correct-indicator {
                width: 28px;
                height: 28px;
                right: 10px;
                top: 50%;
                transform: translateY(-50%);
            }

            .question-input {
                font-size: 1.8rem;
                max-width: 100% !important;
                margin: 0 auto;
                overflow: visible !important;
                height: auto !important;
                white-space: normal !important;
                word-wrap: break-word !important;
                overflow-wrap: break-word !important;
                text-overflow: clip !important;
            }

            .media-upload-area {
                max-width: 225px;
                max-height: 120px;
            }

            /* Bottom carousel container */
            .mobile-carousel-container {
                display: flex;
                flex-direction: column;
                background: rgba(243, 237, 222, 0.60);
                border-top: 1px solid var(--border-warm);
                padding: 0.5rem 0;
                padding-left: 0.75rem;
                gap: 0.5rem;
                max-height: 160px;
                width: 100%;
                max-width: 100vw;
                overflow: hidden;
                position: relative;
                flex-shrink: 0;
            }

            /* Horizontal scrolling carousel */
            .mobile-carousel {
                display: flex;
                gap: 0.75rem;
                overflow-x: auto;
                overflow-y: hidden;
                padding: 0.25rem;
                padding-right: 150px;
                scroll-behavior: smooth;
                -webkit-overflow-scrolling: touch;
                width: 100%;
                max-width: 100%;
            }

            /* Carousel thumbnails */
            .mobile-carousel .slide-thumbnail {
                min-width: 120px;
                max-width: 120px;
                width: 120px;
                height: 75px;
                cursor: pointer;
            }

            .mobile-carousel .slide-thumbnail.active {
                border-color: rgba(141, 110, 99, 0.6);
                
            }

            .mobile-carousel .slide-item {
                display: flex;
                flex-direction: row;
                align-items: center;
                gap: 0.35rem;
                flex-shrink: 0;
                flex-grow: 0;
            }

            .mobile-carousel .slide-index-number {
                font-size: 0.65rem;
                padding: 0;
                width: auto;
                text-align: center;
                min-width: 14px;
            }

            .mobile-carousel .preview-question {
                font-size: 0.35rem;
                max-height: 0.4rem;
            }

            /* Hide the old add button inside the carousel on mobile */
            .mobile-carousel .add-slide-btn {
                display: none;
            }

            /* Mobile Carousel Fixed Buttons */
            .mobile-carousel-fixed-buttons {
                position: absolute;
                right: 0;
                top: 0;
                bottom: 0;
                width: 110px;
                background: linear-gradient(to left, rgba(255, 255, 255, 0.9) 85%, transparent);
                display: flex;
                align-items: center;
                justify-content: flex-end;
                padding-right: 0.75rem;
                gap: 0.5rem;
                z-index: 10;
            }

            .mobile-carousel-add-btn,
            .mobile-carousel-rearrange-btn {
                width: 44px;
                height: 44px;
                border: none;
                background: rgba(243, 237, 222, 0.85);
                color: var(--text-primary);
                border-radius: 12px;
                font-size: 1.25rem;
                display: flex;
                align-items: center;
                justify-content: center;
                cursor: pointer;
                
            }

            .mobile-carousel-rearrange-btn svg {
                width: 20px;
                height: 20px;
                stroke: currentColor;
                stroke-width: 2;
                fill: none;
            }

            /* Hide desktop add button */
            .desktop-add-container {
                display: none !important;
            }

            .question-ideas-btn {
                position: relative;
                top: auto;
                left: auto;
                margin: 0 auto 0.75rem;
                display: block;
            }
        }

        /* ============================================
        Reorder Drawer Styles (Mobile)
        ============================================ */

        .reorder-drawer-backdrop {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(93, 64, 55, 0.3);
            z-index: 160;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.25s;
        }

        .reorder-drawer-backdrop.visible {
            opacity: 1;
            pointer-events: auto;
        }

        .reorder-drawer {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            width: 100%;
            height: 60vh;
            max-height: 60vh;
            background: rgba(248, 242, 230, 0.84);
            -webkit-backdrop-filter: blur(10px);
            backdrop-filter: blur(10px);
            border-top: none;
            border-radius: 16px 16px 0 0;
            
            z-index: 170;
            display: flex;
            flex-direction: column;
            transform: translateY(100%);
            transition: transform 0.3s ease-out;
        }

        /* Hide on desktop by default, but allow it to show when needed */
        @media (min-width: 769px) {
            .reorder-drawer:not(.open) {
                display: none;
            }
        }

        .reorder-drawer.open {
            transform: translateY(0);
        }

        .reorder-drawer-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 1rem 1.25rem;
            border-bottom: 1px solid var(--border-warm);
            flex-shrink: 0;
            position: relative;
        }

        .reorder-drawer-header::before {
            content: '';
            position: absolute;
            top: 0.5rem;
            left: 50%;
            transform: translateX(-50%);
            width: 40px;
            height: 4px;
            background: var(--border-medium);
            border-radius: 2px;
        }

        .reorder-drawer-header h3 {
            margin: 0;
            color: var(--text-heading);
            font-size: 1.1rem;
        }

        .reorder-drawer-close {
            background: none;
            border: none;
            color: var(--text-secondary);
            font-size: 1.5rem;
            cursor: pointer;
            padding: 0.25rem;
            line-height: 1;
            transition: color 0.15s;
        }

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

        .reorder-drawer-subtitle {
            font-size: 0.8rem;
            color: var(--text-secondary);
            margin-top: -0.5rem;
            margin-bottom: 1rem;
        }

        .reorder-list {
            flex: 1;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            display: flex;
            flex-direction: column;
        }

        .reorder-item {
            display: flex;
            align-items: center;
            background: transparent;
            padding: 0.75rem;
            border-bottom: 1px solid var(--border-warm);
            gap: 0.75rem;
            position: relative;
            user-select: none;
            touch-action: pan-y;
            transition: transform 0.2s;
        }

        .reorder-item.dragging-reorder {
            opacity: 0.8;
            background: rgba(248, 242, 230, 0.84);
            
        }

        .reorder-item.drag-over {
            background: rgba(255, 183, 77, 0.15);
        }

        .reorder-item.shift-down-reorder {
            transform: translateY(100%);
        }

        .reorder-item.shift-up-reorder {
            transform: translateY(-100%);
        }

        .reorder-item-number {
            font-size: 0.9rem;
            color: var(--text-primary);
            font-weight: bold;
            width: 20px;
            text-align: center;
        }

        .reorder-item-thumbnail {
            width: 60px;
            height: 37.5px;
            flex-shrink: 0;
        }

        .reorder-item-thumbnail .slide-preview {
            width: 100%;
            height: 100%;
            padding: 2px;
            border-radius: 2px;
        }

        .reorder-item-thumbnail .preview-question {
            font-size: 6px;
            margin-bottom: 2px;
            max-height: 8px;
        }

        .reorder-item-thumbnail .preview-answers {
            gap: 1px;
        }

        .reorder-item-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 2px;
            min-width: 0;
        }

        .reorder-item-question {
            font-size: 0.9rem;
            font-weight: bold;
            color: var(--text-primary);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .reorder-item-meta {
            font-size: 0.75rem;
            color: var(--text-secondary);
        }

        .reorder-item-actions {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-left: auto;
        }

        .reorder-delete-btn {
            background: none;
            border: none;
            padding: 8px;
            cursor: pointer;
            color: #ef5350;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 4px;
        }

        .reorder-delete-btn:active {
            background-color: rgba(239, 83, 80, 0.1);
        }

        .reorder-delete-btn svg {
            width: 20px;
            height: 20px;
            fill: none;
            stroke: currentColor;
            stroke-width: 2;
            stroke-linecap: round;
            stroke-linejoin: round;
        }

        .reorder-drag-handle {
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--text-secondary);
            cursor: grab;
            flex-shrink: 0;
            touch-action: none;
        }

        .reorder-drag-handle:active {
            cursor: grabbing;
        }

        .reorder-drag-handle svg {
            width: 20px;
            height: 20px;
            stroke: currentColor;
            fill: none;
            stroke-width: 2;
            stroke-linecap: round;
        }

        /* ============================================
        Question Bank Drawer Styles
        ============================================ */



        /* Desktop: Right-side drawer */
        .question-bank-drawer {
            position: fixed;
            top: 60px;
            right: 0;
            width: 320px;
            height: calc(100vh - 60px);
            height: calc(100dvh - 60px);
            background: rgba(248, 242, 230, 0.84);
            -webkit-backdrop-filter: blur(10px);
            backdrop-filter: blur(10px);
            border-left: none;
            
            z-index: 150;
            display: flex;
            flex-direction: column;
            transform: translateX(100%);
            transition: transform 0.25s ease-out;
        }

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

        .drawer-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 1rem;
            border-bottom: 1px solid var(--border-warm);
            flex-shrink: 0;
        }

        .drawer-header h3 {
            margin: 0;
            color: var(--text-heading);
            font-size: 1.1rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .drawer-close-btn {
            background: none;
            border: none;
            color: var(--text-secondary);
            font-size: 1.5rem;
            cursor: pointer;
            padding: 0.25rem;
            line-height: 1;
            transition: color 0.15s;
        }

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

        /* Category chips */
        .drawer-categories {
            display: flex;
            gap: 0.5rem;
            padding: 0.75rem 1rem;
            overflow-x: auto;
            flex-shrink: 0;
            border-bottom: 1px solid var(--border-warm);
            -ms-overflow-style: none;
            scrollbar-width: none;
        }

        .drawer-categories::-webkit-scrollbar {
            display: none;
        }

        .category-chip {
            flex-shrink: 0;
            padding: 0.5rem 1rem;
            background: transparent;
            border: 2px solid var(--border-medium);
            border-radius: 9999px;
            color: var(--text-secondary);
            font-family: inherit;
            font-size: 0.85rem;
            cursor: pointer;
            transition: all 0.2s ease;
            white-space: nowrap;
            display: flex;
            align-items: center;
            gap: 0.35rem;
        }

        .category-chip:hover {
            border-color: var(--border-medium);
            color: var(--text-primary);
            background: rgba(255, 255, 255, 0.5);
        }

        .category-chip.active {
            background: var(--pink);
            border-color: var(--pink);
            color: #fff;
            
        }

        /* Search box */
        .drawer-search {
            padding: 0.75rem 1rem;
            flex-shrink: 0;
        }

        .drawer-search-input {
            width: 100%;
            padding: 0.5rem 0.75rem;
            background: rgba(255, 255, 255, 0.6);
            border: 2px solid var(--border-medium);
            border-radius: 12px;
            color: var(--text-primary);
            font-family: inherit;
            font-size: 0.85rem;
        }

        .drawer-search-input::placeholder {
            color: rgba(74, 74, 74, 0.4);
        }

        .drawer-search-input:focus {
            outline: none;
            border-color: rgba(141, 110, 99, 0.6);
        }

        /* Suggestions list */
        .drawer-suggestions {
            flex: 1;
            overflow-y: auto;
            padding: 0.5rem;
        }

        .suggestion-card {
            background: rgba(255, 255, 255, 0.3);
            border: 2px solid transparent;
            border-radius: 6px;
            padding: 0.75rem;
            margin-bottom: 0.5rem;
            cursor: pointer;
            transition: all 0.15s;
        }

        .suggestion-card:hover {
            background: rgba(255, 255, 255, 0.5);
            border-color: var(--border-medium);
        }

        .suggestion-card:active {
            transform: scale(0.98);
        }

        .suggestion-text {
            color: var(--text-primary);
            font-size: 0.9rem;
            line-height: 1.4;
            margin: 0;
        }

        .suggestion-hint {
            color: var(--text-secondary);
            font-size: 0.75rem;
            margin-top: 0.35rem;
            display: flex;
            align-items: center;
            gap: 0.25rem;
        }

        .drawer-empty {
            text-align: center;
            padding: 2rem 1rem;
            color: var(--text-secondary);
        }

        .drawer-empty-icon {
            font-size: 2rem;
            margin-bottom: 0.5rem;
        }

        /* Backdrop for mobile */
        .drawer-backdrop {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(93, 64, 55, 0.2);
            z-index: 140;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.25s;
        }

        .drawer-backdrop.visible {
            opacity: 1;
            pointer-events: auto;
        }

        /* Mobile: Bottom sheet */
        @media (max-width: 768px) {
            .question-bank-drawer {
                top: auto;
                bottom: 0;
                left: 0;
                right: 0;
                width: 100%;
                height: 60vh;
                max-height: 60vh;
                border-left: none;
                border-top: none;
                border-radius: 16px 16px 0 0;
                transform: translateY(100%);
                
            }

            .question-bank-drawer.open {
                transform: translateY(0);
            }

            .drawer-header {
                position: relative;
                padding-top: 1.5rem;
            }

            .drawer-header::before {
                content: '';
                position: absolute;
                top: 0.5rem;
                left: 50%;
                transform: translateX(-50%);
                width: 40px;
                height: 4px;
                background: var(--border-medium);
                border-radius: 2px;
            }

            .drawer-categories {
                padding: 0.5rem 0.75rem;
            }

            .category-chip {
                padding: 0.35rem 0.65rem;
                font-size: 0.75rem;
            }

            .question-ideas-btn {
                padding: 0.5rem 0.5rem;
                border-radius: 4px;
                position: relative;
                left: auto;
                top: auto;
                margin: 0;
                z-index: 10;
                font-size: 0.8rem;
                display: block;
                flex-shrink: 0;
                white-space: nowrap;
            }

            /* Flex container for input and button on mobile */
            .question-input-container {
                display: flex !important;
                flex-direction: column;
                align-items: center;
                justify-content: flex-start;
                gap: 0.5rem;
                width: 100%;
                flex-shrink: 0;
            }

            .question-input {
                flex: 1;
                width: auto !important;
                min-height: 4em;
            }

            .question-input:not(:placeholder-shown)+.question-ideas-btn {
                display: none;
            }
        }

        .question-ideas-btn {
            padding: 0.5rem 1rem;
            border-radius: 4px;
            position: absolute;
            left: 2.5rem;
            top: 6rem;
            display: block;
            margin: 0;
            z-index: 10;
            font-size: 0.8rem;
            border: 3px solid #333;
            color: #333;
            font-weight: bold;
        }

        /* Timer Button Container - Desktop Layout */
        .timer-container {
            display: flex;
            justify-content: flex-end;
            margin: 0.75rem 0;
        }

        /* On desktop, position timer absolutely to the right of media */
        @media (min-width: 769px) {
            .timer-container {
                position: absolute;
                right: 2.5rem;
                top: 7.5rem;
                margin: 0;
            }
        }

        /* On mobile, timer is centered above answers */
        @media (max-width: 768px) {
            .timer-container {
                justify-content: center;
            }
        }

        /* ============================================
        Avatar Animations Drawer Styles
        ============================================ */

        .animations-drawer-backdrop {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(93, 64, 55, 0.3);
            z-index: 180;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.2s;
        }

        .animations-drawer-backdrop.visible {
            opacity: 1;
            pointer-events: auto;
        }

        .animations-drawer {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            width: 100%;
            height: 80vh;
            max-height: 80vh;
            background: rgba(248, 242, 230, 0.84);
            -webkit-backdrop-filter: blur(10px);
            backdrop-filter: blur(10px);
            border-top: none;
            border-radius: 16px 16px 0 0;

            z-index: 190;
            display: flex;
            flex-direction: column;
            transform: translateY(100%);
            transition: transform 0.3s ease-out;
            pointer-events: none;
        }

        .animations-drawer.open {
            transform: translateY(0);
            pointer-events: auto;
        }

        .animations-drawer-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 1rem 1.25rem;
            border-bottom: 1px solid var(--border-warm);
            flex-shrink: 0;
        }

        .animations-drawer-header h3 {
            margin: 0;
            color: var(--text-heading);
            font-size: 1.1rem;
        }

        .animations-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 1rem;
            padding: 1.5rem;
            overflow-y: auto;
        }

        .animation-card {
            background: rgba(255, 255, 255, 0.3);
            border: 3px solid transparent;
            border-radius: 8px;
            padding: 0.75rem;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.5rem;
        }

        .animation-card:hover {
            border-color: var(--border-medium);
            background: rgba(255, 255, 255, 0.5);
        }

        .animation-preview {
            width: 100%;
            aspect-ratio: 4/3;
            border-radius: 4px;
            border: 1px solid var(--border-warm);
            background-color: rgba(255, 229, 180, 0.3);
            position: relative;
            overflow: hidden;
        }

        .animation-sprite {
            position: absolute;
            left: 0;
            width: 400%;
            height: 300%;
            background-repeat: no-repeat;
            background-size: 100% 100%;
        }

        .animation-sprite.animate {
            animation: sprite-slide var(--watercolor-anim-duration) steps(4) infinite;
        }

        @keyframes sprite-slide {
            0%, 24.99% { transform: translateX(0); }
            25%, 49.99% { transform: translateX(-25%); }
            50%, 74.99% { transform: translateX(-50%); }
            75%, 100% { transform: translateX(-75%); }
        }

        /* Animation Rows - Tagged via Top offset */
        .anim-blowing-kiss {
            top: 0;
        }

        .anim-shy-glances {
            top: -100%;
        }

        .anim-cheers {
            top: -200%;
        }

        .add-slide-container {
            position: relative;
        }

        .add-slide-menu {
            position: absolute;
            top: 100%;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(248, 242, 230, 0.84);
            -webkit-backdrop-filter: blur(10px);
            backdrop-filter: blur(10px);
            border: 1px solid var(--border-warm);
            border-radius: 16px;
            padding: 0.5rem;
            display: none;
            flex-direction: column;
            gap: 0.5rem;
            z-index: 50;
            min-width: 160px;
            
            margin-top: 0.5rem;
        }

        .add-slide-menu.visible {
            display: flex;
        }

        .add-slide-menu-item {
            background: rgba(255, 255, 255, 0.3);
            border: none;
            color: var(--text-primary);
            padding: 0.75rem;
            cursor: pointer;
            text-align: left;
            border-radius: 12px;
            font-family: inherit;
            font-size: 0.9rem;
            transition: all 0.15s;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .add-slide-menu-item:hover {
            background: var(--pink);
            color: #fff;
        }

        /* Mobile specific overrides for the menu */
        @media (max-width: 768px) {
            .add-slide-menu {
                position: fixed;
                top: auto;
                bottom: calc(80px + env(safe-area-inset-bottom, 0px));
                left: auto;
                right: 1rem;
                transform: none;
                margin-top: 0;
                z-index: 1000;
            }
        }

        /* Couple Question Styles */
        .couple-display-container {
            display: flex;
            justify-content: center;
            gap: 2rem;
            padding: 0;
            margin-bottom: 0;
        }

        .couple-sprite-box {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.5rem;
        }

        .couple-sprite-view {
            width: 120px;
            height: 144px;
            position: relative;
            overflow: hidden;
            transform: scale(1.2);
        }

        .couple-sprite-sheet {
            width: 480px;
            height: 576px;
            background-repeat: no-repeat;
            background-size: 100% 100%;
            position: absolute;
            top: 0;
            left: 0;
            animation: couple-walk 1.5s steps(4) infinite;
            transition: none;
        }

        .couple-label {
            font-family: 'Noto Serif TC', 'SatsukiGendaiMincho', serif;
            color: #fff;
            font-size: 1.8rem;
            padding: 8px 20px;
            border: 4px solid #000;
            
            margin-top: 0.8rem;
            text-align: center;
            min-width: 120px;
        }

        .couple-sprite-box:first-child .couple-label {
            background-color: var(--ruby);
        }

        .couple-sprite-box:last-child .couple-label {
            background-color: var(--sapphire);
        }

        /* Override inline dark styles from dashboard.html */
        #subscriptionBadge {
            background: linear-gradient(135deg, rgba(240, 98, 146, 0.9), rgba(255, 183, 77, 0.9)) !important;
        }

        .subscription-lock-overlay {
            background: rgba(93, 64, 55, 0.6) !important;
            border-radius: 16px !important;
        }

        .subscription-lock-overlay:hover {
            background: rgba(93, 64, 55, 0.7) !important;
        }

        /* Locale-specific font overrides for components with hardcoded font-family */
        :lang(zh-CN) .question-input,
        :lang(zh-CN) .media-label,
        :lang(zh-CN) .answer-card,
        :lang(zh-CN) .answer-input,
        :lang(zh-CN) .welcome-screen h2,
        :lang(zh-CN) .modal-header h3,
        :lang(zh-CN) .couple-label {
            font-family: 'Noto Serif SC', 'PingFang SC', 'Microsoft YaHei', serif;
        }

        :lang(th) .question-input,
        :lang(th) .media-label,
        :lang(th) .answer-card,
        :lang(th) .answer-input,
        :lang(th) .welcome-screen h2,
        :lang(th) .modal-header h3,
        :lang(th) .couple-label {
            font-family: 'Sarabun', 'Noto Serif TC', serif;
        }

        /* Sprite History Picker Modal */
        .sprite-history-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(93, 64, 55, 0.35);
            z-index: 10003;
            justify-content: center;
            align-items: center;
        }

        .sprite-history-overlay.active {
            display: flex;
        }

        .sprite-history-modal {
            background: rgba(248, 242, 230, 0.95);
            -webkit-backdrop-filter: blur(12px);
            backdrop-filter: blur(12px);
            border-radius: 20px;
            padding: 1.25rem;
            max-width: 360px;
            width: 90%;
            max-height: 75vh;
            overflow-y: auto;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
            font-family: 'Noto Serif TC', serif;
        }

        .sprite-history-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 0.25rem;
        }

        .sprite-history-header h5 {
            margin: 0;
            color: var(--text-heading);
            font-size: 1rem;
            font-weight: 600;
        }

        .sprite-history-close {
            background: none;
            border: 1px solid var(--text-secondary);
            border-radius: 50%;
            color: var(--text-secondary);
            font-size: 1rem;
            line-height: 1;
            cursor: pointer;
            width: 26px;
            height: 26px;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0;
            flex-shrink: 0;
        }

        .sprite-history-close:hover {
            border-color: var(--text-primary);
            color: var(--text-primary);
        }

        .sprite-history-subtitle {
            font-size: 0.75rem;
            color: var(--text-secondary);
            margin: 0 0 0.75rem 0;
        }

        .sprite-history-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 8px;
        }

        .sprite-history-item {
            position: relative;
            aspect-ratio: 5 / 6;
            border-radius: 10px;
            border: 2px solid var(--border-medium);
            overflow: hidden;
            cursor: pointer;
            background: rgba(255, 255, 255, 0.5);
            transition: border-color 0.2s, transform 0.15s;
        }

        .sprite-history-item:hover {
            border-color: var(--pink);
            transform: scale(1.03);
        }

        .sprite-history-item.active {
            border-color: var(--gold-accent);
            border-width: 3px;
            box-shadow: 0 0 0 2px rgba(255, 183, 77, 0.25);
        }

        .sprite-history-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .sprite-history-item .history-active-badge {
            position: absolute;
            top: 4px;
            right: 4px;
            background: var(--gold-accent);
            color: #fff;
            font-size: 0.6rem;
            padding: 1px 6px;
            border-radius: 8px;
            font-weight: 600;
        }

        .sprite-history-item .history-date {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            background: linear-gradient(transparent, rgba(0,0,0,0.5));
            color: #fff;
            font-size: 0.55rem;
            padding: 10px 5px 3px;
            text-align: center;
        }

        .sprite-history-empty {
            text-align: center;
            color: var(--text-secondary);
            font-size: 0.85rem;
            padding: 1.5rem 0;
        }

        .sprite-history-loading {
            display: flex;
            justify-content: center;
            padding: 1.5rem 0;
        }
