:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-soft: #eef4ff;
  --text: #111827;
  --muted: #5f6b7a;
  --border: #d9e2ef;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #0f766e;
  --added: #dcfce7;
  --added-text: #14532d;
  --removed: #fee2e2;
  --removed-text: #7f1d1d;
  --modified: #fef3c7;
  --modified-text: #78350f;
  --code-bg: #0f172a;
  --shadow: 0 18px 45px rgba(15, 23, 42, .08);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1020;
  --surface: #121a2c;
  --surface-soft: #17243b;
  --text: #f8fafc;
  --muted: #a8b3c7;
  --border: #263650;
  --primary: #60a5fa;
  --primary-dark: #3b82f6;
  --accent: #5eead4;
  --added: #123d27;
  --added-text: #bbf7d0;
  --removed: #491919;
  --removed-text: #fecaca;
  --modified: #463514;
  --modified-text: #fde68a;
  --code-bg: #080c17;
  --shadow: 0 18px 45px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

button, input, textarea { font: inherit; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem clamp(1rem, 4vw, 4rem);
  background: rgba(255, 255, 255, .86);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

[data-theme="dark"] .site-header { background: rgba(11, 16, 32, .86); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: .5rem;
  background: var(--primary);
  color: white;
  font-size: .85rem;
}

.nav {
  display: none;
  align-items: center;
  gap: 1.25rem;
  color: var(--muted);
  font-weight: 600;
}

.nav a:hover { color: var(--primary); }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid var(--border);
  border-radius: .5rem;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.hero,
.content-section,
.ad-slot,
.footer {
  width: min(1180px, calc(100% - 2rem));
  margin-inline: auto;
}

.tool-section {
  width: min(1480px, calc(100% - 1rem));
  margin-inline: auto;
}

.hero {
  display: grid;
  gap: 2rem;
  align-items: center;
  min-height: calc(100vh - 11rem);
  padding: clamp(2rem, 6vw, 5rem) 0 2rem;
}

.eyebrow {
  margin: 0 0 .65rem;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1, h2, h3 { line-height: 1.1; letter-spacing: 0; }
h1 { margin: 0; font-size: clamp(2.5rem, 8vw, 5.4rem); max-width: 11ch; }
h2 { margin: 0; font-size: clamp(1.9rem, 4vw, 3.1rem); }
h3 { margin: 0 0 .6rem; font-size: 1.1rem; }
p { color: var(--muted); }

.hero-subtitle {
  max-width: 45rem;
  font-size: clamp(1.05rem, 2vw, 1.28rem);
}

.hero-actions,
.tool-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
}

.result-actions {
  position: sticky;
  top: 4.25rem;
  z-index: 10;
  padding: .7rem 0;
  background: var(--surface);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.85rem;
  padding: .8rem 1.1rem;
  border: 1px solid transparent;
  border-radius: .5rem;
  font-weight: 800;
  text-align: center;
  white-space: normal;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.button:hover { transform: translateY(-1px); }
.button:focus-visible, .drop-zone:focus-within, textarea:focus { outline: 3px solid rgba(37, 99, 235, .35); outline-offset: 2px; }
.button-primary { background: var(--primary); color: white; box-shadow: 0 12px 24px rgba(37, 99, 235, .22); }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.button-ghost { background: transparent; color: var(--muted); border-color: var(--border); }

.hero-visual {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: .75rem;
  background: var(--code-bg);
  box-shadow: var(--shadow);
}

.preview-toolbar {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .75rem;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  color: #dbeafe;
}

.preview-toolbar span {
  width: .7rem;
  height: .7rem;
  border-radius: 50%;
  background: #ef4444;
}

.preview-toolbar span:nth-child(2) { background: #f59e0b; }
.preview-toolbar span:nth-child(3) { background: #22c55e; }
.preview-toolbar strong { margin-left: .4rem; font-size: .85rem; }

.preview-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: rgba(255, 255, 255, .1);
}

.preview-grid pre {
  margin: 0;
  min-height: 11rem;
  padding: 1rem;
  overflow: auto;
  background: var(--code-bg);
  color: #dbeafe;
  font-size: .85rem;
}

.ad-slot {
  display: grid;
  place-items: center;
  min-height: 5.5rem;
  margin-block: 1rem;
  border: 1px dashed var(--border);
  border-radius: .75rem;
  background: var(--surface);
  color: var(--muted);
  font-size: .85rem;
  font-weight: 700;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 1.5rem;
}

.tool-section,
.content-section {
  padding: clamp(2.5rem, 6vw, 5rem) 0;
}

.tool-shell {
  display: grid;
  gap: 1.25rem;
}

.tool-section .section-heading {
  margin-inline: auto;
  text-align: center;
}

.tool-main,
.privacy-card,
.feature-card,
.steps article,
.faq-list details,
.tool-link {
  border: 1px solid var(--border);
  border-radius: .75rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tool-main {
  min-width: 0;
  padding: clamp(1rem, 3vw, 1.5rem);
}

.upload-grid,
.editor-grid,
.card-grid,
.steps {
  display: grid;
  gap: 1rem;
}

.drop-zone {
  display: grid;
  gap: .4rem;
  min-height: 12rem;
  padding: 1.2rem;
  border: 1.5px dashed var(--border);
  border-radius: .75rem;
  background: var(--surface-soft);
  cursor: pointer;
  transition: border-color .18s ease, transform .18s ease, background .18s ease;
}

.drop-zone:hover,
.drop-zone.is-dragover {
  transform: translateY(-1px);
  border-color: var(--primary);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.drop-zone em {
  color: var(--muted);
  font-size: .88rem;
  overflow-wrap: anywhere;
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: .5rem;
  background: var(--primary);
  color: white;
  font-weight: 800;
}

.editor-grid { margin-top: 1rem; }

.editor-grid label {
  display: grid;
  gap: .45rem;
  color: var(--muted);
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 13rem;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: .65rem;
  padding: .9rem;
  background: var(--surface);
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: .9rem;
}

.tool-actions,
.result-actions,
.summary {
  margin-top: 1rem;
}

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
}

.summary span {
  padding: .45rem .65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .86rem;
}

.change-nav {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  min-height: 2.85rem;
  padding: .35rem .5rem;
  border: 1px solid var(--border);
  border-radius: .5rem;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .9rem;
  font-weight: 800;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: .45rem;
  background: var(--surface);
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--primary);
  color: var(--primary);
}

.diff-viewer {
  max-width: 100%;
  margin-top: 1rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: .75rem;
  background: var(--surface);
}

.diff-header,
.diff-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-width: 100%;
}

.diff-header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 800;
}

.diff-header span,
.diff-cell {
  min-width: 0;
  padding: .55rem .75rem;
  border-right: 1px solid var(--border);
}

.diff-cell:last-child,
.diff-header span:last-child { border-right: 0; }

.diff-row { border-top: 1px solid var(--border); }

.diff-row:hover .diff-cell {
  box-shadow: inset 0 0 0 999px rgba(37, 99, 235, .04);
}

.diff-cell {
  display: grid;
  grid-template-columns: 2.8rem minmax(0, 1fr);
  gap: .5rem;
  align-items: start;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: .78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.line-no {
  color: var(--muted);
  text-align: right;
  user-select: none;
}

.is-added { background: var(--added); color: var(--added-text); }
.is-removed { background: var(--removed); color: var(--removed-text); }
.is-modified { background: var(--modified); color: var(--modified-text); }
.is-empty { color: var(--muted); }

.is-active-change {
  box-shadow: inset 0 0 0 2px var(--primary), inset 0 0 0 999px rgba(37, 99, 235, .08);
}

.inline-added,
.inline-removed {
  display: inline;
  padding: .05rem .12rem;
  border-radius: .2rem;
  color: inherit;
  font-weight: 800;
}

.inline-added {
  background: rgba(22, 163, 74, .26);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

.inline-removed {
  background: rgba(220, 38, 38, .24);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.empty-state {
  margin: 0;
  padding: 1.25rem;
  grid-column: 1 / -1;
  color: var(--muted);
}

.sidebar {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.ad-slot-sidebar {
  width: 100%;
  min-height: 17rem;
  margin: 0;
}

.privacy-card,
.feature-card,
.steps article {
  padding: 1.25rem;
}

.card-grid { grid-template-columns: 1fr; }

.split-section {
  display: grid;
  gap: 1.25rem;
  align-items: center;
}

.format-list {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.format-list a {
  padding: .8rem 1rem;
  border: 1px solid var(--border);
  border-radius: .5rem;
  background: var(--surface);
  color: var(--primary);
  font-weight: 800;
}

.steps article span {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: .8rem;
  border-radius: .5rem;
  background: var(--surface-soft);
  color: var(--primary);
  font-weight: 800;
}

.faq-list {
  display: grid;
  gap: .75rem;
}

.faq-list details { padding: 1rem 1.15rem; }
.faq-list summary { cursor: pointer; font-weight: 800; }

.tool-link {
  display: flex;
  align-items: center;
  min-height: 4.5rem;
  padding: 1rem;
  color: var(--primary);
  font-weight: 800;
}

.footer {
  display: grid;
  gap: 1rem;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--border);
}

.footer p { margin: .25rem 0 0; }
.footer nav { display: flex; flex-wrap: wrap; gap: .8rem 1rem; color: var(--muted); font-weight: 700; }

.seo-page .hero {
  min-height: auto;
  grid-template-columns: 1fr;
}

.prose {
  max-width: 850px;
}

.prose ul {
  padding-left: 1.2rem;
  color: var(--muted);
}

@media (min-width: 720px) {
  .nav { display: flex; }
  .preview-grid,
  .upload-grid,
  .editor-grid,
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer { grid-template-columns: 1fr auto; align-items: start; }
}

@media (min-width: 980px) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(420px, .78fr); }
  .tool-shell { grid-template-columns: 1fr; }
  .sidebar { grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr); }
  .ad-slot-sidebar { min-height: 7rem; }
  .card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .split-section { grid-template-columns: minmax(0, 1fr) minmax(360px, .55fr); }
}

@media (max-width: 520px) {
  .site-header { align-items: flex-start; }
  .brand span:last-child { display: none; }
  .button { width: 100%; }
  .result-actions { top: 3.6rem; }
  .change-nav { width: 100%; justify-content: space-between; }
  .diff-header,
  .diff-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .diff-cell {
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: .35rem;
    padding: .45rem .4rem;
    font-size: .72rem;
  }
  .diff-header span { padding: .5rem .4rem; }
}
