:root,
[data-theme="light"] {
  color-scheme: light;
  --paper: #efe6d4;
  --card: #fffaf3;
  --surface: #fffdf9;
  --ink: #241c16;
  --ink-soft: #6a5e52;
  --line: #e3d5c3;
  --line-strong: #cbbba4;
  --green: #245443;
  --green-deep: #1a3d30;
  --on-green: #f6f1e8;
  --del-bg: #f3d5cd;
  --del-ink: #7a2e24;
  --ins-bg: #d5eddc;
  --ins-ink: #1d5c38;
  --chip: #f4ebdd;
  --mark: #b08968;
  --edge-del: #e4b7ae;
  --edge-ins: #b7dcc4;
  --wash: #e7dcc8;
  --shadow: 0 1px 0 rgba(36, 28, 22, 0.04), 0 18px 40px rgba(90, 62, 30, 0.07);
}

[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1a1714;
  --card: #26211c;
  --surface: #2e2823;
  --ink: #f3ece3;
  --ink-soft: #b7aa9c;
  --line: #3d352d;
  --line-strong: #564c42;
  --green: #3e6b56;
  --green-deep: #2f5342;
  --on-green: #f4efe6;
  --del-bg: #4a302c;
  --del-ink: #f0c7bf;
  --ins-bg: #24382e;
  --ins-ink: #c9e6d4;
  --chip: #322c26;
  --mark: #8d7352;
  --edge-del: #6d403a;
  --edge-ins: #3d6350;
  --wash: #141210;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.25), 0 18px 40px rgba(0, 0, 0, 0.32);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(1100px 520px at 50% -12%, var(--wash), transparent 62%),
    var(--paper);
  color: var(--ink);
  font-family: Outfit, "Segoe UI", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.5;
}

body::before {
  content: "";
  display: block;
  height: 8px;
  background: var(--green);
}

.wrap {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.stage {
  width: min(1720px, calc(100% - 2rem));
  margin: 0 auto;
}

.site {
  position: relative;
  padding: 0.4rem 0 0.25rem;
}

.mast {
  display: flex;
  justify-content: flex-end;
  width: min(1720px, calc(100% - 2rem));
  margin: 0 auto;
  padding-top: 0.85rem;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  padding: 0.35rem 0.85rem 0.35rem 0.55rem;
  cursor: pointer;
}

.theme-toggle::before {
  content: "";
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 50%;
  background: var(--mark);
}

.theme-toggle:hover {
  border-color: var(--line-strong);
}

.header-copy {
  text-align: center;
  padding-top: 0.35rem;
}

.brand {
  margin: 0;
  font-family: Newsreader, Georgia, serif;
  font-size: 1.65rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1;
}

.brand span {
  color: var(--green);
}

h1 {
  max-width: 16ch;
  margin: 0.85rem auto 0.7rem;
  font-family: Newsreader, Georgia, serif;
  font-weight: 500;
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.lede {
  max-width: 38rem;
  margin: 0 auto;
  color: var(--ink-soft);
  font-size: 1.08rem;
}

.rule {
  width: 4.5rem;
  height: 2px;
  margin: 1.15rem auto 1.5rem;
  border: 0;
  background: var(--mark);
}

.tool {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.segment {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.segment button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.92rem;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
}

.segment button[aria-checked="true"] {
  background: var(--green);
  color: var(--on-green);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.95rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-left: auto;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-size: 0.92rem;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
}

.btn-primary {
  border-color: var(--green);
  background: var(--green);
  color: var(--on-green);
}

.btn:hover,
.segment button:hover {
  border-color: var(--line-strong);
}

.btn-primary:hover {
  border-color: var(--green-deep);
  background: var(--green-deep);
}

.segment button:hover {
  border-color: transparent;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.edit {
  width: 11.5rem;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-size: 0.92rem;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
}

textarea {
  width: 100%;
  min-height: 260px;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  line-height: 1.55;
  resize: vertical;
}

textarea:focus {
  border-color: var(--green);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 0.75rem 0 0;
}

.stats p {
  margin: 0;
  padding: 0.65rem 0.75rem 0.55rem;
  background: var(--chip);
  border-radius: 10px;
}

.stats strong {
  display: block;
  font-size: 1.35rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stats span {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.changes {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.changes-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.changes h2,
.notes h2 {
  margin: 0;
  font-family: Newsreader, Georgia, serif;
  font-size: 1.7rem;
  font-weight: 550;
  letter-spacing: -0.03em;
}

.legend {
  display: flex;
  gap: 0.75rem;
  margin: 0;
  font-size: 0.85rem;
}

.key {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}

.key-del {
  background: var(--del-bg);
  color: var(--del-ink);
}

.key-ins {
  background: var(--ins-bg);
  color: var(--ins-ink);
}

.summary {
  min-height: 1.5em;
  margin: 0.7rem 0;
  font-variant-numeric: tabular-nums;
}

.summary .up {
  color: var(--ins-ink);
}

.summary .down {
  color: var(--del-ink);
}

.summary .dot {
  color: var(--ink-soft);
}

.split-empty {
  margin: 0;
  min-height: 7rem;
  padding: 1rem 1.05rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-soft);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.split-text {
  min-height: 10rem;
  max-height: 26rem;
  overflow: auto;
  padding: 1rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#split-original {
  border-left: 4px solid var(--edge-del);
}

#split-revised {
  border-left: 4px solid var(--edge-ins);
}

del {
  background: var(--del-bg);
  color: var(--del-ink);
  text-decoration: none;
  border-radius: 2px;
}

ins {
  background: var(--ins-bg);
  color: var(--ins-ink);
  text-decoration: none;
  border-radius: 2px;
}

.notes {
  max-width: 42rem;
  margin: 1.75rem auto 1rem;
  padding: 1.25rem 1.4rem 1.15rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.notes h2 {
  text-align: center;
}

.notes ol {
  margin: 0.75rem 0;
  padding-left: 1.2rem;
}

.notes li + li {
  margin-top: 0.35rem;
}

.notes p,
.site-foot p {
  color: var(--ink-soft);
}

.site-foot {
  padding: 0.35rem 0 2rem;
  text-align: center;
}

.foot-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.1rem;
  margin: 0 0 0.7rem;
}

.foot-nav a,
.page a {
  color: var(--green);
}

.foot-nav a {
  color: var(--ink-soft);
}

.site-foot p {
  margin: 0.2rem 0 0;
  font-size: 0.92rem;
}

a.brand {
  color: inherit;
  text-decoration: none;
}

.page {
  width: min(42rem, calc(100% - 2rem));
  margin: 0 auto 2rem;
  padding: 1.35rem 1.45rem 1.2rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.page h1 {
  max-width: none;
  margin: 0 0 0.8rem;
  font-size: clamp(2rem, 4vw, 2.7rem);
  text-align: center;
}

.page h2 {
  margin: 1.35rem 0 0.35rem;
  font-family: Newsreader, Georgia, serif;
  font-size: 1.35rem;
  font-weight: 550;
  letter-spacing: -0.03em;
}

.page p,
.page li {
  color: var(--ink-soft);
}

.page ul {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 800px) {
  .panes,
  .split {
    grid-template-columns: 1fr;
  }

  .actions {
    margin-left: 0;
  }

  textarea {
    min-height: 200px;
  }
}

input[type="checkbox"] {
  accent-color: var(--green);
}

::selection {
  background: var(--ins-bg);
  color: var(--ink);
}
