:root {
  --bg: #f1ebdf;
  --panel: rgba(252, 248, 241, 0.88);
  --panel-strong: #fffaf2;
  --border: rgba(53, 45, 36, 0.12);
  --text: #2f261f;
  --muted: #6d6055;
  --accent: #b6542a;
  --accent-dark: #7a3214;
  --shadow: 0 24px 60px rgba(72, 49, 24, 0.12);
  --added: #d9f5e4;
  --removed: #f8d8d3;
  --changed: #fde9c7;
  --unchanged: #f3eee5;
  --code-bg: rgba(75, 59, 43, 0.06);
  --grid-line: rgba(47, 38, 31, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(182, 84, 42, 0.16), transparent 26%),
    radial-gradient(circle at right 20%, rgba(98, 138, 110, 0.16), transparent 24%),
    linear-gradient(180deg, #f7f1e5 0%, #efe4d1 100%);
  color: var(--text);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

button,
input,
textarea {
  font: inherit;
}

.page-shell {
  width: calc(100% - 32px);
  max-width: 1680px;
  margin: 0 auto;
  padding: 18px 0 28px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(320px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.hero-copy,
.hero-card,
.controls-panel,
.results-panel {
  background: var(--panel);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 28px 32px;
}

.eyebrow {
  margin: 0 0 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 700;
}

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

h1 {
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 0.95;
  max-width: 11ch;
}

.hero-text {
  margin-top: 14px;
  max-width: 64ch;
  color: var(--muted);
  line-height: 1.55;
  font-size: 1rem;
}

.hero-card {
  padding: 22px 26px;
  display: grid;
  gap: 10px;
  align-content: center;
  background:
    linear-gradient(180deg, rgba(255, 247, 236, 0.95), rgba(250, 241, 230, 0.88)),
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 23px,
      rgba(47, 38, 31, 0.04) 23px,
      rgba(47, 38, 31, 0.04) 24px
    );
}

.stat-block {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.stat-block:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.stat-label {
  color: var(--muted);
}

.workspace {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.controls-panel,
.results-panel {
  padding: 24px;
}

.panel-heading,
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.panel-heading p,
.results-header p {
  margin-top: 8px;
  color: var(--muted);
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.input-card {
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 18px;
}

.input-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.file-picker {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(182, 84, 42, 0.28);
  padding: 10px 16px;
  background: rgba(182, 84, 42, 0.08);
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
}

.file-picker input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-meta {
  margin-top: 12px;
  min-height: 22px;
  color: var(--muted);
  font-size: 0.95rem;
}

textarea {
  width: 100%;
  min-height: 220px;
  margin-top: 12px;
  padding: 16px;
  resize: vertical;
  border-radius: 18px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.95), rgba(251, 247, 239, 0.95)),
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 27px,
      var(--grid-line) 27px,
      var(--grid-line) 28px
    );
  color: var(--text);
  font-family: "SFMono-Regular", "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
  font-size: 0.96rem;
  line-height: 1.7;
}

textarea:focus,
button:focus,
input:focus {
  outline: 2px solid rgba(182, 84, 42, 0.45);
  outline-offset: 2px;
}

.action-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.share-row {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 250, 242, 0.72);
}

.share-link-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.share-link-input {
  display: block;
  width: 100%;
  min-width: 0;
  margin-top: 0;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 251, 245, 0.96);
  color: var(--text);
  font-family: "SFMono-Regular", "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.4;
  resize: vertical;
  min-height: 84px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.share-status {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.share-copy-btn {
  min-width: 112px;
  align-self: stretch;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  border-radius: 999px;
  padding: 12px 18px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), #cc6d3f);
  color: #fff8f2;
  box-shadow: 0 14px 24px rgba(182, 84, 42, 0.22);
}

.secondary-btn {
  background: rgba(80, 114, 91, 0.12);
  color: #2d5740;
  border-color: rgba(80, 114, 91, 0.2);
}

.ghost-btn {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.legend-item,
.summary-pill {
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.92rem;
  border: 1px solid rgba(47, 38, 31, 0.08);
}

.legend-item.added,
.diff-row.added {
  background: var(--added);
}

.legend-item.removed,
.diff-row.removed {
  background: var(--removed);
}

.legend-item.changed,
.diff-row.changed {
  background: var(--changed);
}

.legend-item.unchanged,
.diff-row.unchanged {
  background: var(--unchanged);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.summary-pill {
  background: rgba(255, 250, 242, 0.92);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.diff-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.diff-column {
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  background: var(--panel-strong);
}

.diff-column-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 250, 242, 0.8);
}

.diff-list {
  max-height: 70vh;
  overflow: auto;
  background: linear-gradient(180deg, rgba(255, 253, 249, 0.96), rgba(249, 243, 233, 0.96));
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

.diff-row {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(47, 38, 31, 0.06);
  animation: rise 240ms ease;
}

.line-number {
  color: var(--muted);
  font-family: "SFMono-Regular", "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.6;
}

.line-content {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.6;
}

.line-content mark {
  background: rgba(182, 84, 42, 0.25);
  color: inherit;
  padding: 0.02em 0;
  border-radius: 4px;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .hero,
  .input-grid,
  .diff-layout,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .page-shell {
    width: calc(100% - 20px);
    padding-top: 14px;
  }

  .panel-heading,
  .results-header,
  .input-card-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: calc(100% - 12px);
    padding-top: 10px;
  }

  .hero-copy,
  .hero-card,
  .controls-panel,
  .results-panel {
    border-radius: 18px;
  }

  .hero-copy,
  .hero-card,
  .controls-panel,
  .results-panel {
    padding-left: 18px;
    padding-right: 18px;
  }

  h1 {
    max-width: 100%;
  }

  .diff-row {
    grid-template-columns: 48px 1fr;
    padding: 10px 12px;
  }

  .share-link-shell {
    grid-template-columns: 1fr;
  }

  .share-copy-btn {
    width: 100%;
  }
}
