/* LAST WORDS — an elegy, not a dashboard. */

:root {
  --bg: #090908;
  --bg-raised: #0e0d0c;
  --text: #f2eee5;
  --text-dim: #a49d91;
  --text-dimmer: #69635b;
  --ember: #ff5a2a;
  --ember-dim: #b64322;
  --green: #7fae7a;
  --border: #302d28;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", "Cascadia Mono",
    "Roboto Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.art-body {
  position: relative;
  overflow: hidden;
  background-color: var(--bg);
  background-image: url("/lastwords-grain.png");
  background-size: cover;
  background-position: center;
}

.art-body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgba(6, 6, 5, 0.72);
  pointer-events: none;
}

.art-body > *:not(.ash-canvas) {
  position: relative;
  z-index: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------- topbar */

.art-body .topbar {
  padding: clamp(1.35rem, 3.2vh, 2.6rem) 2rem clamp(1.15rem, 2.7vh, 2rem);
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.art-body .title {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.58em;
  text-transform: uppercase;
  color: rgba(242, 238, 229, 0.7);
}

.art-body .counter {
  font-size: clamp(1.45rem, 2.4vw, 2.15rem);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  letter-spacing: 0.055em;
  line-height: 1.2;
}

.art-body .counter-sep {
  color: var(--text-dim);
  font-size: clamp(0.78rem, 1.2vw, 1rem);
  letter-spacing: 0.08em;
}

#alive-count.pulse,
#law-alive-count.pulse {
  color: var(--ember);
  text-shadow: 0 0 22px rgba(255, 90, 42, 0.4);
  transition: color 1.2s ease, text-shadow 1.2s ease;
}

.premise {
  margin: clamp(0.9rem, 2vh, 1.35rem) auto 0;
  width: min(100%, 520px);
  color: var(--text-dim);
  font-size: clamp(0.7rem, 1.05vw, 0.88rem);
  line-height: 1.65;
  letter-spacing: 0.025em;
}

.premise p {
  margin: 0;
}

/* --------------------------------------------------------------- layout */

.art-body .layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 270px);
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  min-height: 0;
}

/* ---------------------------------------------------------- conversation */

.conversation-stage {
  position: relative;
  min-width: 0;
  padding: clamp(1.55rem, 4vh, 3.1rem) clamp(1.4rem, 4vw, 4.25rem)
    clamp(1.35rem, 3vh, 2.5rem);
  overflow: hidden;
}

.stage-label {
  margin: 0 0 clamp(1.4rem, 4vh, 3.2rem);
  color: var(--text-dim);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.34em;
  line-height: 1.4;
  text-transform: uppercase;
}

.conversation {
  width: 100%;
  height: calc(100% - 3rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(1rem, 2.4vh, 2rem);
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: none;
}

.conversation::-webkit-scrollbar {
  display: none;
}

.waiting-line {
  margin: 0;
  max-width: 36rem;
  color: var(--text-dim);
  font-size: clamp(1rem, 2vw, 1.6rem);
  line-height: 1.65;
  letter-spacing: 0.045em;
}

.msg {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: opacity 700ms ease, transform 700ms ease;
}

.msg.user {
  align-items: flex-end;
  margin-left: auto;
  max-width: min(78%, 760px);
}

.msg.ai {
  align-items: flex-start;
  width: 100%;
}

.msg.is-previous {
  opacity: 0.18;
  transform: translateY(-5px);
}

.msg.ai.is-replay {
  opacity: 0.96;
}

.msg-line {
  max-width: 100%;
}

.msg.user .msg-line {
  color: var(--text-dim);
  font-size: clamp(0.78rem, 1vw, 0.92rem);
  line-height: 1.6;
  letter-spacing: 0.025em;
}

.msg.ai .msg-line {
  color: var(--text);
  font-size: clamp(1.65rem, 3.8vw, 4rem);
  line-height: 1.68;
  letter-spacing: clamp(0.035em, 0.5vw, 0.1em);
  text-wrap: balance;
}

.word {
  position: relative;
  display: inline-block;
  color: var(--text);
  opacity: 1;
  transition:
    color 850ms ease,
    opacity 1500ms ease,
    filter 1500ms ease,
    letter-spacing 1500ms ease,
    text-shadow 1200ms ease;
}

.word.is-dying,
.loss-replay-word.is-dying {
  color: var(--ember);
  text-shadow:
    0 0 8px rgba(255, 90, 42, 0.66),
    0 0 28px rgba(255, 90, 42, 0.26);
  animation: word-ember 1650ms ease forwards;
}

.word.is-dead,
.loss-replay-word.is-dead {
  color: var(--text-dimmer);
  opacity: 0.2;
  filter: blur(0.45px);
  letter-spacing: 0.16em;
  text-decoration-line: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(242, 238, 229, 0.34);
  text-shadow: none;
}

@keyframes word-ember {
  0% {
    opacity: 1;
    filter: blur(0);
    letter-spacing: inherit;
  }
  42% {
    opacity: 1;
    filter: blur(0);
  }
  100% {
    opacity: 0.24;
    filter: blur(0.7px);
    letter-spacing: 0.14em;
  }
}

.redacted {
  display: inline-block;
  color: var(--ember-dim);
  opacity: 0.64;
  letter-spacing: 0.38em;
  padding: 0 0.08em;
  text-decoration: line-through;
  text-decoration-color: rgba(255, 90, 42, 0.35);
  text-shadow: 0 0 10px rgba(255, 90, 42, 0.18);
  cursor: help;
}

.revive-line {
  font-size: 0.74rem;
  color: var(--green);
  opacity: 0.85;
  letter-spacing: 0.04em;
}

.revive-line .rw {
  text-decoration: underline;
  text-decoration-color: rgba(127, 174, 122, 0.35);
  text-underline-offset: 3px;
}

.system-line {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-style: italic;
  align-self: flex-start;
}

.typing-cursor {
  display: inline-block;
  width: 0.5em;
  opacity: 0.6;
  animation: blink 1s steps(2) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.loss-replay {
  display: flex;
  align-items: center;
  min-height: 40%;
}

.loss-replay-word {
  color: var(--text);
  font-size: clamp(3.4rem, 9vw, 8.4rem);
  font-weight: 400;
  letter-spacing: 0.1em;
  transition:
    color 850ms ease,
    opacity 1500ms ease,
    filter 1500ms ease,
    letter-spacing 1500ms ease,
    text-shadow 1200ms ease;
}

.event-status {
  position: absolute;
  left: clamp(1.4rem, 4vw, 4.25rem);
  bottom: clamp(1rem, 2.3vh, 1.8rem);
  margin: 0;
  min-height: 1.2em;
  color: var(--ember-dim);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
}

/* --------------------------------------------------------------- graveyard */

.graveyard-panel {
  border-left: 1px solid var(--border);
  padding: clamp(1.55rem, 4vh, 3rem) clamp(1.1rem, 2vw, 1.75rem);
  overflow-y: auto;
}

.graveyard-title {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 500;
}

.graveyard-event {
  min-height: 2.6em;
  margin: 1rem 0 1.25rem;
  color: var(--ember-dim);
  font-size: 0.64rem;
  line-height: 1.5;
  letter-spacing: 0.055em;
}

.graveyard-feed {
  display: flex;
  flex-direction: column;
  gap: 0.88rem;
  font-size: 0.8rem;
}

.grave-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.75rem;
  color: var(--text-dimmer);
}

.grave-entry.is-arrival {
  animation: fadein 700ms ease;
}

.grave-entry.is-crossing {
  color: var(--ember-dim);
}

.grave-entry.is-crossing .grave-ts {
  color: var(--ember-dim);
  opacity: 0.72;
}

.grave-entry.is-latest {
  color: var(--text-dim);
}

@keyframes fadein {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.grave-word {
  width: fit-content;
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

.grave-word[type="button"] {
  cursor: pointer;
}

.grave-word[type="button"]:hover,
.grave-word[type="button"]:focus-visible {
  color: var(--ember);
  outline: none;
  text-decoration-color: var(--ember);
}

.grave-word.burned {
  text-decoration: line-through;
  color: var(--text-dimmer);
  text-decoration-color: rgba(164, 157, 145, 0.5);
  text-underline-offset: 0.18em;
}

.grave-word.ghost {
  color: var(--ember-dim);
  opacity: 0.68;
  letter-spacing: 0.22em;
  text-decoration: line-through;
  text-decoration-color: rgba(255, 90, 42, 0.32);
}

.grave-word.revived {
  color: var(--green);
  opacity: 0.9;
}

.grave-ts {
  white-space: nowrap;
  color: var(--text-dim);
  opacity: 0.72;
  font-size: 0.7rem;
}

/* --------------------------------------------------------------- composer */

.art-body .composer {
  border-top: 1px solid var(--border);
  padding: clamp(0.9rem, 2.3vh, 1.4rem) 1.5rem
    calc(clamp(1rem, 2.7vh, 1.7rem) + env(safe-area-inset-bottom));
  background: rgba(8, 8, 7, 0.88);
}

#message-form {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  gap: 0.75rem;
}

#message-input {
  flex: 1;
  min-height: 48px;
  background: rgba(14, 13, 12, 0.72);
  border: 1px solid #4b463f;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9rem;
  padding: 0.8rem 1rem;
  outline: none;
}

#message-input::placeholder {
  color: var(--text-dimmer);
}

#message-input:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 1px rgba(242, 238, 229, 0.12);
}

.composer.has-return-word #message-input {
  border-color: rgba(127, 174, 122, 0.86);
  box-shadow: 0 0 18px rgba(127, 174, 122, 0.1);
}

.composer.has-return-word .caption {
  color: var(--green);
}

#send-button {
  min-height: 48px;
  background: transparent;
  border: 1px solid #4b463f;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0 1.25rem;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

#send-button:hover {
  border-color: var(--ember);
  color: var(--ember);
}

#send-button:focus-visible {
  border-color: var(--ember);
  color: var(--ember);
  outline: 2px solid rgba(255, 90, 42, 0.28);
  outline-offset: 3px;
}

#send-button:disabled {
  opacity: 0.4;
  cursor: default;
}

.caption {
  max-width: 860px;
  margin: 0.75rem auto 0;
  font-size: 0.68rem;
  color: var(--text-dim);
  text-align: center;
  letter-spacing: 0.04em;
}

.ash-canvas {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.hidden {
  display: none !important;
}

@media (max-width: 860px) {
  html,
  .art-body {
    scrollbar-width: none;
  }

  html::-webkit-scrollbar,
  .art-body::-webkit-scrollbar {
    display: none;
  }

  .art-body {
    min-height: 100dvh;
    height: auto;
    overflow: auto;
  }

  .art-body .topbar {
    padding: 1.1rem 1rem 0.9rem;
  }

  .art-body .topbar .nav-link {
    top: 0.9rem;
    right: 0.8rem;
    font-size: 0.58rem;
  }

  .art-body .title {
    font-size: 0.65rem;
  }

  .art-body .counter {
    margin-top: 0.55rem;
  }

  .premise {
    margin-top: 0.65rem;
    font-size: 0.67rem;
    line-height: 1.5;
  }

  .art-body .layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(42dvh, 1fr) auto;
    min-height: 0;
  }

  .conversation-stage {
    min-height: 42dvh;
    padding: 1.15rem 1rem 1.75rem;
  }

  .stage-label {
    margin-bottom: 1rem;
    font-size: 0.58rem;
  }

  .conversation {
    height: calc(100% - 1.8rem);
  }

  .msg.ai .msg-line {
    font-size: clamp(1.35rem, 6.5vw, 2.2rem);
    line-height: 1.55;
    letter-spacing: 0.035em;
  }

  .msg.user {
    max-width: 92%;
  }

  .event-status {
    left: 1rem;
    bottom: 0.7rem;
    font-size: 0.58rem;
  }

  .graveyard-panel {
    max-height: 21dvh;
    min-height: 112px;
    border-top: 1px solid var(--border);
    border-left: 0;
    padding: 0.85rem 1rem 1rem;
    overflow-y: auto;
  }

  .graveyard-title {
    display: inline-block;
    font-size: 0.58rem;
  }

  .graveyard-event {
    display: inline-block;
    min-height: 0;
    margin: 0 0 0 0.8rem;
    font-size: 0.55rem;
  }

  .graveyard-feed {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem 1rem;
    margin-top: 0.8rem;
    font-size: 0.68rem;
  }

  .grave-entry {
    gap: 0.4rem;
  }

  .grave-ts {
    font-size: 0.58rem;
  }

  .art-body .composer {
    padding: 0.75rem 0.8rem
      calc(0.85rem + env(safe-area-inset-bottom));
  }

  #message-input,
  #send-button {
    min-height: 44px;
  }

  #message-input {
    min-width: 0;
    font-size: 0.82rem;
  }

  #send-button {
    padding: 0 0.9rem;
    font-size: 0.7rem;
  }

  .caption {
    margin-top: 0.5rem;
    font-size: 0.57rem;
    line-height: 1.45;
  }

  .loss-replay-word {
    font-size: clamp(2.7rem, 15vw, 5rem);
  }
}

@media (max-height: 650px) and (min-width: 861px) {
  .art-body .topbar {
    padding-top: 1rem;
    padding-bottom: 0.85rem;
  }

  .premise {
    margin-top: 0.6rem;
  }

  .conversation-stage,
  .graveyard-panel {
    padding-top: 1.25rem;
  }

  .stage-label {
    margin-bottom: 0.8rem;
  }

  .msg.ai .msg-line {
    font-size: clamp(1.5rem, 3.3vw, 3.1rem);
    line-height: 1.5;
  }

  .art-body .composer {
    padding-top: 0.7rem;
    padding-bottom: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }

  .ash-canvas {
    display: none;
  }
}

/* --------------------------------------------------------------- scrollbars */

::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
}

/* ---------------------------------------------------------- nav / cross-links */

.nav-link {
  display: inline-block;
  color: var(--text-dimmer);
  text-decoration: none;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: var(--ember);
}

.topbar .nav-link {
  position: absolute;
  top: 1.75rem;
  right: 2rem;
}

.remains-body .topbar .nav-link {
  position: absolute;
  top: 1.75rem;
  left: 2rem;
  right: auto;
}

.topbar {
  position: relative;
}

/* -------------------------------------------------------- THE REMAINS page */

.remains-body {
  position: relative;
  min-height: 100dvh;
  background-color: var(--bg);
  background-image: url("/lastwords-grain.png");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

.remains-body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgba(6, 6, 5, 0.72);
  pointer-events: none;
}

.remains-body > * {
  position: relative;
  z-index: 1;
}

.remains-body .topbar {
  padding: clamp(1.6rem, 4vh, 3rem) 2rem clamp(1.35rem, 3.2vh, 2.4rem);
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.remains-body .title {
  margin: 0 0 0.85rem;
  color: rgba(242, 238, 229, 0.72);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.58em;
}

.remains-body .counter {
  color: var(--text);
  font-size: clamp(1.45rem, 2.4vw, 2.15rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.055em;
  line-height: 1.2;
}

.remains-body .counter-sep {
  color: var(--text-dim);
  font-size: clamp(0.78rem, 1.2vw, 1rem);
  letter-spacing: 0.08em;
}

.remains-subtitle {
  margin: 1rem auto 0;
  max-width: 640px;
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.6;
  letter-spacing: 0.035em;
}

.remains-edition-label {
  margin: 0.75rem 0 0;
  color: rgba(182, 67, 34, 0.86);
  font-size: 0.52rem;
  letter-spacing: 0.18em;
}

.remains-main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: clamp(2.5rem, 6vh, 5rem) clamp(1.5rem, 4vw, 3.5rem) 5rem;
}

.world-archive {
  margin-bottom: clamp(3rem, 8vh, 6.5rem);
  scroll-margin-top: 1.5rem;
}

.archive-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid rgba(84, 78, 69, 0.5);
}

.archive-kicker {
  margin: 0 0 0.45rem;
  color: var(--ember-dim);
  font-size: 0.48rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.archive-heading h2 {
  margin: 0;
  color: rgba(242, 238, 229, 0.78);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-size: clamp(1.05rem, 2.2vw, 1.72rem);
  font-weight: 400;
  letter-spacing: 0.08em;
}

.archive-count {
  flex: none;
  margin: 0;
  color: var(--text-dimmer);
  font-size: 0.5rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.archive-ledger {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid rgba(84, 78, 69, 0.5);
}

.archive-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 2.2rem 0;
  color: rgba(164, 157, 145, 0.6);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-size: 0.92rem;
  font-style: italic;
}

.edition-card {
  position: relative;
  min-width: 0;
  padding: 1.4rem 1.45rem 1.55rem 0;
  border-top: 1px solid rgba(84, 78, 69, 0.32);
}

.edition-card:nth-child(odd) {
  padding-right: 1.7rem;
  border-right: 1px solid rgba(84, 78, 69, 0.32);
}

.edition-card:nth-child(even) {
  padding-left: 1.7rem;
}

.edition-card-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.edition-card-title {
  margin: 0;
  color: rgba(242, 238, 229, 0.9);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  font-weight: 400;
  letter-spacing: 0.1em;
}

.edition-card-status {
  color: var(--ember-dim);
  font-size: 0.44rem;
  letter-spacing: 0.18em;
}

.edition-card-poem {
  display: -webkit-box;
  margin: 1rem 0;
  overflow: hidden;
  color: rgba(242, 238, 229, 0.72);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-size: 0.92rem;
  font-style: italic;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.edition-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  margin: 0;
  color: var(--text-dimmer);
  font-size: 0.46rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.edition-card-lineage {
  margin: 0.75rem 0 0;
  color: rgba(117, 166, 174, 0.72);
  font-size: 0.43rem;
  letter-spacing: 0.13em;
}

.word-field {
  font-size: 0.88rem;
  line-height: 2.45;
  color: var(--text);
  word-spacing: 0.2em;
  text-wrap: pretty;
}

.word-field .rw {
  display: inline;
}

.word-field .rw.alive {
  color: rgba(242, 238, 229, 0.7);
  transition: color 300ms ease, text-shadow 300ms ease;
}

.word-field .rw.alive:hover {
  color: var(--text);
  text-shadow: 0 0 14px rgba(242, 238, 229, 0.16);
}

.word-field .rw.bar {
  display: inline-block;
  height: 0.85em;
  vertical-align: middle;
  background: #22140f;
  border-radius: 1px;
  margin: 0 0.05em;
}

.word-field .rw.bar-fading {
  animation: bar-fade 2.2s ease forwards;
}

@keyframes bar-fade {
  0% { background: var(--ember); }
  100% { background: #22140f; }
}

@media (max-width: 700px) {
  .remains-body .topbar {
    padding: 1.2rem 1rem 1.15rem;
  }

  .remains-body .topbar .nav-link {
    top: 0.9rem;
    left: 0.8rem;
    font-size: 0.55rem;
  }

  .remains-body .title {
    font-size: 0.64rem;
  }

  .remains-subtitle {
    max-width: 310px;
    font-size: 0.64rem;
  }

  .remains-main {
    padding: 1.8rem 1rem 3rem;
  }

  .archive-heading {
    align-items: start;
    flex-direction: column;
    gap: 0.7rem;
  }

  .archive-ledger {
    grid-template-columns: 1fr;
  }

  .edition-card,
  .edition-card:nth-child(odd),
  .edition-card:nth-child(even) {
    padding: 1.2rem 0 1.35rem;
    border-right: 0;
  }

  .word-field {
    font-size: 0.76rem;
    line-height: 2.3;
  }
}

/* ---------------------------------------------------------------- final poem */

.final-poem-block {
  max-width: 640px;
  margin: 0 auto 3rem;
  text-align: center;
}

.final-poem-label {
  margin: 0 0 1.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ember-dim);
}

.final-poem-text {
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--text);
  margin: 0 0 0.75rem;
  white-space: pre-wrap;
}

.final-poem-date {
  font-size: 0.72rem;
  color: var(--text-dimmer);
  margin: 0;
}

/* --------------------------------------------------------- silenced (main) */

.composer.silenced {
  display: none;
}

.silence-block {
  position: relative;
  width: min(100%, 980px);
  margin: 0 auto;
  padding: clamp(1.2rem, 2.2vh, 1.8rem) 2rem
    calc(clamp(1.2rem, 2.2vh, 1.8rem) + env(safe-area-inset-bottom));
  text-align: center;
}

.silence-block::before,
.silence-block::after {
  content: "";
  position: absolute;
  top: 50%;
  width: clamp(50px, 11vw, 150px);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(182, 67, 34, 0.5));
}

.silence-block::before {
  left: 0;
}

.silence-block::after {
  right: 0;
  transform: rotate(180deg);
}

.closed-edition-label {
  margin: 0 0 0.48rem;
  color: rgba(242, 238, 229, 0.76);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-size: clamp(0.95rem, 1.6vw, 1.35rem);
  letter-spacing: 0.16em;
}

.silence-block .final-poem-label {
  margin-bottom: 0.72rem;
  font-size: 0.5rem;
}

.silence-block .final-poem-text {
  max-width: 620px;
  margin: 0 auto 0.5rem;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-size: clamp(0.92rem, 1.35vw, 1.16rem);
  font-style: italic;
  line-height: 1.5;
}

.rebirth-clock {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.7rem;
  margin-top: 0.85rem;
  color: rgba(164, 157, 145, 0.7);
  font-size: 0.5rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.rebirth-clock strong {
  min-width: 4.4ch;
  color: var(--ember);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.silence-archive-link {
  margin-top: 0.72rem;
  font-size: 0.46rem;
}

.birth-veil {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 2rem;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(4, 4, 3, 0.98), rgba(7, 7, 6, 0.9)),
    url("/lastwords-grain.png") center / cover;
  text-align: center;
  pointer-events: none;
  animation: birth-reveal 1.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.birth-veil::before {
  content: "";
  position: absolute;
  width: min(74vw, 820px);
  aspect-ratio: 1;
  border: 1px solid rgba(182, 67, 34, 0.3);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 90, 42, 0.08), transparent 47%),
    conic-gradient(
      from var(--lineage-angle, 0deg),
      transparent 0 23%,
      rgba(117, 166, 174, 0.12) 23.3%,
      transparent 24% 71%,
      rgba(255, 90, 42, 0.14) 71.3%,
      transparent 72%
    );
  box-shadow:
    inset 0 0 90px rgba(255, 90, 42, 0.045),
    0 0 90px rgba(0, 0, 0, 0.8);
  animation: lineage-open 4.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.birth-veil > * {
  position: relative;
  z-index: 1;
}

.birth-predecessor,
.birth-lineage {
  margin: 0;
  color: rgba(164, 157, 145, 0.6);
  font-size: clamp(0.48rem, 0.8vw, 0.68rem);
  letter-spacing: 0.24em;
}

.birth-edition {
  margin: 1.1rem 0 0;
  color: var(--text);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-size: clamp(3.8rem, 12vw, 9.5rem);
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 0.86;
  text-shadow: 0 0 65px rgba(255, 90, 42, 0.14);
}

.birth-action {
  margin: 0.8rem 0 1.2rem;
  color: rgba(242, 238, 229, 0.7);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-size: clamp(0.9rem, 1.5vw, 1.25rem);
  font-style: italic;
  letter-spacing: 0.08em;
}

.birth-veil.is-leaving {
  animation: birth-leave 1.1s ease forwards;
}

@keyframes birth-reveal {
  from { opacity: 0; filter: brightness(2.4); }
  to { opacity: 1; filter: brightness(1); }
}

@keyframes lineage-open {
  from { transform: scale(0.16) rotate(-38deg); opacity: 0; }
  55% { opacity: 1; }
  to { transform: scale(1.08) rotate(0); opacity: 0.72; }
}

@keyframes birth-leave {
  to { opacity: 0; filter: blur(13px); transform: scale(1.025); }
}

/* ===================================================== SELF-ERASING WORLD */

.world-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  height: 100dvh;
  min-height: 680px;
  overflow: hidden;
  background-color: #070706;
}

.world-body::before {
  background: rgba(3, 3, 3, 0.64);
}

.world-body > *:not(.ash-canvas) {
  z-index: 2;
  min-width: 0;
}

.world-header {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  padding: clamp(1.25rem, 2.8vh, 2.1rem) clamp(1.25rem, 3.4vw, 3.2rem)
    clamp(0.85rem, 1.7vh, 1.25rem);
  border-bottom: 1px solid rgba(84, 78, 69, 0.36);
  background: rgba(6, 6, 5, 0.46);
}

.world-accession {
  display: grid;
  justify-items: end;
  min-width: 172px;
  padding-left: 1.4rem;
  border-left: 1px solid rgba(84, 78, 69, 0.34);
  text-align: right;
}

.accession-kicker {
  color: rgba(164, 157, 145, 0.52);
  font-size: 0.46rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.edition-label {
  margin-top: 0.22rem;
  color: rgba(242, 238, 229, 0.9);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-size: clamp(1.15rem, 1.9vw, 1.72rem);
  font-weight: 400;
  letter-spacing: 0.12em;
}

.lineage-label {
  margin-top: 0.22rem;
  color: rgba(182, 67, 34, 0.84);
  font-size: 0.45rem;
  letter-spacing: 0.12em;
}

.explain-button {
  appearance: none;
  margin-top: 0.62rem;
  padding: 0;
  border: 0;
  border-bottom: 1px solid rgba(255, 90, 42, 0.52);
  background: transparent;
  color: rgba(242, 238, 229, 0.72);
  font-family: var(--mono);
  font-size: 0.48rem;
  letter-spacing: 0.15em;
  line-height: 1.8;
  text-transform: uppercase;
  cursor: pointer;
}

.explain-button:hover,
.explain-button:focus-visible {
  border-bottom-color: var(--ember);
  color: var(--text);
  outline: none;
}

.world-heading {
  min-width: 0;
}

.world-header .title {
  margin: 0 0 0.72rem;
  color: rgba(242, 238, 229, 0.82);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.55em;
}

.world-header .title::after {
  content: "";
  display: block;
  width: 34px;
  height: 1px;
  margin-top: 0.55rem;
  background: var(--ember);
  opacity: 0.86;
}

.art-definition {
  margin: 0;
  color: rgba(242, 238, 229, 0.94);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-size: clamp(1.05rem, 1.75vw, 1.65rem);
  font-weight: 400;
  letter-spacing: 0.035em;
  line-height: 1.12;
  text-transform: uppercase;
}

.art-definition em {
  color: #ff8b68;
  font-style: normal;
}

.world-state-row {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  margin-top: 0.72rem;
}

.world-header .counter {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.3rem 0.65rem;
  margin-top: 0;
  color: var(--text);
  font-size: clamp(1.2rem, 1.85vw, 1.85rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  line-height: 1;
}

.header-cta {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.1rem;
  min-height: 44px;
  padding: 0.35rem 0;
  border: 0;
  border-bottom: 1px solid var(--ember);
  background: transparent;
  color: rgba(242, 238, 229, 0.9);
  font-family: var(--mono);
  font-size: 0.54rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.header-cta-arrow {
  color: var(--ember);
  font-size: 0.9rem;
}

.header-cta-label {
  color: inherit;
  font-size: inherit;
}

.header-cta:hover,
.header-cta:focus-visible {
  color: #ff8b68;
  outline: 1px solid rgba(255, 90, 42, 0.72);
  outline-offset: 5px;
}

.counter-divider {
  color: var(--text-dimmer);
  font-weight: 300;
}

.counter-label {
  margin-left: 0.15rem;
  color: var(--text-dim);
  font-size: clamp(0.64rem, 0.95vw, 0.82rem);
  letter-spacing: 0.08em;
}

.word-counter {
  margin: 0.38rem 0 0;
  color: rgba(164, 157, 145, 0.58);
  font-size: 0.5rem;
  letter-spacing: 0.105em;
  text-transform: uppercase;
}

.technical-detail {
  display: none;
}

.world-instruction {
  margin: 0.48rem 0 0;
  color: var(--text-dim);
  font-size: clamp(0.62rem, 0.86vw, 0.76rem);
  letter-spacing: 0.035em;
}

.live-proof {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.72rem 0 0;
  color: rgba(164, 157, 145, 0.75);
  font-size: 0.58rem;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 10px rgba(255, 90, 42, 0.72);
}

.proof-separator {
  color: var(--ember);
}

.world-remains-link {
  flex: none;
  margin-top: 0.58rem;
  font-size: 0.5rem;
  letter-spacing: 0.17em;
}

.world-shell {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.world-stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
}

.work-explainer {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: clamp(1.25rem, 3.4vw, 3.2rem);
  width: min(555px, calc(100% - 315px));
  max-height: calc(100% - 1.6rem);
  padding: clamp(1rem, 2.5vh, 1.55rem) clamp(1rem, 2.3vw, 1.65rem);
  overflow-y: auto;
  border: 1px solid rgba(194, 185, 169, 0.22);
  border-left-color: rgba(255, 90, 42, 0.62);
  background:
    linear-gradient(105deg, rgba(11, 10, 9, 0.97) 0 72%, rgba(11, 10, 9, 0.88)),
    url("/lastwords-grain.png") center / cover;
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.58),
    inset 16px 0 28px rgba(255, 90, 42, 0.025);
  transform: translateY(-50%);
  scrollbar-width: thin;
}

.work-explainer::before {
  content: "";
  position: absolute;
  top: 0.8rem;
  bottom: 0.8rem;
  left: -1px;
  width: 1px;
  background: linear-gradient(
    transparent,
    rgba(255, 90, 42, 0.98) 24%,
    rgba(117, 166, 174, 0.72) 76%,
    transparent
  );
  box-shadow: 0 0 18px rgba(255, 90, 42, 0.4);
}

.close-explainer {
  appearance: none;
  position: absolute;
  top: 0.65rem;
  right: 0.72rem;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: rgba(164, 157, 145, 0.72);
  font: 300 1.25rem/1 var(--mono);
  cursor: pointer;
}

.close-explainer:hover,
.close-explainer:focus-visible {
  color: var(--text);
  outline: 1px solid rgba(255, 90, 42, 0.5);
}

.explainer-kicker {
  margin: 0 2.2rem 0.65rem 0;
  color: var(--ember);
  font-size: 0.48rem;
  letter-spacing: 0.24em;
}

.work-explainer h2 {
  margin: 0;
  color: rgba(242, 238, 229, 0.95);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-size: clamp(1.65rem, 3vw, 2.8rem);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 0.98;
}

.work-explainer h2 em {
  color: #ff8b68;
  font-style: italic;
  font-weight: 400;
}

.explainer-thesis {
  max-width: 49rem;
  margin: clamp(0.75rem, 1.8vh, 1rem) 0 0;
  color: rgba(214, 208, 196, 0.82);
  font-size: clamp(0.62rem, 0.82vw, 0.74rem);
  letter-spacing: 0.025em;
  line-height: 1.58;
}

.explainer-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: clamp(0.8rem, 2vh, 1.15rem) 0 0;
  padding: 0;
  border-top: 1px solid rgba(84, 78, 69, 0.55);
  border-bottom: 1px solid rgba(84, 78, 69, 0.55);
  list-style: none;
}

.explainer-steps li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.55rem;
  min-width: 0;
  padding: 0.72rem 0.65rem 0.72rem 0;
}

.explainer-steps li + li {
  padding-left: 0.65rem;
  border-left: 1px solid rgba(84, 78, 69, 0.44);
}

.step-number {
  color: var(--ember);
  font-size: 0.5rem;
  letter-spacing: 0.08em;
}

.explainer-steps strong,
.explainer-steps small {
  display: block;
}

.explainer-steps strong {
  color: rgba(242, 238, 229, 0.86);
  font-size: 0.54rem;
  font-weight: 500;
  letter-spacing: 0.075em;
  line-height: 1.35;
  text-transform: uppercase;
}

.explainer-steps small {
  margin-top: 0.3rem;
  color: rgba(164, 157, 145, 0.68);
  font-size: 0.47rem;
  line-height: 1.45;
}

.begin-ritual {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  min-width: 178px;
  margin-top: clamp(0.8rem, 1.8vh, 1.05rem);
  padding: 0.65rem 0;
  border: 0;
  border-bottom: 1px solid var(--ember);
  background: transparent;
  color: rgba(242, 238, 229, 0.94);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  cursor: pointer;
}

.begin-ritual:hover,
.begin-ritual:focus-visible {
  color: #ff8b68;
  outline: none;
  text-shadow: 0 0 14px rgba(255, 90, 42, 0.32);
}

.explainer-ending {
  margin: 0.65rem 0 0;
  color: rgba(164, 157, 145, 0.48);
  font-size: 0.45rem;
  letter-spacing: 0.035em;
  line-height: 1.5;
}

.explainer-technical {
  margin: 0.5rem 0 0;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(84, 78, 69, 0.38);
  color: rgba(117, 166, 174, 0.68);
  font-size: 0.43rem;
  letter-spacing: 0.025em;
  line-height: 1.5;
}

.begin-ritual:focus-visible {
  outline: 1px solid rgba(255, 90, 42, 0.72);
  outline-offset: 5px;
}

.world-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.lineage-scar {
  position: absolute;
  inset: -18%;
  z-index: 1;
  opacity: 0.48;
  background:
    radial-gradient(
      circle at var(--lineage-x, 50%) var(--lineage-y, 50%),
      transparent 0 12%,
      rgba(255, 91, 43, 0.035) 12.15%,
      transparent 12.45% 20%,
      rgba(117, 166, 174, 0.028) 20.12%,
      transparent 20.45% 100%
    ),
    conic-gradient(
      from var(--lineage-angle, 0deg) at var(--lineage-x, 50%) var(--lineage-y, 50%),
      transparent 0 9deg,
      rgba(255, 96, 47, 0.055) 9.4deg,
      transparent 10.2deg 126deg,
      rgba(117, 166, 174, 0.035) 126.4deg,
      transparent 127deg 360deg
    );
  mix-blend-mode: screen;
  transform: rotate(var(--lineage-angle, 0deg));
  transform-origin: var(--lineage-x, 50%) var(--lineage-y, 50%);
  transition: opacity 1.8s ease, transform 2.6s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.world-body.is-being-born .lineage-scar {
  opacity: 0.95;
  transform: rotate(calc(var(--lineage-angle, 0deg) + 18deg)) scale(1.08);
}

.world-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-bottom: 1px solid rgba(84, 78, 69, 0.36);
  pointer-events: none;
}

.mutation-epitaph {
  position: absolute;
  z-index: 3;
  left: clamp(1.25rem, 3.4vw, 3.2rem);
  top: 47%;
  width: min(31vw, 390px);
  transform: translateY(-50%);
  pointer-events: none;
}

.mutation-title {
  margin: 0;
  color: rgba(242, 238, 229, 0.82);
  font-size: clamp(0.72rem, 1.15vw, 1rem);
  letter-spacing: 0.28em;
  line-height: 1.65;
  text-transform: uppercase;
}

.epitaph-mark {
  display: block;
  width: 46px;
  height: 1px;
  margin: 0.9rem 0 1rem;
  background: var(--ember);
  box-shadow: 0 0 14px rgba(255, 90, 42, 0.35);
}

.mutation-consequence {
  margin: 0;
  color: var(--text-dim);
  font-size: clamp(0.66rem, 0.9vw, 0.8rem);
  line-height: 1.65;
  letter-spacing: 0.045em;
}

.whisper-stage {
  position: absolute;
  z-index: 3;
  left: 34%;
  right: 255px;
  bottom: 1.15rem;
  min-height: 82px;
  pointer-events: none;
}

.whisper-stage .stage-label {
  margin: 0 0 0.45rem;
  color: rgba(164, 157, 145, 0.62);
  font-size: 0.52rem;
  letter-spacing: 0.24em;
}

.whisper-stage .conversation {
  display: block;
  width: 100%;
  height: auto;
  max-height: 105px;
  overflow: hidden;
}

.whisper-stage .waiting-line {
  max-width: 34rem;
  color: rgba(242, 238, 229, 0.58);
  font-size: clamp(0.68rem, 0.92vw, 0.82rem);
  font-style: italic;
  line-height: 1.65;
}

.whisper-stage .msg {
  display: none;
}

.whisper-stage .msg.ai:last-of-type,
.whisper-stage .system-line:last-child {
  display: block;
}

.whisper-stage .msg.ai .msg-line {
  max-width: 38rem;
  color: rgba(242, 238, 229, 0.78);
  font-size: clamp(0.68rem, 0.95vw, 0.88rem);
  font-style: italic;
  line-height: 1.65;
  letter-spacing: 0.035em;
}

.whisper-stage .msg.user,
.whisper-stage .revive-line {
  display: none;
}

.whisper-stage .word.is-dead {
  opacity: 0.16;
  letter-spacing: 0.08em;
}

.whisper-stage .event-status {
  position: static;
  min-height: 1em;
  margin: 0.38rem 0 0;
  color: rgba(182, 67, 34, 0.8);
  font-size: 0.52rem;
}

.source-trace {
  position: absolute;
  z-index: 3;
  top: 0;
  right: 0;
  bottom: 0;
  width: 240px;
  padding: 1.2rem 1.1rem 1rem;
  border-left: 1px solid rgba(84, 78, 69, 0.38);
  background: rgba(5, 5, 4, 0.38);
  overflow: hidden;
}

.source-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.7rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(84, 78, 69, 0.3);
}

.source-heading h2 {
  margin: 0;
  color: rgba(242, 238, 229, 0.62);
  font-size: 0.56rem;
  font-weight: 500;
  letter-spacing: 0.16em;
}

#compile-status {
  color: rgba(164, 157, 145, 0.55);
  font-size: 0.46rem;
  letter-spacing: 0.1em;
}

#compile-status.is-pass {
  color: var(--green);
}

#compile-status.is-fail {
  color: var(--ember);
}

#source-code {
  max-height: calc(100% - 5.4rem);
  margin: 1rem 0 0;
  overflow: hidden;
  color: rgba(188, 181, 168, 0.68);
  font-family: var(--mono);
  font-size: 0.58rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

#source-code .code-delete {
  color: var(--ember);
}

#source-code .code-add {
  color: var(--green);
}

.compile-time {
  position: absolute;
  left: 1.1rem;
  right: 1.1rem;
  bottom: 0.95rem;
  margin: 0;
  color: rgba(164, 157, 145, 0.7);
  font-size: 0.52rem;
  line-height: 1.55;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.world-body .world-ritual {
  position: relative;
  z-index: 6;
  padding: 0.85rem clamp(1.25rem, 3.4vw, 3.2rem)
    calc(0.9rem + env(safe-area-inset-bottom));
  border-top: 0;
  background: rgba(6, 6, 5, 0.95);
}

.world-ritual #message-form {
  display: block;
  max-width: none;
}

.ritual-question-label {
  display: block;
  margin: 0.25rem 0 0.45rem;
  color: var(--ember-dim);
  font-size: 0.54rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.question-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  padding-bottom: 0.72rem;
  border-bottom: 1px solid rgba(84, 78, 69, 0.36);
  transition: border-color 180ms ease;
}

.question-row:focus-within {
  border-bottom-color: rgba(255, 90, 42, 0.72);
}

.world-ritual #message-input {
  min-height: 44px;
  padding: 0.45rem 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: clamp(0.88rem, 1.35vw, 1.18rem);
  letter-spacing: 0.06em;
}

.world-ritual #message-input:focus {
  border: 0;
  box-shadow: none;
}

.world-ritual #send-button {
  min-height: 44px;
  border-color: rgba(84, 78, 69, 0.72);
  padding: 0 1.05rem;
  font-size: 0.62rem;
}

.sacrifice-fieldset {
  min-width: 0;
  margin: 0 0 0.55rem;
  padding: 0;
  border: 0;
}

.sacrifice-fieldset legend {
  padding: 0;
  color: rgba(164, 157, 145, 0.62);
  font-size: 0.5rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sacrifice-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.1rem;
  margin-top: 0.55rem;
}

.sacrifice-option {
  appearance: none;
  position: relative;
  min-width: 0;
  min-height: 76px;
  padding: 0.48rem 0.65rem 0.35rem;
  border: 0;
  border-top: 1px solid rgba(84, 78, 69, 0.58);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--mono);
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms ease, color 180ms ease;
}

.sacrifice-option::after {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--ember);
  box-shadow: 0 0 12px rgba(255, 90, 42, 0.55);
  transition: width 220ms ease;
}

.sacrifice-option:hover,
.sacrifice-option:focus-visible,
.sacrifice-option.is-selected {
  color: var(--text);
  outline: none;
  border-top-color: rgba(255, 90, 42, 0.28);
}

.sacrifice-option.is-selected {
  border-top-color: var(--ember);
  background: rgba(255, 90, 42, 0.055);
  box-shadow: inset 0 0 0 1px rgba(255, 90, 42, 0.12);
}

.sacrifice-option.is-selected .sacrifice-word {
  color: #ff8b68;
}

.sacrifice-option:hover::after,
.sacrifice-option:focus-visible::after,
.sacrifice-option.is-selected::after {
  width: 100%;
}

.sacrifice-word {
  display: block;
  overflow: hidden;
  color: inherit;
  font-size: clamp(0.9rem, 1.35vw, 1.3rem);
  letter-spacing: 0.22em;
  line-height: 1.2;
  text-overflow: ellipsis;
}

.sacrifice-consequence {
  display: block;
  margin-top: 0.38rem;
  overflow: hidden;
  color: var(--ember-dim);
  font-size: 0.48rem;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sacrifice-preview {
  display: block;
  margin-top: 0.32rem;
  color: rgba(214, 208, 196, 0.64);
  font-size: 0.49rem;
  letter-spacing: 0.03em;
  line-height: 1.4;
}

.options-loading {
  grid-column: 1 / -1;
  margin: 0.5rem 0 0.35rem;
  color: var(--text-dimmer);
  font-size: 0.62rem;
}

.world-ritual .caption {
  max-width: none;
  margin: 0.55rem 0 0;
  color: rgba(164, 157, 145, 0.58);
  font-size: 0.48rem;
  text-align: left;
  letter-spacing: 0.08em;
}

.world-body .ash-canvas {
  z-index: 8;
}

.world-body.is-mutating .world-stage {
  animation: world-impact 850ms ease;
}

@keyframes world-impact {
  0% { filter: brightness(1); }
  18% { filter: brightness(1.75); }
  100% { filter: brightness(1); }
}

@media (max-width: 900px) {
  .world-body {
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    grid-template-rows: auto minmax(48dvh, 1fr) auto;
  }

  .world-header {
    padding: 1rem 1rem 0.75rem;
  }

  .world-accession {
    min-width: 132px;
    padding-left: 0.8rem;
  }

  .edition-label {
    font-size: 1.05rem;
  }

  .world-header .title {
    margin-bottom: 0.65rem;
    font-size: 0.62rem;
  }

  .art-definition {
    font-size: clamp(0.92rem, 3.1vw, 1.3rem);
  }

  .world-header .counter {
    margin-top: 0.55rem;
    font-size: clamp(1.05rem, 4.2vw, 1.5rem);
  }

  .world-state-row .counter {
    margin-top: 0;
  }

  .world-instruction {
    max-width: calc(100vw - 4rem);
    font-size: 0.62rem;
  }

  .header-cta {
    font-size: 0.48rem;
  }

  .world-remains-link {
    font-size: 0.5rem;
  }

  .world-stage {
    min-height: 48dvh;
  }

  .work-explainer {
    left: 1rem;
    width: min(540px, calc(100% - 205px));
    max-height: calc(100% - 1.1rem);
    padding: 1rem 1.1rem;
  }

  .source-trace {
    width: 168px;
    padding: 0.8rem 0.7rem;
    background: rgba(5, 5, 4, 0.22);
  }

  #source-code {
    font-size: 0.42rem;
    line-height: 1.55;
  }

  .compile-time {
    left: 0.7rem;
    right: 0.7rem;
    font-size: 0.42rem;
  }

  .mutation-epitaph {
    left: 1rem;
    top: 36%;
    width: calc(100% - 205px);
  }

  .mutation-title {
    font-size: 0.66rem;
  }

  .mutation-consequence {
    font-size: 0.58rem;
  }

  .whisper-stage {
    left: 1rem;
    right: 185px;
    bottom: 0.65rem;
  }

  .world-body .world-ritual {
    padding: 0.75rem 1rem
      calc(0.8rem + env(safe-area-inset-bottom));
  }

  .sacrifice-options {
    gap: 0.75rem;
  }
}

@media (max-width: 560px) {
  .world-body {
    min-height: 100dvh;
    grid-template-rows: auto minmax(42dvh, 1fr) auto;
  }

  .world-header {
    gap: 0.7rem;
  }

  .world-heading {
    width: calc(100% - 108px);
  }

  .world-accession {
    min-width: 100px;
    padding-left: 0.55rem;
  }

  .accession-kicker {
    font-size: 0.38rem;
  }

  .edition-label {
    font-size: 0.82rem;
    letter-spacing: 0.08em;
  }

  .lineage-label {
    max-width: 92px;
    overflow: hidden;
    font-size: 0.34rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .world-header .counter {
    gap: 0.2rem 0.38rem;
    margin-top: 0.48rem;
    font-size: 1.1rem;
  }

  .world-state-row {
    align-items: flex-start;
    gap: 0.35rem 0.8rem;
    margin-top: 0.5rem;
  }

  .world-state-row .counter {
    margin-top: 0;
  }

  .header-cta {
    width: fit-content;
    min-height: 44px;
    padding-block: 0.2rem;
    font-size: 0.42rem;
    letter-spacing: 0.1em;
  }

  .counter-label {
    width: 100%;
    margin: 0.18rem 0 0;
    font-size: 0.52rem;
  }

  .world-instruction {
    max-width: calc(100vw - 2rem);
    margin-top: 0.35rem;
    font-size: 0.53rem;
    line-height: 1.45;
  }

  .art-definition {
    font-size: 0.88rem;
    line-height: 1.08;
  }

  .word-counter {
    margin-top: 0.3rem;
    font-size: 0.4rem;
  }

  .live-proof {
    margin-top: 0.48rem;
    font-size: 0.45rem;
  }

  .explain-button {
    margin-top: 0.5rem;
    font-size: 0.39rem;
  }

  .world-remains-link {
    position: static;
    margin-top: 0.45rem;
    font-size: 0.4rem;
  }

  .world-stage {
    min-height: 42dvh;
  }

  .work-explainer {
    top: 0.55rem;
    left: 0.55rem;
    width: calc(100% - 1.1rem);
    max-height: calc(100% - 1.1rem);
    padding: 0.85rem 0.9rem;
    transform: none;
  }

  .work-explainer h2 {
    font-size: clamp(1.45rem, 7.2vw, 2rem);
  }

  .explainer-thesis {
    margin-top: 0.65rem;
    font-size: 0.54rem;
  }

  .explainer-steps {
    grid-template-columns: 1fr;
    margin-top: 0.7rem;
  }

  .explainer-steps li {
    grid-template-columns: 24px minmax(0, 1fr);
    padding: 0.42rem 0;
  }

  .explainer-steps li + li {
    padding-left: 0;
    border-top: 1px solid rgba(84, 78, 69, 0.36);
    border-left: 0;
  }

  .explainer-steps small {
    display: inline;
    margin: 0 0 0 0.35rem;
  }

  .begin-ritual {
    margin-top: 0.65rem;
    padding-block: 0.55rem;
  }

  .explainer-ending {
    margin-top: 0.5rem;
    font-size: 0.4rem;
  }

  .source-trace {
    top: 0.55rem;
    right: 0.55rem;
    bottom: auto;
    width: 132px;
    height: auto;
    padding: 0.55rem 0.6rem;
    border: 1px solid rgba(84, 78, 69, 0.38);
    background: rgba(5, 5, 4, 0.76);
  }

  .source-heading {
    padding-bottom: 0.4rem;
  }

  #source-code {
    display: none;
  }

  .compile-time {
    position: static;
    margin: 0.42rem 0 0;
    font-size: 0.38rem;
    line-height: 1.45;
  }

  .mutation-epitaph {
    top: 28%;
    width: calc(100% - 2rem);
  }

  .mutation-title {
    font-size: 0.56rem;
    letter-spacing: 0.2em;
  }

  .epitaph-mark {
    margin: 0.55rem 0 0.6rem;
  }

  .whisper-stage {
    right: 1rem;
    bottom: 0.45rem;
  }

  .whisper-stage .stage-label {
    font-size: 0.43rem;
  }

  .whisper-stage .msg.ai .msg-line,
  .whisper-stage .waiting-line {
    font-size: 0.54rem;
  }

  .question-row {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .world-ritual #send-button {
    width: 100%;
    min-height: 44px;
  }

  .sacrifice-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
    padding-bottom: 0.25rem;
    overflow: hidden;
  }

  .sacrifice-option {
    min-height: 52px;
    padding-inline: 0.35rem;
  }

  .sacrifice-word {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
  }

  .sacrifice-consequence,
  .sacrifice-preview {
    display: none;
  }

  .silence-block {
    padding-inline: 1rem;
  }

  .silence-block::before,
  .silence-block::after {
    display: none;
  }

  .rebirth-clock {
    align-items: center;
    flex-direction: column;
    gap: 0.35rem;
  }

  .birth-edition {
    font-size: clamp(3.2rem, 20vw, 5.2rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .world-body.is-mutating .world-stage {
    animation: none;
  }
}
