/* ================= Design tokens ================= */
:root {
  --accent: #dc2626;
  --accent-soft: #fdeeee;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1a202e;
  --muted: #67708b;
  --border: #e3e6f0;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 24, 46, 0.05), 0 8px 24px rgba(20, 24, 46, 0.07);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ================= Header ================= */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 9px; font-size: 19px; color: var(--text); text-decoration: none; letter-spacing: -0.01em; }
.brand strong { color: var(--accent); }
.header-nav { display: flex; align-items: center; gap: 20px; }
.header-nav a { color: var(--muted); text-decoration: none; font-size: 14.5px; font-weight: 500; }
.header-nav a:hover { color: var(--text); }

/* ================= Hero ================= */
.hero { padding: 42px 0 10px; text-align: center; }
.hero h1 { font-size: clamp(26px, 4.2vw, 40px); margin: 0 0 10px; letter-spacing: -0.02em; }
.hero h1 em { color: var(--accent); font-style: normal; }
.hero p { max-width: 680px; margin: 0 auto; color: var(--muted); font-size: 16.5px; }

/* ================= Layout ================= */
.app-layout {
  display: grid;
  grid-template-columns: minmax(360px, 480px) 1fr;
  gap: 28px;
  align-items: start;
  padding-top: 30px;
  padding-bottom: 40px;
}
@media (max-width: 980px) {
  .app-layout { grid-template-columns: 1fr; }
}

/* ================= Panels ================= */
.editor, .results-col { display: flex; flex-direction: column; gap: 16px; }
#mergeSection, #splitSection { display: flex; flex-direction: column; gap: 16px; }
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
  box-shadow: var(--shadow);
}
.panel-title h2 { margin: 0 0 14px; font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field span b { color: var(--accent); }
input {
  font: inherit;
  font-size: 14.5px;
  color: var(--text);
  background: #fbfbfe;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}
.hint { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; }
.range-field { margin-top: 14px; }

/* ================= Dropzone ================= */
.dropzone {
  text-align: center;
  border: 2px dashed var(--border);
  cursor: pointer;
  padding: 30px 20px;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}
.dz-icon { font-size: 34px; margin-bottom: 6px; }
.dz-title { font-weight: 700; font-size: 16px; }
.dz-link { color: var(--accent); text-decoration: underline; }
.dz-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* ================= Segmented control ================= */
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-big .seg-btn { flex: 1; padding: 10px 13px; font-size: 14.5px; }
.seg-btn {
  font: inherit; font-size: 13.5px; font-weight: 600;
  padding: 7px 13px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: #fbfbfe; color: var(--muted);
  transition: all .12s;
}
.seg-btn:hover { border-color: var(--accent); color: var(--accent); }
.seg-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.seg-big { display: flex; }
.lock-inline { font-size: 12px; }

/* ================= Buttons ================= */
.btn {
  font: inherit; font-weight: 600; font-size: 14.5px;
  border-radius: 9px; padding: 10px 18px;
  cursor: pointer; border: 1px solid transparent;
  transition: background .15s, transform .05s;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, black); }
.btn-subtle { background: #fff; color: var(--text); border-color: var(--border); }
.btn-subtle:hover:not(:disabled) { background: #f5f6fb; }
.btn-ghost-accent { background: var(--accent-soft); color: var(--accent); border: none; }
.btn-ghost-accent:hover { background: color-mix(in srgb, var(--accent) 18%, white); }
.btn-wide { width: 100%; padding: 12px; font-size: 15.5px; }
.editor-actions { display: flex; gap: 12px; }
.editor-actions .btn-primary { flex: 1; padding: 13px; font-size: 15.5px; }

/* ================= File list ================= */
.file-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}
.file-num {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent);
  font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.file-info { min-width: 0; }
.file-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.file-controls { display: flex; gap: 4px; }
.icon-btn {
  font: inherit; width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: #fbfbfe; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px;
  transition: all .12s;
}
.icon-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ================= Results ================= */
.results-empty { text-align: center; color: var(--muted); padding: 46px 20px; }
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 10px;
}
.result-icon { font-size: 26px; }
.result-info { min-width: 0; }
.result-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ================= Batch banner ================= */
.batch-banner {
  background: linear-gradient(120deg, #fef2f2, #fff);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  font-size: 14px;
}
.batch-banner b { display: block; margin-bottom: 2px; }

/* ================= Content sections ================= */
.content-section { padding: 46px 0 30px; }
.content-alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.content-section h2 { font-size: 24px; letter-spacing: -0.01em; margin: 0 0 18px; }
.content-section h2:not(:first-child) { margin-top: 36px; }
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.feature {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px;
}
.content-alt .feature { background: var(--bg); }
.feature h3 { margin: 0 0 6px; font-size: 15.5px; }
.feature p { margin: 0; font-size: 14px; color: var(--muted); }

details {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 13px 16px; margin-bottom: 10px;
}
details summary { font-weight: 600; cursor: pointer; font-size: 15px; }
details p { color: var(--muted); font-size: 14px; margin: 10px 0 2px; }

/* ================= Footer ================= */
.site-footer { padding: 30px 0 40px; text-align: center; color: var(--muted); font-size: 13.5px; }
.site-footer a { color: var(--accent); }

/* ================= Ad slot ================= */
.ad-slot { min-height: 90px; }

/* ================= Premium modal ================= */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 18, 32, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: 16px; box-shadow: 0 24px 64px rgba(0,0,0,.25);
  max-width: 440px; width: 100%; padding: 26px 28px; position: relative;
}
.modal h2 { margin: 0 0 4px; }
.modal-sub { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.modal-close {
  position: absolute; top: 12px; right: 12px; border: none; background: none;
  font-size: 16px; cursor: pointer; color: var(--muted); width: 30px; height: 30px; border-radius: 8px;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.premium-perks { margin: 0 0 16px; padding-left: 20px; font-size: 14.5px; }
.premium-perks li { margin-bottom: 7px; }
.premium-price { font-size: 15px; color: var(--muted); margin-bottom: 12px; }
.premium-price b { font-size: 26px; color: var(--text); }
.license-row { display: flex; gap: 8px; margin-top: 14px; }
.license-status { font-size: 13px; margin: 8px 0 0; min-height: 18px; }
.license-status.ok { color: #15803d; }
.license-status.err { color: #b91c1c; }

/* ================= Toast ================= */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; font-size: 14px; font-weight: 600;
  padding: 11px 20px; border-radius: 999px; z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
