:root {
  color-scheme: light;
  --bg: #f7f8fc;
  --surface: #ffffff;
  --surface-2: #f2f3fa;
  --text: #241f20;
  --muted: #746a6c;
  --border: #e5e6ef;
  --primary: #5b5bd6;
  --primary-text: #ffffff;
  --blue: #6e74df;
  --green: #26956c;
  --amber: #c5860b;
  --purple: #8b6ee8;
  --shadow: 0 18px 48px rgba(53, 56, 91, .09);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 7% 7%, rgba(151, 155, 255, .21), transparent 24%),
    radial-gradient(circle at 93% 14%, rgba(108, 211, 194, .14), transparent 20%),
    var(--bg);
  background-attachment: fixed;
}
button, input, select { font: inherit; }
button, a, label { -webkit-tap-highlight-color: transparent; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 70px;
  padding: 0 max(20px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(229,230,239,.9);
  background: rgba(247,248,252,.88);
  backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 17px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  border-radius: 13px 13px 13px 4px;
  color: #fff;
  background: linear-gradient(145deg, #7777eb, var(--primary));
  box-shadow: 0 9px 20px rgba(91,91,214,.22);
}
.brand-mark svg, .btn svg, .upload-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.wrap { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 32px 0 56px; }
.hero { display: grid; grid-template-columns: 1.08fr .92fr; gap: 18px; align-items: stretch; margin-bottom: 20px; }
.intro {
  position: relative;
  display: grid;
  align-content: center;
  min-height: 245px;
  overflow: hidden;
  padding: clamp(25px,4vw,42px);
  border: 1px solid rgba(229,230,239,.92);
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(91,91,214,.12), rgba(255,255,255,.82) 52%), var(--surface);
  box-shadow: var(--shadow);
}
.intro::after { content: "✦"; position: absolute; right: 31px; top: 26px; color: rgba(91,91,214,.25); font-size: 36px; transform: rotate(12deg); }
h1 { margin: 0; max-width: 720px; font-size: clamp(30px,4vw,46px); line-height: 1.1; font-weight: 900; letter-spacing: -.05em; }
.lead { max-width: 700px; margin: 15px 0 0; color: var(--muted); font-size: 15px; line-height: 1.72; }
.visual { min-height: 245px; overflow: hidden; border: 1px solid rgba(229,230,239,.92); border-radius: 24px; background: var(--surface-2); box-shadow: var(--shadow); }
.visual canvas { width: 100%; height: 100%; display: block; }

.workspace { display: grid; grid-template-columns: 355px 1fr; gap: 18px; align-items: start; padding: 18px; border: 1px solid rgba(229,230,239,.94); border-radius: 24px; background: rgba(255,255,255,.76); box-shadow: var(--shadow); backdrop-filter: blur(9px); }
.panel { padding: 17px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.dropzone { display: grid; place-items: center; gap: 10px; min-height: 174px; padding: 20px; border: 1.5px dashed #cfd0e6; border-radius: 16px; text-align: center; cursor: pointer; background: linear-gradient(150deg, #fafaff, #f0f1ff); transition: border-color .2s ease, background .2s ease, transform .2s ease; }
.dropzone:hover, .dropzone.is-dragover { border-color: var(--primary); background: #eaeaFF; transform: translateY(-1px); }
.dropzone input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; pointer-events: none; }
.upload-icon { display: grid; place-items: center; width: 54px; height: 54px; border: 0; border-radius: 18px; color: var(--primary); background: #fff; box-shadow: 0 9px 24px rgba(62,65,115,.13); }

.field { display: grid; gap: 7px; margin-top: 15px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label, .label { font-size: 13px; font-weight: 700; }
input[type="number"], input[type="text"], select { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 11px; outline: none; color: var(--text); background: #fff; transition: border-color .2s ease, box-shadow .2s ease; }
input[type="number"]:focus, input[type="text"]:focus, select:focus { border-color: #9b9be9; box-shadow: 0 0 0 4px rgba(91,91,214,.09); }
input[type="range"], input[type="checkbox"] { accent-color: var(--primary); }
input[type="range"] { width: 100%; }
input[type="checkbox"] { width: 18px; height: 18px; }
.checkline { display: grid; grid-template-columns: 18px 1fr; gap: 9px; align-items: start; margin-top: 13px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 17px; }
.btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; border: 1px solid var(--border); border-radius: 11px; color: var(--text); background: #fff; text-decoration: none; font-weight: 700; cursor: pointer; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.btn:hover:not(:disabled):not([aria-disabled="true"]) { transform: translateY(-1px); border-color: #bfc0ec; box-shadow: 0 7px 18px rgba(53,56,91,.09); }
.btn.primary { border-color: transparent; color: var(--primary-text); background: var(--primary); box-shadow: 0 9px 20px rgba(91,91,214,.19); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.status { min-height: 40px; margin-top: 14px; padding: 11px 12px; border-radius: 11px; color: var(--muted); background: var(--surface-2); font-size: 12px; line-height: 1.5; }
.status.ok { color: var(--green); background: #edf9f4; }
.status.warn { color: #a96e00; background: #fff7df; }

.stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 11px; margin-bottom: 16px; }
.stat, .preview { border: 1px solid var(--border); border-radius: 17px; background: var(--surface); }
.stat { min-height: 88px; padding: 14px; }
.stat-label { color: var(--muted); font-size: 11px; font-weight: 650; }
.stat-value { margin-top: 7px; overflow-wrap: anywhere; font-size: 20px; line-height: 1.2; font-weight: 850; letter-spacing: -.03em; }
.stat-small { margin-top: 4px; overflow-wrap: anywhere; color: var(--muted); font-size: 11px; }
.preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.preview { overflow: hidden; }
.preview-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; min-height: 48px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.preview-title { font-size: 13px; font-weight: 800; }
.preview-body { display: grid; place-items: center; min-height: 352px; background-color: #faf7f7; background-image: linear-gradient(45deg, rgba(225,211,212,.36) 25%, transparent 25%), linear-gradient(-45deg, rgba(225,211,212,.36) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(225,211,212,.36) 75%), linear-gradient(-45deg, transparent 75%, rgba(225,211,212,.36) 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; }
.preview-body img { display: block; max-width: 100%; max-height: 520px; object-fit: contain; }
.muted, .empty { color: var(--muted); font-size: 12px; line-height: 1.5; }
.empty { padding: 25px; text-align: center; }
.file-list { display: grid; gap: 9px; max-height: 286px; overflow: auto; margin-bottom: 14px; }
.file-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 13px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); }
.file-main { min-width: 0; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 750; }
.file-meta { margin-top: 4px; color: var(--muted); font-size: 11px; }
.file-item .btn { flex: 0 0 auto; min-height: 34px; padding: 0 10px; font-size: 11px; }
.batch-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin: 0 0 14px; }
.batch-toolbar .btn { min-width: 138px; }
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
table { width: 100%; min-width: 620px; border-collapse: collapse; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; font-size: 12px; }
th { color: var(--muted); background: var(--surface-2); font-weight: 750; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.result-ok { color: var(--green); font-weight: 750; }
.result-error { color: #a96e00; font-weight: 750; }
.notice { margin-top: 12px; padding: 11px 12px; border-radius: 11px; color: var(--muted); background: #f6f6fd; font-size: 12px; line-height: 1.55; }

@media (max-width: 1050px) { .hero, .workspace, .stats, .preview-grid { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .topbar { min-height: 64px; padding: 0 14px; }
  .brand { font-size: 15px; }
  .brand-mark { width: 36px; height: 36px; }
  .topbar > .btn { min-height: 38px; padding: 0 11px; font-size: 12px; }
  .wrap { width: min(100% - 24px,1180px); padding: 20px 0 36px; }
  .hero { margin-bottom: 13px; }
  .intro { min-height: 190px; padding: 26px 22px; border-radius: 20px; }
  .visual { display: none; }
  .workspace { padding: 12px; border-radius: 20px; }
  .panel { padding: 13px; }
  .field-row, .actions { grid-template-columns: 1fr; }
  .preview-body { min-height: 280px; }
  .batch-toolbar { align-items: stretch; flex-direction: column; }
  .batch-toolbar .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .btn, .dropzone { transition: none; } }
