@font-face { font-family: 'Smiley Sans'; src: url('/api/fonts/SmileySans-Oblique.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'LXGW WenKai'; src: url('/api/fonts/LXGWWenKai-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'LXGW WenKai'; src: url('/api/fonts/LXGWWenKai-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

/* ===== Base ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans SC', sans-serif; background: #f8f9fb; color: #1a1a2e; min-height: 100vh; -webkit-font-smoothing: antialiased; }

/* ===== Container ===== */
.container { max-width: 820px; margin: 0 auto; padding: 0 24px 24px; position: relative; z-index: 2; }

/* ===== Header area (legacy) ===== */
h1 { text-align: center; margin: 0 0 8px; font-size: 28px; color: #1a1a2e; }
h1 span { background: linear-gradient(135deg, #4f46e5, #6366f1); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.subtitle { text-align: center; color: #8b8fa3; margin-bottom: 24px; font-size: 14px; }

/* ===== Input card ===== */
.input-box { background: #fff; border-radius: 20px; padding: 28px 30px 28px; box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 8px 32px rgba(0,0,0,0.06); margin-bottom: 22px; border: 1px solid #eeeef2; }
.input-box textarea { width: 100%; padding: 14px 16px; border: 1.5px solid #e5e6ed; border-radius: 12px; font-size: 15px; outline: none; transition: border-color 0.2s, box-shadow 0.2s; resize: vertical; min-height: 112px; font-family: inherit; background: #fafbfc; line-height: 1.65; color: #1a1a2e; }
.input-box textarea:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.1); background: #fff; }
.input-box .hint { font-size: 12px; color: #a0a3b1; }
.input-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 6px; }
.provider-row { margin-top: 12px; display: flex; align-items: center; gap: 12px; background: #f7f7fa; border: 1px solid #ededf2; border-radius: 10px; padding: 10px 14px; width: fit-content; }
.provider-row label { font-size: 13px; color: #5c5f72; white-space: nowrap; font-weight: 600; }
.provider-row select { padding: 7px 12px; border: 1px solid #e0e1e8; border-radius: 8px; font-size: 13px; outline: none; cursor: pointer; background: #fff; color: #4f46e5; }

/* ===== Button rows ===== */
.btn-row { display: grid; gap: 12px; margin-top: 16px; }
.btn-row.main-actions { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.btn-row.tool-actions { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 12px; }
.btn-row button { min-width: 0; min-height: 64px; padding: 10px 8px 9px; border: none; border-radius: 12px; font-size: 13px; cursor: pointer; transition: all 0.25s ease; font-weight: 600; white-space: nowrap; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; position: relative; overflow: hidden; }
.btn-row button::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0) 60%); pointer-events: none; }
.btn-row button:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
.btn-row button:active { transform: translateY(0); }
.btn-row button:disabled { background: #d4d5dc !important; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-icon { font-size: 19px; line-height: 1; display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1)); }
.btn-label { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; opacity: 0.95; }

/* ===== Button colors — gradient cards ===== */
.btn-individual { background: linear-gradient(135deg, #ff6b8a, #ee3868); box-shadow: 0 4px 14px rgba(238,56,104,0.3); }
.btn-merge { background: linear-gradient(135deg, #5b8def, #3366e6); box-shadow: 0 4px 14px rgba(51,102,230,0.3); }
.btn-download { background: linear-gradient(135deg, #2dd4a0, #10b981); box-shadow: 0 4px 14px rgba(16,185,129,0.3); }
.btn-custom { background: linear-gradient(135deg, #a78bfa, #7c3aed) !important; box-shadow: 0 4px 14px rgba(124,58,237,0.3) !important; }
.btn-creative { background: linear-gradient(135deg, #34d399, #059669); box-shadow: 0 4px 14px rgba(5,150,105,0.3); }
.btn-history { background: linear-gradient(135deg, #fbbf24, #f59e0b); box-shadow: 0 4px 14px rgba(245,158,11,0.3); }
.btn-imggen { background: linear-gradient(135deg, #c084fc, #9333ea); box-shadow: 0 4px 14px rgba(147,51,234,0.3); }
.btn-tts { background: linear-gradient(135deg, #f472b6, #e11d7b); box-shadow: 0 4px 14px rgba(225,29,123,0.3); }
.btn-avatar { background: linear-gradient(135deg, #60a5fa, #3b82f6); box-shadow: 0 4px 14px rgba(59,130,246,0.3); }
.btn-video-edit { background: linear-gradient(135deg, #8daab8, #64818f); box-shadow: 0 4px 14px rgba(100,129,143,0.3); }
.btn-material { background: linear-gradient(135deg, #fb923c, #ea580c); box-shadow: 0 4px 14px rgba(234,88,12,0.3); }
.btn-credit-admin { background: linear-gradient(135deg, #2dd4bf, #0f766e); box-shadow: 0 4px 14px rgba(15,118,110,0.3); }
.btn-user-credit-admin { background: linear-gradient(135deg, #38bdf8, #0284c7); box-shadow: 0 4px 14px rgba(2,132,199,0.3); }
.btn-membership-admin { background: linear-gradient(135deg, #818cf8, #4f46e5); box-shadow: 0 4px 14px rgba(79,70,229,0.3); }

/* ===== Job cards ===== */
.job-card { background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04); margin-bottom: 14px; border: 1px solid #eeeef2; }
.job-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.job-title { font-weight: 600; font-size: 15px; flex: 1; margin-right: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#jobs { margin-top: 20px; }

/* ===== Badges ===== */
.badge { padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.done { background: #ecfdf5; color: #166534; }
.badge.failed { background: #fef2f2; color: #991b1b; }
.badge.resolving, .badge.fetching_info, .badge.downloading, .badge.transcribing, .badge.polishing, .badge.translating { background: #fefce8; color: #854d0e; }
.badge.merging { background: #eef2ff; color: #3730a3; }

/* ===== Transcript ===== */
.transcript { background: #fafbfc; border: 1px solid #e5e6ed; border-radius: 10px; padding: 16px; font-size: 14px; line-height: 1.8; white-space: pre-wrap; max-height: 400px; overflow-y: auto; margin-top: 12px; }

/* ===== Copy button ===== */
.copy-btn { background: #f3f4f6; border: none; padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 12px; margin-top: 8px; transition: all 0.2s; color: #5c5f72; }
.copy-btn:hover { background: #e5e7eb; }

/* ===== Rewrite panels ===== */
.rewrite-panel { background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04); margin-top: 20px; border-left: 3px solid #6366f1; }
.rewrite-panel h3 { color: #4f46e5; margin-bottom: 12px; }
.rewrite-custom-panel { background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04); margin-bottom: 16px; border: 1px solid #eeeef2; }
.rewrite-custom-panel h3 { color: #4f46e5; margin-bottom: 12px; font-size: 16px; }
.rewrite-btn { background: #6366f1; color: #fff; border: none; padding: 10px 24px; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.rewrite-btn:hover { background: #4f46e5; box-shadow: 0 4px 12px rgba(99,102,241,0.2); }
.rewrite-btn:disabled { background: #d4d5dc; cursor: not-allowed; }
.credit-price { margin-left: 4px; font-size: 12px; font-weight: 600; opacity: 0.95; }
.credit-price-original { text-decoration: line-through; opacity: 0.75; margin-right: 4px; }
.credit-price-discount { font-weight: 700; }
.rewrite-history-btn { background: #f3f4f6; color: #5c5f72; border: none; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.rewrite-history-btn:hover { background: #e5e7eb; }
.rewrite-loading { color: #6366f1; font-size: 14px; padding: 12px 0; display: none; }
.rewrite-error { color: #dc2626; font-size: 13px; padding: 8px 12px; background: #fef2f2; border-radius: 8px; margin-top: 8px; display: none; }

/* ===== TTS panel ===== */
.tts-panel { background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04); margin-bottom: 16px; border-left: 3px solid #e879a8; display: none; }
.tts-panel h3 { color: #d6336c; margin-bottom: 12px; }
.tts-panel textarea { width: 100%; min-height: 120px; padding: 14px; border: 1.5px solid #e5e6ed; border-radius: 10px; font-size: 14px; line-height: 1.7; resize: vertical; font-family: inherit; background: #fafbfc; outline: none; color: #1a1a2e; }
.tts-panel textarea:focus { border-color: #e879a8; box-shadow: 0 0 0 3px rgba(232,121,168,0.1); }
.tts-panel .voice-select { display: flex; align-items: center; gap: 12px; margin: 12px 0; font-size: 14px; }
.tts-panel .tts-result { margin-top: 16px; padding: 16px; background: #fdf2f8; border-radius: 10px; }

/* ===== Avatar panel ===== */
.avatar-panel { background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04); margin-bottom: 16px; border-left: 3px solid #5b7cf7; display: none; }
.avatar-panel h3 { color: #4f46e5; margin-bottom: 12px; }
.avatar-panel .avatar-select { display: flex; align-items: center; gap: 12px; margin: 12px 0; font-size: 14px; }
.avatar-panel .avatar-result { margin-top: 16px; padding: 16px; background: #eef2ff; border-radius: 10px; }

/* ===== Modal ===== */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.3); backdrop-filter: blur(6px); z-index: 1000; justify-content: center; align-items: center; }
.modal-overlay.active { display: flex; }
.modal-box { background: #fff; border-radius: 16px; padding: 28px; max-width: 650px; width: 90%; max-height: 80vh; overflow-y: auto; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,0.12); }
.modal-box h3 { margin-bottom: 16px; color: #1a1a2e; }
.modal-close { position: absolute; top: 16px; right: 20px; font-size: 24px; cursor: pointer; color: #a0a3b1; border: none; background: none; transition: color 0.2s; }
.modal-close:hover { color: #374151; }
.voice-item { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1.5px solid #eeeef2; border-radius: 10px; margin-bottom: 8px; transition: all 0.2s; }
.voice-item:hover { border-color: #6366f1; background: #f8f7ff; }
.avatar-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.avatar-grid-item { border: 1.5px solid #eeeef2; border-radius: 10px; padding: 8px; text-align: center; cursor: pointer; transition: all 0.2s; }
.avatar-grid-item:hover { border-color: #6366f1; background: #f8f7ff; }
.avatar-grid-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
/* ===== Go to TTS / Avatar buttons ===== */
.go-tts-btn { background: #e879a8; color: #fff; border: none; padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 12px; margin-top: 8px; margin-left: 8px; transition: all 0.2s; }
.go-tts-btn:hover { box-shadow: 0 2px 8px rgba(232,121,168,0.25); }
.go-avatar-btn { background: #5b7cf7; color: #fff; border: none; padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 12px; margin-top: 8px; transition: all 0.2s; }
.go-avatar-btn:hover { box-shadow: 0 2px 8px rgba(91,124,247,0.25); }

/* ===== Upload button ===== */
.upload-btn { background: #6366f1; color: #fff; border: none; padding: 8px 16px; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 600; margin-bottom: 16px; transition: all 0.2s; }
.upload-btn:hover { background: #4f46e5; box-shadow: 0 4px 12px rgba(99,102,241,0.2); }

/* ===== Image gen ===== */
.imggen-panel { background: #fff; border-radius: 14px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04); margin-bottom: 16px; border-left: 3px solid #8b5cf6; display: none; }
.imggen-panel h3 { color: #7c3aed; margin-bottom: 20px; }
.imggen-upload-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.imggen-upload-box { border: 2px dashed #d4d5dc; border-radius: 10px; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; overflow: hidden; position: relative; background: #fafbfc; }
.imggen-upload-box:hover { border-color: #8b5cf6; background: #f8f7ff; }
.imggen-upload-box img { width: 100%; height: 100%; object-fit: cover; position: absolute; top: 0; left: 0; }
.imggen-upload-box .upload-icon { font-size: 32px; color: #d4d5dc; margin-bottom: 4px; }
.imggen-upload-box .upload-text { font-size: 12px; color: #a0a3b1; }
.imggen-upload-box .remove-btn { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,0.6); color: #fff; border: none; border-radius: 50%; width: 24px; height: 24px; font-size: 16px; cursor: pointer; line-height: 24px; text-align: center; z-index: 5; display: none; }
.imggen-upload-box.has-img .remove-btn { display: block; }
.imggen-params { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.imggen-params label { color: #6b7280; font-size: 13px; }
.imggen-params select { padding: 6px 10px; border: 1.5px solid #e5e6ed; border-radius: 8px; font-size: 13px; outline: none; background: #fafbfc; }
.imggen-params select:focus { border-color: #8b5cf6; }

/* ===== Image gen history ===== */
.imggen-history { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.imggen-history-item { border: 1px solid #eeeef2; border-radius: 10px; overflow: hidden; background: #fff; transition: all 0.2s; }
.imggen-history-item:hover { border-color: #8b5cf6; box-shadow: 0 4px 12px rgba(139,92,246,0.08); }
.imggen-history-item img { width: 100%; display: block; cursor: pointer; }
.imggen-history-item .item-info { padding: 8px; font-size: 11px; color: #a0a3b1; }
.imggen-history-item .item-actions { display: flex; gap: 6px; padding: 0 8px 8px; flex-wrap: wrap; }
.imggen-history-item .item-actions button, .imggen-history-item .item-actions a { font-size: 11px; padding: 3px 8px; border-radius: 6px; border: 1px solid #e5e6ed; background: #fff; color: #6b7280; cursor: pointer; text-decoration: none; transition: all 0.2s; }
.imggen-history-item .item-actions button:hover, .imggen-history-item .item-actions a:hover { border-color: #8b5cf6; color: #8b5cf6; }
/* ===== Credit rules admin ===== */
.credit-admin-panel, .user-credit-admin-panel, .my-credit-panel { background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04); margin-bottom: 16px; border-left: 3px solid #14b8a6; display: none; }
.user-credit-admin-panel, .my-credit-panel { border-left-color: #38bdf8; }
.credit-admin-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.credit-admin-header h3 { color: #0f766e; margin-bottom: 5px; }
.credit-admin-header p { color: #6b7280; font-size: 13px; line-height: 1.5; }
.credit-rule-table-wrap, .user-credit-table-wrap { width: 100%; overflow-x: auto; border: 1px solid #e5e6ed; border-radius: 10px; background: #fafbfc; }
.credit-rule-table, .user-credit-table { width: 100%; min-width: 860px; border-collapse: collapse; font-size: 13px; }
.credit-rule-table th, .credit-rule-table td, .user-credit-table th, .user-credit-table td { padding: 10px 12px; border-bottom: 1px solid #e5e6ed; text-align: left; vertical-align: middle; }
.credit-rule-table th, .user-credit-table th { background: #f7f7fa; color: #0f766e; font-weight: 700; white-space: nowrap; }
.user-credit-table th { color: #0e7490; }
.credit-rule-table tr:last-child td, .user-credit-table tr:last-child td { border-bottom: none; }
.credit-rule-table input[type="number"], .user-credit-table input[type="number"] { width: 86px; }
.credit-rule-table input[type="text"], .user-credit-table input[type="text"], .user-credit-table input[type="password"] { width: 180px; }
.credit-rule-table input[type="number"], .credit-rule-table input[type="text"], .credit-rule-table select, .user-credit-table input[type="number"], .user-credit-table input[type="text"], .user-credit-table input[type="password"], .user-credit-table select { padding: 7px 9px; border: 1.5px solid #e5e6ed; border-radius: 8px; font-size: 13px; outline: none; background: #fff; }
.credit-rule-table input:focus, .credit-rule-table select:focus, .user-credit-table input:focus, .user-credit-table select:focus { border-color: #14b8a6; box-shadow: 0 0 0 3px rgba(20,184,166,0.08); }
.credit-rule-table input[type="checkbox"], .user-credit-table input[type="checkbox"] { width: 16px; height: 16px; accent-color: #14b8a6; }
#creditRuleTable, #userCreditTable, #membershipLevelTable { min-width: 0; table-layout: fixed; }
#creditRuleTable th, #creditRuleTable td, #userCreditTable th, #userCreditTable td, #membershipLevelTable th, #membershipLevelTable td { padding: 8px 9px; }
#creditRuleTable th:nth-child(1), #creditRuleTable td:nth-child(1) { width: 19%; }
#creditRuleTable th:nth-child(2), #creditRuleTable td:nth-child(2) { width: 10%; }
#creditRuleTable th:nth-child(3), #creditRuleTable td:nth-child(3) { width: 10%; }
#creditRuleTable th:nth-child(4), #creditRuleTable td:nth-child(4) { width: 10%; }
#creditRuleTable th:nth-child(5), #creditRuleTable td:nth-child(5) { width: 8%; text-align: center; }
#creditRuleTable th:nth-child(6), #creditRuleTable td:nth-child(6) { width: 10%; text-align: center; }
#creditRuleTable th:nth-child(7), #creditRuleTable td:nth-child(7) { width: 23%; }
#creditRuleTable th:nth-child(8), #creditRuleTable td:nth-child(8) { width: 10%; text-align: center; }
#userCreditTable th:nth-child(1), #userCreditTable td:nth-child(1) { width: 14%; }
#userCreditTable th:nth-child(2), #userCreditTable td:nth-child(2) { width: 9%; }
#userCreditTable th:nth-child(3), #userCreditTable td:nth-child(3) { width: 9%; }
#userCreditTable th:nth-child(4), #userCreditTable td:nth-child(4) { width: 12%; }
#userCreditTable th:nth-child(5), #userCreditTable td:nth-child(5) { width: 7%; }
#userCreditTable th:nth-child(6), #userCreditTable td:nth-child(6) { width: 9%; }
#userCreditTable th:nth-child(7), #userCreditTable td:nth-child(7) { width: 12%; }
#userCreditTable th:nth-child(8), #userCreditTable td:nth-child(8) { width: 12%; }
#userCreditTable th:nth-child(9), #userCreditTable td:nth-child(9) { width: 16%; text-align: center; }
#membershipLevelTable th:nth-child(1), #membershipLevelTable td:nth-child(1) { width: 16%; }
#membershipLevelTable th:nth-child(2), #membershipLevelTable td:nth-child(2) { width: 28%; }
#membershipLevelTable th:nth-child(3), #membershipLevelTable td:nth-child(3) { width: 24%; }
#membershipLevelTable th:nth-child(4), #membershipLevelTable td:nth-child(4) { width: 12%; text-align: center; }
#membershipLevelTable th:nth-child(5), #membershipLevelTable td:nth-child(5) { width: 20%; text-align: center; }
#creditRuleTable input[type="text"], #creditRuleTable input[type="number"], #userCreditTable input[type="text"], #userCreditTable input[type="password"], #userCreditTable input[type="number"], #userCreditTable select, #membershipLevelTable input[type="text"], #membershipLevelTable input[type="number"] { width: 100%; max-width: 100%; box-sizing: border-box; }
#creditRuleTable .copy-btn, #membershipLevelTable .copy-btn { margin-top: 0; padding: 6px 10px; }
#userCreditTable .copy-btn { margin: 2px; padding: 5px 8px; }
.credit-rule-code { margin-top: 3px; color: #a0a3b1; font-size: 11px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.my-credit-balance { background: #f0fdfa; color: #0e7490; border: 1px solid #ccfbf1; border-radius: 10px; padding: 13px 15px; font-weight: 700; margin-bottom: 12px; }
.credit-change.positive { color: #16a34a; font-weight: 700; }
.credit-change.negative { color: #dc2626; font-weight: 700; }

/* ===== Video edit panel ===== */
.video-edit-panel { background: #fff; border-radius: 14px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04); margin-bottom: 16px; border-left: 3px solid #f59e42; display: none; }
.video-edit-panel h3 { color: #ea580c; margin-bottom: 20px; }
.ve-section { background: #fafbfc; border: 1.5px solid #eeeef2; border-radius: 10px; padding: 18px; margin-bottom: 16px; }
.ve-section-title { color: #6b7280; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.ve-preview { background: #000; border-radius: 10px; overflow: hidden; position: relative; margin-bottom: 20px; }
.ve-preview video { width: 100%; max-height: 65vh; display: block; object-fit: contain; }
.ve-subtitle-overlay { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 20px; text-align: center; pointer-events: auto; cursor: move; padding: 6px 16px; text-shadow: 2px 2px 4px rgba(0,0,0,0.9); max-width: 90%; word-break: break-all; user-select: none; z-index: 10; }
.ve-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ve-control-group { display: flex; align-items: center; gap: 8px; }
.ve-control-group label { color: #6b7280; font-size: 13px; white-space: nowrap; min-width: 40px; }
.ve-control-group select, .ve-control-group input[type="number"] { background: #fafbfc; border: 1.5px solid #e5e6ed; color: #1a1a2e; padding: 6px 10px; border-radius: 8px; font-size: 13px; outline: none; }
.ve-control-group select:focus, .ve-control-group input[type="number"]:focus { border-color: #f59e42; }
.ve-control-group input[type="color"] { width: 36px; height: 30px; border: 1.5px solid #e5e6ed; border-radius: 8px; cursor: pointer; padding: 2px; }
.ve-subtitle-list { max-height: 200px; overflow-y: auto; border-radius: 8px; background: #fff; border: 1.5px solid #eeeef2; padding: 4px; }
.ve-subtitle-list::-webkit-scrollbar { width: 6px; }
.ve-subtitle-list::-webkit-scrollbar-thumb { background: #d4d5dc; border-radius: 3px; }
.ve-subtitle-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid #f5f5f7; }
.ve-subtitle-item:last-child { border-bottom: none; }
.ve-subtitle-item .time { color: #ea580c; font-size: 11px; font-family: monospace; white-space: nowrap; min-width: 80px; }
.ve-subtitle-item input { flex: 1; background: transparent; border: 1px solid #eeeef2; color: #1a1a2e; font-size: 13px; padding: 4px 8px; border-radius: 6px; outline: none; }
.ve-subtitle-item input:focus { border-color: #f59e42; }
.ve-slider-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.ve-slider-row label { color: #6b7280; font-size: 13px; min-width: 80px; }
.ve-slider-row input[type="range"] { flex: 1; -webkit-appearance: none; height: 4px; border-radius: 2px; background: #e5e6ed; outline: none; }
.ve-slider-row input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #f59e42; cursor: pointer; }
.ve-slider-row .vol-val { color: #ea580c; font-size: 13px; font-weight: 600; min-width: 35px; text-align: right; }
.ve-bgm-info { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #fffbf5; border: 1px solid #fde8cd; border-radius: 8px; margin-bottom: 12px; }
.ve-bgm-info .bgm-name { color: #ea580c; font-weight: 600; flex: 1; }
.ve-btn { border: none; padding: 10px 24px; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.ve-btn-primary { background: #f59e42; color: #fff; }
.ve-btn-primary:hover { box-shadow: 0 4px 12px rgba(245,158,66,0.25); }
.ve-btn-secondary { background: #f3f4f6; color: #6b7280; }
.ve-btn-secondary:hover { background: #e5e7eb; }
.ve-btn-danger { background: transparent; color: #dc2626; border: 1px solid #fecaca; }
.ve-btn-danger:hover { background: #fef2f2; }
.ve-btn-accent { background: #6366f1; color: #fff; }
.ve-btn-accent:hover { box-shadow: 0 4px 12px rgba(99,102,241,0.2); }
.ve-select-card { background: #fafbfc; border: 1.5px solid #e5e6ed; border-radius: 10px; padding: 16px; cursor: pointer; transition: all 0.2s; }
.ve-select-card:hover { border-color: #f59e42; background: #fffbf5; }
.ve-select-card .card-label { color: #a0a3b1; font-size: 12px; margin-bottom: 6px; }
.ve-select-card .card-value { color: #ea580c; font-weight: 600; font-size: 15px; }
.ve-loading { color: #ea580c; font-size: 14px; padding: 12px 0; display: none; }
.ve-error { color: #dc2626; font-size: 13px; padding: 8px 12px; background: #fef2f2; border-radius: 8px; margin-top: 8px; display: none; }
/* ===== Video preview container ===== */
.video-preview-container { position: relative; background: #000; border-radius: 10px; overflow: hidden; margin-bottom: 16px; width: 100%; }
.video-preview-container video { width: 100%; max-height: 70vh; display: block; object-fit: contain; }

/* ===== History ===== */
.platform-tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; margin-left: 8px; }
.platform-tag.douyin { background: #fef2f2; color: #ef4444; }
.platform-tag.youtube { background: #fef2f2; color: #ef4444; }
.job-meta { font-size: 13px; color: #a0a3b1; margin-bottom: 8px; }
.error { color: #dc2626; font-size: 13px; margin-top: 8px; }

/* ===== History detail ===== */
.history-job-card { background: #fff; border-radius: 14px; padding: 16px 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04); margin-bottom: 12px; border-left: 3px solid #f59e42; }
.hj-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.hj-title { font-weight: 600; font-size: 15px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 12px; }
.hj-meta { font-size: 12px; color: #a0a3b1; margin-bottom: 6px; }
.hj-transcript { background: #fafbfc; border: 1px solid #eeeef2; border-radius: 8px; padding: 12px; font-size: 13px; line-height: 1.8; max-height: 200px; overflow-y: auto; white-space: pre-wrap; margin-top: 6px; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d4d5dc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a0a3b1; }

/* ===== Top bar ===== */
.top-bar { background: rgba(255,255,255,0.82); border-bottom: 1px solid #eeeef2; padding: 9px 0; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); position: relative; z-index: 3; }
.top-bar-inner { max-width: 820px; margin: 0 auto; padding: 0 20px; display: flex; justify-content: space-between; align-items: center; }
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon { width: 34px; height: 34px; background: #6366f1; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; box-shadow: 0 2px 8px rgba(99,102,241,0.2); }
.logo-title { font-weight: 700; font-size: 16px; color: #1a1a2e; letter-spacing: -0.01em; }
.logo-sub { font-size: 10px; color: #a0a3b1; }
.pro-badge { background: #f7f7fa; color: #6366f1; font-size: 12px; font-weight: 600; padding: 5px 13px; border-radius: 999px; border: 1px solid #e5e6ed; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.top-permission-actions { display: flex; align-items: center; gap: 8px; }
.top-action-btn { border: none; color: #fff; border-radius: 999px; padding: 6px 13px; font-size: 12px; font-weight: 600; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,0.08); white-space: nowrap; transition: all 0.2s; }
.top-action-btn:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.btn-my-credits { background: #8b5cf6; }
/* ===== Auth ===== */
.auth-area { display: flex; align-items: center; }
.auth-entry, .auth-logout { border: 1px solid #e5e6ed; background: #fff; color: #6366f1; border-radius: 999px; padding: 6px 13px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.auth-entry:hover, .auth-logout:hover { background: #f7f7fa; }
.auth-user { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #e5e6ed; border-radius: 999px; padding: 4px 5px 4px 12px; color: #1a1a2e; font-size: 12px; font-weight: 600; }
.auth-logout { padding: 4px 10px; color: #6366f1; box-shadow: none; }
.auth-modal { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center; padding: 18px; }
.auth-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.25); backdrop-filter: blur(8px); }
.auth-dialog { position: relative; width: min(92vw, 390px); background: #fff; border: 1px solid #eeeef2; border-radius: 20px; padding: 28px 26px 26px; box-shadow: 0 20px 60px rgba(0,0,0,0.12); }
.auth-dialog h2 { margin: 0 0 18px; color: #1a1a2e; font-size: 22px; }
.auth-dialog label { display: block; margin-bottom: 12px; color: #6b7280; font-size: 13px; font-weight: 600; }
.auth-dialog label span { display: block; margin-bottom: 6px; }
.auth-dialog input { width: 100%; border: 1.5px solid #e5e6ed; border-radius: 12px; padding: 12px 14px; outline: none; font-size: 15px; background: #fafbfc; color: #1a1a2e; }
.auth-code-row { display: flex; gap: 8px; }
.auth-code-row input { flex: 1; min-width: 0; }
.auth-code-btn { flex: 0 0 104px; border: none; border-radius: 12px; background: #eef2ff; color: #4f46e5; font-size: 13px; font-weight: 700; cursor: pointer; }
.auth-code-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-dialog input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.1); background: #fff; }
.auth-close { position: absolute; top: 14px; right: 16px; width: 30px; height: 30px; border: none; background: transparent; color: #a0a3b1; font-size: 24px; line-height: 1; cursor: pointer; }
.auth-error { margin-bottom: 12px; padding: 9px 11px; border-radius: 8px; background: #fef2f2; color: #dc2626; font-size: 13px; }
.auth-submit { width: 100%; margin-top: 4px; border: none; border-radius: 12px; padding: 13px 16px; color: #fff; background: #6366f1; font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.auth-submit:hover { background: #4f46e5; }
.auth-submit:disabled { opacity: 0.65; cursor: not-allowed; }
.auth-switch { flex: 1; margin-top: 12px; border: none; background: transparent; color: #6366f1; font-size: 13px; font-weight: 600; cursor: pointer; }
.auth-link-row { display: flex; gap: 8px; }

/* ===== Hero ===== */
.hero { text-align: center; padding: 24px 20px 10px; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; top: -140px; left: 8%; width: 300px; height: 300px; background: radial-gradient(circle, rgba(99,102,241,0.06) 0%, transparent 68%); border-radius: 50%; pointer-events: none; }
.hero::after { content: ''; position: absolute; top: -120px; right: 5%; width: 280px; height: 280px; background: radial-gradient(circle, rgba(139,92,246,0.05) 0%, transparent 68%); border-radius: 50%; pointer-events: none; }
.hero-badge { display: inline-block; background: #f7f7fa; color: #6366f1; font-size: 12px; font-weight: 600; padding: 5px 16px; border-radius: 999px; margin-bottom: 10px; border: 1px solid #e5e6ed; letter-spacing: 0.02em; }
.hero h1 { font-size: 36px; font-weight: 800; color: #1a1a2e; margin-bottom: 8px; letter-spacing: -0.03em; line-height: 1.2; }
.hero h1 span { background: linear-gradient(135deg, #6366f1, #8b5cf6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero-subtitle { color: #8b8fa3; font-size: 14px; max-width: 620px; margin: 0 auto 6px; line-height: 1.6; }
/* ===== Input box header ===== */
.input-box-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.input-box-header strong { font-size: 15px; color: #1a1a2e; }
.input-box-header span { font-size: 12px; color: #a0a3b1; margin-left: 4px; }
.input-box-icon { width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; background: #f0f0ff; }
.char-count { font-size: 12px; color: #a0a3b1; text-align: right; }

/* ===== Features ===== */
.features-section { max-width: 820px; margin: 0 auto 14px; padding: 0 24px; }
.features-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.feature-item { background: #fff; border-radius: 14px; padding: 18px 16px 17px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04); border: 1px solid #eeeef2; }
.feature-icon { font-size: 26px; margin-bottom: 7px; }
.feature-title { font-weight: 700; font-size: 14px; color: #1a1a2e; margin-bottom: 4px; }
.feature-desc { font-size: 12px; color: #8b8fa3; line-height: 1.45; }

/* ===== Footer ===== */
.site-footer { text-align: center; padding: 30px 20px; color: #a0a3b1; font-size: 12px; }
.footer-links { margin-top: 4px; }

/* ===== Responsive: 760px ===== */
@media (max-width: 760px) {
  .top-bar { padding: 7px 0; }
  .top-bar-inner { padding: 0 16px; }
  .top-actions { gap: 7px; max-width: 58vw; }
  .top-permission-actions { gap: 6px; }
  .top-action-btn { padding: 5px 10px; font-size: 11px; }
  .auth-entry, .auth-logout { padding: 5px 10px; font-size: 11px; }
  .auth-user { max-width: 138px; padding-left: 10px; gap: 6px; }
  .auth-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .logo { gap: 9px; }
  .logo-icon { width: 30px; height: 30px; border-radius: 8px; font-size: 14px; }
  .logo-title { font-size: 15px; }
  .hero { padding: 15px 16px 8px; }
  .hero-badge { padding: 4px 12px; margin-bottom: 6px; font-size: 11px; }
  .hero h1 { font-size: 32px; letter-spacing: -0.04em; margin-bottom: 6px; }
  .hero-subtitle { max-width: 340px; font-size: 13px; line-height: 1.45; }
  .container { padding: 0 14px 20px; }
  .input-box { padding: 20px 18px; border-radius: 16px; }
  .input-box-header { gap: 10px; margin-bottom: 12px; }
  .input-box-icon { width: 34px; height: 34px; font-size: 16px; }
  .input-box textarea { min-height: 104px; padding: 13px 14px; border-radius: 10px; font-size: 14px; line-height: 1.55; }
  .input-meta { align-items: flex-start; }
  .provider-row { width: 100%; flex-direction: column; align-items: stretch; gap: 7px; padding: 10px 12px; }
  .provider-row select { width: 100%; }
  .btn-row { gap: 10px; margin-top: 14px; }
  .btn-row.main-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .btn-row.tool-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 10px; }
  .btn-row button { min-height: 58px; padding: 9px 6px 8px; border-radius: 11px; }
  .btn-icon { font-size: 17px; }
  .btn-label { font-size: 11.5px; }
  .features-section { padding: 0 14px; }
  .features-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .feature-item { border-radius: 12px; padding: 15px 12px; }
  .feature-icon { font-size: 24px; margin-bottom: 5px; }
  .credit-admin-panel, .user-credit-admin-panel, .my-credit-panel { padding: 16px 12px; border-radius: 12px; }
  .credit-admin-header { flex-direction: column; align-items: stretch; gap: 10px; }
  .credit-admin-header .rewrite-history-btn { width: 100%; }
  .credit-rule-table, .user-credit-table { min-width: 760px; }
  .credit-rule-table th, .credit-rule-table td, .user-credit-table th, .user-credit-table td { padding: 9px 10px; }
}

/* ===== Responsive: 460px ===== */
@media (max-width: 460px) {
  .top-bar-inner { align-items: center; gap: 8px; }
  .top-actions { flex-shrink: 0; max-width: 62vw; justify-content: flex-end; }
  .top-action-btn { padding: 5px 9px; }
  .auth-user { max-width: 112px; }
  .auth-dialog { padding: 23px 18px 21px; border-radius: 16px; }
  .pro-badge { display: none; }
  .hero h1 { font-size: 30px; }
  .hero-subtitle { font-size: 12.5px; }
  .btn-row.main-actions, .btn-row.tool-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .btn-row button { min-height: 54px; }
  .features-grid { grid-template-columns: 1fr; }
}