        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
            background-color: #000;
            /* 先設定黑色背景，避免白色閃爍 */
            background-image: url('https://raw.githubusercontent.com/brendon-create/duet-frontend/main/assets/images/backgrounds/Toscana.png');
            background-position: center 14%;
            background-size: cover;
            background-repeat: no-repeat;
            background-attachment: fixed;
            color: #fff;
            overflow: hidden;
            height: 100vh;
        }

        .glass {
            background: rgba(255, 255, 255, 0.02);
            backdrop-filter: blur(10px) saturate(100%);
            -webkit-backdrop-filter: blur(10px) saturate(100%);
            border: 1px solid rgba(255, 255, 255, 0.1);
            box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37), inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
        }

        #control-panel {
            position: absolute;
            left: 20px;
            top: 20px;
            width: 320px;
            max-height: calc(100vh - 40px);
            overflow-y: auto;
            padding: 24px;
            border-radius: 20px;
            z-index: 100;
        }

        #control-panel::-webkit-scrollbar {
            width: 4px;
        }

        #control-panel::-webkit-scrollbar-track {
            margin: 20px 0;
        }

        #control-panel::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.2);
            border-radius: 2px;
        }

        .panel-header {
            position: relative;
            text-align: center;
            margin-bottom: 24px;
            padding-bottom: 16px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        }

        .panel-header h1 {
            font-size: 24px;
            font-weight: 700;
            letter-spacing: -0.5px;
            margin-bottom: 4px;
            font-family: 'Cantata One', serif;
        }

        .panel-header .subtitle {
            font-size: 11px;
            color: #d4af37;
            letter-spacing: 2px;
            text-transform: uppercase;
            font-weight: 300;
        }

        .section {
            margin-bottom: 24px;
        }

        .section-title {
            font-size: 11px;
            font-weight: 600;
            letter-spacing: 1.5px;
            text-transform: uppercase;
            color: #d4af37;
            margin-bottom: 16px;
        }

        .control-group {
            margin-bottom: 16px;
        }

        label {
            display: block;
            font-size: 12px;
            font-weight: 500;
            color: rgba(255, 255, 255, 0.7);
            margin-bottom: 8px;
        }

        .flex-row {
            display: flex;
            gap: 10px;
        }

        .flex-row>div:first-child {
            flex: 1;
        }

        .flex-row>div:last-child {
            flex: 2;
        }

        input[type="text"],
        select {
            width: 100%;
            padding: 12px 16px;
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 12px;
            color: #fff;
            font-size: 14px;
            outline: none;
            transition: all 0.3s ease;
        }

        input:focus,
        select:focus {
            background: rgba(255, 255, 255, 0.12);
            border-color: #d4af37;
        }

        .font-select-btn {
            width: 100%;
            padding: 12px 16px;
            background: rgba(212, 175, 55, 0.15);
            border: 1px solid rgba(212, 175, 55, 0.3);
            border-radius: 12px;
            color: #d4af37;
            font-size: 13px;
            cursor: pointer;
            transition: all 0.3s ease;
            text-align: left;
        }

        /* 字體下拉選單中的選項以各自字體顯示 */
        select.font-select-btn {
            font-family: inherit;
        }

        select.font-select-btn option {
            background: #1a1a2e;
            color: #fff;
            padding: 8px;
            font-size: 14px;
        }

        .font-select-btn:hover {
            background: rgba(212, 175, 55, 0.25);
            border-color: #d4af37;
        }

        input[type="range"] {
            width: 100%;
            height: 4px;
            -webkit-appearance: none;
            appearance: none;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 2px;
        }

        input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: #d4af37;
            cursor: pointer;
            box-shadow: 0 2px 8px rgba(212, 175, 55, 0.4);
        }

        .slider-value {
            float: right;
            color: #d4af37;
            font-weight: 600;
        }

        button {
            width: 100%;
            padding: 14px;
            border: none;
            border-radius: 12px;
            font-size: 14px;
            font-weight: 600;
            letter-spacing: 0.5px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .btn-primary {
            background: linear-gradient(135deg, #d4af37 0%, #aa8a2e 100%);
            color: #000;
            box-shadow: 0 4px 16px rgba(212, 175, 55, 0.3);
            display: flex;
            align-items: center;
        }

        #addToCartBtn {
            justify-content: space-between;
        }

        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
        }

        .view-cart-section {
            width: 70px;
            border-left: 1px solid rgba(0, 0, 0, 0.2);
            padding-left: 12px;
            display: flex;
            flex-direction: column;
            align-items: center;
            font-size: 9px;
            cursor: pointer;
        }

        .view-cart-section:hover {
            opacity: 0.8;
        }

        .btn-secondary {
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(255, 255, 255, 0.2);
            color: #fff;
        }

        .btn-secondary:hover {
            background: rgba(255, 255, 255, 0.12);
        }

        .divider {
            height: 1px;
            background: rgba(255, 255, 255, 0.1);
            margin: 20px 0;
        }

        .info-box {
            background: rgba(0, 0, 0, 0.3);
            padding: 16px;
            border-radius: 12px;
            margin-bottom: 16px;
        }

        .info-row {
            display: flex;
            justify-content: space-between;
            margin-bottom: 8px;
            font-size: 13px;
        }

        .info-label {
            color: rgba(255, 255, 255, 0.6);
        }

        .info-value {
            color: #d4af37;
            font-weight: 600;
            text-align: right;
        }

        #saved-versions {
            position: absolute;
            top: 20px;
            right: 20px;
            display: flex;
            align-items: center;
            gap: 12px;
            z-index: 100;
        }

        .version-slot {
            width: 160px;
            height: 160px;
            border-radius: 16px;
            cursor: pointer;
            position: relative;
            overflow: hidden;
            transition: all 0.3s ease;
            background: rgba(255, 255, 255, 0.02);
            backdrop-filter: blur(10px) saturate(100%);
            -webkit-backdrop-filter: blur(10px) saturate(100%);
            border: 1px solid rgba(255, 255, 255, 0.1);
            box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37), inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
        }

        .version-slot:hover {
            transform: scale(1.2);
            z-index: 200;
        }

        .version-slot.empty {
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            color: rgba(255, 255, 255, 0.6);
        }

        .version-label {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            padding: 8px;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(10px);
            font-size: 10px;
            text-align: center;
            color: #d4af37;
        }

        #viewport {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            z-index: 0;
            touch-action: none; /* 防止 Safari 在自訂域名上攔截 wheel/gesture 事件 */
        }

        /* Font Constraint Overlay */
        #constraint-overlay {
            display: none;
            position: absolute;
            top: 62%;
            left: 50%;
            transform: translateX(-50%);
            z-index: 50;
            padding: 9px 18px;
            border-radius: 8px;
            font-size: 12px;
            letter-spacing: 0.3px;
            text-align: center;
            pointer-events: none;
            white-space: nowrap;
            max-width: 80%;
            backdrop-filter: blur(8px);
        }
        #constraint-overlay.block {
            background: rgba(35, 15, 15, 0.82);
            border: 1px solid rgba(220, 70, 70, 0.35);
            color: rgba(255, 130, 130, 0.9);
        }
        #constraint-overlay.warn {
            background: rgba(35, 28, 10, 0.82);
            border: 1px solid rgba(195, 140, 50, 0.35);
            color: rgba(215, 168, 80, 0.9);
        }

        /* Font Selector Modal */
        #font-selector-modal {
            display: none;
            position: fixed;
            top: 20px;
            left: 360px;
            right: 20px;
            max-height: calc(100vh - 40px);
            border-radius: 16px;
            z-index: 2000;
            overflow: hidden;
            background: rgba(0, 0, 0, 0.5);
            backdrop-filter: blur(20px) saturate(150%);
            -webkit-backdrop-filter: blur(20px) saturate(150%);
            border: 1px solid rgba(255, 255, 255, 0.1);
            box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37), inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
        }

        #font-selector-modal.active {
            display: block;
        }

        .close-modal-btn {
            position: absolute;
            top: 20px;
            right: 20px;
            background: none;
            border: none;
            color: #fff;
            font-size: 40px;
            cursor: pointer;
            z-index: 2001;
            width: auto;
            padding: 0;
            line-height: 1;
        }

        .close-modal-btn:hover {
            color: #d4af37;
        }

        .modal-layout {
            display: flex;
            height: calc(100vh - 40px);
        }

        .font-sidebar {
            width: 20%;
            min-width: 200px;
            background: rgba(255, 255, 255, 0.02);
            border-right: 1px solid rgba(255, 255, 255, 0.1);
            padding: 20px;
            overflow-y: auto;
        }

        .font-sidebar::-webkit-scrollbar {
            width: 4px;
        }

        .font-sidebar::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.2);
        }

        .char-input-group {
            margin-bottom: 20px;
        }

        .char-input-group input {
            width: 100%;
            padding: 12px;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.1);
            color: #fff;
            text-align: center;
            font-size: 18px;
            border-radius: 8px;
        }

        .select-all-group {
            padding: 12px 0;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            margin-bottom: 12px;
            display: flex;
            align-items: center;
            font-size: 12px;
        }

        .select-all-group input {
            margin-right: 10px;
            cursor: pointer;
        }

        .font-list-item {
            display: flex;
            align-items: center;
            padding: 10px 6px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.03);
            cursor: pointer;
            transition: background 0.2s;
        }

        .font-list-item:hover {
            background: rgba(255, 255, 255, 0.05);
        }

        .font-list-item input[type="checkbox"] {
            margin-right: 12px;
            cursor: pointer;
        }

        .font-list-item span {
            font-size: 13px;
            color: #ccc;
            font-display: block;
        }

        .font-display-area {
            flex: 1;
            padding: 40px;
            overflow-y: auto;
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
            gap: 20px;
            align-content: start;
        }

        .font-display-area::-webkit-scrollbar {
            width: 6px;
        }

        .font-display-area::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.2);
            border-radius: 3px;
        }

        .font-preview-card {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 20px 10px;
            background: rgba(255, 255, 255, 0.03);
            border: 2px solid transparent;
            border-radius: 12px;
            transition: all 0.3s;
            cursor: pointer;
            min-height: 140px;
        }

        .font-preview-card:hover {
            background: rgba(255, 255, 255, 0.08);
            transform: translateY(-2px);
        }

        .font-preview-card.selected {
            border-color: #d4af37;
            background: rgba(212, 175, 55, 0.15);
        }

        .preview-char {
            font-size: 48px;
            margin-bottom: 8px;
            color: #fff;
            font-display: block;
        }

        .preview-name {
            font-size: 11px;
            color: rgba(255, 255, 255, 0.5);
            text-align: center;
            font-display: block;
        }

        .confirm-container {
            position: absolute;
            /* 改為 absolute，相對於 font-selector-modal */
            bottom: 30px;
            right: 30px;
            z-index: 2002;
        }

        .confirm-btn {
            background: linear-gradient(135deg, #d4af37 0%, #aa8a2e 100%);
            color: #000;
            border: none;
            padding: 16px 40px;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            box-shadow: 0 4px 16px rgba(212, 175, 55, 0.3);
            transition: all 0.3s;
        }

        .confirm-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
        }

        /* Cart Modal */
        #cart-modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.9);
            backdrop-filter: blur(10px);
            z-index: 2000;
            align-items: center;
            justify-content: center;
        }

        #cart-modal.active {
            display: flex;
        }

        .cart-container {
            width: 80%;
            max-width: 900px;
            height: 80%;
            background: rgba(10, 10, 10, 0.95);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 24px;
            overflow: hidden;
            display: flex;
            flex-direction: column;
        }

        .cart-header {
            padding: 24px 32px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 16px;
        }

        .cart-header h2 {
            font-size: 24px;
            font-weight: 700;
            margin: 0;
        }

        .cart-items {
            flex: 1;
            padding: 24px;
            overflow-y: auto;
        }

        .cart-item {
            padding: 20px;
            margin-bottom: 16px;
            background: rgba(255, 255, 255, 0.05);
            border-radius: 16px;
            display: flex;
            align-items: center;
            gap: 20px;
        }

        .cart-item-image {
            width: 150px;
            height: 150px;
            background: rgba(0, 0, 0, 0.5);
            border-radius: 12px;
            flex-shrink: 0;
        }

        .cart-item-info {
            flex: 1;
        }

        .cart-item-info h3 {
            font-size: 18px;
            margin-bottom: 8px;
        }

        .cart-item-details {
            font-size: 13px;
            color: rgba(255, 255, 255, 0.6);
            line-height: 1.6;
        }

        .cart-item-price {
            font-size: 20px;
            font-weight: 700;
            color: #d4af37;
            margin-right: 20px;
        }

        .cart-item-quantity {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .quantity-input {
            width: 60px;
            padding: 8px;
            text-align: center;
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 8px;
            color: #fff;
            -moz-appearance: textfield;
            appearance: none;
        }

        .quantity-input::-webkit-outer-spin-button,
        .quantity-input::-webkit-inner-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }

        .quantity-btns {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .qty-btn {
            width: 24px;
            height: 20px;
            padding: 0;
            background: rgba(212, 175, 55, 0.2);
            border: 1px solid rgba(212, 175, 55, 0.3);
            color: #d4af37;
            font-size: 12px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .qty-btn:hover {
            background: rgba(212, 175, 55, 0.3);
        }

        .delete-btn {
            width: 36px;
            height: 36px;
            padding: 0;
            background: rgba(255, 0, 0, 0.2);
            border: 1px solid rgba(255, 0, 0, 0.3);
            color: #ff4444;
            font-size: 18px;
            border-radius: 8px;
            cursor: pointer;
        }

        .delete-btn:hover {
            background: rgba(255, 0, 0, 0.3);
        }

        .cart-footer {
            padding: 24px 32px;
            border-top: 1px solid rgba(255, 255, 255, 0.1);
        }

        .cart-total {
            display: flex;
            justify-content: space-between;
            font-size: 24px;
            font-weight: 700;
            margin-bottom: 20px;
            color: #d4af37;
        }

        .cart-actions {
            display: flex;
            gap: 12px;
        }

        .cart-actions button {
            flex: 1;
            text-align: center;
            justify-content: center;
        }

        #loader {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: #000;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            z-index: 9999;
            pointer-events: none;
            transition: opacity 0.8s ease-out, visibility 0.8s;
        }

        #loader.fade-out {
            opacity: 0;
            visibility: hidden;
        }

        .spinner {
            width: 50px;
            height: 50px;
            border: 2px solid rgba(255, 255, 255, 0.1);
            border-top: 2px solid #d4af37;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin-bottom: 20px;
        }

        @keyframes spin {
            0% {
                transform: rotate(0deg);
            }

            100% {
                transform: rotate(360deg);
            }
        }

        .loading-text {
            color: rgba(255, 255, 255, 0.5);
            font-size: 12px;
            letter-spacing: 3px;
        }

        /* 優惠碼欄位樣式 */
        #promo-code-input:focus {
            border-color: #d4af37;
            background: rgba(255, 255, 255, 0.15);
            box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.3);
        }

        #promo-code-input:disabled {
            opacity: 0.6;
            cursor: not-allowed;
            background: rgba(255, 255, 255, 0.05);
        }

        #apply-promo-btn:hover:not(:disabled) {
            background: rgba(255, 255, 255, 0.12);
            border-color: rgba(212, 175, 55, 0.4);
            box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.3), inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
            transform: translateY(-2px);
        }

        #apply-promo-btn:active:not(:disabled) {
            transform: translateY(0);
        }

        #apply-promo-btn:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        /* Modal 滾動條樣式 */
        .modal-content::-webkit-scrollbar {
            width: 6px;
        }

        .modal-content::-webkit-scrollbar-track {
            background: rgba(255, 255, 255, 0.05);
            border-radius: 3px;
        }

        .modal-content::-webkit-scrollbar-thumb {
            background: rgba(212, 175, 55, 0.5);
            border-radius: 3px;
        }

        .modal-content::-webkit-scrollbar-thumb:hover {
            background: rgba(212, 175, 55, 0.7);
        }

        /* ========== AI 諮詢連結樣式 (新增) ========== */
        .ai-consultant-link {
            margin-top: 20px;
            padding-top: 20px;
            border-top: 1px solid rgba(255, 255, 255, 0.1);
            text-align: center;
        }

        .ai-consultant-link a {
            color: #d4af37;
            text-decoration: none;
            font-size: 13px;
            font-weight: 500;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            transition: 0.3s;
            cursor: pointer;
        }

        .ai-consultant-link a:hover {
            color: #f4d03f;
        }

        /* 隱藏設計理念卡片的滾軸 */
        #story-content::-webkit-scrollbar {
            display: none;
        }

        /* 點點動畫 */
        @keyframes dots {

            0%,
            20% {
                content: '.';
            }

            40% {
                content: '..';
            }

            60%,
            100% {
                content: '...';
            }
        }

        .dots-animation::after {
            content: '';
            animation: dots 1.5s infinite;
        }

        /* 🧹 Toggle Switch 樣式 */
        .toggle-switch {
            position: relative;
            display: inline-block;
        }

        .toggle-checkbox {
            display: none;
        }

        .toggle-label {
            display: block;
            width: 44px;
            height: 24px;
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 24px;
            cursor: pointer;
            position: relative;
            transition: all 0.3s ease;
            backdrop-filter: blur(10px);
        }

        .toggle-button {
            position: absolute;
            top: 2px;
            left: 2px;
            width: 18px;
            height: 18px;
            background: rgba(255, 255, 255, 0.8);
            border-radius: 50%;
            transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        }

        .toggle-checkbox:checked + .toggle-label {
            background: rgba(212, 175, 55, 0.3);
            border-color: rgba(212, 175, 55, 0.5);
        }

        .toggle-checkbox:checked + .toggle-label .toggle-button {
            left: 22px;
            background: #d4af37;
        }

        .toggle-checkbox:disabled + .toggle-label {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .toggle-label:hover:not(.toggle-checkbox:disabled + .toggle-label) {
            background: rgba(255, 255, 255, 0.15);
        }

        /* 零碎部件提醒：清理 toggle 金色脈衝光暈 */
        .cleanup-needs-attention .toggle-label {
            border-color: rgba(212, 175, 55, 0.9) !important;
            animation: cleanupGlow 1.6s ease-in-out infinite;
        }

        @keyframes cleanupGlow {
            0%, 100% { box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.15), 0 0 10px rgba(212, 175, 55, 0.3); }
            50%       { box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.3), 0 0 22px rgba(212, 175, 55, 0.65); }
        }

        .cleanup-needs-attention-label {
            color: #d4af37 !important;
        }

        /* Fragment warning toast 出現動畫 */
        @keyframes slideUpFadeIn {
            from { opacity: 0; transform: translateX(-50%) translateY(14px); }
            to   { opacity: 1; transform: translateX(-50%) translateY(0); }
        }

        /* Liquid Glass 確認對話框 */
        .cleanup-confirm-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.6);
            backdrop-filter: blur(8px);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 10000;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .cleanup-confirm-overlay.show {
            opacity: 1;
        }

        .cleanup-confirm-dialog {
            background: rgba(14, 14, 20, 0.96);
            backdrop-filter: blur(30px) saturate(150%);
            -webkit-backdrop-filter: blur(30px) saturate(150%);
            border: 1px solid rgba(212, 175, 55, 0.45);
            border-radius: 24px;
            padding: 32px;
            max-width: 400px;
            box-shadow:
                0 8px 40px rgba(0, 0, 0, 0.6),
                inset 0 1px 0 rgba(255, 255, 255, 0.06);
            transform: scale(0.9);
            transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
        }

        .cleanup-confirm-overlay.show .cleanup-confirm-dialog {
            transform: scale(1);
        }

        .cleanup-confirm-title {
            font-size: 18px;
            font-weight: 600;
            color: #d4af37;
            margin-bottom: 16px;
            text-align: center;
        }

        .cleanup-confirm-message {
            font-size: 13px;
            line-height: 1.7;
            color: #e8d5a0;
            margin-bottom: 24px;
            text-align: center;
            letter-spacing: 0.2px;
        }

        .cleanup-confirm-buttons {
            display: flex;
            gap: 12px;
        }

        .cleanup-confirm-btn {
            flex: 1;
            padding: 12px 24px;
            border: none;
            border-radius: 8px;
            font-size: 13px;
            font-weight: 600;
            letter-spacing: 0.5px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .cleanup-confirm-btn.confirm {
            background: linear-gradient(135deg, #d4af37 0%, #aa8a2e 100%);
            color: #000;
        }

        .cleanup-confirm-btn.confirm:hover {
            background: linear-gradient(135deg, #e0bc42 0%, #b8963a 100%);
        }

        .cleanup-confirm-btn.cancel {
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(255, 255, 255, 0.18);
            color: rgba(232, 213, 160, 0.8);
        }

        .cleanup-confirm-btn.cancel:hover {
            background: rgba(255, 255, 255, 0.13);
        }
        
        /* 脈衝動畫 - 用於提示生成按鈕 */
        @keyframes pulse {
            0%, 100% {
                transform: scale(1);
                box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
            }
            50% {
                transform: scale(1.05);
                box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
            }
        }

        @keyframes pulse-glow {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.4; background: rgba(212, 175, 55, 0.25); }
        }
        
        /* 低調的 Toast 提示 */
        .custom-toast {
            position: fixed;
            bottom: 30px;
            left: 50%;
            transform: translateX(-50%) translateY(100px);
            background: rgba(40, 40, 40, 0.95);
            backdrop-filter: blur(10px);
            color: white;
            padding: 16px 24px;
            border-radius: 12px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
            z-index: 10000;
            opacity: 0;
            transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
            pointer-events: none;
            max-width: 90%;
        }
        
        .custom-toast.show {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
            pointer-events: auto;
        }
        
        .custom-toast-content {
            display: flex;
            align-items: center;
            gap: 12px;
        }
        
        .custom-toast-icon {
            font-size: 20px;
            flex-shrink: 0;
        }
        
        .custom-toast-message {
            font-size: 14px;
            line-height: 1.5;
        }
        
        /* ========== 手機版 RWD ========== */
        @media (max-width: 768px) {
            /* Font Selector Modal 手機版 - 只顯示字體卡，隱藏左側清單 */
            #font-selector-modal {
                left: 0;
                right: 0;
                top: 0;
                bottom: 0;
                max-height: 100vh;
                border-radius: 0;
                overflow-y: auto;
            }
            
            #font-selector-modal .modal-layout {
                flex-direction: column;
                height: 100vh;
                padding-bottom: 70px; /* 為固定確認按鈕預留空間 */
            }
            
            /* 隱藏左側字體清單 */
            #font-selector-modal .font-sidebar {
                display: none;
            }
            
            /* 字體卡顯示區域 - 填滿可用空間 */
            #font-selector-modal .font-display-area {
                flex: 1;
                padding: 20px;
                padding-bottom: 80px; /* 確認按鈕上方一點 */
                overflow-y: auto;
                -webkit-overflow-scrolling: touch;
            }
            
            /* 確認按鈕固定在最下方 */
            #font-selector-modal .confirm-container {
                position: fixed;
                bottom: 0;
                left: 0;
                right: 0;
                padding: 12px 20px;
                background: rgba(0, 0, 0, 0.9);
                backdrop-filter: blur(10px);
                z-index: 2002;
                box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
            }
            
            #font-selector-modal .confirm-btn {
                width: 100%;
                padding: 14px;
            }
            
            #control-panel {
                position: fixed;
                left: 0;
                right: 0;
                bottom: 0;
                top: auto;
                width: 100%;
                max-height: 33vh;
                border-radius: 20px 20px 0 0;
                z-index: 1000;
            }
            
            #saved-versions {
                position: fixed;
                top: 10px;
                left: 10px;
                right: 10px;
                width: auto;
                flex-direction: row;
                align-items: center;
                gap: 8px;
                justify-content: stretch;
            }
            
            .version-slot {
                width: 50%;
                height: 0;
                padding-bottom: 50%;
                min-height: 0;
                max-height: none;
            }
            
            #viewport {
                top: 0;
                left: 0;
                right: 0;
                bottom: 36vh;
            }
        }

/* ── 設計理念卡片 ── */
.story-corner {
    position: absolute;
    width: 20px;
    height: 20px;
    pointer-events: none;
}
.story-corner.tl { top:7px; left:7px;  border-top:1px solid rgba(150,142,130,0.72); border-left:1px solid rgba(150,142,130,0.72); }
.story-corner.tr { top:7px; right:7px; border-top:1px solid rgba(150,142,130,0.72); border-right:1px solid rgba(150,142,130,0.72); }
.story-corner.bl { bottom:7px; left:7px;  border-bottom:1px solid rgba(150,142,130,0.72); border-left:1px solid rgba(150,142,130,0.72); }
.story-corner.br { bottom:7px; right:7px; border-bottom:1px solid rgba(150,142,130,0.72); border-right:1px solid rgba(150,142,130,0.72); }

/* ── 背景切換器 ── */
#bg-switcher {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 8px 12px;
}

#bg-switcher-hint {
    position: fixed;
    bottom: 32vh;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(16, 14, 10, 0.88);
    border: 1px solid rgba(212,175,55,0.35);
    border-radius: 24px;
    padding: 7px 20px;
    font-size: 13px;
    color: rgba(212,175,55,0.9);
    letter-spacing: 1.2px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
    z-index: 200;
}

@keyframes bgSwitcherGlow {
    0%, 100% { box-shadow: 0 0 0 1px rgba(212,175,55,0.2), 0 0 10px rgba(212,175,55,0.3); }
    50%       { box-shadow: 0 0 0 2px rgba(212,175,55,0.45), 0 0 22px rgba(212,175,55,0.65); }
}

#bg-switcher.glowing {
    animation: bgSwitcherGlow 1.6s ease-in-out infinite;
}

.bg-switcher-label {
    font-size: 11.7px;
    color: rgba(255,255,255,0.38);
    letter-spacing: 1.5px;
    user-select: none;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
}

.bg-switcher-dots {
    display: flex;
    align-items: center;
}

.bg-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    border: 1px solid rgba(255,255,255,0.5);
    cursor: pointer;
    transition: background 0.3s ease, border-color 0.3s ease;
    padding: 0;
    outline: none;
    flex-shrink: 0;
}

.bg-dot.active {
    background: rgba(212,175,55,0.85);
    border-color: rgba(212,175,55,1);
}

.bg-dot:hover:not(.active) {
    background: rgba(255,255,255,0.55);
    border-color: rgba(255,255,255,0.75);
}

.bg-dot-line {
    width: 16px;
    height: 1px;
    background: rgba(255,255,255,0.18);
    flex-shrink: 0;
}

@media (max-width: 768px) {
    #bg-switcher {
        bottom: calc(36vh + 10px);
        right: 12px;
    }
}

