:root {
  color-scheme: dark;
  --bg: #101a2c;
  --bg-glow: radial-gradient(ellipse at 70% 10%, #213452 0, transparent 48%);
  --panel: #17243a;
  --panel-strong: #1c2c47;
  --text: #edf3fb;
  --muted: #a8b6ca;
  --faint: #7e8fa6;
  --line: rgba(255, 255, 255, 0.10);
  --surface: #1e2f4a;
  --accent: #6ee7c2;
  --accent-ink: #0b2b22;
  --focus: #6ee7c2;
  --radius-lg: 16px;
  --shadow-card: 0 18px 50px #050b1538;
  --ring: 0 0 0 1px var(--line);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-glow), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Geist', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
}

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(16, 26, 44, 0.86);
  backdrop-filter: blur(8px);
  box-shadow: var(--ring);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  text-decoration: none; color: var(--text);
  font-weight: 600; font-size: 15px; letter-spacing: -0.01em;
}
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 6px;
  color: var(--accent); background: var(--surface); box-shadow: var(--ring);
}
.header-nav { display: flex; gap: 20px; }
.header-nav a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.header-nav a:hover { color: var(--text); }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 64px 0 40px; }
.pill {
  display: inline-block; padding: 3px 12px; border-radius: 9999px;
  background: rgba(110, 231, 194, 0.12); color: var(--accent);
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em; margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(34px, 5vw, 52px); font-weight: 600; line-height: 1.05;
  letter-spacing: -0.04em; margin: 0 0 16px;
}
.hero .accent { color: var(--accent); }
.hero-sub { color: var(--muted); font-size: 18px; line-height: 1.6; max-width: 560px; margin: 0 auto; }

/* ---------- Tool ---------- */
.tool {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 32px; align-items: start; padding-bottom: 64px;
}
.tool-form {
  padding: 26px; border-radius: var(--radius-lg);
  background: rgba(23, 36, 58, 0.88); box-shadow: var(--ring), var(--shadow-card);
}
.field-label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.muted-inline { color: var(--faint); font-weight: 400; }

/* Dropzone */
.dropzone {
  display: block; border: 1px dashed rgba(110, 231, 194, 0.45);
  border-radius: 12px; padding: 30px 18px; text-align: center; cursor: pointer;
  background: rgba(16, 26, 44, 0.55); transition: background .15s ease, border-color .15s ease;
}
.dropzone:hover, .dropzone:focus-visible { background: rgba(110, 231, 194, 0.07); border-color: var(--accent); outline: none; }
.dropzone.dragover { background: rgba(110, 231, 194, 0.12); border-color: var(--accent); }
.dz-inner { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.dz-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 12px; background: rgba(110, 231, 194, 0.12);
  color: var(--accent); margin-bottom: 8px;
}
.dz-title { font-weight: 600; font-size: 15px; }
.dz-sub { color: var(--muted); font-size: 13px; }
.dz-hint { color: var(--faint); font-size: 12px; margin-top: 6px; }

/* File queue */
#queue-wrap { margin-top: 18px; }
.list-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.list-head .field-label { margin-bottom: 0; }
.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file-item {
  background: rgba(16, 26, 44, 0.72); border-radius: 9px; box-shadow: var(--ring);
  padding: 10px 12px; display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: start;
}
.file-item .order { color: var(--accent); font-family: 'Geist Mono', ui-monospace, monospace; font-size: 13px; padding-top: 2px; }
.file-main { min-width: 0; }
.file-name { font-size: 14px; font-weight: 500; word-break: break-all; }
.file-meta { color: var(--faint); font-size: 12px; margin-top: 2px; }
.range-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.range-row label { color: var(--faint); font-size: 12px; }
.range-input {
  width: 130px; font-family: 'Geist Mono', ui-monospace, monospace; font-size: 12px;
  color: var(--text); background: rgba(16, 26, 44, 0.72); border: 0; border-radius: 6px;
  box-shadow: var(--ring); padding: 5px 8px; outline: none;
}
.range-input:focus { box-shadow: 0 0 0 2px var(--focus); }
.range-badge { color: var(--accent); font-size: 12px; }
.file-actions { display: flex; flex-direction: column; gap: 4px; }
.icon-btn {
  border: 0; background: transparent; color: var(--faint); cursor: pointer;
  width: 24px; height: 22px; border-radius: 5px; font-size: 13px; line-height: 1;
}
.icon-btn:hover:not(:disabled) { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.icon-btn.remove:hover { color: #ff9b9b; }
.range-error { color: #ff9b9b; font-size: 12px; margin-top: 5px; }

/* Name + options */
.name-row { margin-top: 20px; padding-top: 18px; box-shadow: var(--line, rgba(255,255,255,0.1)) 0 -1px 0 0; }
.name-field { display: flex; align-items: center; border-radius: 9px; box-shadow: var(--ring); background: rgba(16, 26, 44, 0.72); }
.name-field:focus-within { box-shadow: 0 0 0 2px var(--focus); }
.name-field input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 14px; padding: 9px 12px;
}
.name-field input::placeholder { color: var(--faint); }
.name-field .ext { font-family: 'Geist Mono', ui-monospace, monospace; color: var(--faint); font-size: 13px; padding-right: 12px; }
.merge-options { display: flex; flex-direction: column; gap: 9px; margin-top: 14px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

/* Buttons */
.btn-primary {
  display: block; width: 100%; margin-top: 20px; padding: 13px 16px; border: 0; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer; box-shadow: 0 10px 26px rgba(110, 231, 194, 0.18);
  transition: transform .12s ease, box-shadow .12s ease, opacity .15s ease;
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(110, 231, 194, 0.24); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-secondary {
  display: inline-block; padding: 9px 16px; border-radius: 9px; background: var(--surface);
  color: var(--text); font-size: 14px; font-weight: 500; border: 0; cursor: pointer; box-shadow: var(--ring);
}
.btn-secondary:hover { background: var(--panel-strong); }

.hint { font-size: 12px; color: var(--faint); margin: 12px 0 0; }
.hint-center { text-align: center; }
.error {
  font-size: 13px; color: #ff9b9b; background: rgba(255, 107, 107, 0.10);
  border-radius: 9px; padding: 8px 10px; margin: 12px 0 0;
}

/* Progress */
.progress-wrap { margin-top: 16px; }
.bar { height: 6px; border-radius: 999px; background: var(--surface); overflow: hidden; box-shadow: var(--ring); }
.bar span { display: block; height: 100%; width: 0%; background: var(--accent); transition: width .2s ease; }
.progress-text { color: var(--faint); font-size: 12px; margin-top: 6px; }

/* Result */
.result-card {
  background: rgba(110, 231, 194, 0.08); border-radius: 12px; box-shadow: var(--ring);
  padding: 16px; margin-top: 18px; text-align: center;
}
.result-kicker { color: var(--accent); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.result-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.result-card .download-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.result-card .btn-primary { width: auto; margin: 14px 0 0; padding: 9px 16px; font-size: 14px; }

/* ---------- Preview ---------- */
.tool-result { text-align: center; }
.preview-frame { background: var(--panel); }
.preview-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: var(--faint); background: rgba(30, 47, 74, 0.55);
}
.preview-empty p { margin: 0; font-size: 14px; line-height: 1.5; }
.sheet { position: absolute; inset: 0; padding: 24px; overflow: hidden; }
.sheet-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--faint); margin-bottom: 10px; }
.sheet-num { color: var(--accent); font-family: 'Geist Mono', ui-monospace, monospace; }
.sheet-body {
  height: calc(100% - 58px); border-radius: 6px; background: #f6f8fb; box-shadow: 0 12px 34px #050b1560;
  overflow: auto; display: flex; align-items: flex-start; justify-content: center;
}
.sheet-body canvas { display: block; width: 100%; height: auto; }
.sheet-foot { color: var(--faint); font-size: 11px; margin-top: 8px; }
.qr-frame {
  position: relative; display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1 / 1; border-radius: var(--radius-lg); box-shadow: var(--shadow-card); overflow: hidden;
}

/* ---------- Sections ---------- */
.section { padding: 24px 0 40px; }
.section h2 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.card { background: rgba(23, 36, 58, 0.88); border-radius: var(--radius-lg); box-shadow: var(--ring); padding: 20px; }
.card h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 6px; }
.card p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.6; }
.step {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border-radius: 50%; background: rgba(110, 231, 194, 0.14); color: var(--accent);
  font-size: 12px; font-weight: 600; margin-bottom: 10px;
}
code { font-family: 'Geist Mono', ui-monospace, monospace; font-size: 13px; background: rgba(16, 26, 44, 0.72); border-radius: 4px; padding: 1px 5px; }

.faq-list details { padding: 0 20px; margin-bottom: 10px; }
.faq-list summary { cursor: pointer; font-size: 15px; font-weight: 500; padding: 14px 0; list-style: none; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: '+'; float: right; color: var(--faint); font-weight: 400; }
.faq-list details[open] summary::after { content: '–'; }
.faq-list details p { margin: 0 0 14px; }

/* ---------- Footer ---------- */
.site-footer { box-shadow: rgba(255,255,255,0.10) 0 -1px 0 0; padding: 22px 0; margin-top: 24px; }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--faint); }
.footer-inner p { margin: 0; }
.mono { font-family: 'Geist Mono', ui-monospace, monospace; font-size: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .tool { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .preview-frame { max-width: 520px; margin: 0 auto; }
}
@media (max-width: 520px) {
  .container { padding: 0 16px; }
  .hero { padding: 40px 0 28px; }
  .header-nav { display: none; }
  .tool-form { padding: 18px; }
  .file-item { grid-template-columns: 20px 1fr auto; gap: 6px; }
}
