:root {
  color-scheme: dark light;
  --bg: #0b1220;
  --card: #101a2e;
  --line: #2a3654;
  --text: #dce7ff;
  --muted: #8ea0c9;
  --primary: #62a0ff;
  --added: #0f5132;
  --removed: #842029;
  --changed: #664d03;
  --surface: #0d1730;
  --page-top: #15233d;
  --page-bottom: #0b1220;
  --focus: rgba(98, 160, 255, 0.45);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f6ff;
  --card: #ffffff;
  --line: #d1dcef;
  --text: #13213e;
  --muted: #52658f;
  --primary: #2f6fe4;
  --added: #d8f5e6;
  --removed: #f9d9de;
  --changed: #fff2c9;
  --surface: #f8fbff;
  --page-top: #ffffff;
  --page-bottom: #eaf1ff;
  --focus: rgba(47, 111, 228, 0.35);
}

html {
  width: 100%;
  -webkit-text-size-adjust: 100%;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
  background: radial-gradient(circle at top, var(--page-top) 0%, var(--page-bottom) 52%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

a {
  color: #b9d3ff;
}

.site-shell {
  width: min(1080px, 100% - 2rem);
  margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) 0 1.5rem;
  display: grid;
  gap: 1rem;
}

.site-header,
.site-footer,
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.site-header {
  display: grid;
  gap: 0.75rem;
}

.badge {
  display: inline-flex;
  text-decoration: none;
  background: rgba(98, 160, 255, 0.2);
  border: 1px solid rgba(98, 160, 255, 0.5);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
  color: #c7ddff;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  width: 100%;
}

.theme-toggle {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.7rem;
  font-size: 0.9rem;
  cursor: pointer;
  line-height: 1;
  margin-left: auto;
}

.theme-toggle:hover {
  border-color: var(--primary);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.nav-link {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-decoration: none;
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  font-size: 0.86rem;
}

.nav-link.active {
  border-color: var(--primary);
  background: rgba(98, 160, 255, 0.2);
}

.hero h1 {
  margin: 0.25rem 0;
  font-size: 1.7rem;
}

.subtitle {
  color: var(--muted);
  margin-top: 0.5rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.tool-card {
  display: block;
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem;
  background: var(--surface);
}

.tool-card h2 {
  margin: 0 0 0.2rem;
  font-size: 1.04rem;
}

.tool-card p {
  margin: 0;
  color: var(--muted);
}

.inputs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
}


input,
textarea,
select,
button {
  font-size: 16px;
}

textarea {
  min-height: 170px;
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0.7rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.actions {
  margin-top: 0.8rem;
}

.primary {
  border: none;
  border-radius: 10px;
  padding: 0.6rem 1rem;
  background: linear-gradient(90deg, #4b8fff, #78b1ff);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.summary {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.results {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.5rem;
}

.diff-item {
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  padding: 0.6rem;
  font-size: 0.88rem;
}

.diff-item pre {
  margin: 0.25rem 0 0;
  white-space: pre-wrap;
}

.added {
  border-left-color: #2ecc71;
  background: color-mix(in srgb, var(--added) 55%, transparent);
}

.removed {
  border-left-color: #ff6b6b;
  background: color-mix(in srgb, var(--removed) 48%, transparent);
}

.changed {
  border-left-color: #ffd166;
  background: color-mix(in srgb, var(--changed) 45%, transparent);
}

.side-by-side {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
}

.panel pre {
  margin: 0;
  padding: 0.6rem;
}

.related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-left: 0;
  list-style: none;
}

.related-links a {
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  background: var(--surface);
}

.ad-slot {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  min-height: 0;
}

.ad-slot .adsbygoogle {
  margin: 0 auto;
}

.adsbygoogle:empty,
.ad-slot:has(.adsbygoogle:empty) {
  display: none !important;
}

.ad-note {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.83rem;
}

.footer-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (min-width: 760px) {
  .inputs {
    grid-template-columns: 1fr 1fr;
  }

  .hero h1 {
    font-size: 2.15rem;
  }

  .side-by-side {
    grid-template-columns: 1fr 1fr;
  }

  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 980px) {
  .tool-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
