        * { box-sizing: border-box; margin: 0; padding: 0; }
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans TC', sans-serif;
            background: linear-gradient(135deg, #fafcfe 0%, #f0f4f8 50%, #ffffff 100%);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            color: #2c3e50;
        }
        /* 語言選擇歡迎畫面 */
        .language-welcome-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, #fafcfe 0%, #f0f4f8 50%, #ffffff 100%);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 10000;
            animation: fadeIn 0.5s ease-out;
            overflow-y: auto;
            overflow-x: hidden;
            -webkit-overflow-scrolling: touch;
        }
        .language-welcome-overlay.hidden {
            display: none;
        }
        .language-welcome-modal {
            text-align: center;
            max-width: 600px;
            padding: 3rem;
            animation: scaleIn 0.5s ease-out;
            margin: auto;
            width: 100%;
        }
        .welcome-logo {
            width: 120px;
            height: 120px;
            object-fit: contain;
            margin-bottom: 2rem;
            animation: float 3s ease-in-out infinite;
            filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.15));
        }
        .welcome-title {
            background: linear-gradient(135deg, #e5243b 0%, #26bde2 25%, #56c02b 50%, #fcc30b 75%, #dd1367 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            font-size: 2.5rem;
            font-weight: 800;
            margin-bottom: 0.5rem;
        }
        .welcome-subtitle {
            color: #5a6c7d;
            font-size: 1.2rem;
            margin-bottom: 3rem;
            font-weight: 500;
        }
        .language-prompt {
            color: #2c3e50;
            font-size: 1.5rem;
            margin-bottom: 2rem;
            font-weight: 600;
        }
        .language-options {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 1.5rem;
            max-width: 500px;
            margin: 0 auto;
        }
        .language-option-btn {
            background: white;
            border: 3px solid #e0e0e0;
            border-radius: 1rem;
            padding: 1.5rem;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.5rem;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
            min-height: 44px;
            touch-action: manipulation;
        }
        .language-option-btn:hover {
            transform: translateY(-5px);
            border-color: #26bde2;
            box-shadow: 0 8px 24px rgba(38, 189, 226, 0.3);
        }
        .language-option-btn:active {
            transform: translateY(-2px);
        }
        .language-flag {
            font-size: 3rem;
            margin-bottom: 0.5rem;
        }
        .language-name {
            font-size: 1.3rem;
            font-weight: 700;
            color: #2c3e50;
        }
        .language-desc {
            font-size: 0.9rem;
            color: #7f8c8d;
        }
        .header {
            background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
            border-bottom: 5px solid transparent;
            border-image: linear-gradient(90deg, 
                #e5243b 0%, #dda63a 6%, #4c9f38 12%, #c5192d 18%, 
                #ff3a21 24%, #26bde2 30%, #fcc30b 36%, #a21942 42%,
                #fd6925 48%, #dd1367 54%, #fd9d24 60%, #bf8b2e 66%,
                #3f7e44 72%, #0a97d9 78%, #56c02b 84%, #00689d 90%, #19486a 96%) 1;
            padding: 2rem 1.5rem;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
            position: relative;
            overflow: hidden;
        }
        .header::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: linear-gradient(120deg, 
                rgba(229, 36, 59, 0.03) 0%, 
                rgba(221, 166, 58, 0.03) 10%, 
                rgba(76, 159, 56, 0.03) 20%,
                rgba(197, 25, 45, 0.03) 30%, 
                rgba(255, 58, 33, 0.03) 40%,
                rgba(38, 189, 226, 0.03) 50%,
                rgba(252, 195, 11, 0.03) 60%,
                rgba(162, 25, 66, 0.03) 70%,
                rgba(253, 105, 37, 0.03) 80%,
                rgba(221, 19, 103, 0.03) 90%,
                rgba(253, 157, 36, 0.03) 100%);
            z-index: 0;
        }
        .header-content {
            display: flex;
            align-items: center;
            gap: 1.5rem;
            justify-content: center;
            flex-wrap: wrap;
            position: relative;
            z-index: 1;
        }
        .header-logo {
            width: 90px;
            height: 90px;
            object-fit: contain;
            animation: float 3s ease-in-out infinite;
            filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
        }
        @keyframes float {
            0%, 100% { transform: translateY(0px) rotate(0deg); }
            50% { transform: translateY(-12px) rotate(2deg); }
        }
        .header-text {
            flex: 1;
            min-width: 300px;
        }
        .language-selector {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            background: rgba(255, 255, 255, 0.9);
            padding: 0.75rem 1rem;
            border-radius: 0.5rem;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        }
        .language-selector label {
            font-size: 0.9rem;
            color: #5a6c7d;
            font-weight: 500;
        }
        .language-selector select {
            padding: 0.5rem 0.75rem;
            border: 2px solid #e0e0e0;
            border-radius: 0.375rem;
            background: white;
            color: #2c3e50;
            font-size: 0.9rem;
            cursor: pointer;
            transition: all 0.3s ease;
        }
        .language-selector select:hover {
            border-color: #26bde2;
        }
        .language-selector select:focus {
            outline: none;
            border-color: #26bde2;
            box-shadow: 0 0 0 3px rgba(38, 189, 226, 0.1);
        }
        .header h1 {
            background: linear-gradient(135deg, #e5243b 0%, #26bde2 25%, #56c02b 50%, #fcc30b 75%, #dd1367 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            font-size: 2rem;
            font-weight: 800;
            margin-bottom: 0.5rem;
            text-shadow: none;
            filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.05));
        }
        .header .subtitle {
            color: #5a6c7d;
            font-size: 1.05rem;
            margin-bottom: 0;
            font-weight: 500;
        }
        .status {
            background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
            color: #2e7d32;
            padding: 1rem;
            border-radius: 0.75rem;
            font-size: 0.95rem;
            border: 2px solid #81c784;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            box-shadow: 0 2px 8px rgba(46, 125, 50, 0.1);
        }
        .status.raw-mode {
            background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
            color: #e65100;
            border: 2px solid #ffb74d;
        }
        .status.error {
            background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
            color: #c62828;
            border: 2px solid #e57373;
        }
        .features {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 1rem;
            margin-top: 1rem;
        }
        .feature {
            background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
            padding: 0.85rem;
            border-radius: 0.75rem;
            text-align: center;
            color: #2c3e50;
            font-size: 0.9rem;
            border: 2px solid transparent;
            background-clip: padding-box;
            position: relative;
            font-weight: 500;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
            transition: all 0.3s ease;
        }
        .feature::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            border-radius: 0.75rem;
            padding: 2px;
            background: linear-gradient(135deg, #26bde2, #56c02b, #fcc30b, #e5243b);
            -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
            -webkit-mask-composite: xor;
            mask-composite: exclude;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        .feature:hover {
            transform: translateY(-3px);
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
        }
        .feature:hover::before {
            opacity: 1;
        }
        .chat-container {
            flex: 1;
            display: flex;
            flex-direction: column;
            max-width: 1000px;
            margin: 1.5rem auto;
            width: 100%;
            background: #ffffff;
            border-radius: 1.2rem;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
            overflow: hidden;
            min-height: 80vh;
            height: auto;
            border: 3px solid transparent;
            background-clip: padding-box;
            position: relative;
        }
        .chat-container::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            border-radius: 1.2rem;
            padding: 3px;
            background: linear-gradient(135deg, 
                #e5243b 0%, #dda63a 10%, #4c9f38 20%, #c5192d 30%, 
                #ff3a21 40%, #26bde2 50%, #fcc30b 60%, #a21942 70%,
                #fd6925 80%, #dd1367 90%, #56c02b 100%);
            -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
            -webkit-mask-composite: xor;
            mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
            mask-composite: exclude;
            z-index: -1;
        }
        .model-selector {
            padding: 1rem 1.5rem;
            border-bottom: 2px solid #e3f2fd;
            background: linear-gradient(135deg, #f0f9ff 0%, #e3f2fd 100%);
        }
        .model-selector h3 {
            color: #0077b6;
            font-size: 1rem;
            margin-bottom: 0.75rem;
            font-weight: 600;
        }
        .model-controls {
            display: flex;
            align-items: center;
            gap: 1rem;
            flex-wrap: wrap;
        }
        .model-dropdown {
            padding: 0.5rem 1rem;
            border: 2px solid #56c1ff;
            border-radius: 0.5rem;
            background: #ffffff;
            font-size: 0.9rem;
            color: #0077b6;
            cursor: pointer;
            transition: all 0.2s ease;
            min-width: 200px;
            font-weight: 500;
        }
        .model-dropdown:hover {
            border-color: #009edb;
            box-shadow: 0 0 0 3px rgba(0, 158, 219, 0.1);
        }
        .model-dropdown:focus {
            outline: none;
            border-color: #009edb;
            box-shadow: 0 0 0 3px rgba(0, 158, 219, 0.2);
        }
        .current-model {
            font-size: 0.85rem;
            color: #0077b6;
            background: #e3f2fd;
            padding: 0.35rem 0.85rem;
            border-radius: 1.5rem;
            border: 2px solid #56c1ff;
            font-weight: 500;
        }
        .quick-actions {
            padding: 1rem 1.5rem;
            border-bottom: 2px solid #e3f2fd;
            background: #ffffff;
        }
        .quick-actions h3 {
            color: #0077b6;
            font-size: 1rem;
            margin-bottom: 0.75rem;
            font-weight: 600;
        }
        .preset-buttons {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
        }
        .preset-button {
            background: linear-gradient(135deg, #26bde2 0%, #0a97d9 100%);
            color: white;
            border: none;
            padding: 0.65rem 1.3rem;
            border-radius: 2rem;
            cursor: pointer;
            font-size: 0.9rem;
            transition: all 0.3s ease;
            box-shadow: 0 4px 12px rgba(38, 189, 226, 0.25);
            font-weight: 600;
            border: 2px solid transparent;
            position: relative;
            overflow: hidden;
        }
        .preset-button::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
            transition: left 0.5s;
        }
        .preset-button:hover::before {
            left: 100%;
        }
        /* SDG12 - 負責任的消費與生產（永續時尚）- 橘棕色 */
        .preset-button.sdg12-button:hover {
            background: linear-gradient(135deg, #bf8b2e 0%, #8d6a1f 100%) !important;
            box-shadow: 0 6px 20px rgba(191, 139, 46, 0.4) !important;
            transform: translateY(-2px);
        }
        /* SDG13 - 氣候行動（氣候變遷/氣候行動）- 深綠色 */
        .preset-button.sdg13-button:hover {
            background: linear-gradient(135deg, #3f7e44 0%, #2d5a2f 100%) !important;
            box-shadow: 0 6px 20px rgba(63, 126, 68, 0.4) !important;
            transform: translateY(-2px);
        }
        /* SDG7 - 負擔得起的清潔能源（永續能源）- 黃色 */
        .preset-button.sdg7-button:hover {
            background: linear-gradient(135deg, #fcc30b 0%, #dda63a 100%) !important;
            box-shadow: 0 6px 20px rgba(252, 195, 11, 0.4) !important;
            transform: translateY(-2px);
        }
        /* SDG5 - 性別平等 - 紅色 */
        .preset-button.sdg5-button:hover {
            background: linear-gradient(135deg, #ff3a21 0%, #e5243b 100%) !important;
            box-shadow: 0 6px 20px rgba(255, 58, 33, 0.4) !important;
            transform: translateY(-2px);
        }
        /* SDG4 - 優質教育（英語練習活動）- 深紅色 */
        .preset-button.sdg4-button:hover {
            background: linear-gradient(135deg, #c5192d 0%, #a21942 100%) !important;
            box-shadow: 0 6px 20px rgba(197, 25, 45, 0.4) !important;
            transform: translateY(-2px);
        }
        /* SDG3 - 良好健康與福祉（放鬆身心）- 綠色 */
        .preset-button.sdg3-button:hover {
            background: linear-gradient(135deg, #4c9f38 0%, #2d5a2f 100%) !important;
            box-shadow: 0 6px 20px rgba(76, 159, 56, 0.4) !important;
            transform: translateY(-2px);
        }
        .preset-button:disabled {
            background: #9ca3af;
            cursor: not-allowed;
            opacity: 0.6;
        }
        .messages {
            flex: 1;
            overflow-y: auto;
            padding: 1.5rem;
            display: flex;
            flex-direction: column;
            gap: 1rem;
            min-height: 400px;
            background: #ffffff;
        }
        .message {
            max-width: 85%;
            padding: 1rem 1.25rem;
            border-radius: 1rem;
            line-height: 1.6;
            animation: slideIn 0.3s ease-out;
            word-wrap: break-word;
            min-height: 20px;
            flex-shrink: 0;
        }
        @keyframes slideIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        @keyframes slideOut {
            from { opacity: 1; transform: translateY(0); }
            to { opacity: 0; transform: translateY(-10px); }
        }
        .message.user {
            align-self: flex-end;
            background: linear-gradient(135deg, #26bde2 0%, #0a97d9 100%);
            color: white;
            box-shadow: 0 4px 16px rgba(38, 189, 226, 0.3);
            white-space: pre-line;
            border: none;
            position: relative;
            overflow: hidden;
        }
        .message.user::before {
            content: '';
            position: absolute;
            top: -50%;
            right: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
            animation: shimmer 3s infinite;
        }
        @keyframes shimmer {
            0%, 100% { transform: translate(0, 0); }
            50% { transform: translate(-20%, -20%); }
        }
        .message.assistant {
            align-self: flex-start;
            background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
            color: #2c3e50;
            border: 2px solid #e9ecef;
            box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
        }

        /* Markdown 樣式 */
        .message.assistant h1,
        .message.assistant h2,
        .message.assistant h3 {
            margin: 0.5rem 0;
            color: #1f2937;
        }

        .message.assistant h1 {
            font-size: 1.5rem;
            border-bottom: 2px solid #e5e7eb;
            padding-bottom: 0.25rem;
        }

        .message.assistant h2 {
            font-size: 1.3rem;
            border-bottom: 1px solid #e5e7eb;
            padding-bottom: 0.25rem;
        }

        .message.assistant h3 {
            font-size: 1.1rem;
        }

        .message.assistant code {
            background: #f3f4f6;
            color: #dc2626;
            padding: 0.125rem 0.25rem;
            border-radius: 0.25rem;
            font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
            font-size: 0.875em;
        }

        .message.assistant pre {
            background: #1f2937;
            color: #f9fafb;
            padding: 1rem;
            border-radius: 0.5rem;
            overflow-x: auto;
            margin: 0.5rem 0;
            font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
            font-size: 0.875em;
            line-height: 1.4;
        }

        .message.assistant pre code {
            background: none;
            color: inherit;
            padding: 0;
            border-radius: 0;
        }

        .message.assistant strong {
            font-weight: 600;
            color: #1f2937;
        }

        .message.assistant em {
            font-style: italic;
            color: #4b5563;
        }

        .message.assistant a {
            color: #d97706;
            text-decoration: underline;
        }

        .message.assistant a:hover {
            color: #b45309;
        }
        .message.tool {
            align-self: center;
            background: linear-gradient(135deg, #56c02b 0%, #4c9f38 100%);
            color: white;
            font-size: 0.9em;
            max-width: 90%;
            box-shadow: 0 4px 16px rgba(86, 192, 43, 0.3);
        }
        .message.warning {
            align-self: center;
            background: linear-gradient(135deg, #fcc30b 0%, #dda63a 100%);
            color: #664d00;
            font-size: 0.95em;
            max-width: 95%;
            box-shadow: 0 4px 16px rgba(252, 195, 11, 0.3);
            border-left: 4px solid #bf8b2e;
            font-weight: 600;
        }
        .message.error {
            align-self: center;
            background: linear-gradient(135deg, #e5243b 0%, #c5192d 100%);
            color: white;
            font-size: 0.95em;
            max-width: 95%;
            box-shadow: 0 4px 16px rgba(229, 36, 59, 0.3);
            font-weight: 600;
        }
        .input-area {
            padding: 1.5rem;
            border-top: 2px solid #e3f2fd;
            background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%);
        }
        .input-container {
            display: flex;
            gap: 0.75rem;
            align-items: stretch;
            position: relative;
        }
        /* 自動完成樣式 */
        .autocomplete-container {
            position: relative;
            flex: 1;
            display: flex;
        }
        .autocomplete-dropdown {
            position: absolute;
            bottom: 100%;
            left: 0;
            right: 0;
            max-height: 300px;
            overflow-y: auto;
            background: white;
            border: 2px solid #d97706;
            border-radius: 0.75rem;
            margin-bottom: 0.5rem;
            box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
            z-index: 1000;
            display: none;
        }
        .autocomplete-dropdown.show {
            display: block;
        }
        .autocomplete-item {
            padding: 0.75rem 1rem;
            cursor: pointer;
            transition: background 0.2s ease;
            border-bottom: 1px solid #f3f4f6;
            font-size: 0.95rem;
            color: #374151;
        }
        .autocomplete-item:last-child {
            border-bottom: none;
        }
        .autocomplete-item:hover {
            background: #fef3c7;
        }
        .autocomplete-item.selected {
            background: #fde68a;
        }
        .autocomplete-highlight {
            font-weight: 600;
            color: #d97706;
        }
        .message-input {
            flex: 1;
            padding: 1rem 1.25rem;
            border: 2px solid #56c1ff;
            border-radius: 0.75rem;
            outline: none;
            font-size: 1rem;
            transition: all 0.2s ease;
            background: white;
            resize: none;
            min-height: 50px;
            max-height: 120px;
            font-family: inherit;
            color: #1d1d1d;
        }
        .message-input:focus {
            border-color: #009edb;
            box-shadow: 0 0 0 4px rgba(0, 158, 219, 0.15);
        }
        .button-group {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
        }
        /* 自動完成樣式 */
        .autocomplete-container {
            position: relative;
            width: 100%;
        }
        .autocomplete-dropdown {
            display: none;
            position: absolute;
            bottom: 100%;
            left: 0;
            right: 0;
            background: white;
            border: 2px solid #56c1ff;
            border-radius: 0.75rem;
            margin-bottom: 0.5rem;
            max-height: 320px;
            overflow-y: auto;
            box-shadow: 0 -4px 16px rgba(0, 158, 219, 0.2);
            z-index: 1000;
        }
        .autocomplete-dropdown.show {
            display: block;
        }
        .autocomplete-item {
            padding: 0.75rem 1rem;
            cursor: pointer;
            transition: all 0.2s ease;
            border-bottom: 1px solid #f0f0f0;
            color: #2c3e50;
            font-size: 0.95rem;
        }
        .autocomplete-item:last-child {
            border-bottom: none;
        }
        .autocomplete-item:hover,
        .autocomplete-item.selected {
            background: linear-gradient(135deg, #e3f2fd 0%, #f0f9ff 100%);
            color: #009edb;
            font-weight: 500;
        }
        .autocomplete-dropdown::-webkit-scrollbar {
            width: 8px;
        }
        .autocomplete-dropdown::-webkit-scrollbar-track {
            background: #f0f0f0;
            border-radius: 0.75rem;
        }
        .autocomplete-dropdown::-webkit-scrollbar-thumb {
            background: #56c1ff;
            border-radius: 0.75rem;
        }
        .autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
            background: #009edb;
        }
        .send-button {
            padding: 1.1rem 2.5rem;
            background: linear-gradient(135deg, #56c02b 0%, #4c9f38 50%, #3f7e44 100%);
            color: white;
            border: none;
            border-radius: 3rem;
            cursor: pointer;
            font-size: 1.05rem;
            font-weight: 700;
            letter-spacing: 0.5px;
            transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            box-shadow: 
                0 6px 20px rgba(86, 192, 43, 0.4),
                inset 0 -2px 8px rgba(0, 0, 0, 0.15),
                inset 0 2px 4px rgba(255, 255, 255, 0.3);
            white-space: nowrap;
            position: relative;
            overflow: hidden;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
        }
        
        /* 光澤效果 */
        .send-button::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: linear-gradient(
                45deg,
                transparent 30%,
                rgba(255, 255, 255, 0.3) 50%,
                transparent 70%
            );
            transform: rotate(45deg);
            transition: all 0.6s ease;
        }
        
        /* 脈衝效果 */
        .send-button::after {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 100%;
            height: 100%;
            background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
            transform: translate(-50%, -50%) scale(0);
            border-radius: 50%;
            transition: transform 0.5s ease;
            opacity: 0;
        }
        
        .send-button:hover::before {
            left: 150%;
        }
        
        .send-button:active::after {
            transform: translate(-50%, -50%) scale(2);
            opacity: 1;
            transition: transform 0s, opacity 0.3s;
        }
        
        .send-button:hover:not(:disabled) {
            background: linear-gradient(135deg, #4c9f38 0%, #3f7e44 50%, #2d5a2f 100%);
            transform: translateY(-3px) scale(1.03);
            box-shadow: 
                0 10px 30px rgba(76, 159, 56, 0.5),
                inset 0 -2px 8px rgba(0, 0, 0, 0.2),
                inset 0 2px 6px rgba(255, 255, 255, 0.4),
                0 0 20px rgba(86, 192, 43, 0.3);
        }
        
        .send-button:active:not(:disabled) {
            transform: translateY(-1px) scale(0.98);
            box-shadow: 
                0 4px 15px rgba(76, 159, 56, 0.4),
                inset 0 2px 8px rgba(0, 0, 0, 0.25);
            transition: all 0.1s ease;
        }
        
        .send-button:disabled {
            background: linear-gradient(135deg, #d1d5db 0%, #9ca3af 100%);
            cursor: not-allowed;
            transform: none;
            box-shadow: 
                0 2px 8px rgba(0, 0, 0, 0.1),
                inset 0 1px 3px rgba(255, 255, 255, 0.2);
            opacity: 0.6;
            color: #6b7280;
        }
        
        /* 按鈕圖標動畫 */
        .send-button:hover .button-icon {
            animation: fly 0.6s ease-in-out;
        }
        
        @keyframes fly {
            0%, 100% { transform: translateX(0) translateY(0); }
            25% { transform: translateX(3px) translateY(-3px); }
            50% { transform: translateX(6px) translateY(-6px); opacity: 0.7; }
            75% { transform: translateX(3px) translateY(-3px); }
        }
        /* 思考過程樣式 - 全域隱藏 */
        .thinking-process,
        .thinking-message {
            display: none !important;
        }
        
        /* 保留樣式定義以防需要 */
        .thinking-process-legacy {
            margin: 15px 0;
            padding: 0;
            background: linear-gradient(135deg, #fff9e6 0%, #fffbf0 100%);
            border: 2px solid #fcc30b;
            border-radius: 0.75rem;
            font-size: 14px;
            color: #6d4c00;
            overflow: hidden;
            animation: slideIn 0.3s ease-out;
            max-width: 90%;
            align-self: flex-start;
            flex-shrink: 0;
        }
        
        .thinking-header {
            background: rgba(252, 195, 11, 0.15);
            padding: 12px 16px;
            font-weight: 600;
            border-bottom: 2px solid #fcc30b;
            display: flex;
            align-items: center;
            justify-content: space-between;
            cursor: pointer;
            transition: all 0.2s ease;
            user-select: none;
        }
        
        .thinking-header:hover {
            background: rgba(252, 195, 11, 0.25);
        }
        
        .thinking-header .toggle-icon {
            font-size: 0.9em;
            transition: transform 0.3s ease;
            color: #bf8b2e;
        }
        
        .thinking-steps {
            padding: 12px 16px;
        }
        
        .thinking-step {
            margin: 8px 0;
            padding: 10px 12px;
            background: #ffffff;
            border-radius: 0.5rem;
            border-left: 3px solid #fcc30b;
            line-height: 1.5;
            animation: fadeInStep 0.4s ease-out;
        }
        
        @keyframes fadeInStep {
            from { opacity: 0; transform: translateX(-10px); }
            to { opacity: 1; transform: translateX(0); }
        }
        
        /* 工具執行結果樣式 */
        .tool-execution {
            margin: 15px 0;
            border: 2px solid #56c1ff;
            border-radius: 0.75rem;
            overflow: hidden;
            animation: slideIn 0.3s ease-out;
            max-width: 90%;
            align-self: flex-start;
            background: white;
            box-shadow: 0 4px 12px rgba(0, 119, 182, 0.1);
            min-height: 60px;
            flex-shrink: 0;
        }
        
        .tool-header {
            background: linear-gradient(135deg, #e3f2fd 0%, #f0f9ff 100%);
            padding: 14px 18px;
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-weight: 600;
            color: #0077b6;
            transition: all 0.2s ease;
            user-select: none;
            min-height: 52px;
            border-bottom: 2px solid #56c1ff;
        }
        
        .tool-header:hover {
            background: linear-gradient(135deg, #d4edfe 0%, #e3f2fd 100%);
        }
        
        .tool-header.executing {
            background: linear-gradient(135deg, #fff9e6 0%, #fffbf0 100%);
            color: #bf8b2e;
        }
        
        .tool-header.completed {
            background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f4 100%);
            color: #2e7d32;
        }
        
        .tool-header.error {
            background: linear-gradient(135deg, #ffebee 0%, #fef5f5 100%);
            color: #c62828;
        }
        
        .tool-title {
            display: flex;
            align-items: center;
            gap: 10px; /* 增加間距 */
            font-size: 14px; /* 調整標題字體大小 */
        }
        
        .tool-toggle {
            font-size: 16px; /* 增大切換按鈕字體 */
            transition: transform 0.3s ease;
            color: #495057;
            cursor: pointer;
            padding: 4px 8px; /* 增加點擊區域 */
            border-radius: 4px;
            user-select: none;
        }
        
        .tool-toggle:hover {
            background-color: rgba(0,0,0,0.1);
        }
        
        .tool-toggle.expanded {
            transform: rotate(180deg);
        }
        
        .tool-content {
            overflow-y: auto;
            max-height: 600px;
            background: #f8fafc;
            padding: 16px;
        }
        
        .tool-result {
            font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
            font-size: 12px;
            white-space: pre-wrap;
            background: white;
            padding: 16px;
            border-radius: 0.5rem;
            border: 1px solid #e2e8f0;
            line-height: 1.4;
            max-height: 550px;
            min-height: 150px;
            overflow-y: auto;
            word-wrap: break-word;
        }
        
        .tool-result-item {
            margin-bottom: 12px;
            padding: 12px;
            border-left: 3px solid #22c55e;
            background: #f0fdf4;
            border-radius: 0.25rem;
            min-height: 60px;
        }
        
        .tool-result-item.error {
            border-left-color: #ef4444;
            background: #fef2f2;
        }
        
        .tool-result-item.executing {
            border-left-color: #f59e0b;
            background: #fffbeb;
        }
        
        .result-header {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 8px; /* 增加間距 */
            font-size: 12px;
            color: #6c757d;
        }
        
        .result-timestamp {
            font-family: monospace;
            background: #e9ecef;
            padding: 2px 6px;
            border-radius: 3px;
        }
        
        .result-status {
            background: #3b82f6;
            color: white;
            padding: 2px 6px;
            border-radius: 0.25rem;
            font-size: 11px;
            text-transform: uppercase;
        }
        
        .result-content {
            margin-top: 8px;
            padding: 8px;
            background: white;
            border-radius: 0.25rem;
            border: 1px solid #e2e8f0;
            min-height: 40px;
        }
        
        .tool-loading {
            display: flex;
            align-items: center;
            gap: 8px;
            color: #6c757d;
            font-style: italic;
        }
        
        .tool-id {
            font-size: 10px;
            color: #6c757d;
            margin-left: 8px;
        }
        
        /* 載入動畫 */
        .loading-dots {
            display: inline-block;
        }
        
        .loading-dots::after {
            content: '';
            animation: dots 1.5s infinite;
        }
        
        @keyframes dots {
            0%, 20% { content: ''; }
            40% { content: '.'; }
            60% { content: '..'; }
            80%, 100% { content: '...'; }
        }
        
        /* 進度指示器 */
        .progress-indicator {
            margin: 15px 0;
            padding: 12px 16px;
            background: linear-gradient(135deg, #e3f2fd 0%, #f0f9ff 100%);
            border: 2px solid #56c1ff;
            border-radius: 0.75rem;
            color: #0077b6;
            font-size: 14px;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 10px;
            animation: slideIn 0.3s ease-out;
            max-width: 85%;
            align-self: flex-start;
            flex-shrink: 0;
            box-shadow: 0 4px 12px rgba(0, 119, 182, 0.1);
        }
        
        .progress-icon {
            animation: pulse 2s infinite;
        }
        
        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.5; }
        }
        
        .typing {
            align-self: flex-start;
            background: linear-gradient(135deg, #fff5f0 0%, #ffe8e0 100%);
            color: #d2421a;
            font-style: normal;
            border: 2px solid #ff6b35;
            border-left: 4px solid #ff6b35;
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            max-width: 85%;
            box-shadow: 0 4px 16px rgba(255, 107, 53, 0.2);
        }
        .typing-dots {
            display: inline-flex;
            gap: 0.25rem;
        }
        .typing-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: #009edb;
            animation: typing 1.4s infinite ease-in-out;
        }
        .typing-dot:nth-child(1) { animation-delay: -0.32s; }
        .typing-dot:nth-child(2) { animation-delay: -0.16s; }
        .typing-dot:nth-child(3) { animation-delay: 0s; }
        @keyframes typing {
            0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
            40% { transform: scale(1); opacity: 1; }
        }
        
        /* 打字機效果樣式 */
        .typewriter-cursor::after {
            content: '|';
            opacity: 1;
            animation: blink 1s infinite;
            color: #009edb;
            font-weight: bold;
        }
        
        @keyframes blink {
            0%, 50% { opacity: 1; }
            51%, 100% { opacity: 0; }
        }
        
        /* 底部語言選擇器樣式 */
        .bottom-language-selector {
            background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
            border-top: 2px solid #e3f2fd;
            color: #5a6c7d;
            padding: 1rem;
            text-align: center;
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
            box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
        }

        .bottom-language-selector label {
            font-size: 0.9rem;
            color: #5a6c7d;
            font-weight: 500;
        }

        .bottom-language-selector select {
            padding: 0.5rem 0.75rem;
            border: 2px solid #e0e0e0;
            border-radius: 0.375rem;
            background: white;
            color: #2c3e50;
            font-size: 0.9rem;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .bottom-language-selector select:hover {
            border-color: #26bde2;
        }

        .bottom-language-selector select:focus {
            outline: none;
            border-color: #26bde2;
            box-shadow: 0 0 0 3px rgba(38, 189, 226, 0.1);
        }

        /* 底部免責聲明樣式 */
        .bottom-disclaimer {
            background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
            border-top: 3px solid transparent;
            border-image: linear-gradient(90deg,
                #e5243b 0%, #26bde2 25%, #56c02b 50%, #fcc30b 75%, #dd1367 100%) 1;
            color: #5a6c7d;
            padding: 0.6rem 1rem;
            text-align: center;
            font-size: 0.8rem;
            font-weight: 500;
            box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
        }
        
        /* 系統導覽樣式 */
        .tour-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            z-index: 9998;
            display: none;
            animation: fadeIn 0.3s ease-in;
            overflow: hidden;
        }
        
        .tour-overlay.active {
            display: block;
        }
        
        /* 防止導覽時背景滾動 */
        body.tour-active {
            overflow: hidden;
            position: fixed;
            width: 100%;
        }
        
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }
        
        .tour-spotlight {
            position: fixed;
            border: 3px solid #d97706;
            border-radius: 8px;
            box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7), 0 0 20px rgba(217, 119, 6, 0.8);
            pointer-events: none;
            z-index: 9999;
            transition: all 0.5s ease;
            animation: pulse 2s infinite;
        }
        
        @keyframes pulse {
            0%, 100% { box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7), 0 0 20px rgba(217, 119, 6, 0.8); }
            50% { box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7), 0 0 30px rgba(217, 119, 6, 1); }
        }
        
        .tour-tooltip {
            position: fixed;
            background: white;
            border-radius: 12px;
            padding: 1.5rem;
            max-width: 400px;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
            z-index: 10000;
            animation: slideIn 0.4s ease-out;
        }
        
        .tour-tooltip-header {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            margin-bottom: 1rem;
        }
        
        .tour-tooltip-icon {
            font-size: 2rem;
        }
        
        .tour-tooltip-title {
            font-size: 1.2rem;
            font-weight: 600;
            color: #d97706;
        }
        
        .tour-tooltip-content {
            color: #4b5563;
            line-height: 1.6;
            margin-bottom: 1.5rem;
            font-size: 0.95rem;
        }
        
        .tour-tooltip-footer {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 1rem;
        }
        
        .tour-progress {
            font-size: 0.85rem;
            color: #9ca3af;
            font-weight: 500;
        }
        
        .tour-buttons {
            display: flex;
            gap: 0.5rem;
        }
        
        .tour-button {
            padding: 0.5rem 1rem;
            border: none;
            border-radius: 0.5rem;
            cursor: pointer;
            font-size: 0.9rem;
            font-weight: 500;
            transition: all 0.2s ease;
        }
        
        .tour-button-skip {
            background: #f3f4f6;
            color: #6b7280;
        }
        
        .tour-button-skip:hover {
            background: #e5e7eb;
        }
        
        .tour-button-next {
            background: linear-gradient(135deg, #d97706 0%, #ea580c 100%);
            color: white;
        }
        
        .tour-button-next:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
        }
        
        /* 歡迎對話框樣式 */
        .welcome-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10001;
            animation: fadeIn 0.3s ease-in;
        }
        
        .welcome-content {
            background: white;
            border-radius: 16px;
            padding: 2rem;
            max-width: 500px;
            width: 90%;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            animation: slideIn 0.5s ease-out;
        }
        
        .welcome-header {
            text-align: center;
            margin-bottom: 1.5rem;
        }
        
        .welcome-icon {
            margin-bottom: 1rem;
        }

        .welcome-icon img {
            width: 160px;
            height: 160px;
            object-fit: contain;
        }
        
        .welcome-title {
            font-size: 1.8rem;
            font-weight: 600;
            color: #d97706;
            margin-bottom: 0.5rem;
        }
        
        .welcome-subtitle {
            font-size: 1rem;
            color: #6b7280;
        }
        
        .welcome-body {
            color: #4b5563;
            line-height: 1.7;
            margin-bottom: 2rem;
        }
        
        .welcome-features {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 1rem;
            margin-bottom: 2rem;
        }
        
        .welcome-feature {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.75rem;
            background: #f8fafc;
            border-radius: 0.5rem;
            font-size: 0.9rem;
            color: #374151;
        }
        
        .welcome-feature-icon {
            font-size: 1.5rem;
        }
        
        .welcome-buttons {
            display: flex;
            gap: 1rem;
        }
        
        .welcome-button {
            flex: 1;
            padding: 0.75rem 1.5rem;
            border: none;
            border-radius: 0.75rem;
            cursor: pointer;
            font-size: 1rem;
            font-weight: 600;
            transition: all 0.2s ease;
        }
        
        .welcome-button-tour {
            background: linear-gradient(135deg, #d97706 0%, #ea580c 100%);
            color: white;
        }
        
        .welcome-button-tour:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(217, 119, 6, 0.4);
        }
        
        .welcome-button-skip {
            background: #f3f4f6;
            color: #6b7280;
        }
        
        .welcome-button-skip:hover {
            background: #e5e7eb;
        }
        
        /* 手機端優化 - 系統導覽 */
        @media (max-width: 768px) {
            /* 導覽提示框優化 */
            .tour-tooltip {
                max-width: 90%;
                width: calc(100% - 2rem);
                padding: 1rem;
                left: 1rem !important;
                right: 1rem;
            }
            
            .tour-tooltip-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 0.5rem;
            }
            
            .tour-tooltip-icon {
                font-size: 1.5rem;
            }
            
            .tour-tooltip-title {
                font-size: 1rem;
            }
            
            .tour-tooltip-content {
                font-size: 0.9rem;
                margin-bottom: 1rem;
            }
            
            .tour-tooltip-footer {
                flex-direction: column;
                gap: 0.75rem;
            }
            
            .tour-buttons {
                width: 100%;
                flex-direction: column;
            }
            
            .tour-button {
                width: 100%;
                padding: 0.75rem;
            }
            
            /* 歡迎對話框優化 */
            .welcome-content {
                padding: 1.5rem;
                max-width: 95%;
                width: 95%;
            }
            
            .welcome-icon {
                margin-bottom: 0.75rem;
            }

            .welcome-icon img {
                width: 128px;
                height: 128px;
            }
            
            .welcome-title {
                font-size: 1.3rem;
                line-height: 1.3;
            }
            
            .welcome-subtitle {
                font-size: 0.9rem;
            }
            
            .welcome-body {
                font-size: 0.9rem;
                margin-bottom: 1.5rem;
            }
            
            .welcome-features {
                grid-template-columns: 1fr;
                gap: 0.75rem;
                margin-bottom: 1.5rem;
            }
            
            .welcome-feature {
                padding: 0.6rem;
                font-size: 0.85rem;
            }
            
            .welcome-feature-icon {
                font-size: 1.3rem;
            }
            
            .welcome-buttons {
                flex-direction: column;
                gap: 0.75rem;
            }
            
            .welcome-button {
                width: 100%;
                padding: 0.875rem 1rem;
                font-size: 0.95rem;
            }
            
            /* 聚光燈效果在手機上稍微縮小 */
            .tour-spotlight {
                border-width: 2px;
            }
            
            /* 確保遮罩層在手機上正確顯示 */
            .tour-overlay {
                position: fixed;
                top: 0;
                left: 0;
                right: 0;
                bottom: 0;
                width: 100%;
                height: 100%;
            }
            
            /* 手機上側邊欄導覽步驟的特殊處理 */
            .sidebar.tour-highlight {
                width: 280px !important;
            }
        }
        
        /* 超小螢幕優化（iPhone SE 等） */
        @media (max-width: 375px) {
            .tour-tooltip {
                padding: 0.875rem;
            }
            
            .tour-tooltip-title {
                font-size: 0.95rem;
            }
            
            .tour-tooltip-content {
                font-size: 0.85rem;
            }
            
            .welcome-content {
                padding: 1.25rem;
            }

            .welcome-icon img {
                width: 96px;
                height: 96px;
            }
            
            .welcome-title {
                font-size: 1.15rem;
            }
            
            .welcome-subtitle {
                font-size: 0.85rem;
            }
            
            .welcome-body {
                font-size: 0.85rem;
            }
            
            .welcome-feature {
                padding: 0.5rem;
                font-size: 0.8rem;
            }
            
            .welcome-button {
                padding: 0.75rem;
                font-size: 0.9rem;
            }
        }
        
        /* 語言選擇模態框樣式 */
        .language-selection-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10002;
            animation: fadeIn 0.3s ease-in;
        }
        
        .language-selection-modal.hidden {
            display: none;
        }
        
        .language-selection-content {
            background: white;
            border-radius: 20px;
            padding: 3rem;
            max-width: 600px;
            width: 90%;
            max-height: 90vh;
            overflow-y: auto;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            animation: slideIn 0.5s ease-out;
            text-align: center;
        }
        
        .language-selection-header {
            margin-bottom: 2rem;
        }
        
        .language-selection-icon {
            font-size: 4rem;
            margin-bottom: 1rem;
        }
        
        .language-selection-title {
            font-size: 2rem;
            font-weight: 600;
            color: #d97706;
            margin-bottom: 0.5rem;
        }
        
        .language-selection-subtitle {
            font-size: 1rem;
            color: #6b7280;
        }
        
        .language-options-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 1rem;
            margin-bottom: 2rem;
        }
        
        .language-option-card {
            background: #f8fafc;
            border: 2px solid #e2e8f0;
            border-radius: 12px;
            padding: 1.5rem 1rem;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.5rem;
        }
        
        .language-option-card:hover {
            background: #fef3c7;
            border-color: #d97706;
            transform: translateY(-4px);
            box-shadow: 0 8px 16px rgba(217, 119, 6, 0.2);
        }
        
        .language-option-card.selected {
            background: linear-gradient(135deg, #d97706 0%, #ea580c 100%);
            border-color: #d97706;
            color: white;
            transform: scale(1.05);
        }
        
        .language-flag {
            font-size: 2.5rem;
            margin-bottom: 0.25rem;
        }
        
        .language-name {
            font-size: 1.1rem;
            font-weight: 600;
        }
        
        .language-native-name {
            font-size: 0.85rem;
            opacity: 0.8;
        }
        
        .language-confirm-button {
            width: 100%;
            padding: 1rem 2rem;
            background: linear-gradient(135deg, #d97706 0%, #ea580c 100%);
            color: white;
            border: none;
            border-radius: 12px;
            cursor: pointer;
            font-size: 1.1rem;
            font-weight: 600;
            transition: all 0.2s ease;
            opacity: 0.5;
            pointer-events: none;
        }
        
        .language-confirm-button.enabled {
            opacity: 1;
            pointer-events: auto;
        }
        
        .language-confirm-button.enabled:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(217, 119, 6, 0.4);
        }
        
        /* 手機端優化 */
        @media (max-width: 768px) {
            .language-selection-content {
                padding: 2rem 1.5rem;
                width: 95%;
                max-height: 85vh;
            }
            
            .language-selection-icon {
                font-size: 3rem;
            }
            
            .language-selection-title {
                font-size: 1.5rem;
            }
            
            .language-selection-subtitle {
                font-size: 0.9rem;
            }
            
            .language-options-grid {
                grid-template-columns: 1fr 1fr;
                gap: 0.75rem;
            }
            
            .language-option-card {
                padding: 1rem 0.75rem;
            }
            
            .language-flag {
                font-size: 2rem;
            }
            
            .language-name {
                font-size: 1rem;
            }
            
            .language-native-name {
                font-size: 0.75rem;
            }
            
            .language-confirm-button {
                padding: 0.875rem 1.5rem;
                font-size: 1rem;
            }
        }
        
        @media (max-width: 375px) {
            .language-selection-content {
                padding: 1.5rem 1rem;
                max-height: 80vh;
            }
            
            .language-selection-icon {
                font-size: 2.5rem;
            }
            
            .language-selection-title {
                font-size: 1.25rem;
            }
            
            .language-options-grid {
                grid-template-columns: 1fr;
            }
        }
        
        /* Markdown 內容樣式 */
        .markdown-content {
            line-height: 1.6;
            word-wrap: break-word;
        }
        
        .markdown-content a {
            background: linear-gradient(135deg, #26bde2, #0a97d9);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            text-decoration: underline;
            text-decoration-color: #26bde2;
            cursor: pointer;
            transition: all 0.2s ease;
            font-weight: 600;
        }
        
        .markdown-content a:hover {
            background: linear-gradient(135deg, #56c02b, #4c9f38);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            text-decoration-color: #56c02b;
            transform: translateX(2px);
        }
        
        .markdown-content a:visited {
            color: #005f8d;
        }
        
        .markdown-content p {
            margin: 0.75em 0;
        }
        
        .markdown-content h1, .markdown-content h2, .markdown-content h3,
        .markdown-content h4, .markdown-content h5, .markdown-content h6 {
            margin: 1em 0 0.5em 0;
            font-weight: 600;
        }
        
        .markdown-content ul, .markdown-content ol {
            margin: 0.75em 0;
            padding-left: 1.5em;
        }
        
        .markdown-content li {
            margin: 0.25em 0;
        }
        
        .markdown-content pre {
            background: linear-gradient(135deg, #f0f9ff 0%, #e3f2fd 100%);
            border: 2px solid #56c1ff;
            border-radius: 0.5rem;
            padding: 1rem;
            overflow-x: auto;
            margin: 1em 0;
        }
        
        .markdown-content code {
            background: #e3f2fd;
            padding: 0.2em 0.4em;
            border-radius: 0.25rem;
            font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
            font-size: 0.9em;
            color: #0077b6;
        }
        
        .markdown-content pre code {
            background: none;
            padding: 0;
        }
        
        .markdown-content blockquote {
            border-left: 4px solid #56c1ff;
            padding-left: 1rem;
            margin: 1em 0;
            color: #0077b6;
            font-style: italic;
        }
        
        /* 工具結果內容樣式 */
        .json-content {
            background: #f8f9fa;
            border: 1px solid #e9ecef;
            border-radius: 4px;
            padding: 12px;
            margin: 8px 0;
            font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
            font-size: 12px;
            line-height: 1.4;
            color: #495057;
            overflow-x: auto;
            white-space: pre-wrap;
        }
        
        .text-content {
            background: #f8f9fa;
            border-left: 3px solid #007bff;
            padding: 12px;
            margin: 8px 0;
            font-size: 13px;
            line-height: 1.5;
            color: #495057;
            white-space: pre-wrap;
        }
        
        .content-item {
            padding: 8px;
            margin: 4px 0;
            background: #fff;
            border: 1px solid #e9ecef;
            border-radius: 3px;
            font-size: 12px;
            color: #6c757d;
        }
        
        .step-content {
            font-size: 14px;
            line-height: 1.5;
        }
        
        .step-text {
            color: #495057;
            white-space: pre-wrap;
            word-wrap: break-word;
        }
        
        /* 響應式設計：手機端優化 */
        @media (max-width: 768px) {
            /* 語言選擇歡迎畫面手機端優化 */
            .language-welcome-modal {
                padding: 2rem 1.5rem;
                max-width: 100%;
                display: flex;
                flex-direction: column;
                min-height: 100vh;
                justify-content: center;
            }

            .welcome-logo {
                width: 80px;
                height: 80px;
                margin-bottom: 1.5rem;
            }

            .welcome-title {
                font-size: 1.8rem;
                line-height: 1.3;
                margin-bottom: 0.5rem;
            }

            .welcome-subtitle {
                font-size: 1rem;
                margin-bottom: 2rem;
                line-height: 1.4;
            }

            .language-prompt {
                font-size: 1.2rem;
                margin-bottom: 1.5rem;
            }

            .language-options {
                grid-template-columns: 1fr;
                gap: 1rem;
                max-width: 100%;
                padding: 0 0.5rem;
                margin-bottom: 2rem;
            }

            .language-option-btn {
                padding: 1.2rem 1rem;
                border-radius: 0.75rem;
                width: 100%;
            }

            .language-flag {
                font-size: 2.5rem;
                margin-bottom: 0.5rem;
            }

            .language-name {
                font-size: 1.1rem;
            }

            .language-desc {
                font-size: 0.85rem;
            }

            /* 語言選擇器在小螢幕上的調整 */
            .language-selector {
                width: 100%;
                justify-content: center;
                margin-top: 1rem;
            }

            .header-content {
                flex-wrap: wrap;
            }

            /* 隱藏思考過程 */
            .thinking-message {
                display: none !important;
            }
            
            /* 頁面整體優化 */
            body {
                font-size: 14px;
            }
            
            /* 標題區域優化 */
            .header {
                padding: 1rem;
                flex-direction: column;
                text-align: center;
                gap: 0.75rem;
            }
            
            .header-content {
                flex-direction: column;
                gap: 1rem;
            }
            
            .header-logo {
                width: 60px;
                height: 60px;
            }
            
            .header-text {
                min-width: unset;
                text-align: center;
            }
            
            .header h1 {
                font-size: 1.3rem;
                line-height: 1.3;
                margin-bottom: 0.3rem;
            }

            .header .subtitle {
                font-size: 0.85rem;
                margin-bottom: 0.5rem;
            }

            .auth-section {
                justify-content: center;
            }

            .login-button {
                padding: 0.6rem 1.2rem;
                font-size: 0.85rem;
            }

            .user-info {
                padding: 0.6rem 0.8rem;
                font-size: 0.85rem;
            }

            .user-avatar {
                width: 28px;
                height: 28px;
                font-size: 0.75rem;
            }
            
            /* 功能卡片響應式 */
            .features {
                grid-template-columns: 1fr 1fr;
                gap: 0.5rem;
                margin-top: 0.75rem;
            }
            
            .feature {
                padding: 0.5rem;
                font-size: 0.8rem;
            }
            
            /* 聊天容器優化 */
            .chat-container {
                margin: 1rem auto;
                width: calc(100% - 2rem);
                border-radius: 0.75rem;
                min-height: 75vh;
            }
            
            /* 模型選擇區域優化 */
            .model-selector {
                padding: 0.75rem 1rem;
            }
            
            .model-selector h3 {
                font-size: 0.9rem;
                margin-bottom: 0.5rem;
            }
            
            .model-controls {
                gap: 0.5rem;
                flex-direction: column;
                align-items: stretch;
            }
            
            .model-dropdown {
                min-width: unset;
                width: 100%;
                padding: 0.75rem;
                font-size: 0.85rem;
            }
            
            .current-model {
                font-size: 0.75rem;
                padding: 0.25rem 0.5rem;
                text-align: center;
            }
            
            /* 快捷操作優化 */
            .quick-actions {
                padding: 0.75rem 1rem;
            }
            
            .quick-actions h3 {
                font-size: 0.9rem;
                margin-bottom: 0.5rem;
            }
            
            .preset-buttons {
                gap: 0.5rem;
                /* 改為自動換行布局 */
                display: flex;
                flex-wrap: wrap;
            }
            
            .preset-button {
                /* 移除 flex: 1，改用 flex-basis 讓按鈕可以自動換行 */
                flex: 0 1 calc(50% - 0.25rem);
                padding: 0.6rem 0.5rem;
                font-size: 0.8rem;
                text-align: center;
                min-width: 0;
                /* 允許文字換行 */
                white-space: normal;
                overflow: visible;
                /* 增加行高讓多行文字更易閱讀 */
                line-height: 1.3;
                /* 確保按鈕有最小高度 */
                min-height: 44px;
                /* 垂直置中文字 */
                display: flex;
                align-items: center;
                justify-content: center;
            }
            
            /* 訊息區域優化 */
            .messages {
                padding: 1rem;
                gap: 0.75rem;
                min-height: 300px;
            }
            
            .message {
                max-width: 95%;
                padding: 0.75rem 1rem;
                border-radius: 0.75rem;
                font-size: 0.9rem;
                line-height: 1.5;
            }
            
            /* 輸入區域優化 */
            .input-area {
                padding: 1rem;
                border-top: 1px solid #e2e8f0;
                background: #f8fafc;
            }
            
            .input-container {
                gap: 0.5rem;
                flex-direction: column;
            }
            
            .message-input {
                padding: 0.75rem 1rem;
                font-size: 0.9rem;
                border-radius: 0.5rem;
                min-height: 45px;
                max-height: 100px;
            }
            
            .button-group {
                flex-direction: row;
                gap: 0.5rem;
                justify-content: space-between;
            }
            
            .send-button {
                flex: 2;
                padding: 0.9rem 1.5rem;
                font-size: 0.95rem;
                border-radius: 2.5rem;
                box-shadow: 0 4px 12px rgba(86, 192, 43, 0.35);
            }
            
            .send-button:hover:not(:disabled) {
                transform: translateY(-2px) scale(1.02);
            }
            
            .send-button:active:not(:disabled) {
                transform: translateY(0) scale(0.98);
            }
            
            /* 工具呼叫優化 */
            .tool-call {
                padding: 0.5rem;
                margin: 0.5rem 0;
                font-size: 0.8rem;
            }
            
            .tool-content {
                padding: 0.5rem;
                font-size: 0.8rem;
                line-height: 1.4;
            }
            
            /* 代碼區塊優化 */
            .markdown-content pre {
                font-size: 0.8rem;
                padding: 0.5rem;
                border-radius: 0.4rem;
                overflow-x: auto;
                white-space: pre;
            }
            
            .markdown-content code {
                font-size: 0.85rem;
                padding: 0.2rem 0.3rem;
            }
            
            /* 狀態區域優化 */
            .status {
                padding: 0.75rem;
                font-size: 0.85rem;
                border-radius: 0.5rem;
            }
            
            /* 確保觸控友好 */
            button, select, .preset-button {
                min-height: 44px;
                touch-action: manipulation;
            }
            
            /* 防止縮放 */
            input, textarea, select {
                font-size: 16px !important;
            }
            
            /* 底部語言選擇器手機端優化 */
            .bottom-language-selector {
                padding: 0.75rem;
                font-size: 0.85rem;
                flex-direction: column;
                gap: 0.5rem;
            }

            .bottom-language-selector label {
                font-size: 0.85rem;
            }

            .bottom-language-selector select {
                padding: 0.5rem;
                font-size: 0.85rem;
                width: 100%;
                max-width: 300px;
            }

            /* 底部免責聲明手機端優化 */
            .bottom-disclaimer {
                padding: 0.5rem 0.75rem;
                font-size: 0.7rem;
                line-height: 1.4;
            }
        }
        
        /* 超小螢幕優化 (iPhone SE等) */
        @media (max-width: 375px) {
            /* 語言選擇歡迎畫面超小螢幕優化 */
            .language-welcome-modal {
                padding: 1.5rem 1rem;
            }

            .welcome-logo {
                width: 60px;
                height: 60px;
                margin-bottom: 1rem;
            }

            .welcome-title {
                font-size: 1.5rem;
            }

            .welcome-subtitle {
                font-size: 0.9rem;
                margin-bottom: 1.5rem;
            }

            .language-prompt {
                font-size: 1rem;
                margin-bottom: 1rem;
            }

            .language-options {
                gap: 0.75rem;
            }

            .language-option-btn {
                padding: 1rem 0.75rem;
            }

            .language-flag {
                font-size: 2rem;
            }

            .language-name {
                font-size: 1rem;
            }

            .language-desc {
                font-size: 0.75rem;
            }

            .chat-container {
                margin: 0.5rem auto;
                width: calc(100% - 1rem);
            }
            
            .header {
                padding: 0.75rem;
            }
            
            .header h1 {
                font-size: 1.2rem;
            }
            
            .features {
                grid-template-columns: 1fr;
            }
            
            .preset-buttons {
                flex-direction: column;
                gap: 0.5rem;
            }
            
            .preset-button {
                flex: none;
                width: 100%;
                padding: 0.75rem 0.5rem;
                /* 確保文字可以換行 */
                white-space: normal;
                line-height: 1.4;
                min-height: 44px;
                display: flex;
                align-items: center;
                justify-content: center;
            }
            
            .button-group {
                flex-direction: column;
            }

            .send-button {
                flex: none;
                width: 100%;
                padding: 1rem 1.5rem;
                font-size: 1rem;
                border-radius: 2.5rem;
            }
            
            /* 超小螢幕底部語言選擇器優化 */
            .bottom-language-selector {
                padding: 0.6rem;
                font-size: 0.8rem;
            }

            .bottom-language-selector label {
                font-size: 0.8rem;
            }

            .bottom-language-selector select {
                padding: 0.4rem;
                font-size: 0.8rem;
            }

            /* 超小螢幕底部免責聲明優化 */
            .bottom-disclaimer {
                padding: 0.4rem 0.5rem;
                font-size: 0.65rem;
                line-height: 1.3;
            }
        }

        /* 中獎彈窗樣式 */
        .prize-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 9999;
            animation: fadeIn 0.3s ease-in;
        }

        .prize-overlay.show {
            display: flex;
        }

        .prize-modal {
            background: white;
            border-radius: 20px;
            padding: 2rem;
            max-width: 90%;
            max-height: 90%;
            overflow-y: auto; /* Add this line */
            text-align: center;
            position: relative;
            animation: scaleIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        }

        .prize-modal h2 {
            font-size: 2.5rem;
            margin-bottom: 1rem;
            background: linear-gradient(135deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            animation: shimmer 2s infinite;
        }

        .prize-gif {
            max-width: 100%;
            max-height: 400px;
            border-radius: 10px;
            margin: 1rem 0;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
        }

        .prize-message {
            font-size: 1.3rem;
            color: #e5243b;
            font-weight: bold;
            margin: 1rem 0;
        }

        .prize-number {
            display: block;
            font-size: 1.5rem;
            color: #26bde2;
            margin-top: 1rem;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
        }

        .close-prize-btn {
            background: linear-gradient(135deg, #26bde2 0%, #0a97d9 100%);
            color: white;
            border: none;
            padding: 1rem 2rem;
            font-size: 1.1rem;
            border-radius: 50px;
            cursor: pointer;
            margin-top: 1rem;
            transition: all 0.3s ease;
            box-shadow: 0 4px 15px rgba(38, 189, 226, 0.4);
        }

        .close-prize-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(38, 189, 226, 0.6);
        }

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

        @keyframes scaleIn {
            from {
                transform: scale(0.5) rotate(-5deg);
                opacity: 0;
            }
            to {
                transform: scale(1) rotate(0deg);
                opacity: 1;
            }
        }

        @keyframes shimmer {
            0%, 100% { filter: brightness(1); }
            50% { filter: brightness(1.3); }
        }

        /* 滾動提示動畫 */
        .scroll-indicator {
            position: fixed;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            color: #26bde2;
            font-size: 2rem;
            animation: bounce 2s infinite;
            z-index: 10001;
            opacity: 0.7;
            display: none;
        }

        .language-welcome-overlay .scroll-indicator {
            display: block;
        }

        .language-welcome-overlay.hidden .scroll-indicator {
            display: none;
        }

        @keyframes bounce {
            0%, 20%, 50%, 80%, 100% {
                transform: translateX(-50%) translateY(0);
            }
            40% {
                transform: translateX(-50%) translateY(-10px);
            }
            60% {
                transform: translateX(-50%) translateY(-5px);
            }
        }

        /* 手機端優化 */
        @media (max-width: 768px) {
            .scroll-indicator {
                display: block;
            }

            .prize-modal {
                padding: 1.5rem;
            }

            .prize-modal h2 {
                font-size: 1.8rem;
            }

            .prize-gif {
                max-height: 250px;
            }

            .prize-message {
                font-size: 1.1rem;
            }

            .close-prize-btn {
                padding: 0.8rem 1.5rem;
                font-size: 1rem;
            }
        }

        /* 浮動問卷調查 Logo */
        .floating-survey-container {
            position: fixed;
            bottom: 30px;
            right: 30px;
            display: flex;
            align-items: center;
            gap: 12px;
            cursor: pointer;
            z-index: 9998;
            transition: all 0.3s ease;
        }

        .floating-survey-logo {
            width: 80px;
            height: 80px;
            animation: float 3s ease-in-out infinite;
            filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.2));
            transition: all 0.3s ease;
            flex-shrink: 0;
        }

        .floating-survey-container:hover .floating-survey-logo {
            transform: translateY(-8px) scale(1.1);
            filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.3));
        }

        .floating-survey-container:active .floating-survey-logo {
            transform: translateY(-4px) scale(1.05);
        }

        .floating-survey-logo img {
            width: 100%;
            height: 100%;
            object-fit: contain;
            border-radius: 50%;
            background: white;
            padding: 8px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }

        .floating-survey-text {
            background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
            color: #2c3e50;
            padding: 12px 20px;
            border-radius: 12px;
            font-size: 0.95rem;
            font-weight: 600;
            white-space: nowrap;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
            border: 2px solid transparent;
            background-clip: padding-box;
            position: relative;
            transition: all 0.3s ease;
            opacity: 0;
            transform: translateX(20px);
            pointer-events: none;
        }

        .floating-survey-text::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            border-radius: 12px;
            padding: 2px;
            background: linear-gradient(135deg, #26bde2, #56c02b, #fcc30b, #e5243b);
            -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
            -webkit-mask-composite: xor;
            mask-composite: exclude;
            z-index: -1;
        }

        .floating-survey-text::after {
            content: '';
            position: absolute;
            top: 50%;
            right: -8px;
            transform: translateY(-50%);
            width: 0;
            height: 0;
            border-style: solid;
            border-width: 8px 0 8px 8px;
            border-color: transparent transparent transparent #ffffff;
            filter: drop-shadow(2px 0 2px rgba(0, 0, 0, 0.1));
        }

        .floating-survey-container:hover .floating-survey-text {
            opacity: 1;
            transform: translateX(0);
            pointer-events: auto;
        }

        .floating-survey-text-icon {
            display: inline-block;
            margin-right: 6px;
            font-size: 1.1rem;
        }

        /* 手機端浮動 Logo 優化 */
        @media (max-width: 768px) {
            .floating-survey-container {
                bottom: 20px;
                right: 20px;
                flex-direction: column-reverse;
                align-items: flex-end;
                gap: 8px;
            }

            .floating-survey-logo {
                width: 60px;
                height: 60px;
            }

            .floating-survey-text {
                font-size: 0.85rem;
                padding: 8px 14px;
                opacity: 1;
                transform: translateX(0);
                pointer-events: auto;
            }

            .floating-survey-text::after {
                top: auto;
                bottom: -8px;
                right: 20px;
                transform: translateY(0);
                border-width: 8px 8px 0 8px;
                border-color: #ffffff transparent transparent transparent;
            }
        }
