:root {
  --bg: #f5f1e8;
  --ink: #1c1c1c;
  --accent: #16697a;
  --panel: #ffffff;
  --border: #d3cfc7;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Alegreya", "Noto Serif JP", serif;
  background: radial-gradient(circle at 10% 10%, #fff, var(--bg));
  color: var(--ink);
}

.app {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.app__header h1 { margin: 0 0 8px; }

.columns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.column {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 12px;
  min-height: 360px;
}

textarea {
  width: 100%;
  min-height: 300px;
  border: 1px solid var(--border);
}

.diff-view {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.seg {
  border: 1px solid var(--border);
  padding: 8px;
  background: #faf7f0;
}

.seg-equal {
  background: #f7f5f1;
}

.seg-insert {
  background: #e6f3e9;
  border-color: #b9d8c0;
}

.seg-delete {
  background: #f6e7e7;
  border-color: #e0b4b4;
}

.seg-move-from {
  background: #f2e4e4;
  border-left: 6px solid #b45f5f;
}

.seg-move-to {
  background: #e4eef2;
  border-left: 6px solid #4f7a8a;
}

.seg__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #5b5b5b;
  margin-bottom: 6px;
}

.seg__part {
  margin: 0 0 6px;
  white-space: pre-wrap;
  font-family: "Noto Serif JP", serif;
}

.seg__part--inline {
  white-space: pre-wrap;
}

.inline-del {
  background: #f1b2b2;
  color: #5a1f1f;
}

.inline-ins {
  background: #bfe7c5;
  color: #1f4c2a;
}

.seg__part:last-child {
  margin-bottom: 0;
}

.seg.is-active {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.seg-empty {
  border: 1px dashed var(--border);
  background: transparent;
  min-height: 24px;
}

.diff-section {
  margin-top: 20px;
}

.diff-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.diff-cell {
  min-width: 0;
}

.diff-cell--left .seg {
  border-left: 6px solid #d66d6d;
}

.diff-cell--right .seg {
  border-left: 6px solid #5aa56f;
}

.diff-cell--left .seg-equal,
.diff-cell--right .seg-equal {
  border-left-color: #bfb7a6;
}

.options {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.options--sticky {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 12px 8px;
  margin: 0 -8px 16px;
  background: rgba(245, 241, 232, 0.95);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}

button {
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
}

.diff-placeholder {
  color: #666;
  padding: 12px;
}

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

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