/* === 切图工坊 - Style === */
:root {
    --bg: #0b0c10;
    --surface: rgba(31, 40, 51, 0.6);
    --surface-border: rgba(69, 162, 158, 0.2);
    --primary: #66fcf1;
    --secondary: #45a29e;
    --text: #ffffff;
    --text-dim: #c5c6c7;
    --danger: #ff5252;
    --success: #69f0ae;
    --glass: blur(14px);
    --radius: 16px;
}

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

body {
    font-family: 'Noto Sans SC', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding: 1.5rem;
    overflow-x: hidden;
    position: relative;
}

/* 背景装饰 */
.bg-grid {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background-image:
        linear-gradient(rgba(102,252,241,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(102,252,241,0.03) 1px, transparent 1px);
    background-size: 60px 60px;
}
.bg-glow {
    position: fixed; border-radius: 50%; pointer-events: none; z-index: 0;
    filter: blur(120px); opacity: 0.12;
}
.bg-glow-1 { width: 600px; height: 600px; top: -200px; left: -100px; background: var(--secondary); }
.bg-glow-2 { width: 500px; height: 500px; bottom: -150px; right: -100px; background: var(--primary); }

/* 头部 */
.header {
    text-align: center; padding: 2rem 0 1.5rem; position: relative; z-index: 1;
    animation: fadeDown 0.6s ease-out;
}
.logo {
    font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    font-weight: 900; letter-spacing: 2px;
    background: linear-gradient(135deg, #fff 30%, var(--primary) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.logo-icon { -webkit-text-fill-color: var(--primary); }
.subtitle { color: var(--text-dim); font-size: 0.95rem; margin-top: 0.4rem; font-weight: 300; }

/* 面板通用 */
.panel {
    position: relative; z-index: 1;
    background: var(--surface);
    backdrop-filter: var(--glass); -webkit-backdrop-filter: var(--glass);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.panel-title {
    font-size: 0.8rem; text-transform: uppercase; letter-spacing: 2px;
    color: var(--text-dim); margin-bottom: 1.2rem;
}

/* 主布局 */
.main-grid {
    max-width: 960px; margin: 0 auto;
    display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem;
    animation: fadeUp 0.6s ease-out 0.15s both;
}
@media (max-width: 768px) {
    .main-grid { grid-template-columns: 1fr; }
}

/* 拖拽区 */
.drop-zone {
    height: 240px; border: 2px dashed rgba(69,162,158,0.35); border-radius: 12px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.3s; background: rgba(0,0,0,0.2); position: relative;
}
.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary); background: rgba(102,252,241,0.04);
    transform: scale(1.01);
}
.drop-zone:hover .drop-icon { color: var(--primary); transform: translateY(-4px); }
.drop-icon { color: var(--secondary); transition: all 0.3s; margin-bottom: 0.8rem; }
.drop-text { color: var(--text-dim); text-align: center; line-height: 1.8; font-size: 0.95rem; }
.drop-text span { color: var(--primary); font-weight: 600; }

/* 文件列表 */
.file-list { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.file-item {
    background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.05);
    padding: 0.8rem 1rem; border-radius: 8px;
    display: flex; justify-content: space-between; align-items: center;
    animation: slideIn 0.25s ease-out;
}
.file-info { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.file-name {
    font-weight: 500; font-size: 0.9rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px;
}
.file-meta { font-size: 0.75rem; color: var(--text-dim); }
.file-remove {
    background: none; border: none; color: var(--danger); cursor: pointer;
    font-size: 1.1rem; padding: 4px 8px; opacity: 0.6; transition: opacity 0.2s;
}
.file-remove:hover { opacity: 1; }

/* 比例按钮 */
.setting-group { margin-bottom: 1.5rem; }
.setting-label { display: block; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); margin-bottom: 0.8rem; }
.ratio-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.ratio-btn {
    background: rgba(0,0,0,0.3); border: 1px solid var(--surface-border);
    color: var(--text); padding: 0.7rem 0.4rem; border-radius: 10px; cursor: pointer;
    font-family: inherit; text-align: center; transition: all 0.2s; position: relative; overflow: hidden;
}
.ratio-btn span { display: block; font-weight: 700; font-size: 1rem; position: relative; z-index: 1; }
.ratio-btn small { display: block; font-size: 0.65rem; color: var(--text-dim); margin-top: 2px; position: relative; z-index: 1; }
.ratio-btn::before {
    content: ''; position: absolute; inset: 0; z-index: 0;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    opacity: 0; transition: opacity 0.3s;
}
.ratio-btn:hover { border-color: var(--primary); }
.ratio-btn.active {
    border-color: transparent; color: #0b0c10;
    box-shadow: 0 0 15px rgba(102,252,241,0.35);
}
.ratio-btn.active::before { opacity: 1; }
.ratio-btn.active small { color: rgba(0,0,0,0.6); }

/* 自定义比例输入 */
.custom-ratio {
    display: none; grid-template-columns: 1fr auto 1fr; gap: 0.6rem;
    align-items: center; margin-top: 0.6rem;
    background: rgba(0,0,0,0.2); padding: 0.8rem; border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.05);
}
.custom-ratio.show { display: grid; animation: fadeIn 0.25s; }
.ratio-input {
    width: 100%; background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.1);
    color: #fff; padding: 0.6rem; border-radius: 6px; text-align: center;
    font-size: 1rem; font-family: inherit;
}
.ratio-input:focus { outline: none; border-color: var(--primary); }
.ratio-sep { color: var(--text-dim); font-weight: 700; }

/* Toggle */
.toggle-row {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.9rem; color: var(--text-dim);
}
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
    position: absolute; inset: 0; background: rgba(255,255,255,0.1);
    border-radius: 12px; transition: background 0.3s;
}
.toggle-track::after {
    content: ''; position: absolute; left: 2px; top: 2px;
    width: 20px; height: 20px; background: #fff; border-radius: 50%;
    transition: transform 0.3s;
}
.toggle input:checked + .toggle-track { background: var(--secondary); }
.toggle input:checked + .toggle-track::after { transform: translateX(20px); }

/* 切割按钮 */
.btn-slice {
    width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    color: #0b0c10; border: none; padding: 1rem; border-radius: 10px;
    font-family: inherit; font-weight: 700; font-size: 1rem; cursor: pointer;
    transition: all 0.3s; box-shadow: 0 4px 15px rgba(102,252,241,0.3);
    position: relative; overflow: hidden;
}
.btn-slice::after {
    content: ''; position: absolute; top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
    transform: skewX(-20deg);
}
.btn-slice:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(102,252,241,0.5); }
.btn-slice:hover:not(:disabled)::after { animation: shine 1.2s; }
.btn-slice:disabled { background: #333; color: #666; cursor: not-allowed; box-shadow: none; }

/* 状态 */
.status { margin-top: 1rem; font-size: 0.85rem; min-height: 1.5rem; }
.status.processing { color: var(--primary); }
.status.success { color: var(--success); }
.status.error { color: var(--danger); }

/* 结果区 */
.panel-results {
    max-width: 960px; margin: 1.5rem auto 0; z-index: 1; position: relative;
    animation: fadeUp 0.4s ease-out;
}
.results-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.btn-download {
    display: flex; align-items: center; gap: 6px;
    background: rgba(102,252,241,0.12); border: 1px solid var(--secondary);
    color: var(--primary); padding: 0.6rem 1.2rem; border-radius: 8px;
    font-family: inherit; font-weight: 600; font-size: 0.9rem; cursor: pointer;
    transition: all 0.2s;
}
.btn-download:hover { background: rgba(102,252,241,0.2); transform: translateY(-1px); }

.slices-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem;
}
.slice-card {
    background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px; overflow: hidden; animation: fadeUp 0.3s ease-out;
}
.slice-card img { width: 100%; display: block; }
.slice-card .slice-label {
    padding: 0.5rem; font-size: 0.75rem; color: var(--text-dim); text-align: center;
}

/* Footer */
.footer {
    text-align: center; padding: 2rem 0 1rem; font-size: 0.8rem;
    color: rgba(255,255,255,0.25); position: relative; z-index: 1;
}

/* 动画 */
@keyframes fadeDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes shine { 100% { left: 200%; } }
