* {
  box-sizing: border-box;
}

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(300px, 420px) minmax(320px, 1fr);
  gap: 36px;
  align-items: start;
  min-height: 100vh;
  padding: 32px 40px 48px;
}

.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;
}

h2 {
  margin: 18px 0 8px;
  font-family: "Noto Serif", "Liberation Serif", Georgia, serif;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.2;
}

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

.counts {
  display: grid;
  gap: 0;
  margin: 0 0 14px;
}

.counts div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin: 0;
  padding: 7px 0;
  border-bottom: 1px solid #ddd4c6;
}

.counts dt {
  font-size: 14px;
  line-height: 1.3;
  color: #3f3a34;
}

.counts dd {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #3f3a34;
}

input {
  width: 100%;
  border: 1px solid #c9c0b2;
  border-radius: 6px;
  background: #fffcf7;
  color: #1c1916;
  font: inherit;
  font-size: 16px;
  padding: 10px 12px;
}

.find {
  display: flex;
  gap: 8px;
  align-items: end;
  margin-top: 18px;
}

.find label {
  flex: 1;
  min-width: 0;
}

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

.fine {
  margin-top: 18px;
}

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

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

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;
}

button:hover:not(:disabled):not([aria-pressed="true"]) {
  background: #f3ece1;
}

button[aria-pressed="true"] {
  background: #1c1916;
  color: #fffcf7;
}

button[aria-pressed="true"]:hover:not(:disabled) {
  background: #34302b;
  color: #fffcf7;
}

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

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

.keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.keywords button {
  font-size: 14px;
  padding: 6px 10px;
}

.keywords .meta {
  margin-left: 6px;
  color: #5e574e;
  font-variant-numeric: tabular-nums;
}

.keywords button[aria-pressed="true"] .meta {
  color: #d9d0c4;
}

.stage {
  display: flex;
  justify-content: center;
}

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

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

.editor {
  position: relative;
  border: 1px solid #c9c0b2;
  border-radius: 6px;
  background: #fffcf7;
}

.editor:focus-within {
  border-color: #1c1916;
}

.mirror,
.editor textarea {
  margin: 0;
  border: 0;
  padding: 16px;
  width: 100%;
  min-height: 62vh;
  font-family: Inter, "Noto Sans", "Liberation Sans", sans-serif;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: normal;
  tab-size: 4;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.mirror {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  color: transparent;
}

.mirror mark {
  color: transparent;
  background: #e4c56a;
  border-radius: 2px;
}

.editor textarea {
  position: relative;
  display: block;
  resize: vertical;
  overflow: hidden;
  background: transparent;
  color: #1c1916;
  caret-color: #1c1916;
}

.editor textarea::placeholder {
  color: #8a8175;
}

.live {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

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

@media (max-width: 860px) {
  main {
    grid-template-columns: 1fr;
    padding: 24px 18px 40px;
  }

  .sheet {
    min-height: 0;
  }

  .mirror,
  .editor textarea {
    min-height: 320px;
  }
}
