:root {
  --bg-base: #f3efe5;
  --bg-surface: rgba(255, 252, 245, 0.84);
  --bg-surface-strong: rgba(255, 250, 240, 0.94);
  --bg-accent-1: rgba(217, 119, 6, 0.16);
  --bg-accent-2: rgba(180, 83, 9, 0.12);
  --text: #1d1c1a;
  --muted: #5e584f;
  --line: rgba(55, 46, 32, 0.12);
  --accent: #d97706;
  --accent-strong: #b45309;
  --neutral: #57534e;
  --font-sans: "Manrope", sans-serif;
}

:root[data-theme="dark"] {
  --bg-base: #15161b;
  --bg-surface: rgba(26, 31, 41, 0.84);
  --bg-surface-strong: rgba(20, 24, 33, 0.94);
  --bg-accent-1: rgba(245, 158, 11, 0.18);
  --bg-accent-2: rgba(249, 115, 22, 0.14);
  --text: #f5f2ea;
  --muted: #c4bcad;
  --line: rgba(255, 255, 255, 0.12);
  --success: #4ade80;
  --danger: #f87171;
  --neutral: #d6d3d1;
}

.hero,
.controls,
.diff-card {
  padding: 1.2rem;
}

.workspace {
  margin-top: 1.25rem;
}

.controls-top {
  align-items: end;
  margin-bottom: 1rem;
}

.button-row {
  justify-content: flex-end;
}

.editors {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.9rem;
}

.editor-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.editor-shell {
  height: 420px;
  min-height: 260px;
}

.view-switch {
  display: inline-flex;
  padding: 0.3rem;
  border-radius: 999px;
  background: var(--bg-surface-strong);
  border: 1px solid var(--line);
}

.view-switch .button {
  padding: 0.55rem 0.85rem;
  border: 0;
  background: transparent;
}

.view-switch .button.is-active {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent-strong);
}

.diff-card {
  margin-top: 1.25rem;
}

.card-header {
  margin-bottom: 0.8rem;
}

.diff-output {
  margin: 0;
  height: 520px;
  min-height: 440px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--bg-surface-strong) 86%, white 14%);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  line-height: 1.6;
}

.diff-line {
  display: grid;
  grid-template-columns: 64px 64px 84px minmax(0, 1fr);
  gap: 0.9rem;
  padding: 0.18rem 0;
  align-items: start;
}

.diff-kind {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

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

.diff-line code {
  display: inline-block;
  min-width: max-content;
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
}

.diff-fragment {
  border-radius: 0.32rem;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.diff-fragment.added {
  background: rgba(34, 197, 94, 0.2);
  color: inherit;
}

.diff-fragment.removed {
  background: rgba(239, 68, 68, 0.2);
  color: inherit;
}

.diff-fragment.unchanged {
  color: inherit;
}

.diff-line.added {
  background: rgba(34, 197, 94, 0.09);
}

.diff-line.removed {
  background: rgba(239, 68, 68, 0.09);
}

.diff-split-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  min-height: 100%;
}

.diff-pane {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--bg-surface-strong) 78%, white 22%);
  overflow: hidden;
}

.diff-pane-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.85rem 1rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: color-mix(in srgb, var(--bg-surface) 88%, white 12%);
  border-bottom: 1px solid var(--line);
}

.diff-pane-scroll {
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.diff-pane-line {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  padding: 0.38rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  line-height: 1.6;
}

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

.diff-pane-line code {
  display: inline-block;
  min-width: max-content;
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
}

.diff-pane-line.added {
  background: rgba(34, 197, 94, 0.09);
}

.diff-pane-line.removed {
  background: rgba(239, 68, 68, 0.09);
}

.diff-pane-line.unchanged {
  background: rgba(255, 255, 255, 0.24);
}

.diff-pane-line.empty {
  background: rgba(255, 255, 255, 0.14);
}

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

.empty-state {
  margin: 0;
  color: var(--muted);
}

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

  .button-row {
    justify-content: flex-start;
  }

  .diff-toolbar {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .hero,
  .controls,
  .diff-card {
    padding: 1rem;
  }

  .editor-shell {
    height: 260px;
  }

  .diff-output {
    height: 320px;
    min-height: 320px;
  }

  .diff-line {
    grid-template-columns: 52px 52px 76px minmax(0, 1fr);
    gap: 0.55rem;
  }

  .diff-split-view {
    grid-template-columns: 1fr;
  }
}
