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

.mark {
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.14em;
  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;
}

.drop, fieldset {
  display: grid;
  gap: 8px;
}

fieldset {
  border: 0;
  margin: 14px 0 0;
  padding: 0;
}

legend {
  padding: 0;
  font-size: 13px;
  color: #3f3a34;
}

.drop {
  gap: 10px;
  padding: 16px;
  border: 1px dashed #c9c0b2;
  border-radius: 6px;
  background: #fffcf7;
}

.drop.over {
  border-style: solid;
  border-color: #1c1916;
}

.drop-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
}

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

input[type="number"] {
  width: 100%;
}

input[type="range"] {
  width: 100%;
  height: 28px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: #c9c0b2;
  border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -7px;
  border: 1px solid #1c1916;
  border-radius: 50%;
  background: #fffcf7;
}

input[type="number"] {
  border: 1px solid #c9c0b2;
  border-radius: 6px;
  background: #fffcf7;
  color: #1c1916;
  font: inherit;
  font-size: 16px;
  padding: 10px 12px;
}

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

.fine {
  margin-top: 2px;
}

.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: 16px;
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.choice {
  min-width: 72px;
}

.file-button {
  position: relative;
  display: inline-flex;
  width: auto;
  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.linkish {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 14px;
  text-decoration: underline;
}

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

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

button.linkish:hover:not(:disabled) {
  background: transparent;
  color: #34302b;
}

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

body.busy .choice,
body.busy .file-button,
body.busy input {
  pointer-events: none;
}

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

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

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

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

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

.rows {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid #e4dcd0;
}

.row.plain {
  grid-template-columns: minmax(0, 1fr);
}

.thumb {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: contain;
  background: #f6f1e8;
  border: 1px solid #e4dcd0;
}

.name, .sentence {
  margin: 0;
  overflow-wrap: anywhere;
}

.name {
  font-size: 15px;
  line-height: 1.3;
}

.sentence {
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.4;
  color: #1c1916;
}

.meta {
  margin-top: 2px;
}

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

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

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

  .sheet {
    max-height: calc(100vh - 48px);
    overflow: auto;
  }
}

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

  .row {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .row button {
    grid-column: 2;
    justify-self: start;
  }
}
