:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-subtle: #f9fafb;
  --border: #d9dee7;
  --border-strong: #bcc5d2;
  --text: #172033;
  --muted: #667085;
  --accent: #2f63d8;
  --accent-hover: #254fae;
  --accent-soft: #eef4ff;
  --added: #18794e;
  --added-bg: #edf9f2;
  --removed: #b42318;
  --removed-bg: #fff1f0;
  --changed: #9a6700;
  --changed-bg: #fff8df;
  --danger: #b42318;
  --danger-bg: #fff4f3;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

button,
textarea,
input {
  font: inherit;
}

button,
.file-button,
summary {
  -webkit-tap-highlight-color: transparent;
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.hero {
  margin-bottom: 22px;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow,
.panel-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.hero-subtitle {
  margin-bottom: 10px;
  max-width: 720px;
  color: #465267;
  font-size: 1.08rem;
}

.privacy-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.privacy-note span {
  margin-right: 6px;
  color: var(--added);
  font-size: 0.75rem;
}

.tool-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(23, 32, 51, 0.05);
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.editor-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-subtle);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading h2 {
  margin: 2px 0 0;
  font-size: 1rem;
}

.file-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  color: #344054;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.file-button:hover {
  border-color: #8e99a8;
  background: #f6f7f9;
}

.file-status {
  min-height: 20px;
  margin: 7px 0 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

textarea {
  display: block;
  width: 100%;
  min-height: 330px;
  resize: vertical;
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  outline: none;
  background: var(--surface);
  color: #1d2939;
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.55;
  tab-size: 2;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 99, 216, 0.12);
}

textarea[aria-invalid="true"] {
  border-color: var(--danger);
}

.input-error {
  min-height: 0;
  margin-top: 8px;
  color: var(--danger);
  font-size: 0.84rem;
}

.input-error:empty {
  display: none;
}

.input-error strong,
.input-error span {
  display: block;
}

.input-error span {
  margin-top: 2px;
  color: #912018;
  font-family: var(--mono);
  font-size: 0.78rem;
  white-space: pre-line;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.button {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

.button-primary {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

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

.button-secondary {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: #344054;
}

.button-secondary:hover,
.button-quiet:hover {
  background: #f5f6f8;
}

.button-quiet {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
}

.button:focus-visible,
.file-button:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(47, 99, 216, 0.22);
  outline-offset: 2px;
}

.form-error {
  min-height: 0;
  margin-top: 10px;
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 600;
}

.form-error:empty {
  display: none;
}

.results {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.results-header h2 {
  margin-bottom: 4px;
  font-size: 1.16rem;
}

.results-header p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.summary-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.summary-pill {
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.79rem;
  font-weight: 700;
}

.summary-pill.added {
  color: var(--added);
  background: var(--added-bg);
}

.summary-pill.removed {
  color: var(--removed);
  background: var(--removed-bg);
}

.summary-pill.changed {
  color: var(--changed);
  background: var(--changed-bg);
}

.no-differences {
  padding: 16px;
  border: 1px solid #b8dfc8;
  border-radius: 9px;
  background: var(--added-bg);
}

.no-differences strong {
  display: block;
  color: var(--added);
}

.no-differences p {
  margin: 4px 0 0;
  color: #406154;
  font-size: 0.88rem;
}

.diff-groups {
  display: grid;
  gap: 16px;
}

.diff-group {
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
}

.diff-group h3 {
  margin: 0;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  background: #f8f9fb;
  font-size: 0.9rem;
}

.diff-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.diff-item {
  padding: 12px;
  border-top: 1px solid #e8ebf0;
}

.diff-item:first-child {
  border-top: 0;
}

.diff-path {
  margin-bottom: 7px;
  color: #25324a;
  font-family: var(--mono);
  font-size: 0.86rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.diff-value,
.value-comparison pre {
  margin: 0;
  overflow-x: auto;
  color: #344054;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.value-comparison {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.value-box {
  min-width: 0;
  padding: 9px 10px;
  border-radius: 7px;
  background: #f7f8fa;
}

.value-arrow {
  color: var(--muted);
  font-weight: 800;
}

.info-section {
  max-width: 840px;
  padding-top: 44px;
}

.info-section h2 {
  margin-bottom: 12px;
  font-size: 1.35rem;
  letter-spacing: -0.015em;
}

.info-section p,
.how-list {
  color: #4b566b;
}

.how-list {
  margin: 0;
  padding-left: 1.35rem;
}

.how-list li + li {
  margin-top: 6px;
}

.faq-list {
  border-top: 1px solid var(--border);
}

.faq-list details {
  border-bottom: 1px solid var(--border);
}

.faq-list summary {
  padding: 14px 0;
  font-weight: 700;
  cursor: pointer;
}

.faq-list details p {
  margin-bottom: 14px;
  padding-right: 30px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 28px;
  }

  .hero {
    margin-bottom: 18px;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .tool-card {
    padding: 12px;
    border-radius: 11px;
  }

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

  .editor-panel {
    padding: 12px;
  }

  textarea {
    min-height: 270px;
  }

  .results-header {
    display: block;
  }

  .summary-pills {
    justify-content: flex-start;
    margin-top: 10px;
  }
}

@media (max-width: 420px) {
  .page-shell {
    width: calc(100% - 20px);
    padding-bottom: 52px;
  }

  h1 {
    font-size: 2rem;
  }

  .panel-heading {
    align-items: center;
  }

  .file-button {
    min-height: 34px;
    padding-inline: 9px;
  }

  textarea {
    min-height: 240px;
    font-size: 0.82rem;
  }

  .tool-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .button-primary {
    grid-column: 1 / -1;
  }

  .value-comparison {
    grid-template-columns: 1fr;
  }

  .value-arrow {
    transform: rotate(90deg);
    justify-self: start;
  }
}
