main {
  max-width: 48rem;
  margin: 0 auto;
  padding: 3.5rem 1rem 2.5rem;
  display: grid;
  gap: 1rem;
}

label {
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--ink-soft);
}

.wordmark {
  font-size: 1.375rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

/* OXR's wordmark: the X in SoMark's orange. */
.x {
  color: #de7802;
}

.metrics {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.75rem, 1fr));
  gap: 0.625rem;
}

.metrics > div {
  background: var(--surface);
  border-radius: 0.875rem;
  padding: 0.75rem 0.875rem;
  display: grid;
  gap: 0.125rem;
  align-content: start;
}

.metrics dt {
  font-size: 0.75rem;
  font-weight: 550;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.metrics dd {
  margin: 0;
}

.metrics dd:not(.muted) {
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.metrics dd.muted {
  font-size: 0.75rem;
  line-height: 1.35;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.85em;
}

.dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 0.1em;
}

.source[data-phase="reading"] .dot {
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

.source .row {
  justify-content: flex-start;
}

.drop {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 9rem;
  border: 1px dashed var(--hairline);
  border-radius: 0.875rem;
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
}

.drop[data-disabled="true"] {
  cursor: not-allowed;
}

.drop:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

#preview {
  display: block;
  max-width: 100%;
  max-height: 22rem;
  object-fit: contain;
}

.drop[data-empty="true"] #preview {
  display: none;
}

.drop[data-empty="false"] .hint {
  display: none;
}

.hint {
  color: var(--ink-faint);
  font-size: 0.9rem;
}

/* A scan line sweeps the image while the engine reads it. */
.source[data-phase="reading"] .drop::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--accent);
  opacity: 0.7;
  animation: scan 1.6s ease-in-out infinite alternate;
}

@keyframes scan {
  to {
    translate: 0 calc(22rem - 3px);
  }
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 0.5rem;
}

legend {
  padding: 0;
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--ink-soft);
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.task input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.task span {
  display: inline-block;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0.3rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.task input:checked + span {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--canvas);
}

.task input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

fieldset:disabled .task span {
  cursor: not-allowed;
  opacity: 0.5;
}

.answer {
  gap: 1.25rem;
}

/* The answer drawn block by block: text as written, tables as tables, code in monospace. */
.blocks {
  display: grid;
  gap: 0.875rem;
  max-height: 32rem;
  overflow-y: auto;
}

.blocks:empty {
  display: none;
}

.prose {
  overflow-wrap: anywhere;
  font-size: 1.0625rem;
}

/* A text block's lines as written; the template's own whitespace around them collapses. */
.segment {
  white-space: pre-wrap;
}

.code,
.text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.8125rem;
}

.code {
  background: var(--surface);
  border-radius: 0.75rem;
  padding: 0.75rem 0.875rem;
}

.formula {
  overflow-x: auto;
  overflow-y: hidden;
}

.formula .katex-display {
  margin: 0;
}

/* The Markdown as written, to copy. */
.markdown summary {
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--ink-soft);
}

.markdown .text {
  margin-top: 0.5rem;
  max-height: 14rem;
  overflow-y: auto;
  color: var(--ink-faint);
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  font-size: 0.9375rem;
}

td {
  border: 1px solid var(--hairline);
  padding: 0.375rem 0.625rem;
  vertical-align: top;
}

.placeholder {
  margin: 0;
}
