:root {
  color-scheme: dark;
  --bg0: #060a12;
  --bg1: #0b1020;
  --card: rgba(13, 21, 46, 0.84);
  --card-strong: rgba(17, 28, 61, 0.92);
  --stroke: rgba(255, 255, 255, 0.12);
  --stroke-strong: rgba(255, 255, 255, 0.20);
  --text: #ecf2ff;
  --muted: #aab5d4;
  --soft: rgba(255, 255, 255, 0.05);
  --soft-hover: rgba(255, 255, 255, 0.10);
  --field-bg: rgba(7, 12, 26, 0.66);
  --field-border: rgba(255, 255, 255, 0.18);
  --accent: #7c5cff;
  --accent2: #00d3ff;
  --accent3: #19c37d;
  --warning: #ffc857;
  --danger: #ff6b8a;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  --radius: 20px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --same: rgba(255, 255, 255, 0.03);
  --added: rgba(25, 195, 125, 0.15);
  --added-strong: rgba(25, 195, 125, 0.36);
  --deleted: rgba(255, 107, 138, 0.16);
  --deleted-strong: rgba(255, 107, 138, 0.35);
  --changed: rgba(255, 200, 87, 0.17);
  --changed-strong: rgba(255, 200, 87, 0.40);
  --line-bg: rgba(255, 255, 255, 0.05);
}

body.theme-light {
  color-scheme: light;
  --bg0: #f7f9ff;
  --bg1: #eef2ff;
  --card: rgba(255, 255, 255, 0.88);
  --card-strong: rgba(255, 255, 255, 0.96);
  --stroke: rgba(20, 33, 61, 0.12);
  --stroke-strong: rgba(20, 33, 61, 0.22);
  --text: #0b1324;
  --muted: #53617f;
  --soft: rgba(20, 33, 61, 0.05);
  --soft-hover: rgba(20, 33, 61, 0.10);
  --field-bg: rgba(255, 255, 255, 0.92);
  --field-border: rgba(20, 33, 61, 0.16);
  --shadow: 0 22px 70px rgba(15, 25, 45, 0.16);
  --same: rgba(20, 33, 61, 0.025);
  --added: rgba(25, 195, 125, 0.14);
  --added-strong: rgba(25, 195, 125, 0.30);
  --deleted: rgba(255, 107, 138, 0.14);
  --deleted-strong: rgba(255, 107, 138, 0.28);
  --changed: rgba(255, 200, 87, 0.20);
  --changed-strong: rgba(255, 200, 87, 0.42);
  --line-bg: rgba(20, 33, 61, 0.05);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1100px 700px at 12% 12%, rgba(124, 92, 255, 0.25), transparent 62%),
    radial-gradient(900px 560px at 86% 18%, rgba(0, 211, 255, 0.18), transparent 58%),
    radial-gradient(900px 680px at 55% 96%, rgba(25, 195, 125, 0.12), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  color: var(--text);
  font-family: var(--sans);
  letter-spacing: 0.2px;
  overflow-x: hidden;
  padding-bottom: 44px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.10;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
}

a { color: inherit; }
.container {
  width: min(1500px, calc(100% - 36px));
  margin: 0 auto;
}
.container.narrow { width: min(1100px, calc(100% - 36px)); }

.site-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  background: linear-gradient(90deg, rgba(13, 21, 46, 0.80), rgba(13, 21, 46, 0.56));
  border-bottom: 1px solid var(--stroke);
}
body.theme-light .site-topbar {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.62));
}
.topbar-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-width: 220px;
}
.logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 14px 38px rgba(124, 92, 255, 0.26);
  border: 1px solid rgba(255, 255, 255, 0.22);
  flex: 0 0 auto;
}
.brand-title {
  display: block;
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0.2px;
}
.brand-subtitle {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.nav-button,
.nav-action,
.tool-button,
button,
.file-button {
  border: 1px solid var(--stroke);
  background: var(--soft);
  color: var(--text);
  border-radius: 13px;
  padding: 10px 14px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.10s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.nav-button:hover,
.nav-action:hover,
.tool-button:hover,
button:hover,
.file-button:hover {
  transform: translateY(-1px);
  background: var(--soft-hover);
  border-color: var(--stroke-strong);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18);
}
.nav-button.active,
.tool-button.primary,
button.primary,
.btn-primary-modern {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.24);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 16px 40px rgba(124, 92, 255, 0.20);
}
button.danger,
.tool-button.danger {
  color: #fff;
  background: linear-gradient(135deg, #d9476a, #ff6b8a);
  border-color: rgba(255, 255, 255, 0.20);
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.file-button input { display: none; }

.hero {
  padding: 42px 0 22px;
}
.hero.kicker-only { padding-bottom: 8px; }
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--muted);
  border: 1px solid var(--stroke);
  background: var(--soft);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 16px;
}
.kicker::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.14);
}
.hero h1,
.hero h2 {
  margin: 0 0 12px;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1.02;
  font-weight: 950;
  letter-spacing: -0.8px;
}
.hero h2 { font-size: clamp(30px, 4vw, 44px); }
.hero .lead {
  max-width: 940px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}
.hero-copy,
.seo-copy {
  max-width: 980px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
  margin-top: 14px;
}

.app-card,
.panel,
.card,
.info-card,
.tool-card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header,
.result-header,
.tool-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--stroke);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.045), transparent);
}
body.theme-light .card-header,
body.theme-light .result-header,
body.theme-light .tool-header {
  background: linear-gradient(90deg, rgba(20, 33, 61, 0.035), transparent);
}
.card-header h2,
.result-header h2,
.tool-header h2,
.title {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.14);
}
.content,
.card-body {
  padding: 18px;
}
.actions,
.button-row,
.option-row,
.mini-actions,
.diff-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

input,
select,
textarea,
.field,
.editor-title,
.difference-select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--text);
  outline: none;
  box-shadow: none;
  font-family: var(--sans);
}
input:focus,
select:focus,
textarea:focus,
.field:focus,
.editor-title:focus,
.difference-select:focus {
  border-color: rgba(0, 211, 255, 0.60);
  box-shadow: 0 0 0 4px rgba(0, 211, 255, 0.13);
}
textarea,
.field.editor {
  font-family: var(--mono);
  resize: vertical;
  line-height: 1.55;
  font-size: 13px;
}
textarea::placeholder,
input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0;
}
.tool-card {
  padding: 22px;
  min-height: 290px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.tool-card h2 {
  margin: 0 0 10px;
  font-size: 25px;
}
.tool-card p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.7;
}
.tool-list {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
}
.tool-list li {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  line-height: 1.55;
}
.tool-list li::before {
  content: "✓";
  color: var(--accent3);
  font-weight: 900;
  flex: 0 0 auto;
}
.section-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0;
}
.info-section {
  margin-top: 22px;
  padding: 22px;
}
.info-section h2,
.info-section h3 {
  margin: 0 0 10px;
  font-weight: 900;
}
.info-section p,
.info-section li,
.info-card p {
  color: var(--muted);
  line-height: 1.75;
}
.info-section ul,
.info-section ol { margin: 10px 0 0 20px; padding: 0; }
.info-card { padding: 18px; }
.info-card h3 { margin: 0 0 8px; }

/* Compare page */
.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-bottom: 1px solid var(--stroke);
}
.editor-card {
  padding: 16px;
  min-width: 0;
}
.editor-card:first-child { border-right: 1px solid var(--stroke); }
.editor-top {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.editor-title {
  flex: 1;
  min-width: 180px;
  padding: 10px 12px;
  font-weight: 800;
}
.editor-card textarea {
  min-height: 300px;
  padding: 14px;
  tab-size: 4;
}
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.025);
  border-bottom: 1px solid var(--stroke);
}
label.option {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: auto;
  color: var(--muted);
  font-size: 13px;
  background: var(--soft);
  border: 1px solid var(--stroke);
  padding: 9px 11px;
  border-radius: 999px;
  cursor: pointer;
}
label.option input { width: auto; }
.summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--stroke);
}
.stat {
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 13px;
  background: var(--soft);
}
.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}
.stat strong {
  font-size: 24px;
  color: var(--text);
}
.result-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.diff-shell {
  height: 540px;
  overflow: auto;
  background: rgba(255, 255, 255, 0.02);
}
table.diff-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
}
.diff-table col.line-no { width: 58px; }
.diff-table col.code-col { width: calc((100% - 116px) / 2); }
.diff-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--card-strong);
  color: var(--muted);
  border-bottom: 1px solid var(--stroke);
  text-align: left;
  padding: 9px 10px;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.2px;
}
.line-number {
  background: var(--line-bg);
  color: var(--muted);
  text-align: right;
  padding: 5px 8px;
  border-right: 1px solid var(--stroke);
  border-bottom: 1px solid var(--stroke);
  user-select: none;
  vertical-align: top;
}
.code-cell {
  padding: 5px 10px;
  border-bottom: 1px solid var(--stroke);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  vertical-align: top;
  min-height: 26px;
}
tr.same .code-cell { background: var(--same); }
tr.added .right-code,
tr.added .right-line { background: var(--added); }
tr.deleted .left-code,
tr.deleted .left-line { background: var(--deleted); }
tr.modified .left-code,
tr.modified .right-code,
tr.modified .left-line,
tr.modified .right-line { background: var(--changed); }
.inline-add,
.inline-del,
.inline-changed { border-radius: 4px; padding: 0 1px; }
.inline-add { background: var(--added-strong); }
.inline-del { background: var(--deleted-strong); }
.inline-changed { background: var(--changed-strong); }
.change-marker { font-weight: 900; }
.difference-select { min-width: 260px; max-width: 520px; padding: 10px 12px; font-weight: 800; }
tr.active-diff td { box-shadow: inset 0 0 0 2px var(--accent2); }
.empty-state {
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 34px;
  color: var(--muted);
}
.status-bar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 11px 16px;
  background: rgba(255, 255, 255, 0.025);
  border-top: 1px solid var(--stroke);
  color: var(--muted);
  font-size: 12px;
}
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #111827;
  color: #ffffff;
  padding: 12px 14px;
  border-radius: 14px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.25);
  z-index: 100;
  font-size: 13px;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* Remove comments page */
.control-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}
.control {
  grid-column: span 4;
  background: var(--soft);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 12px;
}
.control .label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.control .label strong {
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
}
.toggle {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: var(--soft-hover);
  border: 1px solid var(--stroke);
  cursor: pointer;
  transition: background 0.2s ease;
  flex: 0 0 auto;
}
.toggle::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  transition: transform 0.2s ease, background 0.2s ease;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}
.toggle.on {
  background: linear-gradient(135deg, rgba(25, 195, 125, 0.92), rgba(0, 211, 255, 0.78));
  border-color: rgba(0, 211, 255, 0.55);
}
.toggle.on::before { transform: translateX(18px); }
.field {
  padding: 10px 12px;
  font-family: var(--mono);
}
.field[disabled] { opacity: 0.55; cursor: not-allowed; }
.bc-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 6px 0 0;
}
.preset-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}
.preset-pill:hover {
  background: var(--soft-hover);
  border-color: var(--stroke-strong);
  color: var(--text);
  transform: translateY(-1px);
}
.kbd {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
}
.editor-wrap { margin-top: 16px; }
textarea.editor { min-height: 390px; }
.hint {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.hint b { color: var(--text); }
.hint .badge {
  background: var(--soft);
  border: 1px solid var(--stroke);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 900;
  letter-spacing: 0.25px;
}
.status-cleaned {
  margin-left: 2px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.3px;
  color: #0e2a1d;
  background: linear-gradient(135deg, #19c37d, #6ee7b7);
  box-shadow: 0 8px 24px rgba(25, 195, 125, 0.35);
  opacity: 0;
  transform: translateY(4px) scale(0.95);
  transition: opacity 0.25s ease, transform 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.status-cleaned.show { opacity: 1; transform: translateY(0) scale(1); }
.footer {
  margin-top: 20px;
  color: color-mix(in srgb, var(--muted) 75%, transparent);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 1020px) {
  .topbar-inner { align-items: flex-start; flex-direction: column; padding: 14px 0; }
  .site-nav { justify-content: flex-start; }
  .brand-link { min-width: 0; }
  .tool-grid,
  .section-grid,
  .input-grid { grid-template-columns: 1fr; }
  .editor-card:first-child { border-right: 0; border-bottom: 1px solid var(--stroke); }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .control { grid-column: span 6; }
  .diff-shell { height: 560px; }
  .diff-table { min-width: 900px; }
}
@media (max-width: 640px) {
  .container { width: min(100% - 26px, 1500px); }
  .site-nav { width: 100%; }
  .nav-button,
  .nav-action { flex: 1 1 auto; }
  .control { grid-column: span 12; }
  .summary { grid-template-columns: 1fr; }
  .editor-top,
  .toolbar,
  .card-header,
  .result-header { align-items: stretch; flex-direction: column; }
  .diff-nav,
  .difference-select,
  .diff-nav button { width: 100%; }
  .hero { padding-top: 28px; }
}
