* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background: #e6e0d4;
  color: #1c1916;
  font-family: Inter, "Noto Sans", "Liberation Sans", sans-serif;
  font-synthesis: none;
}

main {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  min-height: 100vh;
  padding: 28px 32px 40px;
}

.mark {
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5e574e;
}

h1 {
  margin: 0;
  font-family: "Noto Serif", "Liberation Serif", Georgia, serif;
  font-size: 42px;
  font-weight: 400;
  line-height: 1.1;
}

.lede {
  margin: 12px 0 22px;
  max-width: 38em;
  font-size: 16px;
  line-height: 1.45;
  color: #3f3a34;
}

.files {
  display: grid;
  gap: 14px;
}

.file-pick {
  display: grid;
  gap: 6px;
}

.hint, .fine, .empty {
  margin: 0;
  max-width: 46em;
  font-size: 13px;
  line-height: 1.4;
  color: #5e574e;
}

.fine {
  margin-top: 8px;
}

.empty {
  margin-top: 18px;
  font-size: 15px;
  line-height: 1.45;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-top: 14px;
}

button, .file-button {
  justify-self: start;
  border: 1px solid #1c1916;
  border-radius: 6px;
  background: transparent;
  color: #1c1916;
  font: inherit;
  font-size: 15px;
  padding: 10px 16px;
  cursor: pointer;
}

.file-button {
  position: relative;
  display: inline-flex;
  width: fit-content;
  padding: 8px 12px;
  font-size: 14px;
}

.file-button input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  padding: 0;
  border: 0;
  cursor: pointer;
}

.file-button input:focus {
  outline: none;
}

.file-button:focus-within {
  outline: 2px solid #1c1916;
  outline-offset: 2px;
}

button:hover:not(:disabled):not(.linkish),
.file-button:hover {
  background: #f3ece1;
}

button:disabled {
  cursor: default;
  opacity: 0.5;
}

:focus-visible {
  outline: 2px solid #1c1916;
  outline-offset: 2px;
}

.hint.error, #status.error {
  color: #8a2e24;
}

#status {
  min-height: 1.2em;
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.4;
}

.panel, .stage {
  min-width: 0;
  max-width: 100%;
}

.sheet {
  width: 100%;
  min-height: 280px;
  padding: 22px 22px 26px;
  background: #fffcf7;
  box-shadow: 0 12px 32px rgba(48, 38, 22, 0.12);
}

.sheet-label, .view-label {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6a6258;
}

.sheet-label {
  margin-bottom: 16px;
}

.summary dl {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 14px;
}

.summary dl div {
  flex: 1 1 140px;
  padding: 10px 12px;
  background: #f4f0e6;
  border-radius: 6px;
}

.summary dt {
  margin: 0;
  font-size: 12px;
  color: #5e574e;
}

.summary dd {
  margin: 4px 0 0;
  font-family: "Noto Serif", "Liberation Serif", Georgia, serif;
  font-size: 28px;
  line-height: 1.1;
}

#only-a, #only-b {
  font-size: 22px;
}

.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin: 0 0 8px;
}

.tools button {
  padding: 8px 12px;
  font-size: 14px;
}

.tools span {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

#change-label {
  min-height: 1.4em;
  margin: 0 0 12px;
}

.views {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.views.no-pixels {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.view-label {
  margin-bottom: 6px;
}

.scroller {
  height: min(70vh, 760px);
  overflow: auto;
  scrollbar-gutter: stable;
  border: 1px solid #e4dcd0;
  background: #fff;
}

.stack {
  position: relative;
  width: fit-content;
  min-width: 100%;
  min-height: 100%;
}

.stack canvas {
  display: block;
}

.marks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hl {
  position: absolute;
  border-radius: 2px;
}

.hl.removed {
  background: rgba(196, 92, 74, 0.45);
  border: 1px solid #8a2e24;
}

.hl.added {
  background: rgba(74, 140, 90, 0.45);
  border: 1px solid #2c6b40;
}

.hl.visual {
  background: transparent;
  border: 2px solid #1c1916;
  box-shadow: 0 0 0 1px #fffcf7;
}

.hl.is-current {
  outline: 2px solid #1c1916;
  outline-offset: 1px;
  z-index: 1;
}

.missing {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 16px;
  text-align: center;
  background: #fffcf7;
  color: #5e574e;
  font-size: 14px;
  line-height: 1.4;
}

.check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.35;
  color: #3f3a34;
}

.check input {
  width: auto;
  margin: 2px 0 0;
}

#advanced {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 12px;
  background: #fffcf7;
  border: 1px solid #c9c0b2;
  border-radius: 6px;
}

#advanced .check {
  margin-top: 8px;
}

#advanced fieldset {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 10px;
  border: 1px solid #e4dcd0;
  min-inline-size: 0;
}

#advanced legend {
  padding: 0 4px;
  font-size: 13px;
}

.choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
  border: 1px solid #1c1916;
  border-radius: 6px;
  overflow: hidden;
}

.choice {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  border: 0;
  border-right: 1px solid #1c1916;
  border-radius: 0;
  background: transparent;
  color: #1c1916;
  font-size: 14px;
  padding: 8px 6px;
  cursor: pointer;
  user-select: none;
}

.choice:last-child {
  border-right: 0;
}

.choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.choice input:focus {
  outline: none;
}

.choice:focus-within {
  outline: 2px solid #1c1916;
  outline-offset: -2px;
  z-index: 1;
}

.choice:has(input:checked):focus-within {
  outline-color: #fffcf7;
}

.choice:hover:not(:has(input:checked)) {
  background: #f3ece1;
}

.choice:has(input:checked) {
  background: #1c1916;
  color: #fffcf7;
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  font-size: 14px;
}

.range-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: #1c1916;
  background: transparent;
  border: 0;
  padding: 0;
}

#advanced #swap {
  margin-top: 12px;
  justify-self: start;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 14px 0 0;
  font-size: 13px;
  color: #5e574e;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 14px;
  height: 14px;
  border: 1px solid #c9c0b2;
  border-radius: 3px;
}

.swatch.removed { background: rgba(196, 92, 74, 0.55); }
.swatch.added { background: rgba(74, 140, 90, 0.55); }
.swatch.pixels { background: #b02a20; }

.file-pick.over .file-button {
  background: #f3ece1;
}

[hidden] {
  display: none !important;
}

noscript {
  display: block;
  padding: 16px 20px;
  background: #fff4e8;
}

@media (min-width: 1100px) {
  .stage {
    position: sticky;
    top: 16px;
  }
}

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

  .views.no-pixels {
    grid-template-columns: 1fr;
  }

  .scroller {
    height: min(64vh, 640px);
  }
}

@media (max-width: 860px) {
  main {
    grid-template-columns: 1fr;
    padding: 22px 16px 36px;
  }

  h1 {
    font-size: 34px;
  }
}
