*{margin:0;padding:0;box-sizing:border-box}
html{font-size:15px}
body{font-family:"PingFang SC","Microsoft YaHei","Segoe UI",system-ui,sans-serif;background:#f4f5f7;color:#26282c;line-height:1.6;-webkit-font-smoothing:antialiased}
a{color:inherit;text-decoration:none}
button{font-family:inherit;cursor:pointer;border:none;background:none}
input,select,textarea{font-family:inherit;font-size:1rem}
img{max-width:100%}

/* ---------- header ---------- */
.site-header{background:#fff;border-bottom:1px solid #e8eaee;position:sticky;top:0;z-index:50}
.site-header .inner{max-width:1100px;margin:0 auto;display:flex;align-items:center;gap:22px;padding:12px 20px}
.logo{display:flex;align-items:center;gap:9px;font-weight:700;font-size:1.15rem;color:#e5322d;white-space:nowrap}
.logo svg{width:26px;height:26px}
.site-nav{display:flex;gap:4px;flex-wrap:wrap;margin-left:auto}
.site-nav a{padding:6px 12px;border-radius:8px;color:#555;transition:.15s}
.site-nav a:hover{background:#f2f3f5;color:#e5322d}
.site-nav a.on{color:#e5322d;font-weight:600}

/* ---------- layout ---------- */
.wrap{max-width:1100px;margin:0 auto;padding:26px 20px 60px}
.hero{text-align:center;padding:34px 0 26px}
.hero h1{font-size:2rem;letter-spacing:.5px}
.hero p{color:#777;margin-top:8px}
.tool-head{margin-bottom:20px}
.tool-head h1{font-size:1.6rem}
.tool-head .desc{color:#777;margin-top:4px}
.crumbs{font-size:.85rem;color:#999;margin-bottom:10px}
.crumbs a{color:#999}.crumbs a:hover{color:#e5322d}

/* ---------- index grid ---------- */
.search-box{max-width:460px;margin:18px auto 0;position:relative}
.search-box input{width:100%;padding:11px 16px 11px 40px;border:1px solid #e2e4e9;border-radius:10px;background:#fff}
.search-box svg{position:absolute;left:13px;top:50%;transform:translateY(-50%);width:17px;height:17px;stroke:#aaa}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(228px,1fr));gap:14px;margin-top:26px}
.tcard{background:#fff;border:1px solid #e8eaee;border-radius:12px;padding:20px 18px;transition:.18s;display:block}
.tcard:hover{transform:translateY(-3px);box-shadow:0 8px 24px rgba(0,0,0,.08);border-color:#f5b9b4}
.tcard .ic{width:42px;height:42px;border-radius:10px;display:flex;align-items:center;justify-content:center;margin-bottom:12px;background:#fdeceb;color:#e5322d}
.tcard .ic svg{width:22px;height:22px}
.tcard h3{font-size:1.02rem;font-weight:600}
.tcard p{font-size:.84rem;color:#888;margin-top:5px;line-height:1.45}
.sec-title{font-size:1.05rem;font-weight:700;margin:34px 0 2px;color:#444;display:flex;align-items:center;gap:8px}
.sec-title::before{content:"";width:4px;height:16px;background:#e5322d;border-radius:2px}

/* ---------- dropzone ---------- */
.dropzone{border:2px dashed #d4d7dd;border-radius:14px;background:#fff;text-align:center;padding:54px 20px;transition:.15s;cursor:pointer}
.dropzone:hover,.dropzone.drag{border-color:#e5322d;background:#fff8f7}
.dropzone .big{font-size:1.1rem;font-weight:600}
.dropzone .sub{color:#999;font-size:.85rem;margin-top:8px}
.dropzone svg{width:46px;height:46px;stroke:#e5322d;margin-bottom:12px}
.badge{display:inline-block;background:#fdeceb;color:#e5322d;border-radius:6px;font-size:.75rem;padding:2px 8px;margin-top:10px}

/* ---------- file list ---------- */
.file-list{margin-top:16px;display:flex;flex-direction:column;gap:8px}
.file-item{display:flex;align-items:center;gap:12px;background:#fff;border:1px solid #e8eaee;border-radius:10px;padding:10px 14px}
.file-item .fi-ic{width:34px;height:34px;background:#fdeceb;color:#e5322d;border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:.68rem;font-weight:700;flex:none}
.file-item .fi-name{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.92rem}
.file-item .fi-size{color:#999;font-size:.8rem;flex:none}
.file-item .fi-x{color:#bbb;font-size:1.1rem;padding:4px 8px;flex:none}
.file-item .fi-x:hover{color:#e5322d}
.file-item.sortable-ghost{opacity:.4}
.drag-hint{color:#ccc;margin-right:2px;cursor:grab;font-size:1rem;flex:none;user-select:none}

/* ---------- options / buttons ---------- */
.panel{background:#fff;border:1px solid #e8eaee;border-radius:14px;padding:20px;margin-top:18px}
.panel h4{font-size:.95rem;margin-bottom:14px;color:#444}
.opt-row{display:flex;flex-wrap:wrap;gap:14px 26px;align-items:center}
.opt{display:flex;align-items:center;gap:8px;font-size:.9rem;color:#444}
.opt label{color:#666;white-space:nowrap}
.opt input[type=text],.opt input[type=number],.opt select{border:1px solid #dfe2e8;border-radius:8px;padding:7px 10px;min-width:0}
.opt input[type=text]{width:130px}
.opt input[type=number]{width:80px}
.opt input[type=color]{width:36px;height:32px;border:1px solid #dfe2e8;border-radius:6px;padding:2px;background:#fff}
.opt input[type=range]{accent-color:#e5322d}
.radio-cards{display:flex;gap:10px;flex-wrap:wrap}
.radio-cards label{border:1px solid #dfe2e8;border-radius:10px;padding:10px 16px;cursor:pointer;font-size:.88rem;transition:.15s;display:block;text-align:center}
.radio-cards label small{display:block;color:#999;margin-top:2px}
.radio-cards input{display:none}
.radio-cards label:has(input:checked){border-color:#e5322d;background:#fff5f4;color:#e5322d;font-weight:600}
.radio-cards label:has(input:checked) small{color:#e58a84}
.actions{margin-top:22px;display:flex;gap:12px;align-items:center;flex-wrap:wrap}
.btn{display:inline-flex;align-items:center;gap:8px;background:#e5322d;color:#fff;border-radius:10px;padding:12px 34px;font-size:1rem;font-weight:600;transition:.15s}
.btn:hover{background:#c92823}
.btn:disabled{background:#d9dce1;cursor:not-allowed}
.btn.ghost{background:#fff;color:#e5322d;border:1px solid #f0b6b2}
.btn.ghost:hover{background:#fff5f4}
.btn.sm{padding:7px 14px;font-size:.85rem;border-radius:8px}
.hint{color:#999;font-size:.82rem}

/* ---------- result ---------- */
.result{margin-top:22px;display:none}
.result.show{display:block;animation:fadeUp .3s}
.result-card{background:#fff;border:1px solid #e8eaee;border-radius:14px;padding:22px;text-align:center}
.result-card .ok{width:52px;height:52px;border-radius:50%;background:#e8f8ee;color:#22a55b;display:flex;align-items:center;justify-content:center;margin:0 auto 10px}
.result-card h3{font-size:1.1rem}
.result-card .meta{color:#888;font-size:.85rem;margin:6px 0 16px}
.result-card .btns{display:flex;gap:10px;justify-content:center;flex-wrap:wrap}
@keyframes fadeUp{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}

/* ---------- thumbnails ---------- */
.thumbs{display:grid;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:14px;margin-top:18px}
.thumb{position:relative;background:#fff;border:1px solid #e2e4e9;border-radius:10px;padding:8px;transition:.15s;user-select:none}
.thumb.selected{border-color:#e5322d;box-shadow:0 0 0 2px rgba(229,50,45,.25)}
.thumb.sortable-ghost{opacity:.35}
.thumb canvas{width:100%;display:block;border-radius:4px;background:#fafafa}
.thumb .pn{position:absolute;left:8px;top:8px;background:rgba(0,0,0,.55);color:#fff;font-size:.68rem;border-radius:5px;padding:1px 6px}
.thumb .ops{position:absolute;right:6px;top:6px;display:none;gap:4px}
.thumb:hover .ops{display:flex}
.thumb .ops button{background:rgba(255,255,255,.94);border:1px solid #ddd;border-radius:6px;width:26px;height:26px;font-size:.8rem;color:#555;display:flex;align-items:center;justify-content:center}
.thumb .ops button:hover{color:#e5322d;border-color:#e5322d}
.thumb .cap{text-align:center;font-size:.75rem;color:#888;margin-top:6px}
.thumb.blank .ph{aspect-ratio:1/1.3;display:flex;align-items:center;justify-content:center;color:#bbb;font-size:.8rem;background:#fafafa;border-radius:4px}
.toolbar{display:flex;gap:8px;flex-wrap:wrap;margin-top:16px;align-items:center}
.toolbar .sep{width:1px;height:22px;background:#e2e4e9}

/* ---------- textarea / preview ---------- */
.txt-out{width:100%;min-height:240px;border:1px solid #dfe2e8;border-radius:10px;padding:14px;font-size:.88rem;line-height:1.7;background:#fff;resize:vertical;margin-top:14px;white-space:pre-wrap}
.info-line{color:#777;font-size:.85rem;margin-top:10px}

/* ---------- progress ---------- */
.overlay{position:fixed;inset:0;background:rgba(20,22,26,.55);display:none;align-items:center;justify-content:center;z-index:200;backdrop-filter:blur(2px)}
.overlay.show{display:flex}
.prog-card{background:#fff;border-radius:14px;padding:30px 40px;min-width:320px;max-width:420px;text-align:center}
.prog-card h3{font-size:1.05rem;margin-bottom:16px}
.bar{height:8px;background:#eef0f3;border-radius:99px;overflow:hidden}
.bar i{display:block;height:100%;width:0;background:linear-gradient(90deg,#f0655f,#e5322d);border-radius:99px;transition:width .2s}
.prog-card .pct{margin-top:10px;color:#888;font-size:.85rem}
.modal-card{background:#fff;border-radius:14px;padding:26px 30px;width:360px;max-width:92vw}
.modal-card h3{font-size:1rem;margin-bottom:14px}
.modal-card input{width:100%;border:1px solid #dfe2e8;border-radius:8px;padding:10px 12px;margin-bottom:16px}
.modal-card .row{display:flex;gap:10px;justify-content:flex-end}

/* ---------- toast ---------- */
.toast{position:fixed;left:50%;bottom:44px;transform:translateX(-50%) translateY(16px);background:#26282c;color:#fff;padding:10px 22px;border-radius:10px;font-size:.9rem;opacity:0;transition:.25s;z-index:300;pointer-events:none;box-shadow:0 6px 24px rgba(0,0,0,.25)}
.toast.show{opacity:1;transform:translateX(-50%)}
.toast.err{background:#c92823}

/* ---------- footer ---------- */
.site-footer{border-top:1px solid #e8eaee;background:#fff;margin-top:30px}
.site-footer .inner{max-width:1100px;margin:0 auto;padding:26px 20px;color:#999;font-size:.82rem;display:flex;flex-wrap:wrap;gap:8px 24px}
.site-footer .links{display:flex;gap:16px;flex-wrap:wrap}
.site-footer a:hover{color:#e5322d}

@media(max-width:640px){
  .site-header .inner{gap:10px;padding:10px 14px}
  .site-nav a{padding:5px 8px;font-size:.88rem}
  .hero h1{font-size:1.5rem}
  .dropzone{padding:38px 14px}
  .grid{grid-template-columns:repeat(auto-fill,minmax(160px,1fr))}
  .thumbs{grid-template-columns:repeat(auto-fill,minmax(100px,1fr))}
}

/* ---------- 图片裁剪 ---------- */
.crop-stage{position:relative;display:inline-block;max-width:100%;margin-top:18px;touch-action:none;user-select:none}
.crop-stage img{display:block;max-width:100%;border-radius:8px;pointer-events:none}
.crop-dim{position:absolute;inset:0;background:rgba(0,0,0,.45);display:none}
.crop-rect{position:absolute;border:2px dashed #e5322d;box-shadow:0 0 0 9999px rgba(0,0,0,.45);cursor:move;display:none}
.crop-rect .ch{position:absolute;width:12px;height:12px;background:#fff;border:2px solid #e5322d;border-radius:50%;transform:translate(-50%,-50%)}
.crop-info{position:absolute;left:0;top:-24px;font-size:.75rem;color:#fff;background:rgba(0,0,0,.6);padding:1px 8px;border-radius:5px;white-space:nowrap}

/* ---------- 结果预览 ---------- */
.preview-img{max-width:320px;max-height:420px;border:1px solid #e2e4e9;border-radius:10px;background:#fff;margin-top:14px}
