:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --text: #111827;
  --muted: #5b6575;
  --line: #d8dee8;
  --accent: #1f6feb;
  --accent-strong: #174ea6;
  --success: #15803d;
  --warning: #8a5b00;
  --shadow: 0 12px 34px rgba(17, 24, 39, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12161d;
  --surface: #1a2029;
  --surface-2: #232b36;
  --text: #eef2f7;
  --muted: #a8b2c0;
  --line: #354052;
  --accent: #6aa4ff;
  --accent-strong: #9bc1ff;
  --success: #58c77b;
  --warning: #ffc857;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
}

body {
  margin: 0;
  min-width: 320px;
}

a {
  color: inherit;
}

.topbar {
  align-items: center;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 20px;
  grid-template-columns: auto 1fr auto;
  min-height: 64px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(12px);
}

.brand {
  align-items: center;
  display: inline-flex;
  font-weight: 780;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  background: var(--text);
  color: var(--surface);
  display: inline-flex;
  font-size: 13px;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.nav-links {
  display: flex;
  gap: 18px;
  justify-content: center;
}

.nav-links a {
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

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

.icon-button,
.primary-button,
.secondary-button {
  align-items: center;
  border: 1px solid var(--line);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  gap: 8px;
  justify-content: center;
  min-height: 40px;
}

.icon-button {
  background: var(--surface-2);
  height: 40px;
  padding: 0;
  position: relative;
  width: 40px;
}

.sun,
.moon,
.copy-icon {
  display: block;
  position: relative;
}

.sun {
  background: var(--warning);
  border-radius: 50%;
  height: 14px;
  width: 14px;
}

.moon {
  border: 2px solid var(--muted);
  border-left-color: transparent;
  border-radius: 50%;
  height: 14px;
  position: absolute;
  transform: translate(5px, -3px);
  width: 14px;
}

:root[data-theme="light"] .moon,
:root[data-theme="dark"] .sun {
  display: none;
}

main {
  margin: 0 auto;
  max-width: 1480px;
  padding: 28px;
}

.tool-hero {
  align-items: end;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 430px);
  margin-bottom: 22px;
}

.eyebrow {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 42px;
  line-height: 1.05;
  margin-bottom: 12px;
}

.hero-copy p:last-child {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
  margin-bottom: 0;
  max-width: 760px;
}

.privacy-strip {
  background: #e7f7ee;
  border: 1px solid #b9e6cb;
  color: #14532d;
  display: grid;
  gap: 4px;
  padding: 14px 16px;
}

:root[data-theme="dark"] .privacy-strip {
  background: #173122;
  border-color: #28593a;
  color: #baf2cb;
}

.workspace {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr) 300px;
  min-height: 620px;
}

.pane,
.side-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.pane {
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto;
  min-width: 0;
}

.pane-head {
  align-items: start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 16px;
}

.pane-head h2,
.summary h2 {
  font-size: 16px;
  margin-bottom: 4px;
}

.pane-head p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 0;
}

.pane-head span {
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 800;
  margin-top: 2px;
}

textarea {
  background: transparent;
  border: 0;
  color: var(--text);
  font: 15px/1.55 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  min-height: 360px;
  outline: 0;
  padding: 16px;
  resize: none;
  width: 100%;
}

textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 66%, transparent);
}

#cleanText {
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}

.actions {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
}

.primary-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  padding: 0 16px;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.primary-button[data-state="copied"] {
  background: var(--success);
  border-color: var(--success);
}

.copy-icon {
  border: 2px solid currentColor;
  height: 15px;
  width: 13px;
}

.copy-icon::after {
  border: 2px solid currentColor;
  content: "";
  height: 15px;
  left: 3px;
  position: absolute;
  top: -5px;
  width: 13px;
}

.secondary-button {
  background: var(--surface-2);
  color: var(--text);
  padding: 0 14px;
}

.side-panel {
  align-content: start;
  display: grid;
  gap: 14px;
  padding: 14px;
}

.summary,
.options,
.ad-reserve {
  border: 1px solid var(--line);
  padding: 14px;
}

.summary ul {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.summary li {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 13px;
  justify-content: space-between;
}

.summary strong {
  color: var(--success);
}

.options summary {
  cursor: pointer;
  font-weight: 800;
  margin-bottom: 12px;
}

.options label {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 14px;
  gap: 9px;
  margin: 10px 0;
}

input[type="checkbox"] {
  accent-color: var(--accent);
  height: 16px;
  width: 16px;
}

.ad-reserve {
  align-items: center;
  background: repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 8px, transparent 8px, transparent 16px);
  color: var(--muted);
  display: grid;
  min-height: 250px;
  place-content: center;
  text-align: center;
}

.ad-reserve strong,
.ad-reserve span {
  background: var(--surface);
  padding: 2px 8px;
}

.seo-copy {
  display: grid;
  gap: 26px;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1fr);
  padding: 70px 0 34px;
}

.seo-copy h2 {
  font-size: 28px;
  margin-bottom: 12px;
}

.seo-copy p {
  color: var(--muted);
  line-height: 1.7;
}

.seo-grid {
  display: grid;
  gap: 18px;
}

.seo-grid section {
  border-left: 3px solid var(--accent);
  padding-left: 18px;
}

.seo-grid h3 {
  font-size: 17px;
  margin-bottom: 8px;
}

.link-band {
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 24px 0;
}

.link-band a {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  padding: 10px 12px;
  text-decoration: none;
}

footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  gap: 12px;
  justify-content: center;
  padding: 28px;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 1fr 1fr;
  }

  .side-panel {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr 220px;
  }

  .ad-reserve {
    min-height: 160px;
  }
}

@media (max-width: 780px) {
  .topbar {
    grid-template-columns: 1fr auto;
    padding: 0 16px;
  }

  .nav-links {
    display: none;
  }

  main {
    padding: 18px 12px;
  }

  .tool-hero,
  .workspace,
  .seo-copy,
  .side-panel {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 31px;
  }

  .workspace {
    min-height: 0;
  }

  .pane {
    grid-template-rows: auto minmax(260px, 38vh) auto;
  }

  textarea {
    min-height: 260px;
  }

  .side-panel {
    display: grid;
  }

  .ad-reserve {
    min-height: 64px;
  }

  footer {
    flex-direction: column;
    text-align: center;
  }
}
