:root {
  --field: #e6dfd3;
  --sheet: #f7f3ea;
  --ink: #241e18;
  --muted: #655d54;
  --line: rgba(36, 30, 24, 0.16);
  --line-strong: rgba(36, 30, 24, 0.32);
  --seal: #8f3b32;
  --seal-ink: #f6f1e6;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100dvh;
  color: var(--ink);
  background-color: var(--field);
  background-image:
    radial-gradient(rgba(90, 68, 40, 0.045) 0.65px, transparent 0.75px),
    radial-gradient(rgba(50, 36, 20, 0.035) 0.55px, transparent 0.7px);
  background-size: 7px 9px, 13px 11px;
  background-position: 0 0, 4px 5px;
  font-family: "LXGW WenKai", "Songti SC", "STSong", "Noto Serif SC", serif;
  font-weight: 400;
  text-rendering: optimizeLegibility;
  transition: background-color 640ms ease, color 640ms ease;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(70, 52, 32, 0.07) 100%);
}

.grain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 7;
  opacity: 0.22;
  mix-blend-mode: multiply;
}

button,
input,
textarea {
  font-family: inherit;
  color: inherit;
  border-radius: 0;
}

button {
  cursor: pointer;
}

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

::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

::selection {
  background: rgba(143, 59, 50, 0.18);
}

:focus-visible {
  outline: 1px solid var(--seal);
  outline-offset: 3px;
}

.noscript {
  width: min(440px, calc(100% - 36px));
  margin: 48px auto;
  line-height: 1.8;
}

.stage {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 20px max(32px, env(safe-area-inset-bottom));
}

.stage.is-spread,
.stage.is-source {
  width: min(920px, 100%);
}

.mast {
  position: relative;
}

.mast-top {
  display: flex;
  align-items: flex-start;
}

.eyebrow {
  margin: 6px 0 0;
  font-size: 13px;
  letter-spacing: 0.22em;
  color: var(--muted);
}

h1 {
  margin: 8px 76px 0 0;
  font-size: 40px;
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1.15;
}

.lead {
  margin: 16px 0 0;
  max-width: 22em;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.9;
}

.seal {
  display: grid;
  place-items: center;
  border: 1.5px solid var(--seal);
  border-radius: 50%;
  color: var(--seal);
  background: transparent;
  line-height: 1;
}

.seal-mini {
  position: absolute;
  top: 28px;
  right: 0;
  width: 58px;
  height: 58px;
  font-size: 22px;
}

.sec {
  margin: 30px 0 0;
  font-size: 15px;
  letter-spacing: 0.14em;
}

.sec span {
  margin-right: 0.75em;
}

.tiles {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 4px;
  margin-top: 18px;
}

.tile {
  flex: 1;
  min-width: 0;
  padding: 8px 0 10px;
  border: 0;
  background: transparent;
  font-size: 26px;
  line-height: 1.18;
  letter-spacing: 0.08em;
}

.tile.is-on {
  background: var(--seal);
  color: var(--seal-ink);
}

.tiles.is-dim .tile {
  color: var(--muted);
}

.tiles.is-dim .tile.is-on {
  background: transparent;
  color: var(--muted);
}

.gloss {
  display: flex;
  align-items: stretch;
  min-height: 72px;
  margin-top: 18px;
}

.gloss-mark {
  width: 48px;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: var(--seal);
  color: var(--seal-ink);
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0.06em;
}

.gloss p {
  margin: 0;
  padding: 8px 0 8px 14px;
  display: flex;
  align-items: center;
  font-size: 16.5px;
  line-height: 1.55;
  letter-spacing: 0.03em;
}

.paste {
  margin-top: 12px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.url-row input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 16px;
  line-height: 1.5;
  padding: 12px 0;
}

.url-row button {
  border: 0;
  background: none;
  color: var(--seal);
  font-size: 15px;
  letter-spacing: 0.16em;
  padding: 10px 0 10px 8px;
}

textarea {
  display: block;
  width: 100%;
  min-height: 108px;
  resize: vertical;
  border: 0;
  background: transparent;
  font-size: 16px;
  line-height: 1.8;
  padding: 12px 0 4px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 28px;
  padding-bottom: 6px;
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.06em;
}

.meta-row button {
  border: 0;
  background: none;
  padding: 0 0 0 6px;
  color: var(--ink);
  font-size: inherit;
  letter-spacing: 0.08em;
}

.meta-row .warn {
  color: var(--seal);
}

.seal-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 28px;
}

.seal-btn {
  width: 78px;
  height: 78px;
  font-size: 30px;
  transition: transform 180ms ease, background-color 180ms ease, color 180ms ease;
}

.seal-btn.is-pressing,
.seal-btn:active {
  background: var(--seal);
  color: var(--seal-ink);
  transform: scale(0.94);
}

.seal-caption {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.14em;
}

.colophon {
  margin: 16px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.nav button,
.nav-note {
  border: 0;
  background: none;
  padding: 8px 0;
  font-size: 15px;
  letter-spacing: 0.16em;
  color: var(--ink);
}

.nav-note {
  color: var(--muted);
  letter-spacing: 0.08em;
}

.sheet {
  position: relative;
  border: 1px solid var(--line-strong);
  background: var(--sheet);
  box-shadow: 0 18px 40px rgba(48, 36, 24, 0.06);
  padding: 18px 16px 14px;
  animation: unfold 680ms cubic-bezier(0.16, 1, 0.3, 1);
}

.running {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.running h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.1em;
  line-height: 1.35;
}

.running small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.16em;
}

.seal-sheet {
  width: 52px;
  height: 52px;
  font-size: 20px;
}

.spread {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  min-height: 280px;
  padding-top: 14px;
}

.crease {
  position: absolute;
  top: 16px;
  bottom: 8px;
  left: 50%;
  width: 1px;
  transform: translateX(-0.5px);
  background: var(--line-strong);
}

.crease i {
  position: absolute;
  left: -7px;
  width: 15px;
  height: 1px;
  background: var(--ink);
  opacity: 0.35;
}

.crease i:nth-child(1) { top: 18%; }
.crease i:nth-child(2) { top: 50%; }
.crease i:nth-child(3) { top: 82%; }

.side {
  padding: 0 2px;
}

.side-mark {
  margin: 0;
  color: var(--seal);
  font-size: 12px;
  letter-spacing: 0.28em;
}

.side-title {
  margin: 8px 0 12px;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.28;
  letter-spacing: 0.07em;
}

.claim {
  margin: 0 0 10px;
  font-size: 13.5px;
  line-height: 1.7;
  letter-spacing: 0.02em;
}

.band {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.q-label {
  margin: 0;
  color: var(--seal);
  font-size: 12px;
  letter-spacing: 0.28em;
}

.question {
  margin: 6px 0 0;
  font-size: 17px;
  line-height: 1.55;
  letter-spacing: 0.04em;
}

.seam {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.14em;
}

.note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.sheet.is-saved .question,
.sheet.is-saved .seam {
  padding-right: 72px;
}

.stamp {
  position: absolute;
  right: 14px;
  bottom: 78px;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 2px solid var(--seal);
  border-radius: 50%;
  color: var(--seal);
  background: var(--sheet);
  font-size: 20px;
  letter-spacing: 0.08em;
  transform: rotate(-16deg);
  pointer-events: none;
  animation: stamp-in 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 26px;
}

.actions button {
  border: 0;
  background: none;
  padding: 8px 6px;
  font-size: 18px;
  letter-spacing: 0.12em;
}

.dot {
  color: var(--muted);
  letter-spacing: 0;
}

.status {
  min-height: 1.4em;
  margin: 8px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.08em;
}

.hint {
  margin: 18px auto 0;
  max-width: 28em;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.hint button {
  border: 0;
  background: none;
  padding: 0 0 0 0.4em;
  color: var(--ink);
  font-size: inherit;
  letter-spacing: 0.08em;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.manuscript {
  padding: 22px 20px 18px;
}

.manuscript h2 {
  margin: 0 0 16px;
  font-size: 26px;
  font-weight: 400;
  letter-spacing: 0.1em;
}

.manuscript p {
  margin: 0 0 0.95em;
  text-indent: 2em;
  text-align: justify;
  text-justify: inter-character;
  font-size: 16px;
  line-height: 1.95;
}

@keyframes unfold {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes stamp-in {
  from {
    opacity: 0;
    transform: rotate(-16deg) scale(1.4);
  }
  to {
    opacity: 1;
    transform: rotate(-16deg) scale(1);
  }
}

@media (min-width: 840px) {
  .stage.is-spread,
  .stage.is-source {
    padding-top: 42px;
  }

  .sheet {
    padding: 28px 34px 20px;
  }

  .running h2 {
    font-size: 22px;
  }

  .side-title {
    font-size: 32px;
    margin-bottom: 18px;
  }

  .claim {
    font-size: 16.5px;
    line-height: 1.75;
    margin-bottom: 14px;
  }

  .question {
    font-size: 22px;
  }

  .spread {
    gap: 48px;
    min-height: 340px;
    padding-top: 22px;
  }

  .manuscript {
    padding: 36px 48px 28px;
  }

  .manuscript p {
    font-size: 18px;
  }
}

@media (max-width: 360px) {
  h1 {
    font-size: 34px;
    margin-right: 72px;
  }

  .tile {
    font-size: 22px;
  }

  .side-title {
    font-size: 18px;
  }

  .claim {
    font-size: 12.5px;
  }

  .spread {
    gap: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media print {
  .grain,
  body::after,
  .nav,
  .actions,
  .status,
  .hint,
  .colophon,
  .stamp {
    display: none !important;
  }

  body {
    background: white;
  }

  .stage {
    width: auto;
    padding: 0;
  }

  .sheet {
    box-shadow: none;
    border-color: #222;
  }
}
