:root {
    --primary: #8b5cf6;
    --primary-glow: #a78bfa;
    --accent: #06b6d4;
    --accent-glow: #22d3ee;
    --bg: #0b0f1c;
    --card-bg: rgba(18, 24, 40, 0.75);
    --card-border: rgba(255, 255, 255, 0.08);
    --text: #e2e8f0;
    --text-dim: #94a3b8;
    --text-muted: #64748b;
    --radius-lg: 1.6rem;
    --radius-md: 1rem;
    --radius-sm: 0.75rem;
    --shadow-glow: 0 0 30px rgba(139, 92, 246, 0.15);
    --shadow-card: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* 彻底禁用页面的横向滚动 */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

/* 全局滚动条美化 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.3); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(139, 92, 246, 0.6); }

body {
    background: var(--bg);
    background-image:
        radial-gradient(ellipse at 30% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 55%),
        radial-gradient(ellipse at 70% 70%, rgba(6, 182, 212, 0.06) 0%, transparent 55%),
        linear-gradient(180deg, #0b0f1c 0%, #111827 100%);
    font-family: 'Inter', 'SF Pro Display', system-ui, -apple-system, sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 1.5rem;
    color: var(--text);
    line-height: 1.5;
    width: 100%;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

.glass-panel {
    position: relative;
    z-index: 1;
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card), var(--shadow-glow);
    padding: 1.8rem;
    width: 100%;
    max-width: 1050px;
    transition: box-shadow var(--transition);
}

.glass-panel:hover { box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.7), 0 0 40px rgba(139, 92, 246, 0.1); }

.header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.8rem; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.logo { display: flex; align-items: center; gap: 0.7rem; }
.logo-icon { font-size: 2rem; filter: drop-shadow(0 0 6px var(--primary-glow)); }
.logo h1 { font-size: 1.5rem; font-weight: 700; background: linear-gradient(135deg, #e2e8f0 0%, #a78bfa 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; letter-spacing: -0.02em; }
.badge { background: rgba(139, 92, 246, 0.2); border: 1px solid rgba(139, 92, 246, 0.4); color: #c4b5fd; border-radius: 30px; padding: 0.2rem 0.9rem; font-size: 0.7rem; font-weight: 600; backdrop-filter: blur(8px); }
.author { color: var(--text-muted); font-size: 0.75rem; display: flex; align-items: center; gap: 0.3rem; }
.author a { color: var(--primary-glow); text-decoration: none; transition: color var(--transition); }
.author a:hover { color: #c7d2fe; text-decoration: underline; }

.upload-area {
    border: 2px dashed rgba(139, 92, 246, 0.4);
    border-radius: var(--radius-md);
    background: rgba(139, 92, 246, 0.04);
    backdrop-filter: blur(12px);
    padding: 0.7rem 0.6rem;          /* 高度缩小为原来一半 */
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 0.8rem;
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
}
.upload-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 50%, rgba(139, 92, 246, 0.1), transparent 70%);
    opacity: 0;
    transition: opacity var(--transition);
}
.upload-area:hover {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.08);
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.2);
    transform: translateY(-2px);      /* ← 这就是浮动效果 */
}
.upload-area:hover::before {
    opacity: 1;
}
.upload-area.dragover {
    background: rgba(139, 92, 246, 0.15);
    border-color: var(--accent);
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.3);
    transform: scale(1.01);           /* 拖拽时的放大效果 */
}
.upload-area input {
    display: none;
}
.upload-icon svg {
    width: 1.8rem;                   /* 原 2.5rem */
    height: 1.8rem;
    stroke: var(--primary-glow);
    margin-bottom: 0.2rem;           /* 原 0.4rem */
    transition: transform var(--transition);
}
.upload-area:hover .upload-icon svg {
    transform: translateY(-3px);     /* 图标上浮 */
}
.upload-title {
    font-weight: 600;
    font-size: 0.8rem;               /* 原 0.95rem */
    color: #f1f5f9;
    position: relative;
    z-index: 1;
}
.upload-desc {
    font-size: 0.65rem;              /* 原 0.75rem */
    color: var(--text-dim);
    margin-top: 0.1rem;              /* 原 0.15rem */
    position: relative;
    z-index: 1;
}

.feature-section { margin-top: 1.8rem; border-top: 1px solid rgba(255, 255, 255, 0.06); padding-top: 1.2rem; }
.feature-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.7rem; color: #f1f5f9; display: flex; align-items: center; justify-content: space-between; user-select: none; }
.feature-title span:first-child { display: flex; align-items: center; gap: 0.5rem; }
.feature-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: 0 0 10px currentColor; }
.dot-convert { background: var(--primary); box-shadow: 0 0 12px var(--primary-glow); }
.dot-preview { background: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }

.status-box { background: rgba(10, 15, 28, 0.6); border: 1px solid rgba(255, 255, 255, 0.05); border-radius: var(--radius-sm); padding: 0.8rem 1rem; margin-top: 0.5rem; text-align: center; min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.4rem; backdrop-filter: blur(8px); }
.loader { width: 24px; height: 24px; border: 3px solid rgba(139, 92, 246, 0.2); border-top: 3px solid var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; display: none; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.status-msg { color: #cbd5e1; font-weight: 500; font-size: 0.85rem; }

/* 日志区域优化 */
.detail-log { background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 0.6rem; padding: 0.6rem 0.8rem; margin-top: 0.5rem; font-size: 0.7rem; max-height: 90px; overflow-y: auto; font-family: 'JetBrains Mono', 'Fira Code', monospace; text-align: left; width: 100%; transition: all var(--transition); scroll-behavior: smooth; }
.detail-log.collapsed { display: none; }
.log-entry { padding: 0.2rem 0; border-bottom: 1px solid rgba(255, 255, 255, 0.02); display: flex; gap: 0.4rem; line-height: 1.5; animation: slideInLog 0.2s ease-out; }
@keyframes slideInLog { from { opacity: 0; transform: translateX(-4px); } to { opacity: 1; transform: translateX(0); } }
.log-time { opacity: 0.5; font-size: 0.65rem; white-space: nowrap; }
.log-info { color: #e2e8f0; }
.log-success { color: #10b981; }
.log-warn { color: #f59e0b; }
.log-error { color: #ef4444; }
.log-toggle-btn { background: rgba(139, 92, 246, 0.15); border: 1px solid rgba(139, 92, 246, 0.3); border-radius: 30px; padding: 0.2rem 0.8rem; font-size: 0.65rem; color: #c4b5fd; cursor: pointer; transition: all 0.2s; margin-top: 0.4rem; display: inline-block; text-align: center; }
.log-toggle-btn:hover { background: rgba(139, 92, 246, 0.25); }

.action-bar { display: flex; gap: 0.8rem; justify-content: center; margin-top: 0.8rem; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.6rem 1.6rem; border-radius: 2.5rem; font-weight: 600; border: 1px solid transparent; cursor: pointer; font-size: 0.8rem; letter-spacing: 0.02em; transition: all var(--transition); white-space: nowrap; color: #fff; background: rgba(139, 92, 246, 0.2); border-color: rgba(139, 92, 246, 0.4); backdrop-filter: blur(8px); position: relative; overflow: hidden; touch-action: manipulation; }
.btn::after { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255, 255, 0.15), transparent); transition: left 0.5s; }
.btn:hover::after { left: 100%; }
.btn:hover { background: rgba(139, 92, 246, 0.35); border-color: rgba(139, 92, 246, 0.7); box-shadow: 0 8px 25px rgba(139, 92, 246, 0.3); transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.97); box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.btn-download { background: linear-gradient(135deg, #8b5cf6, #3b82f6); border-color: rgba(139, 92, 246, 0.5); box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4); }
.btn-download:hover { background: linear-gradient(135deg, #9b6df7, #4b92f6); box-shadow: 0 10px 25px rgba(139, 92, 246, 0.5); }
.btn-download:disabled { opacity: 0.4; pointer-events: none; filter: grayscale(30%); transform: none; }

/* 修复下拉菜单撑爆父容器 */
.skin-selector { 
    background: rgba(15, 23, 42, 0.6); 
    border: 1px solid rgba(139, 92, 246, 0.3); 
    color: white; 
    padding: 0.4rem 0.8rem; 
    border-radius: 2rem; 
    font-size: 0.8rem; 
    cursor: pointer; 
    outline: none; 
    transition: border-color var(--transition); 
    max-width: 100%; 
    text-overflow: ellipsis; 
    overflow: hidden; 
    white-space: nowrap; 
    flex: 1; 
}
.skin-selector:hover { border-color: var(--primary); }
.footer-note { margin-top: 1.5rem; text-align: center; font-size: 0.7rem; color: #64748b; border-top: 1px solid #334155; padding-top: 1rem; }
.preview-canvas { width: 100%; height: 400px; background: #0f172a; border-radius: 1rem; margin-top: 1rem; box-shadow: inset 0 0 20px rgba(0,0,0,0.5); }

/* 修复控制面板布局 */
.flex-row { 
    display: flex; 
    gap: 0.8rem; 
    align-items: center; 
    flex-wrap: wrap; 
    margin-top: 1rem; 
    justify-content: flex-start; 
    width: 100%; 
}
.skin-count-badge { background: rgba(6, 182, 212, 0.15); border: 1px solid rgba(6, 182, 212, 0.3); color: var(--accent-glow); border-radius: 30px; padding: 0.15rem 0.8rem; font-size: 0.7rem; font-weight: 600; }

/* 弹窗规范样式 - 增加移动端适应 */
.custom-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 12px; animation: fadeIn 0.2s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.custom-dialog { 
    background: var(--card-bg); 
    color: var(--text); 
    border-radius: var(--radius-md); 
    width: 550px; 
    max-width: calc(100vw - 32px); 
    max-height: 85vh; 
    overflow-y: auto; 
    padding: 24px; 
    box-shadow: var(--shadow-card), 0 0 0 1px var(--card-border); 
    display: flex; 
    flex-direction: column; 
    backdrop-filter: blur(20px); 
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1); 
    box-sizing: border-box; 
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.dialog-header { margin: 0 0 16px 0; font-size: 1.1rem; font-weight: 700; border-bottom: 1px solid var(--card-border); padding-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.dialog-row { display: flex; align-items: center; margin-bottom: 12px; gap: 8px; flex-wrap: wrap; width: 100%; background: rgba(0,0,0,0.2); padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.03); box-sizing: border-box; }
.dialog-input { flex: 1; min-width: 200px; max-width: 100%; background: rgba(15, 23, 42, 0.6); color: #e2e8f0; padding: 8px 12px; border-radius: 6px; border: 1px solid rgba(139, 92, 246, 0.3); font-size: 13px; outline: none; transition: border 0.2s; box-sizing: border-box; }
.dialog-input:focus { border-color: var(--primary-glow); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 16px; border-top: 1px solid var(--card-border); padding-top: 16px; }
.btn-cancel { background: rgba(71, 85, 105, 0.3); border: 1px solid rgba(71, 85, 105, 0.5); padding: 8px 16px; border-radius: 8px; color: #cbd5e1; cursor: pointer; font-size: 13px; transition: all 0.2s; }
.btn-cancel:hover { background: rgba(71, 85, 105, 0.5); color: #fff; }
.btn-confirm { background: var(--primary); border: none; padding: 8px 16px; border-radius: 8px; color: white; cursor: pointer; font-size: 13px; font-weight: 600; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); transition: all 0.2s; }
.btn-confirm:hover { background: var(--primary-glow); transform: translateY(-1px); }

/* 盔甲显示设置面板样式 */
.attachables-panel { margin-top: 1.2rem; padding-top: 0.6rem; border-top: 1px dashed rgba(139, 92, 246, 0.3); }
.attachables-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.8rem; cursor: default; }
.attachables-header span:first-child { font-weight: 600; font-size: 0.9rem; display: flex; align-items: center; gap: 0.5rem; }
.attachables-icon { font-size: 1.2rem; }
.attachables-list { background: rgba(0, 0, 0, 0.3); border-radius: 0.8rem; padding: 0.5rem; max-height: 240px; overflow-y: auto; margin-bottom: 0.8rem; border: 1px solid rgba(255,255,255,0.05); }
.attachables-item { display: flex; align-items: center; justify-content: space-between; padding: 0.6rem 0.8rem; border-bottom: 1px solid rgba(255, 255, 255, 0.03); font-size: 0.8rem; transition: background 0.2s; border-radius: 6px; }
.attachables-item:hover { background: rgba(139, 92, 246, 0.05); }
.attachables-item:last-child { border-bottom: none; }
.skin-name-label { font-weight: 500; word-break: break-word; max-width: 65%; color: #e2e8f0; }
.toggle-switch { display: flex; align-items: center; gap: 0.5rem; }
.toggle-switch label { font-size: 0.7rem; color: #94a3b8; cursor: pointer; user-select: none; }
.toggle-switch input { width: 2.2rem; height: 1.2rem; appearance: none; background: rgba(51, 65, 85, 0.8); border-radius: 1rem; position: relative; cursor: pointer; transition: all 0.2s; border: 1px solid rgba(255,255,255,0.1); outline: none; }
.toggle-switch input:checked { background: var(--primary); border-color: var(--primary-glow); }
.toggle-switch input::before { content: ''; width: 0.9rem; height: 0.9rem; background: white; border-radius: 50%; position: absolute; top: 0.1rem; left: 0.15rem; transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.toggle-switch input:checked::before { transform: translateX(1rem); }
.attachables-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 0.5rem; }
.mini-btn { background: rgba(139, 92, 246, 0.15); border: 1px solid rgba(139, 92, 246, 0.3); border-radius: 1.5rem; padding: 0.3rem 0.8rem; font-size: 0.7rem; color: #c4b5fd; cursor: pointer; transition: all 0.2s; }
.mini-btn:hover { background: rgba(139, 92, 246, 0.3); color: #fff; }
.mini-btn:active { transform: scale(0.96); }
.attachables-note { font-size: 0.65rem; color: rgba(148, 163, 184, 0.8); margin-top: 0.5rem; text-align: center; line-height: 1.5; }

.export-btn-wrapper { margin-top: 1.2rem; text-align: center; padding-top: 0.8rem; border-top: 1px dashed rgba(139, 92, 246, 0.3); }

/* 小控件面板（覆盖 JS 强制注入的问题） */
.control-btn-group { display: flex; gap: 6px; flex-wrap: wrap; }
.ctrl-btn { 
    color: white; 
    border: none; 
    padding: 6px 12px; 
    border-radius: 6px; 
    cursor: pointer; 
    font-size: 12px; 
    font-weight: 500; 
    transition: all 0.2s; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.2); 
    outline: none; 
    border: 1px solid rgba(255,255,255,0.1); 
    margin-left: 0 !important; 
    white-space: nowrap; 
}
.ctrl-btn:hover { transform: translateY(-1px); filter: brightness(1.1); }
.ctrl-btn:active { transform: translateY(1px); }

/* 移动端强力适配 */
@media (max-width: 640px) {
    body { padding: 0.8rem; }
    .glass-panel { padding: 1.2rem; width: 100%; }
    .logo h1 { font-size: 1.2rem; }
    .preview-canvas { height: 280px; }
    .btn { padding: 0.5rem 1.2rem; font-size: 0.75rem; }
    .detail-log { max-height: 75px; }
    
    .flex-row { gap: 0.6rem; }
    .skin-selector { width: 100%; flex: 1 1 100%; }
    .skin-count-badge { flex: 1 1 auto; text-align: center; }
    .ctrl-btn { flex: 1 1 auto; text-align: center; padding: 8px 4px; }
}

.hidden-cf, a[href*="cdn-cgi"], script:has(> iframe) { display: none !important; }
