/* ————————————————————————————————————————————
   SORTILEGE · four ways of casting lots, explained
   night-indigo ground · vellum text · gilt · cinnabar
   ———————————————————————————————————————————— */

:root {
  --night: #0d0e16;
  --night-raised: #14161f;
  --night-well: #090a10;
  --vellum: #e8e0cd;
  --vellum-dim: #b5af9e;
  --slate: #8b93ab;
  --gold: #c9a45c;
  --gold-bright: #e3c98a;
  --cinnabar: #b8432f;
  --cinnabar-bright: #d95c42;
  --hairline: rgba(201, 164, 92, 0.22);
  --hairline-faint: rgba(201, 164, 92, 0.12);
  --display: 'IM Fell English', 'Iowan Old Style', Georgia, serif;
  --body: 'EB Garamond', 'Iowan Old Style', Georgia, serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--night);
  color: var(--vellum);
  font-family: var(--body);
  font-size: 1.125rem;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

::selection { background: var(--gold); color: var(--night); }

button {
  font-family: inherit;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ————— star field: two layers of tiny radial gradients, very quiet ————— */
.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1px 1px at 12% 22%, rgba(232,224,205,.55) 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 12%, rgba(232,224,205,.4) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 55% 38%, rgba(201,164,92,.45) 50%, transparent 51%),
    radial-gradient(1px 1px at 33% 66%, rgba(232,224,205,.35) 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 55%, rgba(232,224,205,.45) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 8% 84%, rgba(201,164,92,.3) 50%, transparent 51%),
    radial-gradient(1px 1px at 66% 88%, rgba(232,224,205,.4) 50%, transparent 51%),
    radial-gradient(1px 1px at 44% 8%, rgba(232,224,205,.3) 50%, transparent 51%),
    radial-gradient(1px 1px at 94% 80%, rgba(232,224,205,.3) 50%, transparent 51%),
    radial-gradient(1px 1px at 22% 45%, rgba(232,224,205,.25) 50%, transparent 51%);
  animation: star-breathe 9s ease-in-out infinite alternate;
}

@keyframes star-breathe {
  from { opacity: .5; }
  to { opacity: 1; }
}

header, nav, main, footer { position: relative; z-index: 1; }

/* ————— masthead ————— */
.masthead {
  text-align: center;
  padding: 4.5rem 1.5rem 2.5rem;
}

.masthead-rule {
  color: var(--gold);
  font-size: .85rem;
  letter-spacing: .6em;
  opacity: .8;
  margin-bottom: 1.4rem;
}

.wordmark {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2rem, 9vw, 5.2rem);
  letter-spacing: .14em;
  margin: 0 0 0 .14em; /* balance the trailing letter-space so the word sits centred */
  margin-right: 0;
  text-transform: uppercase;
  color: var(--vellum);
  text-shadow: 0 0 40px rgba(201, 164, 92, .25);
}

.subtitle {
  font-family: var(--body);
  font-style: italic;
  color: var(--slate);
  letter-spacing: .08em;
  margin: .6rem 0 0;
}

/* ————— the cabinet (nav) ————— */
.cabinet {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 11.5rem));
  justify-content: center;
  gap: .75rem;
  padding: 1rem 1.25rem 3rem;
}

.drawer {
  border: 1px solid var(--hairline);
  background: linear-gradient(180deg, var(--night-raised), var(--night));
  padding: .9rem .5rem .8rem;
  text-align: center;
  display: grid;
  gap: .1rem;
  transition: border-color .3s, background .3s, transform .3s;
}

.drawer:hover { border-color: var(--gold); transform: translateY(-2px); }

.drawer.active {
  border-color: var(--gold);
  background: linear-gradient(180deg, #1a1c28, var(--night-raised));
  box-shadow: 0 0 24px rgba(201, 164, 92, .12), inset 0 1px 0 rgba(227, 201, 138, .18);
}

.drawer-glyph {
  font-size: 1.5rem;
  color: var(--gold);
  line-height: 1.3;
}

.drawer-name {
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: .06em;
}

.drawer-sub {
  font-size: .72rem;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--slate);
}

/* ————— the source of chance ————— */
.chance-row {
  text-align: center;
  padding: 0 1.5rem 2.5rem;
  max-width: 46rem;
  margin: 0 auto;
}

.chance-label {
  display: block;
  font-size: .72rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: .8rem;
}

.chance-chips {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .6rem;
}

.chip {
  font-family: var(--body);
  font-size: .92rem;
  letter-spacing: .06em;
  color: var(--slate);
  border: 1px solid var(--hairline-faint);
  padding: .4rem 1.1rem;
  transition: color .3s, border-color .3s;
}

.chip:hover { color: var(--vellum); }

.chip.active {
  color: var(--gold-bright);
  border-color: var(--gold);
}

.chance-desc {
  font-style: italic;
  color: var(--slate);
  font-size: .95rem;
  max-width: 30rem;
  margin: .9rem auto 0;
}

.chance-status {
  font-size: .85rem;
  letter-spacing: .06em;
  color: var(--cinnabar-bright);
  min-height: 1.2em;
  margin: .5rem 0 0;
}

.stir-wrap {
  display: grid;
  justify-items: center;
  padding-top: 1.1rem;
}

.stir-wrap[hidden] { display: none; }

.stir-bowl {
  width: 8.5rem;
  height: 8.5rem;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  position: relative;
  display: grid;
  place-items: center;
  cursor: crosshair;
  touch-action: none;
  background: radial-gradient(circle at 40% 32%, #181a26, #0b0c13 70%);
  box-shadow: inset 0 6px 22px rgba(0, 0, 0, .6);
}

.stir-bowl::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  background: conic-gradient(var(--gold) calc(var(--fill, 0) * 1turn), transparent 0);
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 4px), black calc(100% - 3px));
  mask: radial-gradient(closest-side, transparent calc(100% - 4px), black calc(100% - 3px));
  transition: opacity .3s;
}

.bowl-text {
  font-size: .72rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--slate);
  pointer-events: none;
}

.provenance {
  text-align: center;
  font-size: .78rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--slate);
  margin: 2.4rem 0 0;
  opacity: .8;
}

.provenance::before { content: '— '; color: var(--gold); }
.provenance::after { content: ' —'; color: var(--gold); }

/* ————— oracle sections ————— */
main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.oracle { display: none; }
.oracle.active { display: block; animation: oracle-in .7s ease both; }

@keyframes oracle-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.invocation {
  font-family: var(--display);
  font-style: italic;
  text-align: center;
  color: var(--vellum-dim);
  font-size: 1.15rem;
  max-width: 34rem;
  margin: 0 auto 2rem;
}

/* ————— question field ————— */
.question-field {
  display: block;
  max-width: 30rem;
  margin: 0 auto 2.75rem;
}

.q-label {
  display: block;
  font-size: .72rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gold);
  text-align: center;
  margin-bottom: .5rem;
}

.question-field input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--hairline);
  color: var(--vellum);
  font-family: var(--body);
  font-style: italic;
  font-size: 1.15rem;
  text-align: center;
  padding: .4rem .5rem;
  transition: border-color .3s;
}

.question-field input::placeholder { color: rgba(139, 147, 171, .55); }
.question-field input:focus { outline: none; border-bottom-color: var(--gold); }

/* ————— ritual area & rite buttons ————— */
.ritual {
  display: grid;
  justify-items: center;
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.rite-btn {
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: .12em;
  color: var(--gold-bright);
  border: 1px solid var(--gold);
  padding: .7rem 2.2rem;
  background: transparent;
  transition: background .3s, color .3s, box-shadow .3s;
}

.rite-btn:hover {
  background: rgba(201, 164, 92, .12);
  box-shadow: 0 0 20px rgba(201, 164, 92, .2);
}

.rite-btn:active { transform: translateY(1px); }

.rite-btn.ghost {
  border-color: var(--hairline);
  color: var(--slate);
  font-size: .9rem;
  padding: .5rem 1.6rem;
}

.rite-btn.ghost:hover { color: var(--vellum); box-shadow: none; }

.rite-btn[disabled] { opacity: .4; pointer-events: none; }

/* ————— READINGS (shared) ————— */
.reading {
  border-top: 1px solid var(--hairline);
  padding-top: 2.5rem;
  animation: oracle-in .8s ease both;
}

.reading-question {
  text-align: center;
  font-style: italic;
  color: var(--slate);
  margin: 0 0 2rem;
}

.reading-question::before { content: '“'; }
.reading-question::after { content: '”'; }

.oracle-title {
  font-family: var(--display);
  text-align: center;
  font-weight: 400;
  font-size: 2rem;
  letter-spacing: .04em;
  margin: .2rem 0 .3rem;
}

.oracle-eyebrow {
  text-align: center;
  font-size: .72rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0;
}

.oracle-sub {
  text-align: center;
  color: var(--slate);
  font-style: italic;
  margin: 0 0 1.8rem;
}

.pronouncement {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.3rem;
  line-height: 1.55;
  text-align: center;
  max-width: 32rem;
  margin: 0 auto 1.6rem;
  color: var(--vellum);
}

.gloss {
  max-width: 32rem;
  margin: 0 auto 1.4rem;
  color: var(--vellum-dim);
}

.gloss .g-label {
  font-size: .72rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gold);
  display: block;
  text-align: center;
  margin-bottom: .35rem;
}

.gloss p { margin: 0; text-align: center; }

/* ————— colophon ————— */
.colophon {
  text-align: center;
  color: var(--slate);
  font-size: .9rem;
  padding: 3rem 1.5rem 4rem;
  border-top: 1px solid var(--hairline-faint);
  max-width: 46rem;
  margin: 0 auto;
}

.colophon p { margin: .3rem 0; }
.colophon a { color: var(--vellum-dim); text-decoration-color: var(--hairline); }
.colophon a:hover { color: var(--gold-bright); }
.colophon code { font-family: ui-monospace, monospace; font-size: .82em; color: var(--vellum-dim); }
.colophon-mark { color: var(--gold); margin-top: 1.2rem; }

/* ————— responsive ————— */
@media (max-width: 40rem) {
  body { font-size: 1.06rem; }
  .masthead { padding: 2.6rem 1.25rem 1.6rem; }
  .masthead-rule { margin-bottom: 1rem; }
  .cabinet { grid-template-columns: repeat(2, 1fr); gap: .55rem; padding-bottom: 2rem; }
  .drawer { padding: .75rem .4rem .65rem; }
  .chance-row { padding-bottom: 1.8rem; }
  .chip { padding: .55rem 1rem; }
  .invocation { font-size: 1.05rem; margin-bottom: 1.5rem; }
  .question-field { margin-bottom: 2rem; }
  main { padding: 0 1.1rem 3rem; }


  .pronouncement { font-size: 1.18rem; }
  .oracle-title { font-size: 1.7rem; }
  .colophon { padding: 2.2rem 1.25rem 3rem; font-size: .82rem; }
}

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

/* ════════════════════════════════════════════
   SORTILEGE — the teaching layer and the four stages
   ════════════════════════════════════════════ */

:root {
  --teach: #86b0a2;          /* verdigris: the voice that explains */
  --teach-dim: rgba(134, 176, 162, .55);
  --teach-hair: rgba(134, 176, 162, .25);
  --tibetan: 'Noto Serif Tibetan', 'Kailasa', serif;
  --nut: #5a3b22;
  --nut-light: #8a6340;
  --shell: #e6dcc6;
  --shell-dark: #cbbfa4;
}

.charter {
  max-width: 38rem;
  margin: 1.6rem auto 0;
  color: var(--vellum-dim);
  font-size: 1rem;
  line-height: 1.6;
  text-align: center;
  font-style: italic;
}

.tib { font-family: var(--tibetan); font-style: normal; color: var(--gold-bright); }

/* ————— primers ————— */
.primer {
  max-width: 40rem;
  margin: 0 auto 2.2rem;
  border: 1px solid var(--teach-hair);
  border-radius: 3px;
  background: rgba(134, 176, 162, .04);
}
.primer summary {
  cursor: pointer;
  list-style: none;
  padding: .8rem 1.2rem;
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: .06em;
  color: var(--teach);
  display: flex;
  align-items: center;
  gap: .7rem;
}
.primer summary::-webkit-details-marker { display: none; }
.primer summary::before { content: '◇'; font-size: .8em; transition: transform .3s; }
.primer[open] summary::before { content: '◆'; }
.primer summary:hover { color: var(--vellum); }
.primer-body { padding: 0 1.4rem 1.2rem; color: var(--vellum-dim); font-size: 1.02rem; }
.primer-body p { margin: 0 0 .9rem; }
.primer-body strong { color: var(--vellum); font-weight: 500; }

/* ————— mode choice (chain / nuts) ————— */
.mode-choice { display: flex; justify-content: center; gap: .5rem; margin: 0 0 1.8rem; flex-wrap: wrap; }
.mode-btn {
  font-family: var(--display);
  font-size: .95rem;
  letter-spacing: .06em;
  padding: .5rem 1.1rem;
  border: 1px solid var(--hairline-faint);
  border-radius: 2px;
  color: var(--slate);
  transition: color .3s, border-color .3s;
}
.mode-btn:hover { color: var(--vellum); }
.mode-btn.active { color: var(--gold-bright); border-color: var(--gold); }

/* ————— the stage ————— */
.stage { padding: 1rem 0 1.4rem; }

/* ————— the ledger ————— */
.ledger {
  list-style: none;
  counter-reset: step;
  max-width: 36rem;
  margin: 0 auto 1.6rem;
  padding: 0;
  border-left: 1px solid var(--teach-hair);
}
.ledger:empty { display: none; }
.ledger-line {
  position: relative;
  counter-increment: step;
  padding: .55rem 0 .55rem 2.6rem;
  color: var(--vellum-dim);
  font-size: 1.02rem;
  line-height: 1.55;
  animation: ledger-in .5s ease both;
}
.ledger-line::before {
  content: counter(step);
  position: absolute;
  left: -.85rem;
  top: .7rem;
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--night);
  border: 1px solid var(--teach);
  color: var(--teach);
  font-family: var(--display);
  font-size: .78rem;
}
.ledger-line b { color: var(--vellum); font-weight: 500; }
@keyframes ledger-in { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }

/* ————— arithmetic & notes in readings ————— */
.arithmetic { border-top: 1px solid var(--teach-hair); padding-top: 1rem; margin-top: 1.6rem; }
.arithmetic .g-label { color: var(--teach); }
.babalawo-note {
  max-width: 32rem;
  margin: 1.4rem auto 0;
  color: var(--slate);
  font-style: italic;
  font-size: .95rem;
  text-align: center;
}
.tone-bright, .tone-yes { color: var(--gold-bright) !important; }
.tone-good { color: var(--gold) !important; }
.tone-mixed, .tone-maybe { color: var(--vellum-dim) !important; }
.tone-dim, .tone-no { color: var(--cinnabar-bright) !important; }
.tone-dark { color: var(--cinnabar) !important; }

/* ————— MO: the dice ————— */
.die-pair { display: flex; justify-content: center; gap: 3rem; }
.die-slot { display: flex; flex-direction: column; align-items: center; gap: .7rem; }
.die {
  width: 6.2rem;
  height: 6.2rem;
  border-radius: 14%;
  background: linear-gradient(150deg, #f3ecd9, #cfc4a6);
  color: var(--night);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 -6px 12px rgba(0,0,0,.18), 0 10px 24px rgba(0,0,0,.45);
  transition: transform .4s, opacity .4s;
  opacity: .35;
  transform: rotate(-4deg);
}
.die.cast { opacity: 1; transform: none; }
.die.rolling { animation: die-roll .7s cubic-bezier(.3,.7,.3,1) both; opacity: 1; }
@keyframes die-roll {
  0% { transform: rotate(-4deg) translateY(0); }
  30% { transform: rotate(180deg) translateY(-30px) scale(1.05); }
  60% { transform: rotate(320deg) translateY(0); }
  80% { transform: rotate(350deg) translateY(-6px); }
  100% { transform: rotate(360deg); }
}
.die-tib { font-family: var(--tibetan); font-size: 2.6rem; line-height: 1; }
.die-lat { font-family: var(--display); font-size: .75rem; letter-spacing: .3em; margin-top: .3rem; }
.die[data-element="fire"] .die-tib { color: #a8351f; }
.die[data-element="water"] .die-tib { color: #234f8a; }
.die[data-element="wind"] .die-tib { color: #2e6b4c; }
.die[data-element="earth"] .die-tib { color: #8a6a12; }
.die[data-element="space"] .die-tib { color: #3a3f55; }
.die[data-element="wisdom"] .die-tib { color: #b0751a; text-shadow: 0 0 10px rgba(201,164,92,.5); }
.die-caption { font-size: .72rem; letter-spacing: .28em; text-transform: uppercase; color: var(--slate); }

.cat-table { max-width: 34rem; margin: 0 auto; border-top: 1px solid var(--hairline-faint); }
.cat-row {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 1rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--hairline-faint);
}
.cat-label { color: var(--gold); font-family: var(--display); font-size: .92rem; letter-spacing: .03em; }
.cat-text { color: var(--vellum-dim); }

/* ————— IFÁ: the chain ————— */
.ifa-stage { display: flex; flex-direction: column; align-items: center; gap: 2rem; }
.opele { display: flex; gap: 2.4rem; justify-content: center; position: relative; padding-top: .6rem; }
.opele::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  width: 6rem; height: 1.6rem;
  transform: translateX(-50%);
  border: 1px solid var(--gold);
  border-bottom: none;
  border-radius: 3rem 3rem 0 0;
  opacity: .5;
}
.opele[hidden] { display: none; }
.opele-arm { display: flex; flex-direction: column; gap: .7rem; align-items: center; position: relative; }
.opele-arm::before { content: ''; position: absolute; top: 0; bottom: 0; width: 1px; background: var(--hairline); z-index: 0; }
.pod {
  position: relative; z-index: 1;
  width: 2.2rem; height: 1.5rem;
  border-radius: 50% / 60%;
  background: var(--nut-light);
  box-shadow: inset 0 -3px 5px rgba(0,0,0,.35), 0 3px 6px rgba(0,0,0,.4);
  transition: transform .4s, background .4s;
}
.pod.closed { background: var(--nut); }
.pod.open { background: #c9a878; box-shadow: inset 0 3px 6px rgba(0,0,0,.45), 0 3px 6px rgba(0,0,0,.4); }
.pod.open::after { content: ''; position: absolute; inset: 25% 20%; border-radius: 50%; background: rgba(60,35,15,.45); }
.opele.thrown .pod { animation: pod-fall .6s ease both; }
.opele.thrown .opele-arm:nth-child(2) .pod { animation-delay: .08s; }
@keyframes pod-fall { 0% { transform: translateY(-40px) rotate(60deg); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* ————— IFÁ: the nuts ————— */
.ikin-hand { text-align: center; }
.ikin-hand[hidden] { display: none; }
.ikin-nuts { display: grid; grid-template-columns: repeat(8, 1.4rem); gap: .45rem; justify-content: center; margin-bottom: .8rem; }
.nut {
  width: 1.4rem; height: 1.6rem;
  border-radius: 50% 50% 45% 45%;
  background: radial-gradient(circle at 35% 30%, var(--nut-light), var(--nut) 70%);
  box-shadow: 0 2px 4px rgba(0,0,0,.5);
  transition: opacity .3s, transform .3s;
}
.nut.taken { opacity: .18; transform: translateY(-4px) scale(.9); }
.nut.left-behind { box-shadow: 0 0 0 2px var(--gold), 0 2px 4px rgba(0,0,0,.5); }
.ikin-caption { margin: 0; color: var(--slate); font-style: italic; font-size: .95rem; }

/* ————— IFÁ: the tray ————— */
.tray {
  display: flex;
  gap: 3.5rem;
  padding: 1.4rem 2.6rem 1.6rem;
  border-radius: 50% / 22%;
  background: radial-gradient(ellipse at 50% 40%, #3a2a1a, #221709 75%);
  box-shadow: inset 0 0 40px rgba(0,0,0,.6), 0 12px 30px rgba(0,0,0,.5);
  border: 1px solid rgba(201,164,92,.25);
}
.leg { display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.leg-label { font-size: .62rem; letter-spacing: .25em; text-transform: uppercase; color: var(--slate); margin-bottom: .2rem; }
.mark-slot {
  width: 2.6rem; height: 1.6rem;
  display: grid; place-items: center;
  border-bottom: 1px dotted rgba(232,224,205,.12);
}
.mark-slot.filled { border-bottom-color: transparent; animation: ledger-in .4s ease both; }

/* the marks themselves: single or double vertical stroke */
.mark { display: inline-flex; gap: .3rem; height: 1.2rem; align-items: stretch; }
.mark::before, .mark::after { content: ''; width: .22rem; background: var(--vellum); border-radius: 1px; box-shadow: 0 0 4px rgba(232,224,205,.4); }
.mark.m1::after { display: none; }
.mark.m2::after { display: block; }

.odu-big { display: flex; justify-content: center; gap: 3rem; margin: 1rem 0 1.8rem; }
.odu-big-leg { display: flex; flex-direction: column; align-items: center; gap: .55rem; }
.odu-big-leg .mark { height: 1.5rem; }
.odu-big-leg .mark::before, .odu-big-leg .mark::after { width: .28rem; }

.odu-parents { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; max-width: 40rem; margin: 1.4rem auto 0; }
.odu-card { border: 1px solid var(--hairline-faint); border-radius: 3px; padding: 1.1rem 1.1rem 1rem; text-align: center; }
.odu-role { font-size: .62rem; letter-spacing: .25em; text-transform: uppercase; color: var(--teach); }
.odu-marks { display: flex; flex-direction: column; align-items: center; gap: .4rem; margin: .7rem 0; }
.odu-card h3 { font-family: var(--display); font-weight: 400; font-size: 1.35rem; margin: .2rem 0 .1rem; }
.odu-gloss { color: var(--slate); font-style: italic; margin: 0 0 .7rem; font-size: .92rem; }
.odu-char { color: var(--vellum-dim); font-size: .95rem; margin: 0 0 .6rem; }
.odu-themes { color: var(--gold); font-size: .85rem; letter-spacing: .04em; margin: 0 0 .5rem; }
.odu-proverb { color: var(--vellum-dim); font-style: italic; font-size: .92rem; margin: 0; }

.seniority-wrap { max-width: 40rem; margin: 0 auto 1.6rem; }
.seniority-wrap summary { cursor: pointer; color: var(--teach); font-family: var(--display); font-size: .95rem; letter-spacing: .05em; text-align: center; list-style: none; }
.seniority-wrap summary::-webkit-details-marker { display: none; }
.seniority-wrap summary:hover { color: var(--vellum); }
.seniority { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: .9rem .6rem; counter-reset: sen; }
.seniority li { counter-increment: sen; display: flex; flex-direction: column; align-items: center; gap: .35rem; font-size: .9rem; }
.seniority li::before { content: counter(sen); font-family: var(--display); font-size: .7rem; color: var(--slate); }
.sen-marks { display: flex; flex-direction: column; gap: .25rem; }
.sen-marks .mark { height: .8rem; }
.sen-marks .mark::before, .sen-marks .mark::after { width: .16rem; }
.sen-name { color: var(--vellum-dim); }

/* ————— COWRIES: the mat ————— */
.cowrie-stage { display: flex; flex-direction: column; align-items: center; }
.mat {
  position: relative;
  width: min(22rem, 90vw);
  aspect-ratio: 1;
  border-radius: 4px;
  background:
    repeating-linear-gradient(90deg, rgba(232,224,205,.035) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(0deg, rgba(232,224,205,.035) 0 2px, transparent 2px 9px),
    #1b1710;
  border: 1px solid rgba(201,164,92,.25);
  box-shadow: inset 0 0 40px rgba(0,0,0,.5);
}
.shell {
  position: absolute;
  left: var(--x); top: var(--y);
  width: 2rem; height: 1.45rem;
  transform: translate(-50%, -50%) rotate(var(--r));
  border-radius: 50%;
  background: radial-gradient(ellipse at 40% 35%, #fff8e6, var(--shell) 55%, var(--shell-dark));
  box-shadow: 0 3px 6px rgba(0,0,0,.5);
  transition: opacity .4s;
}
.shell.waiting { opacity: .15; }
.shell.up::after {
  content: '';
  position: absolute;
  left: 18%; right: 18%; top: 42%;
  height: 3px;
  background: repeating-linear-gradient(90deg, #4a3a25 0 2px, transparent 2px 4px);
  border-radius: 2px;
}
.shell.down { background: radial-gradient(ellipse at 40% 30%, #f4ecd8, var(--shell-dark) 60%, #a89a7d); }
.shell.counted { box-shadow: 0 0 0 2px var(--gold), 0 3px 6px rgba(0,0,0,.5); }
.shell.counted::before {
  content: attr(data-n);
  position: absolute;
  top: -1.4rem; left: 50%;
  transform: translateX(-50%) rotate(calc(-1 * var(--r)));
  font-family: var(--display);
  font-size: .75rem;
  color: var(--gold-bright);
}
.mat.thrown .shell { animation: shell-fall .5s ease both; }
@keyframes shell-fall { 0% { opacity: 0; transform: translate(-50%, -120%) rotate(var(--r)); } 100% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--r)); } }
.mat-caption { margin: .9rem 0 0; color: var(--gold-bright); font-family: var(--display); font-size: 1.2rem; letter-spacing: .05em; min-height: 1.6em; }

.count-scale { display: grid; grid-template-columns: repeat(17, 1fr); gap: .25rem; max-width: 30rem; margin: 1.4rem auto .4rem; align-items: end; height: 5rem; }
.count-cell { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: .3rem; }
.count-cell i { display: block; width: 60%; height: calc(var(--p) * 3.6rem + 2px); background: var(--teach-dim); border-radius: 1px; }
.count-cell.here i { background: var(--gold-bright); }
.count-cell.ref i { opacity: .35; }
.count-cell b { font-family: var(--display); font-weight: 400; font-size: .68rem; color: var(--slate); }
.count-cell.here b { color: var(--gold-bright); }
.count-scale-caption { text-align: center; color: var(--slate); font-size: .82rem; font-style: italic; margin: 0; }

/* ————— OBI: the lobes ————— */
.obi-stage { display: flex; justify-content: center; }
.lobes { display: flex; gap: 1.6rem; padding: 1rem 0; }
.lobe {
  width: 3.4rem; height: 4.6rem;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  transform: rotate(var(--r));
  background: radial-gradient(ellipse at 40% 35%, #b8916a, #7a5535 70%);
  box-shadow: 0 6px 12px rgba(0,0,0,.5);
  opacity: .2;
  transition: opacity .4s;
}
.lobe.pale { opacity: 1; background: radial-gradient(ellipse at 40% 35%, #fbf3e0, #d9c9a4 70%); }
.lobe.dark { opacity: 1; background: radial-gradient(ellipse at 40% 35%, #6b4a2c, #3d2818 70%); }
.lobes.thrown .lobe { animation: lobe-fall .5s ease both; }
.lobes.thrown .lobe:nth-child(2) { animation-delay: .06s; }
.lobes.thrown .lobe:nth-child(3) { animation-delay: .12s; }
.lobes.thrown .lobe:nth-child(4) { animation-delay: .18s; }
@keyframes lobe-fall { 0% { opacity: 0; transform: translateY(-40px) rotate(calc(var(--r) + 90deg)); } 100% { opacity: 1; transform: rotate(var(--r)); } }

/* ————— responsive ————— */
@media (max-width: 40rem) {
  .charter { font-size: .92rem; }
  .die-pair { gap: 1.6rem; }
  .die { width: 5rem; height: 5rem; }
  .die-tib { font-size: 2.1rem; }
  .cat-row { grid-template-columns: 1fr; gap: .15rem; }
  .tray { gap: 2rem; padding: 1.1rem 1.6rem 1.3rem; }
  .odu-parents { grid-template-columns: 1fr; }
  .seniority { grid-template-columns: repeat(4, 1fr); gap: .7rem .3rem; font-size: .8rem; }
  .sen-name { font-size: .78rem; }
  .shell { width: 1.7rem; height: 1.25rem; }
  .lobes { gap: 1rem; }
  .ledger-line { padding-left: 2.2rem; font-size: .96rem; }
  .count-cell b { font-size: .58rem; }
}
