:root {
  --ink: #1c120c;
  --muted: #6b5346;
  --paper: #f4ecdf;
  --card: #fffaf3;
  --line: #d7c4b0;
  --brand: #9a3201;
  --brand-ink: #fff8f2;
  --ok: #2f6b3a;
  --bad: #9a1f12;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(1200px 600px at 10% -10%, #fbe7d4 0%, var(--paper) 42%);
  color: var(--ink);
  font-family: Sora, sans-serif;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.top {
  display: flex;
  gap: 1rem;
  align-items: center;
  max-width: 920px;
  margin: 0 auto;
  padding: 2.4rem 1.5rem 0.5rem;
}

.mark {
  width: 3.2rem;
  height: 3.2rem;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 0.4rem 1.1rem 0.4rem 0.4rem;
}

.kicker {
  margin: 0;
  color: var(--brand);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0.15rem 0 0;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

main {
  max-width: 920px;
  margin: 0 auto;
  padding: 1.2rem 1.5rem 4rem;
}

.desk,
.result {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: 0 18px 40px rgba(80, 40, 10, 0.06);
}

.mode {
  border: 0;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.mode legend {
  padding: 0;
  margin-bottom: 0.55rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.choice {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  cursor: pointer;
  background: #fff;
}

.choice:has(input:checked) {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.choice strong {
  display: block;
}

.choice em {
  display: block;
  margin-top: 0.15rem;
  font-style: normal;
  color: var(--muted);
  font-size: 0.82rem;
}

.field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.field input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 0.6rem;
  padding: 0.7rem 0.8rem;
  font: inherit;
  color: var(--ink);
}

.drop {
  display: grid;
  place-items: center;
  gap: 0.2rem;
  min-height: 7.2rem;
  margin-bottom: 1rem;
  border: 1.5px dashed var(--brand);
  border-radius: 0.9rem;
  background: #fff6ee;
  cursor: pointer;
  text-align: center;
  padding: 1rem;
}

.drop.loaded {
  border-style: solid;
  background: #fff;
}

.drop span {
  color: var(--muted);
  font-size: 0.85rem;
}

.turnstile {
  margin-bottom: 1rem;
}

button {
  font: inherit;
  border: 0;
  border-radius: 0.7rem;
  background: var(--brand);
  color: var(--brand-ink);
  padding: 0.8rem 1rem;
  cursor: pointer;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.status {
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.run-log {
  margin: 0.9rem 0 0;
  padding: 0.7rem 0.9rem 0.7rem 1.4rem;
  max-height: 12rem;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  color: var(--muted);
}

.run-log li {
  margin: 0.2rem 0;
}

.status.error {
  color: var(--bad);
}

.result {
  margin-top: 1rem;
}

.result-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.result-bar p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.preview {
  font-family: "Source Serif 4", Georgia, serif;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  padding: 1rem 1.15rem;
  max-height: 36rem;
  overflow: auto;
}

.preview p,
.preview li {
  line-height: 1.45;
}

.preview ul,
.preview ol {
  padding-left: 1.2rem;
}

.copied {
  background: var(--ok);
}

@media (max-width: 700px) {
  .mode,
  .result-bar {
    grid-template-columns: 1fr;
    display: grid;
  }
}
