* {
  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, 440px) minmax(280px, 1fr);
  gap: 28px;
  align-items: start;
  min-height: 100vh;
  padding: 28px 36px 44px;
}

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

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

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

.drop {
  display: grid;
  gap: 8px;
  padding: 14px;
  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;
}

.hint, .fine, .empty, .honest {
  margin: 0;
  max-width: 42em;
  line-height: 1.4;
}

.hint, .fine, .empty {
  font-size: 13px;
  color: #5e574e;
}

.honest {
  font-size: 14px;
  color: #3f3a34;
}

.fine {
  margin-top: 2px;
}

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

.panel {
  display: grid;
  gap: 12px;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

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

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

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

.choice {
  width: 100%;
  padding: 10px 8px;
  font-size: 14px;
  line-height: 1.3;
  text-align: center;
}

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

button.file {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 8px;
  text-align: left;
  background: transparent;
  border-color: transparent;
  color: inherit;
}

button.file[aria-pressed="true"] {
  background: transparent;
  color: inherit;
  border-color: #1c1916;
}

button.linkish {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 14px;
  text-decoration: underline;
}

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

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

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

button.file[aria-pressed="true"]:hover {
  background: #f3ece1;
  color: inherit;
}

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

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

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

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

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

.files {
  list-style: none;
  display: grid;
  gap: 6px;
  max-height: 320px;
  margin: 0;
  padding: 0;
  overflow: auto;
}

.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.thumb, .thumb-slot {
  display: block;
  width: 64px;
  height: 82px;
  object-fit: contain;
  background: #fff;
  border: 1px solid #e4dcd0;
}

.file-name, .file-meta {
  display: block;
  overflow-wrap: anywhere;
}

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

.file-meta {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.35;
  color: #6a6258;
}

.file-meta.error {
  color: #8a2e24;
}

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

.sheet {
  width: min(100%, 760px);
  min-height: 280px;
  padding: 18px 18px 22px;
  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;
}

.words-label {
  margin-top: 16px;
}

.banner {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid #c9c0b2;
  border-radius: 6px;
  background: #f3ece1;
  font-size: 14px;
  line-height: 1.45;
}

#page-view {
  display: block;
  width: min(100%, 260px);
  height: auto;
  margin-top: 12px;
  background: #fff;
  border: 1px solid #e4dcd0;
}

#preview-meta {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: #5e574e;
}

.words {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

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

.words p {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
}

.words .list {
  padding-left: 1.1em;
}

.words .note {
  color: #5e574e;
  font-style: italic;
}

.words img {
  display: block;
  width: auto;
  max-width: min(100%, 420px);
  height: auto;
  background: #fff;
  border: 1px solid #e4dcd0;
}

#view .actions {
  margin-top: 14px;
}

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

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

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

  h1 {
    font-size: 34px;
  }

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