﻿        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: flex-start;
            padding: 10px;
        }
        
        .main-container {
            width: 98%;
            max-width: 1200px;
            height: 96vh;
            background: white;
            overflow: hidden;
            border-radius: 20px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        
        /* 顶部栏 */
        .top-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 15px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .top-header h1 {
            font-size: 1.3em;
        }
        .hd-toggle {
            display: flex; align-items: center; gap: 10px;
            cursor: pointer; user-select: none;
        }
        .hd-toggle .hd-slider {
            width: 44px; height: 24px;
            background: rgba(255,255,255,0.3); border-radius: 12px;
            position: relative; transition: background 0.3s;
        }
        .hd-toggle .hd-slider::after {
            content: ''; position: absolute;
            top: 3px; left: 3px; width: 18px; height: 18px;
            background: white; border-radius: 50%;
            transition: transform 0.3s;
        }
        .hd-toggle.active .hd-slider {
            background: #1a237e;
        }
        .hd-toggle.active .hd-slider::after {
            transform: translateX(20px);
        }
        .hd-toggle .hd-label {
            font-size: 0.95em; font-weight: 600; color: white;
        }
        .hd-toggle.active .hd-label {
            color: #90caf9;
        }

        .option-toggle {
            display: flex;
            align-items: center;
            gap: 8px;
            cursor: pointer;
            user-select: none;
            flex-shrink: 0;
        }
        .option-toggle .option-slider {
            width: 40px;
            height: 22px;
            background: #ccc;
            border-radius: 11px;
            position: relative;
            transition: background 0.3s;
        }
        .option-toggle .option-slider::after {
            content: '';
            position: absolute;
            top: 2px;
            left: 2px;
            width: 18px;
            height: 18px;
            background: white;
            border-radius: 50%;
            transition: transform 0.3s;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
        }
        .option-toggle.active .option-slider {
            background: #667eea;
        }
        .option-toggle.active .option-slider::after {
            transform: translateX(18px);
        }
        .option-toggle .option-label {
            font-size: 0.8em;
            color: #666;
            white-space: nowrap;
        }
        .option-toggle.active .option-label {
            color: #667eea;
            font-weight: 600;
        }
        .privacy-hint {
            font-size: 0.72em;
            color: #e65100;
            white-space: nowrap;
        }

        .main-container.hd-mode {
            border: 2px solid #1a237e !important;
            box-shadow: 0 0 30px rgba(26, 35, 126, 0.4), 0 20px 60px rgba(0,0,0,0.3) !important;
        }
        
        .user-info {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .user-info span {
            font-size: 0.9em;
        }
        
        .user-info button {
            padding: 8px 15px;
            background: rgba(255, 255, 255, 0.2);
            color: white;
            border: 1px solid rgba(255, 255, 255, 0.3);
            border-radius: 15px;
            cursor: pointer;
            font-size: 0.85em;
            transition: background 0.3s;
        }
        
        .user-info button:hover {
            background: rgba(255, 255, 255, 0.3);
        }
        
        .coins-display {
            background: #ffd700;
            color: #333;
            padding: 5px 15px;
            border-radius: 15px;
            font-weight: bold;
            font-size: 0.9em;
            cursor: pointer;
            transition: transform 0.2s;
        }
        .coins-display:hover {
            transform: scale(1.05);
        }
        
        /* 选项卡导航 */
        .tabs-nav {
            display: flex;
            background: #f0f0f0;
            border-bottom: 2px solid #e0e0e0;
        }
        
        .tab-btn {
            flex: 1;
            padding: 8px 6px;
            text-align: center;
            background: none;
            border: none;
            cursor: pointer;
            font-size: 0.9em;
            color: #666;
            transition: all 0.3s;
            position: relative;
        }
        
        .tab-btn:hover {
            background: rgba(102, 126, 234, 0.1);
            color: #667eea;
        }
        
        .tab-btn.active {
            background: white;
            color: #667eea;
            font-weight: bold;
        }
        
        .tab-btn.active::after {
            content: '';
            position: absolute;
            bottom: -2px;
            left: 25%;
            right: 25%;
            height: 3px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 3px;
        }
        
        .tab-icon {
            font-size: 1.1em;
            display: block;
            margin-bottom: 2px;
        }
        .tab-price {
            display: block;
            font-size: 0.7em;
            color: #ffd700;
            font-weight: bold;
            margin-top: 2px;
        }
        
        .tab-btn.active .tab-price {
            color: #ffd700;
        }
        
        /* 选项卡内容 */
        .tab-content {
            display: none;
            flex: 1;
            overflow: hidden;
        }
        
        .tab-content.active {
            display: flex;
            flex-direction: column;
        }
        
        /* 文生图 - 聊天界面 */
        .chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: 12px;
            background: #f5f5f5;
        }
        
        .message {
            margin-bottom: 20px;
            display: flex;
            align-items: flex-start;
        }
        
        .message.user {
            flex-direction: row-reverse;
        }
        
        .message-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.2em;
            flex-shrink: 0;
        }
        
        .message.user .message-avatar {
            background: #667eea;
            color: white;
            margin-left: 10px;
        }
        
        .message.ai .message-avatar {
            background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
            color: white;
            margin-right: 10px;
        }
        
        .message-content {
            max-width: 70%;
            padding: 12px 16px;
            border-radius: 18px;
            word-wrap: break-word;
        }
        
        .message.user .message-content {
            background: #667eea;
            color: white;
            border-bottom-right-radius: 4px;
        }
        
        .message.ai .message-content {
            background: white;
            color: #333;
            border-bottom-left-radius: 4px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        }
        
        .message-content img {
            max-width: 100%;
            border-radius: 10px;
            margin-top: 10px;
        }
        
        .loading {
            display: none;
            text-align: center;
            padding: 20px;
        }
        
        .loading.active {
            display: block;
        }
        
        .loading-spinner {
            display: inline-block;
            width: 40px;
            height: 40px;
            border: 4px solid #f3f3f3;
            border-top: 4px solid #667eea;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }
        
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        
        .chat-input {
            padding: 12px;
            background: white;
            border-top: 1px solid #e0e0e0;
            display: flex;
            gap: 6px;
            overflow: hidden;
            min-width: 0;
        }
        
        .chat-input input,
        .chat-input textarea {
            flex: 1;
            min-width: 0;
            padding: 10px 15px;
            border: 2px solid #e0e0e0;
            border-radius: 18px;
            font-size: 0.95em;
            outline: none;
            transition: border-color 0.3s;
            font-family: inherit;
            resize: none;
            min-height: 42px;
            max-height: 120px;
            overflow-y: auto;
            line-height: 1.4;
        }
        
        .chat-input input:focus,
        .chat-input textarea:focus {
            border-color: #667eea;
        }
        
        .chat-input button {
            padding: 12px 30px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            border-radius: 25px;
            font-size: 1em;
            cursor: pointer;
            transition: transform 0.2s, box-shadow 0.2s;
        }
        
        .chat-input button:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
        }
        
        .chat-input button:disabled {
            background: #ccc;
            cursor: not-allowed;
            transform: none;
        }
        
        /* 横屏/竖屏切换 - 二选一 */
        .orientation-toggle {
            display: flex;
            gap: 12px;
            margin-bottom: 10px;
            padding: 0 5px;
        }
        
        .orientation-option {
            flex: 1;
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 12px 20px;
            border: 2px solid #e0e0e0;
            border-radius: 15px;
            cursor: pointer;
            background: #f9f9f9;
            transition: all 0.3s;
            font-size: 1em;
            color: #999;
        }
        
        .orientation-option:hover {
            border-color: #667eea;
            background: #f0f0ff;
        }
        
        .orientation-option .radio-dot {
            width: 22px;
            height: 22px;
            border-radius: 50%;
            border: 2px solid #ccc;
            flex-shrink: 0;
            position: relative;
            transition: all 0.3s;
        }
        
        .orientation-option.active {
            border-color: #667eea;
            background: linear-gradient(135deg, #f0f0ff 0%, #e8e0ff 100%);
            color: #667eea;
            font-weight: bold;
            box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
        }
        
        .orientation-option.active .radio-dot {
            border-color: #667eea;
            background: white;
        }
        
        .orientation-option.active .radio-dot::after {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        
        /* 紧凑垂直排列 */
        .orientation-compact {
            display: flex;
            flex-direction: column;
            gap: 6px;
            margin-bottom: 10px;
        }
        .orientation-compact .orientation-option {
            flex: none;
            padding: 4px 10px;
            font-size: 0.75em;
            gap: 4px;
        }
        .orientation-compact .orientation-option .radio-dot {
            width: 16px;
            height: 16px;
        }
        .orientation-compact .orientation-option.active .radio-dot::after {
            width: 8px;
            height: 8px;
        }
        
        .welcome-message {
            text-align: center;
            padding: 40px;
            color: #666;
        }
        
        .welcome-message h2 {
            margin-bottom: 10px;
            color: #667eea;
        }
        
        .error-message {
            background: #e8f5e9;
            color: #2e7d32;
            padding: 10px;
            border-radius: 10px;
            margin: 10px 0;
        }
        
        /* 占位选项卡 */
        .placeholder-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            background: #f5f5f5;
            padding: 40px;
        }
        
        .placeholder-content .icon {
            font-size: 5em;
            margin-bottom: 20px;
        }
        
        .placeholder-content h2 {
            color: #667eea;
            margin-bottom: 10px;
        }
        
        .placeholder-content p {
            color: #999;
            font-size: 1.1em;
        }
        
        /* 模态框 */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            z-index: 1000;
            justify-content: center;
            align-items: center;
        }
        
        .modal.active {
            display: flex;
        }
        
        .modal-content {
            background: white;
            padding: 40px;
            border-radius: 20px;
            width: 90%;
            max-width: 400px;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
            max-height: 80vh;
            overflow-y: auto;
        }
        
        .modal-content h2 {
            text-align: center;
            margin-bottom: 30px;
            color: #667eea;
        }
        
        .modal-close {
            position: sticky;
            top: 0;
            float: right;
            z-index: 10;
            width: 32px;
            height: 32px;
            border: none;
            background: #eee;
            border-radius: 50%;
            font-size: 1.2em;
            cursor: pointer;
            color: #666;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
        }
        .modal-close:hover {
            background: #ff4444;
            color: white;
        }
        
        .modal-recharge-btn {
            position: absolute;
            top: 15px;
            left: 15px;
            padding: 6px 15px;
            background: linear-gradient(135deg, #ffd700, #ffaa00);
            border: none;
            border-radius: 15px;
            font-size: 0.85em;
            font-weight: bold;
            color: #333;
            cursor: pointer;
            transition: all 0.2s;
        }
        .modal-recharge-btn:hover {
            transform: scale(1.05);
            box-shadow: 0 3px 10px rgba(255, 170, 0, 0.4);
        }
        
        .form-group {
            margin-bottom: 20px;
        }
        
        .form-group label {
            display: block;
            margin-bottom: 5px;
            color: #666;
            font-size: 0.9em;
        }
        
        .form-group input {
            width: 100%;
            padding: 12px;
            border: 2px solid #e0e0e0;
            border-radius: 10px;
            font-size: 1em;
            outline: none;
            transition: border-color 0.3s;
        }
        
        .form-group input:focus {
            border-color: #667eea;
        }
        
        .form-buttons {
            display: flex;
            gap: 10px;
            margin-top: 25px;
        }
        
        .form-buttons button {
            flex: 1;
            padding: 12px;
            border: none;
            border-radius: 10px;
            font-size: 1em;
            cursor: pointer;
            transition: transform 0.2s;
        }
        
        .form-buttons button[type="submit"] {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
        }
        
        .form-buttons button[type="button"] {
            background: #f0f0f0;
            color: #666;
        }
        
        .form-buttons button:hover {
            transform: translateY(-2px);
        }
        
        .switch-form {
            text-align: center;
            margin-top: 20px;
            color: #666;
            font-size: 0.9em;
        }
        
        .switch-form a {
            color: #667eea;
            cursor: pointer;
            text-decoration: underline;
        }

        /* 登录 / 注册表单 */
        .auth-modal .auth-feedback {
            margin: -10px 0 16px;
            padding: 10px 12px;
            border-radius: 10px;
            font-size: 0.9em;
            line-height: 1.5;
        }

        .auth-modal .auth-feedback.is-error {
            background: #fff0f0;
            color: #c62828;
            border: 1px solid #ffcdd2;
        }

        .auth-modal .auth-feedback.is-success {
            background: #f0fff4;
            color: #2e7d32;
            border: 1px solid #c8e6c9;
        }

        .auth-modal .auth-feedback.is-info {
            background: #f3f6ff;
            color: #5c6bc0;
            border: 1px solid #dce3ff;
        }

        .auth-field-hint {
            margin-top: 6px;
            font-size: 0.82em;
            color: #c62828;
            line-height: 1.4;
        }

        .form-group input.auth-input-error {
            border-color: #ef5350;
            background: #fff8f8;
        }

        .auth-form-extra {
            display: flex;
            justify-content: flex-end;
            margin: -8px 0 4px;
        }

        .auth-link {
            color: #667eea;
            font-size: 0.85em;
            text-decoration: none;
            cursor: pointer;
        }

        .auth-link:hover {
            text-decoration: underline;
        }

        .auth-bonus-hint {
            font-size: 0.85em;
            color: #667eea;
            text-align: center;
            margin: 0 0 8px;
        }

        .auth-muted-text {
            font-size: 0.88em;
            color: #888;
            line-height: 1.6;
            margin: -10px 0 18px;
        }

        .form-buttons button:disabled {
            opacity: 0.65;
            cursor: not-allowed;
            transform: none !important;
        }
        
        /* 图片历史模态框 */
        .images-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
            gap: 15px;
            margin-top: 20px;
        }
        
        .image-card {
            background: #f9f9f9;
            border-radius: 10px;
            overflow: hidden;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
            transition: transform 0.2s;
        }
        
        .image-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
        }
        
        .image-card img {
            width: 100%;
            height: 150px;
            object-fit: cover;
        }
        
        .image-card .info {
            padding: 10px;
        }
        
        .image-card .prompt {
            font-size: 0.8em;
            color: #666;
            margin-bottom: 5px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        
        .image-card .time {
            font-size: 0.75em;
            color: #999;
            margin-bottom: 10px;
        }
        
        .image-card button {
            width: 100%;
            padding: 8px;
            background: #ff4444;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 0.85em;
        }
        
        .image-card button:hover {
            background: #cc0000;
        }
        
        .no-images {
            text-align: center;
            padding: 40px;
            color: #999;
        }
        
        /* 交易详单 */
        .transactions-table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 15px;
            font-size: 0.9em;
        }
        .transactions-table th {
            background: #667eea;
            color: white;
            padding: 10px;
            text-align: left;
        }
        .transactions-table td {
            padding: 10px;
            border-bottom: 1px solid #eee;
        }
        .transactions-table .deduct {
            color: #d32f2f;
            font-weight: bold;
        }
        .transactions-table .recharge {
            color: #2e7d32;
            font-weight: bold;
        }
        .no-transactions {
            text-align: center;
            padding: 30px;
            color: #999;
        }
        
        /* 灯箱 */
        .lightbox {
            display: none;
            position: fixed; top: 0; left: 0;
            width: 100vw; height: 100vh;
            background: rgba(0,0,0,0.92);
            z-index: 10000;
            justify-content: center; align-items: center;
            cursor: pointer;
        }
        .lightbox.active { display: flex; }
        .lightbox img, .lightbox video {
            max-width: 95vw; max-height: 95vh;
            border-radius: 8px;
        }
        .lightbox-close {
            position: absolute; top: 15px; right: 15px;
            width: 36px; height: 36px;
            background: rgba(255,255,255,0.2); border: none;
            border-radius: 50%; color: white;
            font-size: 1.3em; cursor: pointer;
        }
        
        /* ========== 移动端适配 ========== */
        @media (max-width: 768px) {
            .main-container {
                padding: 10px;
            }
            .header {
                padding: 10px 12px;
                flex-wrap: nowrap;
                gap: 5px;
            }
            .header h1 {
                font-size: 1.05em;
                white-space: nowrap;
            }
            .user-info {
                width: auto;
                justify-content: flex-end;
                flex-wrap: nowrap;
                gap: 3px;
                font-size: 0.72em;
            }
            .user-info button {
                padding: 3px 7px;
                font-size: 0.72em;
                border-radius: 8px;
                white-space: nowrap;
            }
            .user-info span {
                font-size: 0.8em;
                white-space: nowrap;
            }
            .coins-display {
                padding: 2px 7px;
                font-size: 0.72em;
                border-radius: 10px;
                white-space: nowrap;
            }
            
            .tab-bar {
                flex-wrap: wrap;
                gap: 5px;
                padding: 8px;
            }
            .tab-button {
                padding: 8px 12px;
                font-size: 0.8em;
                flex: 1 1 auto;
                min-width: 80px;
            }
            
            .chat-input {
                padding: 8px;
                gap: 4px;
                flex-direction: row !important;
                flex-wrap: nowrap !important;
            }
            .chat-input input,
            .chat-input textarea {
                padding: 8px;
                font-size: 0.85em;
            }
            .chat-input button {
                padding: 8px 14px;
                font-size: 0.85em;
                flex-shrink: 0;
            }
            .orientation-toggle.orientation-compact {
                flex-shrink: 0;
                min-width: 0 !important;
            }
            .orientation-compact .orientation-option {
                padding: 4px 6px !important;
                gap: 3px !important;
            }
            .orientation-compact .orientation-option span {
                font-size: 0.6em !important;
                white-space: nowrap;
            }
            .orientation-compact .radio-dot {
                width: 10px !important;
                height: 10px !important;
            }
            
            .modal-content {
                width: 95%;
                max-width: none;
                margin: 10px;
                padding: 15px;
                max-height: 90vh;
                overflow-y: auto;
            }
            .modal-content h2 {
                font-size: 1.1em;
            }
            
            .orientation-compact .orientation-option {
                padding: 8px 12px;
                font-size: 0.85em;
            }
            
            .images-grid {
                grid-template-columns: repeat(2, 1fr);
                gap: 8px;
            }
            .image-card .info {
                padding: 6px;
            }
            .image-card .info button {
                padding: 4px 10px;
                font-size: 0.75em;
            }
            
            .message {
                max-width: 90%;
                font-size: 0.9em;
            }
            
            .loading p {
                font-size: 0.85em;
            }
            
            /* 移动端收窄缩略图和按钮 */
            #img2imgPreviewImg, #img2imgPreviewImg2, #img2videoPreviewImg,
            #videoEditPreviewVideo, #videoEditPreviewImg {
                width: 60px !important;
                height: 60px !important;
            }
            #img2imgBtn, #img2videoBtn, #videoEditBtn,
            #tab-text2img .chat-input button {
                width: 60px !important;
                height: 60px !important;
                font-size: 0.75em !important;
                padding: 4px !important;
            }
        }
        
        @media (max-width: 480px) {
            .images-grid {
                grid-template-columns: 1fr;
            }
            .tab-button {
                font-size: 0.75em;
                padding: 6px 8px;
            }
            .chat-input {
                gap: 4px;
                padding: 6px;
            }
            .chat-input input {
                padding: 6px;
                font-size: 0.8em;
            }
            .chat-input button {
                padding: 6px 10px;
                font-size: 0.8em;
                width: auto;
            }
            .form-buttons {
                flex-direction: column;
            }
            
            /* 进一步收窄模式切换 */
            .orientation-compact .orientation-option {
                padding: 3px 4px !important;
            }
            .orientation-compact .orientation-option span {
                font-size: 0.55em !important;
            }
            .orientation-compact .radio-dot {
                width: 8px !important;
                height: 8px !important;
            }
            
            /* 进一步收窄缩略图和按钮 */
            #img2imgPreviewImg, #img2imgPreviewImg2, #img2videoPreviewImg,
            #videoEditPreviewVideo, #videoEditPreviewImg {
                width: 40px !important;
                height: 40px !important;
            }
            #img2imgBtn, #img2videoBtn, #videoEditBtn,
            #tab-text2img .chat-input button {
                width: 40px !important;
                height: 40px !important;
                font-size: 0.65em !important;
                padding: 2px !important;
            }
            /* 发输入框让它缩 */
            .chat-input textarea {
                min-width: 0 !important;
                padding: 4px !important;
                font-size: 0.75em !important;
            }
            /* 视频替换输入框更窄 */
            #videoEditInput {
                max-width: 80px !important;
            }
            
            /* 移动端按钮缩略图缩小 */
            #img2imgPreviewImg, #img2imgPreviewImg2, #img2videoPreviewImg,
            #videoEditPreviewVideo, #videoEditPreviewImg {
                width: 50px !important;
                height: 50px !important;
            }
            #img2imgBtn, #img2videoBtn, #videoEditBtn,
            #tab-text2img .chat-input button {
                width: 50px !important;
                height: 50px !important;
                font-size: 0.7em !important;
                padding: 2px !important;
            }
        }
