/* Ternion. One dark world by choice: a table of slate under a night sky.
   Layout: a full-window table; altars and the oracle across the top,
   columns below, the codex and map as overlays. */
/* The colour and type tokens (--void, --bone, --font-display, --cw ...) are
   written by scripts/build.ts from src/config/palette.ts into tokens.css. */

html,
body {
  height: 100%;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--void);
  color: var(--bone);
  font-family: var(--font-body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- glyph strokes ---------- */
.sigil,
.index {
  display: block;
  overflow: visible;
}
.sigil path,
.index path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sigil .g-orbit {
  fill: none;
  stroke: currentColor;
  stroke-width: 0.9;
  opacity: 0.42;
}
.sigil .g-bold {
  stroke-width: 2.8;
}
.sigil .g-fill,
.index .g-fill {
  fill: currentColor;
  stroke: none;
}
.sigil .g-band {
  fill: none;
  stroke: currentColor;
  stroke-width: 6;
  opacity: 0.9;
}
.sigil .g-core {
  opacity: 0.95;
}
.sigil.monad .g-band {
  stroke-width: 2.2;
  opacity: 1;
}
.sigil.monad .g-halo {
  fill: none;
  stroke: currentColor;
  stroke-width: 8;
  opacity: 0.1;
}
.sigil .g-rays {
  stroke-width: 0.9;
  opacity: 0.8;
}
.index path {
  stroke-width: 1.7;
}
.index .g-base {
  stroke-width: 0.8;
  opacity: 0.5;
}

/* ---------- cards ---------- */
.card {
  --realm: var(--bone);
  position: absolute;
  width: var(--cw);
  height: calc(var(--cw) * 1.4);
  border-radius: calc(var(--cw) * 0.06);
  background:
    radial-gradient(120% 70% at 50% 42%, color-mix(in srgb, var(--realm) 7%, var(--slate-hi)), var(--slate) 72%),
    var(--slate);
  border: 1px solid color-mix(in srgb, var(--realm) 34%, var(--line));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 6px 14px -6px rgba(0, 0, 0, 0.8),
    0 1px 2px rgba(0, 0, 0, 0.6);
  color: var(--realm);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.card[data-realm='rise'] {
  --realm: var(--ember);
}
.card[data-realm='sink'] {
  --realm: var(--tide);
}
.card[data-realm='whole'] {
  --realm: var(--whole);
}
.card .index {
  position: absolute;
  top: calc(var(--cw) * 0.035);
  left: calc(var(--cw) * 0.07);
  height: calc(var(--cw) * 0.22);
  width: auto;
}
.card .sigil {
  position: absolute;
  left: 9%;
  width: 82%;
  top: calc(var(--cw) * 0.42);
  filter: drop-shadow(0 0 calc(var(--cw) * 0.025) color-mix(in srgb, var(--realm) 55%, transparent));
}
.card .scale-pips {
  position: absolute;
  right: calc(var(--cw) * 0.07);
  top: calc(var(--cw) * 0.06);
  display: flex;
  gap: 3px;
}

/* ---------- screens ---------- */
.app {
  position: fixed;
  inset: 0;
}
/* The version, in tiny print in the bottom-left corner of every screen
   (Scott, 2026-10-19). It lets the mouse through, so it is never in the way. */
.version {
  position: absolute;
  z-index: 3;
  left: calc(env(safe-area-inset-left, 0px) + 10px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--mute);
  opacity: 0.6;
  pointer-events: none;
  user-select: none;
}
#sky {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}
button {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 1.5px solid var(--ember);
  outline-offset: 2px;
}

/* ---------- title ---------- */
.title {
  align-items: center;
  justify-content: center;
  text-align: center;
}
.title-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-inline: 16px;
}
.title-sigil {
  width: min(42vmin, 300px);
  color: var(--bone);
  transition: color 1.2s ease;
  filter: drop-shadow(0 0 10px color-mix(in srgb, currentColor 45%, transparent));
}
.title-sigil[data-realm='rise'] {
  color: var(--ember);
}
.title-sigil[data-realm='sink'] {
  color: var(--tide);
}
.title-sigil .sigil path,
.title-sigil .sigil circle {
  transition: opacity 0.6s;
}
.wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(44px, 9vmin, 92px);
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  text-transform: uppercase;
  color: var(--bone);
}
.tagline {
  margin: -6px 0 12px;
  font-style: italic;
  font-weight: 300;
  color: var(--mute);
  letter-spacing: 0.04em;
}
.begin {
  position: relative;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--bone) 40%, transparent);
  background: radial-gradient(circle, color-mix(in srgb, var(--bone) 10%, transparent), transparent 70%);
  cursor: pointer;
}
.begin-ring {
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  border: 2px solid var(--bone);
  animation: breathe 3.2s ease-in-out infinite;
}
.begin:hover .begin-ring {
  border-color: var(--ember);
}
/* the way to the introit: a glyph under Begin, no words */
.title-glyph {
  display: block;
  width: 30px;
  height: 30px;
  margin-top: 16px;
  color: var(--mute);
  opacity: 0.75;
  transition:
    color 0.3s,
    opacity 0.3s;
}
.title-glyph svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.title-glyph:hover,
.title-glyph:focus-visible {
  color: var(--ember);
  opacity: 1;
}
@keyframes breathe {
  0%,
  100% {
    transform: scale(0.85);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
  }
}

/* ---------- bar ---------- */
.bar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 12px 6px;
}
.bar-mid {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-width: 0;
}
.tool {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  color: color-mix(in srgb, var(--bone) 78%, transparent);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.tool:hover {
  color: var(--bone);
  border-color: var(--line);
  background: color-mix(in srgb, var(--slate-hi) 70%, transparent);
}
.tool:disabled {
  opacity: 0.3;
  cursor: default;
}
.tool svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tool svg .g-fill {
  fill: currentColor;
  stroke: none;
}
.tool.news {
  animation: news 1.6s ease-out 2;
}
@keyframes news {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--ember) 70%, transparent);
    color: var(--ember);
  }
  100% {
    box-shadow: 0 0 0 14px transparent;
  }
}
.oracle-btn.no-path {
  color: var(--rust);
}
body.muted [data-act='sound'] svg path {
  stroke-dasharray: 2 3;
  opacity: 0.6;
}
.rite-mark {
  width: 34px;
  height: 34px;
  color: var(--bone);
}
.rite-mark[data-layer='-'] {
  color: var(--tide);
}
.rite-mark[data-layer='+'] {
  color: var(--ember);
}
.rite-count {
  height: 22px;
  color: var(--mute);
}
.rite-count .index {
  height: 22px;
  width: auto;
}

/* ---------- table ---------- */
.table {
  position: relative;
  flex: 1;
  min-height: 0;
  perspective: 1400px;
}
.slots,
.cards {
  position: absolute;
  inset: 0;
}
.slot,
.lane,
.col-mark {
  position: absolute;
  left: 0;
  top: 0;
}
.slot {
  width: var(--cw);
  height: calc(var(--cw) * 1.4);
  border-radius: calc(var(--cw) * 0.06);
}
.slot.base {
  border: 1px dashed color-mix(in srgb, var(--bone) 16%, transparent);
  background: color-mix(in srgb, var(--night) 40%, transparent);
}
.slot.altar {
  border: 1px solid color-mix(in srgb, var(--bone) 18%, transparent);
  background:
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--bone) 7%, transparent) 0 28%, transparent 30%),
    radial-gradient(circle at 50% 50%, transparent 0 40%, color-mix(in srgb, var(--bone) 9%, transparent) 41% 42%, transparent 43%),
    color-mix(in srgb, var(--night) 60%, transparent);
  box-shadow: inset 0 0 calc(var(--cw) * 0.25) rgba(0, 0, 0, 0.6);
}
.slot.hover {
  border-color: color-mix(in srgb, var(--bone) 60%, transparent);
  border-style: solid;
}
.slot.pulse {
  animation: slot-pulse 0.9s ease-out;
}
@keyframes slot-pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--rust) 70%, transparent);
    border-color: var(--rust);
  }
  100% {
    box-shadow: 0 0 0 calc(var(--cw) * 0.15) transparent;
  }
}
.kb-ring {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  box-sizing: border-box;
  width: calc(var(--cw) + 10px);
  height: calc(var(--cw) * 1.4 + 10px);
  margin: -5px;
  border: 1.5px solid var(--ember);
  border-radius: calc(var(--cw) * 0.08);
  pointer-events: none;
  box-shadow: 0 0 14px color-mix(in srgb, var(--ember) 40%, transparent);
  transition: transform 0.12s ease;
}
.lane {
  width: var(--cw);
  pointer-events: none;
}
.lane.mirror {
  background: linear-gradient(180deg, color-mix(in srgb, var(--tide) 10%, transparent), transparent 70%);
  border-radius: calc(var(--cw) * 0.08) calc(var(--cw) * 0.08) 0 0;
}
.lane.tide {
  background: linear-gradient(180deg, color-mix(in srgb, var(--ember) 10%, transparent), transparent 70%);
}
.lane.mirror.tide {
  background: linear-gradient(180deg, color-mix(in srgb, var(--ember) 8%, transparent), color-mix(in srgb, var(--tide) 7%, transparent) 30%, transparent 70%);
}
.col-mark {
  width: calc(var(--cw) * 0.26);
  height: calc(var(--cw) * 0.26);
  color: var(--tide);
  pointer-events: none;
}
.col-mark.tide {
  color: var(--ember);
}
.col-mark svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}
.col-mark svg .g-fill {
  fill: currentColor;
  stroke: none;
}

.cards .card {
  cursor: grab;
  will-change: transform;
  transform-style: preserve-3d;
  backface-visibility: hidden;
}
.cards .card.buried {
  cursor: default;
}
.cards .card.buried .sigil {
  opacity: 0.55;
}
.cards .card.lifted {
  cursor: grabbing;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--realm) 50%, transparent),
    0 24px 40px -12px rgba(0, 0, 0, 0.9);
}
.cards .card.selected {
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--realm) 80%, transparent),
    0 0 calc(var(--cw) * 0.25) color-mix(in srgb, var(--realm) 35%, transparent);
}
.cards .card.turned {
  background:
    radial-gradient(120% 70% at 50% 58%, color-mix(in srgb, var(--realm) 14%, var(--slate-hi)), var(--slate) 72%),
    var(--slate);
}
.cards .card.glimmer {
  animation: glimmer 2.4s ease-out;
}
@keyframes glimmer {
  0%,
  100% {
    box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.8);
  }
  20%,
  60% {
    box-shadow:
      0 0 0 2px var(--realm),
      0 0 calc(var(--cw) * 0.35) var(--realm);
  }
}
.cards .card.ghost {
  pointer-events: none;
  opacity: 0.8;
  box-shadow: 0 0 calc(var(--cw) * 0.3) var(--realm);
}
.card .g-ring.fault,
.card [data-ring].fault {
  animation: fault 0.9s ease-out;
}
@keyframes fault {
  0%,
  60% {
    color: var(--rust);
    opacity: 1;
  }
  100% {
    color: inherit;
  }
}
.card .g-ring.fault path,
.card .g-ring.fault circle,
.card [data-ring].fault path,
.card [data-ring].fault circle {
  stroke: var(--rust);
}
.card .g-ring.fault .g-fill,
.card [data-ring].fault .g-fill {
  fill: var(--rust);
  stroke: none;
}
.card .fault-still path,
.card .fault-still circle {
  stroke: var(--rust);
}
.card .fault-still .g-fill {
  fill: var(--rust);
  stroke: none;
}
.card.refused {
  animation: refused 0.9s ease-out;
}
@keyframes refused {
  0% {
    border-color: var(--rust);
  }
}
.card [data-ring].join path,
.card [data-ring].join circle {
  animation: join 1.4s ease-out;
}
@keyframes join {
  0% {
    stroke: #fff;
    filter: drop-shadow(0 0 3px #fff);
  }
}
.card .g-ring.just-folded {
  animation: just-folded 1.6s ease-out;
}
@keyframes just-folded {
  0% {
    filter: drop-shadow(0 0 6px #fff) brightness(2);
  }
}
.fold-flash {
  position: absolute;
  left: 0;
  top: 0;
  width: 160px;
  height: 160px;
  margin: -80px 0 0 -80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 250, 235, 0.85), rgba(255, 230, 190, 0.25) 40%, transparent 70%);
  pointer-events: none;
  z-index: 900;
  mix-blend-mode: screen;
}
.card .ros {
  position: absolute;
  right: calc(var(--cw) * 0.07);
  top: calc(var(--cw) * 0.05);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  font: 500 calc(var(--cw) * 0.1) / 1.05 var(--font-mono);
  color: color-mix(in srgb, var(--realm) 80%, white);
  letter-spacing: 0.06em;
  pointer-events: none;
}
.card .ros b {
  font-weight: 500;
}
.card .ros i {
  font-style: normal;
  opacity: 0.65;
}
.table.asleep .cards .card {
  filter: saturate(0.4) brightness(0.75);
  transition: filter 1.2s;
}

/* ---------- panels: oracle and codex ---------- */
.panel {
  position: absolute;
  z-index: 50;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100%);
  overflow-y: auto;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 20px calc(env(safe-area-inset-bottom, 0px) + 24px);
  box-sizing: border-box;
  background: color-mix(in srgb, var(--night) 98%, transparent);
  border-left: 1px solid var(--line);
  box-shadow: -30px 0 60px -20px rgba(0, 0, 0, 0.8);
  transform: translateX(16px);
  opacity: 0;
  transition:
    transform 0.25s ease,
    opacity 0.25s ease;
}
.panel.open {
  transform: none;
  opacity: 1;
}
/* The Codex keeps one width on every page (Scott, 2026-10-19: it jumped,
   and left empty space on the right), and room for a scrollbar always, so
   a long page does not shift it. */
.panel.codex {
  width: min(480px, 100%);
  scrollbar-gutter: stable;
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.panel h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 30px;
  letter-spacing: 0.1em;
  text-wrap: balance;
}
.panel .close {
  border: 0;
  background: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: var(--mute);
  padding: 4px 8px;
}
.panel-note {
  color: var(--mute);
  font-size: 14px;
  line-height: 1.5;
  max-width: 62ch;
}
.panel-note .spent {
  color: var(--ember);
}
.tiers {
  list-style: none;
  padding: 0;
  margin: 18px 0;
  display: grid;
  gap: 8px;
}
.tier {
  width: 100%;
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--slate) 80%, transparent);
  cursor: pointer;
  transition:
    border-color 0.2s,
    background 0.2s;
}
.tier:hover {
  border-color: color-mix(in srgb, var(--ember) 60%, var(--line));
  background: var(--slate-hi);
}
.tier[data-idle] {
  opacity: 0.55;
}
.tier.on {
  border-color: var(--ember);
}
.tier-n {
  grid-row: span 2;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 20px;
  color: var(--ember);
  align-self: center;
  text-align: center;
}
.tier-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.tier-say {
  font-size: 13.5px;
  color: var(--mute);
}
.oracle-out {
  font-size: 15px;
  line-height: 1.55;
}
.oracle-out p {
  max-width: 62ch;
}
.oracle-out .thinking {
  color: var(--mute);
  font-style: italic;
}
.oracle-act {
  margin-top: 6px;
  padding: 8px 16px;
  border: 1px solid var(--ember);
  border-radius: 4px;
  background: none;
  color: var(--ember);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.05em;
}
.mini.card {
  position: relative;
  --cw: 64px;
  display: inline-block;
  flex: none;
}
.mini.card.big {
  --cw: 96px;
}
.reason-pair,
.law-row,
.seal-moment {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.onto,
.arrow {
  color: var(--mute);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
}
.laws-page .law {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 14px;
}
.laws-page h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0.03em;
}
.laws-page p {
  margin: 0 0 8px;
  color: color-mix(in srgb, var(--bone) 88%, transparent);
}

/* Five tabs never fit one row of the Codex: three, then two, in columns. */
.codex-tabs {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: start;
  gap: 6px;
  margin: 14px 0 6px;
}
@media (max-width: 420px) {
  .codex-tabs {
    grid-template-columns: repeat(2, auto);
  }
}
.codex-tabs button {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--mute);
}
.codex-tabs button.on {
  color: var(--bone);
  border-color: color-mix(in srgb, var(--bone) 50%, var(--line));
}
.seals {
  display: grid;
  gap: 12px;
}
.seal {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 4px 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--slate) 70%, transparent);
}
.seal.sealed {
  grid-template-columns: 54px;
  opacity: 0.35;
  border-style: dashed;
}
.seal-glyph {
  width: 54px;
  color: var(--bone);
}
.seal-glyph[data-realm='rise'] {
  color: var(--ember);
}
.seal-glyph[data-realm='sink'] {
  color: var(--tide);
}
.seal-glyph[data-realm='whole'] {
  color: var(--whole);
}
.seal-moment .mini.card {
  --cw: 46px;
}
.seal-count {
  font: 12px var(--font-mono);
  color: var(--mute);
}
.seal-words {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.5;
}
.glyph-note textarea {
  grid-column: 1 / -1;
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--void);
  color: var(--bone);
  font: 14px/1.4 var(--font-body);
}
.glyph-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 10px 0;
}
.codex-sub {
  margin: 14px 0 6px;
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--mute);
}
.glyph-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  gap: 6px;
}
.glyph-cell {
  --realm: var(--bone);
  display: grid;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: color-mix(in srgb, var(--slate) 80%, transparent);
  color: var(--realm);
  cursor: pointer;
}
.glyph-cell[data-realm='rise'] {
  --realm: var(--ember);
}
.glyph-cell[data-realm='sink'] {
  --realm: var(--tide);
}
.glyph-cell[data-realm='whole'] {
  --realm: var(--whole);
}
.glyph-cell .index {
  height: 12px;
  justify-self: center;
}
.glyph-cell.noted {
  border-color: color-mix(in srgb, var(--ember) 50%, var(--line));
}
.glyph-cell.on {
  border-color: var(--bone);
}

/* ---------- the fragments: the makers' words, in the Codex ---------- */
.frags {
  display: grid;
  gap: 10px;
}
.frag {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: start;
  margin: 0;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.frag p {
  margin: 0;
  font: italic 17px/1.5 var(--font-display);
  color: color-mix(in srgb, var(--bone) 92%, transparent);
  max-width: 52ch;
}
.frag-seal {
  width: 40px;
  color: var(--whole);
}
.frag-seal[data-realm='rise'] {
  color: var(--ember);
}
.frag-seal[data-realm='sink'] {
  color: var(--tide);
}
.frag-seal[data-realm='still'] {
  color: var(--bone);
}
.frag.sealed {
  display: flex;
  gap: 6px;
  padding: 16px 0;
  opacity: 0.4;
}
.frag.sealed span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mute);
}

/* ---------- the order: every glyph in its place ---------- */
.order-stage {
  display: grid;
  gap: 12px;
  margin: 16px 0 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.order-tablets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
}
.o-tablet-wrap {
  display: grid;
  justify-items: center;
  gap: 6px;
}
.o-mark {
  width: 22px;
  color: var(--bone);
}
.o-tablet {
  --n: clamp(26px, calc((min(100vw, 480px) - 130px) / 10), 52px);
  position: relative;
  width: calc(var(--n) * 3.3);
  height: calc(var(--n) * 1.1 * var(--rows));
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--void) 50%, transparent);
  transition: border-color 1s, box-shadow 1s;
}
.order-stage[data-w='1'] .o-tablet,
.order-stage[data-w='2'] .o-tablet {
  --n: 52px;
}
.o-tablet .tablet-lines {
  inset: 6px;
  width: calc(100% - 12px);
  height: calc(100% - 12px);
}
.order-stage.whole .o-tablet {
  border-color: color-mix(in srgb, var(--whole) 45%, var(--line));
  box-shadow: 0 0 22px -8px var(--whole);
}
.order-stage.fresh .o-tablet {
  animation: fresh 2.4s ease-out;
}
.tablet-lines .fresh {
  animation: lit-line 1.6s ease-out;
}
@keyframes lit-line {
  0% {
    stroke: #fff;
    stroke-width: 0.16;
    opacity: 0;
  }
}
.o-slot {
  --realm: var(--bone);
  position: absolute;
  left: calc(6px + var(--x) * var(--n) * 1.1 + var(--n) * 0.05);
  top: calc(6px + var(--y) * var(--n) * 1.1 + var(--n) * 0.05);
  width: var(--n);
  height: var(--n);
  box-sizing: border-box;
  padding: calc(var(--n) * 0.08);
  border-radius: 50%;
  border: 1px dashed color-mix(in srgb, var(--bone) 22%, transparent);
  background: color-mix(in srgb, var(--night) 85%, transparent);
  color: var(--realm);
  cursor: pointer;
}
.o-slot.locked {
  cursor: default;
}
.o-slot.locked {
  border: 1px solid color-mix(in srgb, var(--realm) 45%, transparent);
  background: radial-gradient(circle, color-mix(in srgb, var(--realm) 18%, var(--night)) 50%, var(--night) 72%);
}
.o-slot.locked .sigil {
  filter: drop-shadow(0 0 3px var(--realm));
}
.o-slot.hover {
  border: 1px solid var(--bone);
  background: color-mix(in srgb, var(--bone) 10%, var(--night));
}
.o-slot.just {
  animation: fresh 1.8s ease-out;
}
.o-slot.nope {
  animation: o-nope 0.7s ease-out;
}
@keyframes o-nope {
  0% {
    border-color: var(--rust);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--rust) 70%, transparent);
  }
  100% {
    box-shadow: 0 0 0 10px transparent;
  }
}
.o-palette {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.o-glyph {
  --realm: var(--bone);
  width: 48px;
  height: 48px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: color-mix(in srgb, var(--slate) 85%, transparent);
  color: var(--realm);
  cursor: grab;
  touch-action: none;
  transition: border-color 0.2s, opacity 0.2s;
}
.o-glyph:hover {
  border-color: color-mix(in srgb, var(--realm) 60%, var(--line));
}
.o-glyph.on {
  border-color: var(--realm);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--realm) 40%, transparent), 0 0 14px color-mix(in srgb, var(--realm) 35%, transparent);
}
.o-glyph.away {
  opacity: 0.25;
}
.o-glyph.nope {
  animation: nope 0.35s;
}
.o-float {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 300;
  pointer-events: none;
  cursor: grabbing;
  box-shadow: 0 14px 30px -8px rgba(0, 0, 0, 0.9), 0 0 16px color-mix(in srgb, var(--realm) 40%, transparent);
}
.o-slot[data-realm='rise'],
.o-glyph[data-realm='rise'],
.o-mark[data-realm='rise'] {
  --realm: var(--ember);
  color: var(--ember);
}
.o-slot[data-realm='sink'],
.o-glyph[data-realm='sink'],
.o-mark[data-realm='sink'] {
  --realm: var(--tide);
  color: var(--tide);
}
.o-glyph [data-ring].fault path,
.o-glyph [data-ring].fault circle {
  stroke: var(--rust);
}
.o-glyph [data-ring].fault circle.g-fill,
.o-glyph [data-ring].fault path.g-fill {
  fill: var(--rust);
  stroke: none;
}

/* ---------- the veil: a rite won ---------- */
/* the table's last card fades as the veil comes up (src/ui/app.ts win) */
.table.won .cards {
  opacity: 0;
  transition: opacity 0.6s ease;
}
.veil {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: radial-gradient(circle at 50% 45%, rgba(40, 34, 60, 0.55), rgba(4, 4, 8, 0.92) 70%);
  opacity: 0;
  transition: opacity 0.8s ease;
  cursor: pointer;
}
.veil.show {
  opacity: 1;
}
.monad-rise {
  width: min(46vmin, 320px);
  color: var(--whole);
  filter: drop-shadow(0 0 18px rgba(244, 236, 255, 0.7));
  animation: monad 2.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes monad {
  0% {
    transform: scale(0.2) rotate(-60deg);
    opacity: 0;
  }
  60% {
    transform: scale(1.08) rotate(4deg);
    opacity: 1;
  }
  100% {
    transform: none;
  }
}
.win-stats {
  display: grid;
  gap: 4px;
  justify-items: center;
  color: var(--mute);
}
.win-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.win-label {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
  width: 52px;
  text-align: right;
}
.win-row .index {
  height: 38px;
  width: auto;
  color: var(--bone);
}
.win-row:nth-child(2) .index {
  color: var(--mute);
}
.win-pure {
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ember);
}
.win-share {
  padding: 6px 14px;
  border: 1px solid color-mix(in srgb, var(--ember) 60%, transparent);
  border-radius: 999px;
  background: none;
  color: var(--ember);
  font: italic 16px var(--font-display);
  letter-spacing: 0.04em;
  cursor: pointer;
}
.win-text {
  width: min(320px, calc(100vw - 32px));
  height: 4.6em;
  resize: none;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--void);
  color: var(--bone);
  font: 13px/1.4 var(--font-mono);
}
.win-go {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--bone) 40%, transparent);
  background: none;
  cursor: pointer;
}
.win-go span {
  display: block;
  margin: auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--bone);
}

/* ---------- the lattice map ---------- */
.lattice {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  place-items: center;
  align-content: safe center;
  padding-block: 8px 24px;
  padding-inline: 16px;
}
.tablets {
  position: relative;
  z-index: 2;
  display: flex;
  gap: clamp(16px, 3vw, 44px);
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}
.tablet {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--night) 70%, transparent);
}
.tablet[data-layer='still'] {
  transform: scale(1.08);
}
.tablet-mark {
  width: 34px;
  color: var(--bone);
}
.tablet[data-layer='sink'] .tablet-mark {
  color: var(--tide);
}
.tablet[data-layer='rise'] .tablet-mark {
  color: var(--ember);
}
.tablet-grid {
  --node: clamp(52px, 7.4vw, 92px);
  position: relative;
  width: calc(var(--node) * 3.3);
  height: calc(var(--node) * 3.3);
}
.tablet-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.tablet-lines .grid line {
  stroke: var(--line);
  stroke-width: 0.02;
}
.tablet-lines .lit line {
  stroke: var(--whole);
  stroke-width: 0.06;
  stroke-linecap: round;
  filter: drop-shadow(0 0 0.05px #fff);
}
.tablet-lines .pillars circle {
  fill: none;
  stroke: var(--whole);
  stroke-width: 0.04;
}
.node {
  --realm: var(--bone);
  position: absolute;
  left: calc(var(--x) * var(--node) * 1.1 + var(--node) * 0.05);
  top: calc(var(--y) * var(--node) * 1.1 + var(--node) * 0.05);
  width: var(--node);
  height: var(--node);
  padding: calc(var(--node) * 0.1);
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--night) 90%, transparent) 60%, transparent 72%);
  color: var(--realm);
  cursor: pointer;
  transition:
    transform 0.2s,
    color 0.3s,
    opacity 0.3s;
}
.tablet[data-layer='rise'] .node {
  --realm: var(--ember);
}
.tablet[data-layer='sink'] .node {
  --realm: var(--tide);
}
.node .sigil {
  width: 100%;
  height: 100%;
}
.node-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--realm) 30%, transparent);
}
.node[data-state='locked'] {
  opacity: 0.22;
  cursor: default;
}
.node[data-state='open'] .node-ring {
  border-color: var(--realm);
  animation: breathe-ring 2.8s ease-in-out infinite;
}
.node[data-state='open']:hover,
.node[data-state='solved']:hover,
.node[data-state='pure']:hover {
  transform: scale(1.1);
}
.node[data-state='solved'],
.node[data-state='pure'] {
  background: radial-gradient(circle, color-mix(in srgb, var(--realm) 22%, var(--night)) 50%, transparent 72%);
}
.node[data-state='solved'] .sigil,
.node[data-state='pure'] .sigil {
  filter: drop-shadow(0 0 4px var(--realm));
}
.node[data-state='pure'] .node-ring {
  border: 2px solid var(--ember);
  box-shadow: 0 0 10px color-mix(in srgb, var(--ember) 50%, transparent);
}
.node.playing .node-ring {
  border-style: dashed;
}
.node.fresh {
  animation: fresh 2.2s ease-out;
}
.node.nope {
  animation: nope 0.35s;
}
@keyframes breathe-ring {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}
@keyframes fresh {
  0% {
    transform: scale(1.5);
    filter: brightness(3);
  }
}
@keyframes nope {
  25% {
    transform: translateX(-3px);
  }
  75% {
    transform: translateX(3px);
  }
}
.node-tip {
  position: absolute;
  left: 50%;
  top: calc(100% + 4px);
  z-index: 3;
  display: grid;
  gap: 2px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--night);
  color: var(--bone);
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  white-space: nowrap;
}
.node:hover .node-tip,
.node:focus-visible .node-tip {
  opacity: 1;
}
.node:hover {
  z-index: 4;
}
.tip-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tip-row i {
  width: 28px;
  font: italic 13px var(--font-display);
  color: var(--mute);
  text-align: right;
}
.tip-row .index {
  height: 20px;
  width: auto;
}
.finale .tablet-lines .lit line,
.finale .tablet-lines .pillars circle {
  animation: lit-line 1.4s ease-out backwards;
}
.finale .lattice-whole {
  animation: monad 4s cubic-bezier(0.2, 0.8, 0.2, 1) 1.8s backwards;
}
.order-whole {
  width: 120px;
  margin: 12px auto 0;
  color: var(--whole);
  filter: drop-shadow(0 0 12px rgba(244, 236, 255, 0.6));
}
.order-whole.fresh {
  animation: monad 3s cubic-bezier(0.2, 0.8, 0.2, 1) 0.6s backwards;
}
.map-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--bone);
}
.map-progress .index {
  height: 20px;
}
.mp-of {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--mute);
}
.mp-pure {
  color: var(--ember);
  margin-left: 8px;
}
.lattice-whole {
  width: 140px;
  margin: 18px auto 0;
  color: var(--whole);
  filter: drop-shadow(0 0 14px #fff);
  animation: monad 3s ease-out;
}

/* 0.14: a whole tablet (all nine won) has folded into one card; its mark
   shows that card. Just made whole, its nodes draw into the middle and
   back, as three cards draw into one on the table. */
.tablet.whole .tablet-mark {
  width: 46px;
  color: var(--whole);
  filter: drop-shadow(0 0 6px var(--whole));
}
.tablet.folding .node {
  --dx: calc((1 - var(--x)) * var(--node) * 1.1);
  --dy: calc((1 - var(--y)) * var(--node) * 1.1);
  animation: tablet-fold 1.8s cubic-bezier(0.5, 0, 0.3, 1) 0.3s;
}
.tablet.folding .tablet-mark {
  animation: monad 2s cubic-bezier(0.2, 0.8, 0.2, 1) 1.2s backwards;
}
@keyframes tablet-fold {
  45% {
    transform: translate(var(--dx), var(--dy)) scale(0.35);
    filter: brightness(2.5);
  }
}

/* The Ternion: once every tablet is whole, a ring under them opens the last
   rite. Won, it is the Monad (.lattice-whole) and still opens the rite. */
.ternion {
  --realm: var(--whole);
  position: relative;
  z-index: 2;
  display: block;
  width: 96px;
  height: 96px;
  margin: 40px auto 0;
  padding: 12px;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--night) 90%, transparent) 60%, transparent 72%);
  color: var(--whole);
  cursor: pointer;
}
.ternion .sigil {
  width: 100%;
  height: 100%;
}
.ternion[data-state='open'] .node-ring {
  border-color: var(--whole);
  animation: breathe-ring 2.8s ease-in-out infinite;
}
.ternion[data-state='open'] .sigil {
  opacity: 0.45;
}
.ternion.lattice-whole {
  width: 140px;
  height: 140px;
  padding: 0;
  background: none;
}
.ternion.lattice-whole .node-ring {
  display: none;
}
.rite-mark[data-layer='whole'] {
  color: var(--whole);
}

/* Begin anew: a round button under the Deep's, the same size, showing a
   spiral wound out from a seed. Pressed once it asks, with a question mark;
   pressed again soon after, every rite is forgotten (src/ui/app.ts).
   Scott, 2026-10-19: the old mark was too small and faint, and its rust
   read as an error. */
.anew-mark {
  position: relative;
  z-index: 2;
  width: 64px;
  height: 64px;
  margin-top: 34px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--bone) 35%, transparent);
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--bone) 6%, var(--night)) 50%, transparent 72%);
  color: var(--bone);
  cursor: pointer;
  transition:
    transform 0.2s,
    border-color 0.2s;
}
.anew-mark svg {
  display: block;
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.anew-mark .g-fill {
  fill: currentColor;
  stroke: none;
}
.anew-mark:hover,
.anew-mark:focus-visible {
  transform: scale(1.08);
  border-color: var(--bone);
}
.anew-mark .anew-ask,
.anew-mark.armed .anew-glyph {
  display: none;
}
.anew-mark.armed .anew-ask {
  display: block;
}
.anew-mark.armed {
  border-color: var(--bone);
}
/* The question mark breathes; the button itself stays still under the hand. */
.anew-mark.armed .anew-ask {
  animation: ask 1.2s ease-in-out infinite;
}
@keyframes ask {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}
.deep {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 26px;
}
.deep-btn {
  --realm: var(--whole);
  position: relative;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--realm) 35%, transparent);
  background: radial-gradient(circle, color-mix(in srgb, var(--realm) 8%, var(--night)) 50%, transparent 72%);
  color: var(--realm);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}
.deep-btn:hover {
  transform: scale(1.08);
  border-color: var(--realm);
}
.deep-btn .deep-mark {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
}
.deep-btn[data-deep='daily'] {
  --realm: var(--ember);
}
.deep-btn[data-state='playing'] {
  border-style: dashed;
}
.deep-btn[data-state='solved'] {
  background: radial-gradient(circle, color-mix(in srgb, var(--realm) 24%, var(--night)) 50%, transparent 72%);
}
.deep-btn[data-state='pure'] {
  border: 2px solid var(--ember);
  box-shadow: 0 0 10px color-mix(in srgb, var(--ember) 50%, transparent);
  background: radial-gradient(circle, color-mix(in srgb, var(--realm) 24%, var(--night)) 50%, transparent 72%);
}
.deep-btn.dealing {
  animation: breathe-ring 1.2s ease-in-out infinite;
  cursor: progress;
}
.deep-n {
  color: var(--mute);
}
.deep-streak {
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  transform: translateX(-50%);
  color: var(--ember);
}
.deep-streak .index {
  height: 16px;
  width: auto;
}
.deep-n .index {
  height: 20px;
}
.rite-mark[data-layer='deep'] {
  color: var(--whole);
}
.rite-mark .deep-mark {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
}

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

/* ---------- narrow screens ---------- */
.table.compact .card .index {
  top: calc(var(--cw) * 0.05);
  left: calc(var(--cw) * 0.05);
  height: calc(var(--cw) * 0.36);
  max-width: calc(var(--cw) * 0.9);
}
.table.compact .card .sigil {
  top: calc(var(--cw) * 0.5);
}
.table.compact .card .ros {
  display: none;
}
@media (max-width: 640px) {
  .bar {
    padding-inline: 4px;
    gap: 0;
  }
  .tool {
    width: 36px;
    height: 36px;
  }
  .bar-mid {
    gap: 6px;
  }
  .tablet-grid {
    --node: 62px;
  }
  .tablet[data-layer='still'] {
    transform: none;
  }
}
/* stacked on a narrow screen: the rise on top, the sink at the bottom */
@media (max-width: 800px) {
  .tablets {
    flex-direction: column-reverse;
  }
}

/* ======================================================================
   0.3: the Glimmer, the Rosetta toggle, the manual (0.7: readers and the
   profile taken out again).
   Everything above this line is the 0.2 look, unchanged.
   ====================================================================== */

/* ---------- the bar ---------- */
.tool-gap {
  width: 10px;
  flex: none;
}
.tool svg .g-bold {
  stroke-width: 2.4;
}
.rosetta-tool.on {
  color: var(--ember);
  border-color: color-mix(in srgb, var(--ember) 45%, var(--line));
  background: color-mix(in srgb, var(--ember) 10%, transparent);
}

/* ---------- the Glimmer: a spark with three rays, below the table ---------- */
.glimmer-fab {
  position: absolute;
  z-index: 30;
  right: max(18px, env(safe-area-inset-right, 0px) + 12px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--ember) 38%, transparent);
  background:
    radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--ember) 22%, transparent), transparent 62%),
    color-mix(in srgb, var(--night) 88%, transparent);
  color: var(--ember);
  cursor: pointer;
  user-select: none;
  touch-action: manipulation; /* a double tap is a double press, never a zoom */
  box-shadow:
    0 10px 30px -12px rgba(0, 0, 0, 0.9),
    0 0 26px -6px color-mix(in srgb, var(--ember) 45%, transparent);
  transition:
    transform 0.25s ease,
    color 0.4s ease,
    border-color 0.4s ease,
    box-shadow 0.4s ease;
}
.glimmer-fab:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow:
    0 14px 34px -12px rgba(0, 0, 0, 0.9),
    0 0 34px -4px color-mix(in srgb, var(--ember) 65%, transparent);
}
.glimmer-fab:active {
  transform: scale(0.96);
}
/* three arcs of light circling, as the deck counts: in threes */
.fab-halo {
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    currentColor 0deg 54deg,
    transparent 54deg 120deg,
    currentColor 120deg 174deg,
    transparent 174deg 240deg,
    currentColor 240deg 294deg,
    transparent 294deg 360deg
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
  opacity: 0.55;
  animation: fab-turn 12s linear infinite;
  pointer-events: none;
}
.fab-rays {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  box-shadow: 0 0 22px 2px color-mix(in srgb, currentColor 30%, transparent);
  animation: breathe 4.2s ease-in-out infinite;
  pointer-events: none;
}
.fab-glyph svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px color-mix(in srgb, currentColor 70%, transparent));
}
.fab-glyph svg .g-fill {
  fill: currentColor;
  stroke: none;
}
.glimmer-fab.burst .fab-halo {
  animation:
    fab-burst 0.9s cubic-bezier(0.1, 0.6, 0.3, 1),
    fab-turn 12s linear infinite;
}
.glimmer-fab.burst .fab-glyph svg {
  animation: fab-third 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.glimmer-fab.no-path {
  color: var(--rust);
  border-color: color-mix(in srgb, var(--rust) 45%, transparent);
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.9);
}
.glimmer-fab.no-path .fab-halo {
  animation-play-state: paused;
  opacity: 0.3;
}
.glimmer-fab.no-path .fab-rays {
  animation: none;
  opacity: 0.4;
}
.glimmer-fab.nope {
  animation: fab-nope 0.4s ease;
}
/* pressed twice: the solver is looking for the way; the arcs turn fast */
.glimmer-fab.seeking .fab-halo {
  animation: fab-turn 1.1s linear infinite;
  opacity: 0.9;
}
@keyframes fab-turn {
  to {
    transform: rotate(360deg);
  }
}
@keyframes fab-burst {
  0% {
    transform: scale(1);
    opacity: 0.95;
  }
  100% {
    transform: scale(1.9);
    opacity: 0;
  }
}
@keyframes fab-third {
  0% {
    transform: rotate(0) scale(1);
  }
  40% {
    transform: rotate(80deg) scale(1.25);
  }
  100% {
    transform: rotate(120deg) scale(1);
  }
}
@keyframes fab-nope {
  0%,
  100% {
    translate: 0;
  }
  25% {
    translate: -5px;
  }
  75% {
    translate: 5px;
  }
}

/* ---------- the manual: the first page of the Codex ---------- */
.manual-title {
  margin: 10px 0 4px;
  font: italic 15px/1.4 var(--font-display);
  letter-spacing: 0.06em;
  color: var(--mute);
}
.laws-page .law.page h3 {
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-seal {
  width: 30px;
  height: 30px;
  flex: none;
  color: var(--bone);
}
.page-seal[data-realm='rise'] {
  color: var(--ember);
}
.page-seal[data-realm='sink'] {
  color: var(--tide);
}
.page-seal[data-realm='whole'] {
  color: var(--whole);
}
.laws-page p.riddle {
  margin: 2px 0 8px;
  font: italic 17px/1.45 var(--font-display);
  color: color-mix(in srgb, var(--ember) 85%, var(--bone));
}
.laws-page p.verse {
  margin: 0 0 12px;
  font: 400 19px/1.5 var(--font-display);
  letter-spacing: 0.01em;
  color: color-mix(in srgb, var(--bone) 92%, transparent);
}
.verse .line {
  display: block;
}
.verse .line:nth-child(2n) {
  padding-left: 1.2em;
}
.law-row {
  margin: 6px 0 10px;
}
.law-row.legend {
  gap: 14px;
}
.plate-card {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin: 0;
}
.plate-card figcaption {
  font: italic 13px/1.2 var(--font-display);
  color: var(--mute);
}
.law-row.refused .mini.card {
  outline: 1px solid color-mix(in srgb, var(--rust) 50%, transparent);
  outline-offset: 2px;
}
.plate-mark svg {
  width: 40px;
  height: 40px;
  fill: none;
  stroke: var(--tide);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.plate-mark svg .g-fill {
  fill: var(--tide);
  stroke: none;
}
.plate-mark svg .g-bold {
  stroke-width: 2.2;
}
.law-row.marks .plate-mark svg {
  stroke: var(--bone);
}
.law-row.marks .plate-mark svg .g-fill {
  fill: var(--bone);
}
.plate-altar,
.plate-bed {
  display: inline-block;
  width: 26px;
  height: 36px;
  border-radius: 3px;
}
.plate-altar {
  border: 1px solid color-mix(in srgb, var(--bone) 35%, transparent);
  background: radial-gradient(circle, color-mix(in srgb, var(--bone) 14%, transparent) 0 22%, transparent 26%);
}
.plate-bed {
  height: 46px;
  border: 1px dashed color-mix(in srgb, var(--bone) 30%, transparent);
}
.plate-op {
  font: italic 18px/1 var(--font-display);
  color: var(--mute);
}
.plate-stack {
  display: inline-flex;
  flex-direction: column;
}
.plate-carried {
  width: 30px;
  height: 14px;
  margin-top: -4px;
  border: 1px solid color-mix(in srgb, var(--bone) 45%, transparent);
  border-radius: 3px;
  background: var(--slate);
}

@media (max-width: 640px) {
  .tool-gap {
    width: 2px;
  }
  .glimmer-fab {
    width: 58px;
    height: 58px;
    right: 14px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .fab-halo,
  .fab-rays {
    animation: none;
  }
}

/* ---------- the introit (introit.html): the game playing itself ---------- */
.teaser .cards,
.teaser .slots {
  pointer-events: none;
}
.teaser-riddle {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 6vh);
  width: min(90vw, 900px);
  margin: 0;
  transform: translateX(-50%);
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(22px, 3.6vmin, 40px);
  letter-spacing: 0.02em;
  color: var(--bone);
  text-shadow: 0 0 18px var(--void);
  opacity: 0;
  transition: opacity 0.7s ease;
  pointer-events: none;
}
.teaser-riddle.on {
  opacity: 0.9;
}
/* The way into the game: the introit's one call to act, always showing.
   The Monad alone, glowing; no words. */
.teaser-play {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 4vh);
  display: block;
  box-sizing: border-box;
  width: clamp(104px, 15vmin, 160px);
  aspect-ratio: 1;
  padding: clamp(14px, 2.2vmin, 24px);
  border: 1px solid color-mix(in srgb, var(--whole) 40%, transparent);
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--whole) 16%, transparent), transparent 72%);
  color: var(--whole);
  transform: translateX(-50%);
  animation: cta-glow 3.2s ease-in-out infinite;
  transition:
    transform 0.4s ease,
    border-color 0.4s;
}
.teaser-play[hidden] {
  display: none;
}
.teaser-play .sigil {
  display: block;
  width: 100%;
  height: 100%;
}
.teaser-play:hover,
.teaser-play:focus-visible {
  border-color: var(--whole);
  transform: translateX(-50%) scale(1.07);
}
@keyframes cta-glow {
  0%,
  100% {
    box-shadow: 0 0 18px color-mix(in srgb, var(--whole) 25%, transparent);
    filter: drop-shadow(0 0 6px rgba(244, 236, 255, 0.35));
  }
  50% {
    box-shadow: 0 0 48px color-mix(in srgb, var(--whole) 50%, transparent);
    filter: drop-shadow(0 0 16px rgba(244, 236, 255, 0.75));
  }
}
@media (prefers-reduced-motion: reduce) {
  .teaser-play {
    animation: none;
  }
}
/* the riddle sits above the button; in a film there is no button */
.teaser:not(.filming) .teaser-riddle {
  bottom: calc(env(safe-area-inset-bottom, 0px) + 4vh + clamp(104px, 15vmin, 160px) + 20px);
}
