:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --ink: #142023;
  --ink-2: #4a5a5e;
  --ink-3: #7b8a8d;
  --line: #dde5e2;
  --brand: #0f766e;
  --brand-ink: #ffffff;
  --brand-soft: #d9f0ec;
  --problem: #d9363e;
  --problem-soft: #fde8e8;
  --warn: #b26a00;
  --warn-soft: #fdf1dc;
  --ok: #16a34a;
  --ok-soft: #e3f6ea;
  --skip: #8a96a3;
  --info-soft: #e8eef6;
  --shadow: 0 1px 2px rgb(20 32 35 / 0.05), 0 4px 16px rgb(20 32 35 / 0.06);
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1514;
    --surface: #172120;
    --surface-2: #1e2a29;
    --ink: #e6efed;
    --ink-2: #a9b8b5;
    --ink-3: #7d8d8a;
    --line: #2a3735;
    --brand: #2dd4bf;
    --brand-ink: #062b27;
    --brand-soft: #123a35;
    --problem: #f87171;
    --problem-soft: #3a1c1e;
    --warn: #fbbf24;
    --warn-soft: #362a12;
    --ok: #4ade80;
    --ok-soft: #14301f;
    --skip: #8a96a3;
    --info-soft: #1c2633;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
code { font-size: 0.9em; background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 5px; }
[hidden] { display: none !important; }

/* Header */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 1200px; margin: 0 auto; padding: 18px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.brand-mark svg { width: 32px; height: 32px; display: block; }
.brand-mark rect { fill: var(--brand); }
.brand-mark path { fill: var(--brand-ink); }
.site-nav { display: flex; align-items: center; gap: 20px; font-size: 0.92rem; }
.site-nav a { color: var(--ink-2); text-decoration: none; font-weight: 500; }
.site-nav a:hover { color: var(--ink); }
.privacy-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); font-weight: 600; font-size: 0.82rem;
}
.privacy-pill svg { width: 14px; height: 14px; fill: currentColor; }

/* Hero */
.hero { max-width: 760px; margin: 0 auto; padding: 40px 20px 56px; text-align: center; }
.eyebrow { color: var(--brand); font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.78rem; margin: 0 0 12px; }
h1 { font-size: clamp(2rem, 5.5vw, 3.4rem); line-height: 1.08; letter-spacing: -0.035em; margin: 0 0 18px; font-weight: 800; }
.squiggle {
  background: linear-gradient(transparent 62%, var(--problem-soft) 62%);
  text-decoration: underline wavy var(--problem); text-decoration-thickness: 2px; text-underline-offset: 8px;
}
.lede { color: var(--ink-2); font-size: 1.08rem; margin: 0 auto 32px; max-width: 620px; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 44px 20px; border: 2px dashed var(--line); border-radius: 20px;
  background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s, transform .15s;
  box-shadow: var(--shadow);
}
.dropzone:hover, .dropzone:focus-within, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone.drag { transform: scale(1.01); }
.drop-icon svg { width: 52px; height: 52px; fill: none; stroke: var(--brand); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.drop-title { font-weight: 700; font-size: 1.2rem; }
.drop-sub { color: var(--ink-3); font-size: 0.92rem; }
.hero-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 16px 0 0; color: var(--ink-3); font-size: 0.88rem; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.alert { margin-top: 20px; padding: 14px 16px; border-radius: 12px; background: var(--problem-soft); color: var(--ink); text-align: left; border-left: 4px solid var(--problem); }

/* Workspace */
.workspace {
  display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: 24px;
  max-width: 1200px; margin: 0 auto; padding: 8px 20px 56px; align-items: start;
}
.panel-col { display: flex; flex-direction: column; gap: 16px; }
.file-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.file-label { margin: 0; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); font-weight: 700; }
.file-name { margin: 0; font-weight: 700; word-break: break-all; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-success { border-color: var(--ok); }
.card-title { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font-size: 1.1rem; letter-spacing: -0.01em; }
.step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 0.85rem; font-weight: 800; }
.step-done { background: var(--ok); color: #fff; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.stat b { display: block; font-size: 1.5rem; line-height: 1.1; letter-spacing: -0.02em; }
.stat span { font-size: 0.78rem; color: var(--ink-3); font-weight: 600; }
.stat.bad b { color: var(--problem); }
.stat.good b { color: var(--ok); }

.issues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.issue { padding: 12px 14px; border-radius: 10px; border-left: 4px solid; font-size: 0.9rem; }
.issue strong { display: block; margin-bottom: 2px; }
.issue p { margin: 0; color: var(--ink-2); }
.issue-problem { background: var(--problem-soft); border-color: var(--problem); }
.issue-warning { background: var(--warn-soft); border-color: var(--warn); }
.issue-info { background: var(--info-soft); border-color: var(--skip); }
.issue-clean { background: var(--ok-soft); border-color: var(--ok); }

/* Plan */
.plan-group { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.plan-group.active { border-color: var(--brand); }
.plan-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.plan-head strong { font-size: 0.95rem; }
.badge { font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--problem-soft); color: var(--problem); white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.plan-value { font-size: 0.82rem; color: var(--ink-3); margin: 0 0 10px; }
.name-row { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 8px; margin-bottom: 6px; }
.name-row label { font-size: 0.8rem; color: var(--ink-2); font-weight: 600; }
.name-row input {
  width: 100%; font: inherit; font-size: 0.92rem; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.name-row input:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.name-row input.invalid { border-color: var(--problem); outline-color: var(--problem); }
.name-row.hover input { border-color: var(--brand); background: var(--brand-soft); }
.link-toggle { display: flex; gap: 8px; align-items: center; font-size: 0.82rem; color: var(--ink-2); margin-top: 8px; cursor: pointer; }

.healthy { margin: 4px 0 16px; font-size: 0.88rem; color: var(--ink-2); }
.healthy summary { cursor: pointer; font-weight: 600; }
.healthy ul { margin: 8px 0 0; padding-left: 18px; columns: 2; }

.options { border: 0; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 10px; }
.options legend { font-weight: 700; font-size: 0.85rem; margin-bottom: 8px; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.08em; }
.options label { display: grid; grid-template-columns: 20px 1fr; gap: 8px; font-size: 0.9rem; cursor: pointer; }
.options input { margin-top: 4px; accent-color: var(--brand); }
.options small { display: block; color: var(--ink-3); font-size: 0.8rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; border-radius: 10px; padding: 12px 18px; cursor: pointer;
  border: 1px solid transparent; text-decoration: none; transition: filter .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line); padding: 8px 14px; font-size: 0.88rem; }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-3); }
.btn-block { width: 100%; }
.hint { font-size: 0.82rem; color: var(--ink-3); margin: 10px 0 0; }

.result-summary { margin: 0 0 8px; font-weight: 600; }
.result-details { margin: 0 0 16px; padding-left: 18px; font-size: 0.88rem; color: var(--ink-2); }
.tip { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 0.88rem; color: var(--ink-2); }
.tip a { font-weight: 700; }

/* Pro */
.pro-tag {
  display: inline-block; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 1px 7px; border-radius: 999px; background: var(--brand); color: var(--brand-ink); vertical-align: 1px;
}
.site-nav .pro-link { color: var(--brand); font-weight: 700; }
.site-nav .pro-link.active::after { content: " ✓"; }

.paywall { max-width: 560px; margin: 0 auto; padding: 8px 20px 56px; }
.paywall-card { padding: 28px; }
.paywall h2 { font-size: 1.7rem; letter-spacing: -0.03em; margin: 0 0 8px; }
.paywall-lede { color: var(--ink-2); margin: 0 0 16px; }
.paywall .btn-block + .btn-block { margin-top: 8px; }
.perks { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-direction: column; gap: 8px; }
.perks li { position: relative; padding-left: 26px; font-size: 0.94rem; }
.perks li::before {
  content: ""; position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--ok-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%2316a34a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat;
}
.buy-btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }

.license-form { margin-top: 14px; font-size: 0.88rem; }
.license-form summary { cursor: pointer; color: var(--ink-2); font-weight: 600; }
.key-row { display: flex; gap: 8px; margin-top: 8px; }
.key-row input {
  flex: 1; min-width: 0; font: inherit; font-size: 0.85rem; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); font-family: ui-monospace, Consolas, monospace;
}
.key-row input:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.key-msg { margin: 6px 0 0; font-size: 0.82rem; }
.key-msg.bad { color: var(--problem); }
.key-msg.good { color: var(--ok); }

.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.plan { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.plan-pro { border: 2px solid var(--brand); box-shadow: var(--shadow); }
.plan h3 { margin: 0 0 4px; font-size: 1.15rem; }
.plan-price { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; margin: 0 0 16px; }
.plan-price small { font-size: 0.9rem; font-weight: 600; color: var(--ink-3); letter-spacing: 0; }
.pro-active { background: var(--ok-soft); border-radius: 10px; padding: 12px 14px; }
.pro-active .hint { margin: 4px 0 0; }

/* Batch */
.batch { max-width: 1200px; margin: 0 auto; padding: 8px 20px 56px; }
.batch .file-bar { margin-bottom: 16px; }
.batch-grid { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 24px; align-items: start; }
.batch-grid .btn-block + .btn-block, .progress + .btn-block { margin-top: 10px; }
.batch-list-card { padding: 0; overflow: auto; max-height: 75vh; }
.batch-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.batch-table th { position: sticky; top: 0; background: var(--surface); text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); padding: 12px 14px; border-bottom: 1px solid var(--line); }
.batch-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.batch-table tr:last-child td { border-bottom: 0; }
.batch-table .fname { font-weight: 600; word-break: break-all; }
.batch-table .muted { color: var(--ink-3); }
.st-done { color: var(--ok); font-weight: 600; }
.st-error, .st-skipped { color: var(--problem); }
.st-working { color: var(--brand); }
.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 12px; }
.progress-bar { height: 100%; width: 0; background: var(--brand); transition: width .2s; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 10;
  width: min(560px, calc(100% - 32px)); background: var(--ink); color: var(--bg);
  border-radius: 14px; padding: 14px 18px; box-shadow: 0 10px 30px rgb(0 0 0 / 0.25); font-size: 0.92rem;
}
.toast .key-row input { background: rgb(255 255 255 / 0.1); color: inherit; border-color: rgb(255 255 255 / 0.2); }
.toast .btn-ghost { color: inherit; border-color: rgb(255 255 255 / 0.3); }
.toast-close { float: right; background: none; border: 0; color: inherit; font-size: 1.2rem; cursor: pointer; line-height: 1; }

/* Preview */
.preview-col { position: sticky; top: 16px; }
.preview-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.seg button { font: inherit; font-weight: 600; font-size: 0.88rem; border: 0; background: transparent; color: var(--ink-2); padding: 6px 16px; border-radius: 8px; cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg button:disabled { opacity: 0.4; cursor: not-allowed; }
.legend { display: flex; gap: 14px; font-size: 0.8rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; border: 2px solid; display: inline-block; }
.sw-problem { border-color: var(--problem); background: var(--problem-soft); }
.sw-ok { border-color: var(--ok); background: var(--ok-soft); }
.sw-skip { border-color: var(--skip); }

.preview {
  max-height: calc(100vh - 80px); overflow: auto; display: flex; flex-direction: column; gap: 16px;
  background: var(--surface-2); border-radius: var(--radius); padding: 16px;
}
.page { position: relative; flex-shrink: 0; background: #fff; box-shadow: var(--shadow); border-radius: 4px; overflow: hidden; }
.page canvas { display: block; width: 100%; height: auto; }
.page-num { position: absolute; right: 8px; bottom: 6px; font-size: 0.72rem; color: #667; background: rgb(255 255 255 / 0.85); padding: 1px 6px; border-radius: 4px; }
.box { position: absolute; border: 2px solid; border-radius: 3px; transition: box-shadow .12s, background .12s; }
.box.problem { border-color: var(--problem); background: rgb(217 54 62 / 0.08); }
.box.ok { border-color: var(--ok); background: rgb(22 163 74 / 0.06); }
.box.skip { border-color: var(--skip); border-style: dashed; }
.box.hover { box-shadow: 0 0 0 4px rgb(15 118 110 / 0.35); background: rgb(15 118 110 / 0.15); }
.box-tag {
  position: absolute; left: -2px; bottom: 100%; margin-bottom: 2px; font-size: 10px; line-height: 1.4; font-weight: 700;
  padding: 0 5px; border-radius: 3px; white-space: nowrap; color: #fff; max-width: 220px; overflow: hidden; text-overflow: ellipsis;
}
.box.problem .box-tag { background: #d9363e; }
.box.ok .box-tag { background: #16a34a; }
.preview-loading { text-align: center; color: var(--ink-3); padding: 48px 0; }

/* Content sections */
.section { max-width: 900px; margin: 0 auto; padding: 48px 20px; }
.section h2 { font-size: 1.8rem; letter-spacing: -0.03em; margin: 0 0 24px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.steps h3 { margin: 10px 0 6px; font-size: 1.05rem; }
.steps p { margin: 0; color: var(--ink-2); font-size: 0.92rem; }
.step-num { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-weight: 800; }

.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq p { color: var(--ink-2); margin: 10px 0 0; }

.site-footer { text-align: center; padding: 32px 20px 48px; color: var(--ink-3); font-size: 0.88rem; border-top: 1px solid var(--line); }
.site-footer p { margin: 4px 0; }
.fine { font-size: 0.78rem; }

.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 960px) {
  .workspace, .batch-grid { grid-template-columns: 1fr; }
  .preview-col { position: static; order: -1; }
  .preview { max-height: 70vh; }
}
@media (max-width: 640px) {
  .site-header { padding: 14px 16px; }
  .site-nav a:not(.pro-link) { display: none; }
  .hero { padding: 24px 16px 40px; }
  .workspace, .section { padding-left: 16px; padding-right: 16px; }
  .steps, .plans { grid-template-columns: 1fr; }
  .batch, .paywall { padding-left: 16px; padding-right: 16px; }
  .batch-table th:nth-child(2), .batch-table td:nth-child(2) { display: none; }
  .healthy ul { columns: 1; }
  .legend { display: none; }
}
