/* =====================================================================
   Succession - fixed "naturalist's desk" theme.
   Ivory specimen plates, fine ink rules, watercolour trait dots and a
   walnut desk. The shared base.css is loaded (back chip + resets) but
   glass.css deliberately is not: this game keeps its own paper chrome
   (.c-bar, .c-btn, .c-modal and friends).
   ===================================================================== */

:root {
  --plate-hi: #fbf5e6;
  --plate: #f2e8d3;
  --plate-lo: #e3d6b9;
  --plate-line: rgba(122, 102, 70, .40);
  --ink: #2e2a22;
  --ink-soft: #6a6151;
  --ink-faint: rgba(70, 62, 48, .56);
  --oxblood: #8e3325;
  --sage: #5c6f42;
  --ochre: #a97c2c;
  --teal: #386a67;
  --plum: #6b4763;
  --slate: #4a5561;

  --desk-a: #4b3627;
  --desk-b: #35251b;
  --desk-c: #241a13;
  --desk-line: rgba(255, 236, 206, .045);

  --font-body: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
}

/* ---------- The desk ---------- */
/* The whole board is one screen: no page scrollbar, ever. The desk itself is
   the only thing that may scroll (on very short windows) and its scrollbar is
   hidden, so the layout never shifts or gains a gutter. */
body.s-page {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-color: var(--desk-b);
  background-image:
    radial-gradient(120% 68% at 50% -16%, rgba(255, 232, 196, .10), transparent 62%),
    repeating-linear-gradient(94deg, var(--desk-line) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .07) 0 1px, transparent 1px 34px),
    radial-gradient(92% 62% at 50% 118%, rgba(0, 0, 0, .48), transparent 72%),
    linear-gradient(178deg, var(--desk-a), var(--desk-b) 60%, var(--desk-c));
  background-attachment: fixed;
}
body.s-page *,
body.s-page *::before,
body.s-page *::after { box-sizing: border-box; }

.s-app {
  position: relative;
  z-index: 1;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: none;
}

/* ---------- Top bar: a strip of pressed card stock ---------- */
.c-bar {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px clamp(12px, 3vw, 26px) 11px;
  color: var(--ink);
  background: linear-gradient(180deg, var(--plate-hi), var(--plate) 58%, var(--plate-lo));
  border-bottom: 1px solid rgba(110, 92, 62, .45);
  box-shadow: 0 6px 20px rgba(10, 6, 3, .45), inset 0 1px 0 rgba(255, 255, 255, .82);
}
/* Two ink rules, like the head of a printed plate. */
.c-bar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 3px;
  height: 1px;
  background: rgba(110, 92, 62, .22);
  pointer-events: none;
}

.c-bar__brand { display: flex; align-items: center; gap: 9px; }
.c-bar__brand svg { display: block; filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .8)); }
.c-bar__title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(19px, 3vw, 26px);
  font-weight: 700;
  letter-spacing: -.01em;
  color: #2b2419;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .7);
}
.c-bar__stats { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.stat {
  font-size: 13px;
  letter-spacing: .02em;
  color: var(--ink-soft);
}
.stat b {
  font-family: var(--font-mono);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
/* The tally re-inks itself when a point lands, in the colour of whoever took
   it. The number can change on a duel you were not watching. */
@keyframes sInkYou {
  0% { color: #465a31; transform: scale(1.26); }
  100% { color: var(--ink); transform: none; }
}
@keyframes sInkThem {
  0% { color: #8e3325; transform: scale(1.26); }
  100% { color: var(--ink); transform: none; }
}
.stat b.is-gain,
.stat b.is-loss { display: inline-block; }
.stat b.is-gain { animation: sInkYou .6s ease-out both; }
.stat b.is-loss { animation: sInkThem .6s ease-out both; }
.c-bar__controls { display: flex; align-items: center; gap: 6px; margin-left: auto; }

/* Buttons read as small specimen tabs with a hard bottom edge. */
.c-btn {
  appearance: none;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .01em;
  padding: 7px 14px;
  border-radius: 2px;
  color: #3a3226;
  background: linear-gradient(180deg, #fffdf4, #ece0c6);
  border: 1px solid rgba(120, 100, 68, .48);
  box-shadow: 0 2px 0 rgba(120, 100, 68, .24), 0 4px 10px rgba(12, 8, 4, .22);
  cursor: pointer;
  transition: transform .06s ease, box-shadow .12s ease, filter .12s ease;
}
.c-btn:hover { filter: brightness(1.03); }
.c-btn:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(120, 100, 68, .24); }
.c-btn:focus-visible { outline: 2px solid #8a6a34; outline-offset: 2px; }
.c-btn:disabled {
  opacity: .5;
  cursor: default;
  box-shadow: 0 1px 0 rgba(120, 100, 68, .2);
  transform: none;
}
.c-btn--primary {
  color: #fdf4e4;
  background: linear-gradient(180deg, #7d3b2a, #632819);
  border-color: #4f1c10;
  box-shadow: 0 2px 0 #40160c, 0 4px 12px rgba(50, 10, 4, .34);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .32);
}
.c-btn--ghost {
  background: rgba(255, 253, 244, .55);
  box-shadow: none;
}

/* ---------- The desk surface ---------- */
.s-desk {
  width: min(97vw, 1440px);
  margin: 0 auto;
  padding: clamp(6px, 1.2vh, 12px) 0 clamp(8px, 1.6vh, 16px);
  flex: 1 1 auto;
  min-height: 0;
  /* Safety valve for very short windows: the desk scrolls internally, with the
     scrollbar hidden, so the page itself never gains one. */
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  display: flex;
  flex-direction: column;
  gap: clamp(7px, 1.2vh, 12px);
}
.s-desk::-webkit-scrollbar { width: 0; height: 0; }
@media (min-width: 1180px) {
  .s-desk { width: min(96vw, 1720px); }
}

.s-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: rgba(238, 224, 196, .48);
}

/* ---------- Weather ---------- */
.s-weather {
  flex: 0 0 auto;
  display: flex;
  gap: 12px;
  align-items: stretch;
}
.s-env {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  padding: 7px 14px 8px;
  border-radius: 2px;
  color: var(--ink);
  background: linear-gradient(180deg, var(--plate-hi), var(--plate) 60%, var(--plate-lo));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .8),
    0 0 0 1px rgba(112, 92, 62, .44),
    0 7px 16px rgba(10, 6, 3, .42);
}
/* Ink frame inside the plate. */
.s-env::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(122, 102, 70, .3);
  pointer-events: none;
}
.s-env--next {
  flex: 0 1 auto;
  opacity: .9;
  background: linear-gradient(180deg, #f6eeda, #e9deca);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 0 0 1px rgba(112, 92, 62, .3), 0 5px 12px rgba(10, 6, 3, .34);
}
/* Name and its label sit on one line, so the card is a single short strip. */
.s-env__top {
  display: flex;
  align-items: baseline;
  gap: 9px;
  flex: 0 0 auto;
}
.s-env__kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: rgba(80, 68, 50, .52);
}
.s-env__name {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 23px;
  line-height: 1.15;
  letter-spacing: -.01em;
  color: #2b2419;
  white-space: nowrap;
}
.s-env--next .s-env__name { font-size: 19px; }
.s-env__rows {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  margin: 0;
}
.s-env__row { display: flex; align-items: center; gap: 7px; }
.s-env__row dt {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(80, 68, 50, .55);
}
.s-env__row dd { margin: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.s-env__plain {
  margin: 0;
  flex: 1 1 auto;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-faint);
}

/* A trait chip: dot plus name, ringed green when it thrives, struck red
   when it withers. The dot colour is the same one used on the plates. */
.s-trait {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 6px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .02em;
  color: #3c3327;
  background: rgba(255, 255, 255, .5);
  border: 1px solid rgba(120, 102, 70, .3);
}
.s-trait::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tc, #777);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .7) inset;
}
.s-trait--thrive { border-color: rgba(92, 111, 66, .55); }
.s-trait--wither { color: rgba(80, 62, 52, .8); text-decoration: line-through; text-decoration-thickness: 1px; }
.s-trait--wither::before { background: var(--oxblood); }

.s-trait[data-t="shell"] { --tc: var(--slate); }
.s-trait[data-t="wing"] { --tc: var(--plum); }
.s-trait[data-t="gill"] { --tc: var(--teal); }
.s-trait[data-t="fur"] { --tc: var(--ochre); }
.s-trait[data-t="burrow"] { --tc: var(--sage); }
.s-trait[data-t="jaw"] { --tc: var(--oxblood); }

/* ---------- The ground ---------- */
.s-habitat {
  /* Grow into any spare room, but never shrink below its own content: a flex
     item with min-height: 0 in an overflowing column used to collapse the
     ground to nothing. */
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  padding: 10px 12px 12px;
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(20, 14, 9, .34), rgba(20, 14, 9, .16)),
    repeating-linear-gradient(90deg, rgba(255, 236, 206, .05) 0 1px, transparent 1px 22px);
  box-shadow: inset 0 0 0 1px rgba(255, 232, 196, .08), inset 0 2px 10px rgba(0, 0, 0, .28);
}
.s-habitat__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 2px 8px;
}
.s-habitat__hint {
  margin-left: auto;
  font-size: 13px;
  color: rgba(238, 224, 196, .5);
  font-variant-numeric: tabular-nums;
}
.s-habitat__hint b { color: #f0e2c4; font-weight: 700; }
.s-habitat__hint .is-hot { color: #e8a08c; }

/* Three patches of ground, one duel on each. A patch is a pair: your animal on
   the left, theirs on the right, and what the duel paid out underneath. */
.s-ground {
  --pw: clamp(96px, min(8.2vw, 12.4vh), 148px);
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: clamp(7px, 1.1vw, 16px);
  min-height: clamp(64px, 11vh, 132px);
  flex: 1 0 auto;
}
.s-patch {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 5px 7px 6px;
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(255, 240, 214, .04), rgba(0, 0, 0, .14));
  box-shadow: inset 0 0 0 1px rgba(255, 232, 196, .1);
}
.s-patch.is-live { box-shadow: inset 0 0 0 1px rgba(255, 232, 196, .2); }
/* A patch the animal you are holding could legally go on. */
.s-patch.is-open { box-shadow: inset 0 0 0 1px rgba(232, 197, 121, .34); }
.s-patch.is-done { background: linear-gradient(180deg, rgba(0, 0, 0, .1), rgba(0, 0, 0, .2)); }
.s-patch__row { display: flex; align-items: flex-start; gap: 5px; }
.s-patch__vs {
  align-self: center;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(238, 224, 196, .34);
}
.s-patch.is-done .s-patch__vs { color: rgba(158, 186, 122, .6); }
.s-patch__tag {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.3;
  text-align: center;
  color: rgba(238, 224, 196, .44);
}
.s-patch__tag.is-you { color: rgba(158, 186, 122, .92); font-weight: 700; }
.s-patch__tag.is-them { color: rgba(212, 138, 118, .92); font-weight: 700; }
.s-patch__tag.is-wait { color: #e8a08c; }
.s-patch__tag.is-tie { font-style: italic; }

/* What the duel paid, shouted once over the patch it was won on. Drawn only on
   the render right after the fight, so it never repeats. Kept under half a
   second because the next placement repaints the ground and would cut it off
   mid-flight. */
.s-patch__pop {
  position: absolute;
  left: 50%;
  top: 44%;
  z-index: 6;
  padding: 2px 9px;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  color: #fdf4e4;
  background: rgba(74, 92, 54, .94);
  box-shadow: 0 3px 12px rgba(0, 0, 0, .45);
  pointer-events: none;
  animation: sRise .5s cubic-bezier(.2, .7, .3, 1) both;
}
.s-patch__pop.is-tie {
  font-size: 10.5px;
  letter-spacing: .08em;
  background: rgba(96, 86, 68, .94);
}
@keyframes sRise {
  0% { opacity: 0; transform: translate(-50%, -24%) scale(.7); }
  26% { opacity: 1; transform: translate(-50%, -62%) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -175%) scale(1); }
}

.s-slot { display: flex; flex-direction: column; align-items: center; gap: 4px; }
/* The ground is the stage: plates there are the biggest on the page. */
.s-ground .s-plate { --w: var(--pw); }
.s-ground .s-plate__latin { display: none; }
/* EATEN, PREY and the growth tally all live in the top margin of a plate, and
   only animals on the ground ever carry them. So the ground gives the name a
   lane of its own underneath, instead of printing a stamp across it. */
.s-ground .s-plate { padding-top: 21px; }
.s-ground .s-plate__name { font-size: 12px; }
/* A patch plate is the narrowest place a name has to live, and eleven of the
   twenty-four do not fit on one line. Let those fall to a second line instead
   of cutting them: an exactly level row of plates is worth less than a readable
   name, and both sides of one duel almost never wrap at once. */
.s-ground .s-plate__name {
  line-height: 1.12;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}
.s-slot__who {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(238, 224, 196, .4);
}
.s-slot--you .s-slot__who { color: rgba(158, 186, 122, .8); }
.s-slot--them .s-slot__who { color: rgba(212, 138, 118, .8); }

/* An empty slot: the square you aim at once an animal is lifted. */
.s-ghost {
  width: var(--pw);
  min-height: calc(var(--pw) * .96);
  display: grid;
  place-items: center;
  padding: 6px;
  border: 1px dashed rgba(255, 232, 196, .18);
  border-radius: 2px;
  background: rgba(0, 0, 0, .1);
  font: inherit;
  color: rgba(238, 224, 196, .34);
  text-align: center;
}
.s-ghost.is-aim {
  cursor: pointer;
  border-color: rgba(232, 197, 121, .58);
  background: rgba(232, 197, 121, .07);
  color: rgba(246, 236, 216, .82);
  box-shadow: inset 0 0 16px rgba(232, 197, 121, .1);
  transition: transform .1s ease, background .12s ease, border-color .12s ease;
}
.s-ghost.is-aim:hover {
  transform: translateY(-3px);
  background: rgba(232, 197, 121, .15);
  border-color: rgba(232, 197, 121, .9);
}
.s-ghost.is-aim:focus-visible { outline: 2px solid #e8c579; outline-offset: 2px; }
.s-ghost__t { font-size: 11.5px; line-height: 1.35; }

/* ---------- A specimen plate ---------- */
.s-plate {
  --w: clamp(112px, min(9.4vw, 14.6vh), 170px);
  position: relative;
  flex: 0 0 auto;
  width: var(--w);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  padding: 6px;
  border: 0;
  border-radius: 2px;
  font: inherit;
  text-align: center;
  color: var(--ink);
  background: linear-gradient(180deg, var(--plate-hi), var(--plate) 56%, var(--plate-lo));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .82),
    0 0 0 1px rgba(112, 92, 62, .44),
    0 3px 0 rgba(16, 10, 5, .16),
    0 8px 14px rgba(8, 5, 2, .38);
  transition: transform .15s cubic-bezier(.2, .8, .3, 1), box-shadow .15s ease, filter .15s ease;
}
/* The engraved inner rule of a plate. */
.s-plate::before {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1px solid rgba(122, 102, 70, .28);
  border-radius: 1px;
  pointer-events: none;
}
/* A whisper of paper grain. */
.s-plate::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: .45;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='2'/%3E%3C/filter%3E%3Crect width='48' height='48' filter='url(%23n)' opacity='.15'/%3E%3C/svg%3E");
}
.s-plate > * { position: relative; z-index: 1; }

.s-plate__name {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: -.01em;
  color: #2b2419;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.s-plate__latin {
  font-size: 10px;
  font-style: italic;
  line-height: 1.1;
  color: rgba(70, 62, 48, .55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.s-plate__art {
  height: clamp(46px, 7.6vh, 72px);
  display: grid;
  place-items: center;
  color: #4a4433;
}
.s-plate__art svg { height: 100%; width: auto; display: block; }

.s-genome {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 14px;
  margin-top: 1px;
}
.s-pip {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--tc, #888);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5), 0 0 0 .5px rgba(60, 50, 34, .45);
}
.s-pip--empty {
  background: none;
  box-shadow: none;
  border: 1px dashed rgba(110, 92, 62, .42);
}
.s-pip[data-t="shell"] { --tc: var(--slate); }
.s-pip[data-t="wing"] { --tc: var(--plum); }
.s-pip[data-t="gill"] { --tc: var(--teal); }
.s-pip[data-t="fur"] { --tc: var(--ochre); }
.s-pip[data-t="burrow"] { --tc: var(--sage); }
.s-pip[data-t="jaw"] { --tc: var(--oxblood); }

.s-plate__foot {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-top: 4px;
  border-top: 1px solid rgba(122, 102, 70, .3);
  margin-top: 1px;
}
.s-body {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(70, 62, 48, .6);
}
.s-body b {
  font-family: var(--font-mono);
  font-size: 17px;
  letter-spacing: 0;
  color: #33291c;
}
.s-fit {
  margin-left: auto;
  min-width: 30px;
  padding: 0 5px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
  color: #3f4a2f;
  background: rgba(92, 111, 66, .16);
  box-shadow: inset 0 0 0 1px rgba(92, 111, 66, .4);
}
.s-fit.is-low { color: #7e2c1e; background: rgba(142, 51, 37, .14); box-shadow: inset 0 0 0 1px rgba(142, 51, 37, .42); }
.s-fit.is-zero { color: #5d5342; background: rgba(110, 100, 80, .12); box-shadow: inset 0 0 0 1px rgba(110, 100, 80, .34); }
/* An inked mutation tally, handwritten in the margin. */
.s-mut {
  position: absolute;
  top: 4px;
  right: 5px;
  z-index: 2;
  font-family: var(--font-serif);
  font-size: 10.5px;
  font-style: italic;
  line-height: 1;
  color: rgba(142, 51, 37, .82);
  transform: rotate(-3deg);
  pointer-events: none;
}

/* Owner edge on the ground. */
.s-plate--you { box-shadow: inset 0 3px 0 rgba(92, 111, 66, .85), inset 0 1px 0 rgba(255, 255, 255, .82), 0 0 0 1px rgba(112, 92, 62, .44), 0 3px 0 rgba(16, 10, 5, .16), 0 8px 14px rgba(8, 5, 2, .38); }
.s-plate--them { box-shadow: inset 0 3px 0 rgba(142, 51, 37, .8), inset 0 1px 0 rgba(255, 255, 255, .82), 0 0 0 1px rgba(112, 92, 62, .44), 0 3px 0 rgba(16, 10, 5, .16), 0 8px 14px rgba(8, 5, 2, .38); }

/* Eaten. The plate greys on the render right after the duel, and later renders
   draw it already settled so the animation never replays. */
@keyframes sWither {
  0% { transform: none; opacity: 1; filter: none; }
  100% { transform: translateY(7px) rotate(-2.5deg) scale(.94); opacity: .32; filter: grayscale(1) sepia(.4); }
}
.s-plate.is-dead { animation: sWither .55s ease-in forwards; pointer-events: none; }
.s-plate.is-settled {
  transform: translateY(7px) rotate(-2.5deg) scale(.94);
  opacity: .32;
  filter: grayscale(1) sepia(.4);
  animation: none;
  pointer-events: none;
}
.s-plate.is-dead .s-plate__art,
.s-plate.is-settled .s-plate__art { opacity: .5; }
.s-plate.is-dead::after,
.s-plate.is-settled::after { opacity: .9; }

/* A red stamp on the animal that was eaten. Deliberately blunt: this one event
   is the whole rule of the game. */
.s-eaten {
  position: absolute;
  top: 4px;
  left: 3px;
  z-index: 3;
  padding: 1px 5px 1px 4px;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
  line-height: 1.4;
  color: #fdf0e6;
  background: #8e3325;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .32);
  transform: rotate(-4deg);
  pointer-events: none;
}

/* Marked as a meal: alone on its patch with an answer still in the other hand.
   The frame is the plate's inner rule turned red, so the owner's coloured top
   edge and the plate shadow both stay exactly as they were. It is deliberately
   static: the whole ground is repainted on every placement, so an infinite
   pulse here would restart from nothing about once a second and flicker. */
.s-plate.is-target::before {
  border-width: 2px;
  border-color: rgba(200, 84, 62, .95);
}
.s-prey {
  position: absolute;
  top: 4px;
  left: 3px;
  z-index: 3;
  padding: 1px 5px 1px 4px;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
  line-height: 1.4;
  color: #2a1c08;
  background: #e8c579;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .32);
  transform: rotate(-4deg);
  pointer-events: none;
}

/* Placed this era: a soft stamp. */
@keyframes sPop {
  0% { transform: translateY(9px) scale(.92); opacity: 0; }
  100% { transform: none; opacity: 1; }
}
.s-plate.is-new { animation: sPop .22s ease-out both; }

/* Playable plates lift like a lifted card. */
button.s-plate { cursor: pointer; }
button.s-plate:disabled { cursor: default; }
button.s-plate:hover:not(:disabled),
button.s-plate:focus-visible {
  transform: translateY(-6px) rotate(-.6deg);
  filter: brightness(1.04);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .85),
    0 0 0 1px rgba(110, 90, 58, .6),
    0 5px 0 rgba(16, 10, 5, .14),
    0 14px 22px rgba(6, 3, 1, .48);
  z-index: 4;
}
button.s-plate:focus-visible { outline: 2px solid #e8c579; outline-offset: 2px; }
button.s-plate:active:not(:disabled) { transform: translateY(-2px); }

/* Lifted out of your line and waiting for a patch: held up off the desk with a
   gold edge, so the animal you have committed to is unmistakable. Declared
   after the hover rules and scoped to the line, so it wins the transform. */
.s-line__cards .s-plate.is-picked {
  transform: translateY(-10px) rotate(-1deg);
  filter: brightness(1.06);
  z-index: 5;
  box-shadow:
    inset 0 0 0 2px rgba(232, 197, 121, .95),
    0 0 0 1px rgba(112, 92, 62, .5),
    0 7px 0 rgba(16, 10, 5, .15),
    0 16px 26px rgba(6, 3, 1, .5);
}

/* ---------- The two lines ---------- */
.s-lines {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
/* One column when the rival's animals are face down: your own hand gets the
   room, and the rival shrinks to a single line of text. */
.s-lines.is-solo { grid-template-columns: minmax(0, 1fr); }
.s-lines.is-solo .s-line--them { padding: 6px 11px 7px; }
.s-lines.is-solo .s-line--them .s-line__head { padding-bottom: 1px; min-height: 0; }
.s-lines.is-solo .s-line__cards { gap: 6px; }
.s-lines.is-solo .s-line__cards .s-plate { --w: clamp(116px, min(13.5vw, 15.5vh), 186px); }
.s-lines.is-solo .s-line__cards .s-plate__art { height: clamp(42px, 7.2vh, 66px); }
.s-lines.is-solo .s-line__cards .s-plate__name { font-size: 14.5px; }
.s-lines.is-solo .s-line__cards .s-body { font-size: 9.5px; }
.s-lines.is-solo .s-line__cards .s-body b { font-size: 16px; }
.s-lines.is-solo .s-line__cards .s-fit { font-size: 14px; line-height: 20px; min-width: 30px; }
.s-line {
  min-width: 0;
  padding: 9px 11px 11px;
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(255, 244, 222, .07), rgba(0, 0, 0, .12));
  box-shadow: inset 0 0 0 1px rgba(255, 232, 196, .1);
}
.s-line--you { box-shadow: inset 0 0 0 1px rgba(158, 186, 122, .24); }
.s-line--them { box-shadow: inset 0 0 0 1px rgba(212, 138, 118, .2); }
/* The rival's turn: its face-down line breathes while it works out what to take
   from yours. The wait is part of the game, so it should look like one. */
.s-line--them.is-thinking { animation: sThink 1.15s ease-in-out infinite; }
@keyframes sThink {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(212, 138, 118, .2); }
  50% { box-shadow: inset 0 0 0 1px rgba(212, 138, 118, .62), 0 0 16px rgba(212, 138, 118, .16); }
}
.s-line.is-turn { background: linear-gradient(180deg, rgba(255, 244, 222, .13), rgba(0, 0, 0, .1)); }
.s-line__head {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 0 1px 7px;
  min-height: 21px;
}
.s-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(238, 224, 196, .45);
}
.s-line--you .s-tag { color: rgba(158, 186, 122, .85); }
.s-line--them .s-tag { color: rgba(212, 138, 118, .85); }
.s-line__name {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: #f4e8cf;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.s-line__note {
  margin-left: auto;
  font-size: 12.5px;
  color: rgba(238, 224, 196, .42);
  white-space: nowrap;
}
.s-line__cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
  align-items: flex-start;
}
.s-line__cards .s-plate {
  --w: clamp(104px, min(8.4vw, 13.6vh), 152px);
}
.s-line__cards .s-plate__name { font-size: 12.5px; }
.s-line__cards .s-plate__latin { display: none; }
.s-line__cards .s-plate__art { height: clamp(38px, 6.2vh, 56px); }
.s-line__cards .s-plate__foot { padding-top: 3px; }
.s-line__cards .s-body { font-size: 8.5px; }
.s-line__cards .s-body b { font-size: 15px; }
.s-line__cards .s-fit { font-size: 13px; line-height: 18px; min-width: 27px; }
.s-line__cards .s-pip { width: 9.5px; height: 9.5px; }
.s-line__cards .s-genome { height: 12px; gap: 3.5px; }
.s-line__empty {
  font-size: 12.5px;
  font-style: italic;
  color: rgba(238, 224, 196, .3);
}

/* Cards you can take right now get a faint corner fold. */
.s-plate.is-live { box-shadow: inset 0 0 0 2px rgba(232, 197, 121, .55), 0 0 0 1px rgba(112, 92, 62, .44), 0 8px 14px rgba(8, 5, 2, .38); }

/* ---------- The action bar ----------
   The Game Center back chip is fixed at the bottom-left of the viewport
   (base.css), so the bar keeps a wide left gutter: the status line then
   always starts clear of the chip instead of running under it. */
.s-act {
  position: relative;
  flex: 0 0 auto;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px clamp(12px, 3vw, 26px) 10px clamp(160px, 18vw, 188px);
  color: #f2e6ce;
  background: linear-gradient(180deg, rgba(38, 26, 18, .84), rgba(24, 16, 11, .95));
  border-top: 1px solid rgba(255, 232, 196, .14);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, .38);
  backdrop-filter: blur(3px);
}
.s-act__status {
  flex: 1 1 14ch;
  margin: 0;
  min-width: 0;
  font-size: 14px;
  line-height: 1.4;
  color: rgba(242, 230, 206, .86);
}
.s-act__status b { color: #ffeec4; font-weight: 700; }

/* ---------- Modals (the overlay scrolls, never the card) ---------- */
.c-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.c-modal[hidden] { display: none; }
.c-modal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 9, 5, .66);
  cursor: pointer;
}
.c-modal__panel {
  position: relative;
  z-index: 1;
  margin: auto;
  width: min(94vw, 560px);
  color: var(--ink);
  background: linear-gradient(180deg, var(--plate-hi), var(--plate) 62%, var(--plate-lo));
  border-radius: 2px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .84),
    0 0 0 1px rgba(112, 92, 62, .5),
    0 30px 70px rgba(0, 0, 0, .58);
  animation: sPlate .24s ease-out both;
}
@keyframes sPlate {
  0% { transform: translateY(12px) scale(.985); opacity: 0; }
  100% { transform: none; opacity: 1; }
}
/* The engraved rule that every plate carries. */
.c-modal__panel::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(122, 102, 70, .26);
  pointer-events: none;
}
.s-rules { width: min(94vw, 620px); }
/* The rules sheet can open on top of the rival picker. */
#rulesModal { z-index: 62; }
.c-modal__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 10px;
  border-bottom: 1px solid rgba(140, 118, 84, .3);
}
.c-modal__head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 20px;
  letter-spacing: -.01em;
  color: #2b2419;
}
.c-modal__x {
  margin-left: auto;
  position: relative;
  z-index: 2;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 2px;
  border: 1px solid rgba(120, 100, 68, .42);
  background: linear-gradient(180deg, #fffdf4, #ece0c6);
  color: #4a4236;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.c-modal__x:hover { filter: brightness(1.03); }
.c-modal__x[hidden] { display: none; }
.c-modal__body { padding: 14px 22px 4px; font-size: 14.5px; line-height: 1.6; color: #443c31; }
.c-modal__body h3 {
  margin: 16px 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(70, 60, 46, .62);
}
.c-modal__body ul { margin: 0 0 8px; padding-left: 16px; }
.c-modal__body li { margin-bottom: 4px; }
.c-modal__body li::marker { color: rgba(92, 111, 66, .8); }
.c-modal__body b { color: #2d2820; }
.c-modal__body kbd {
  padding: 0 4px;
  border-radius: 2px;
  border: 1px solid rgba(122, 100, 68, .4);
  background: rgba(255, 255, 255, .55);
  font-family: var(--font-mono);
  font-size: 11px;
}
.c-modal__lead { margin: 0 0 10px; font-size: 14.5px; }
.c-modal__note { margin: 14px 0 2px; font-size: 12.5px; color: rgba(80, 68, 52, .72); }
.c-modal__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 18px 14px;
}

/* ---------- Flow: mode pick, breeding, result ---------- */
/* The how-to-play list: four numbered steps, each one a line or two. */
.s-steps {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: 7px;
}
.s-steps li {
  counter-increment: step;
  position: relative;
  padding: 8px 11px 8px 46px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .42);
  box-shadow: inset 0 0 0 1px rgba(120, 100, 68, .24);
  font-size: 14px;
  line-height: 1.45;
}
.s-steps li b { color: #241d13; }
/* The word DIES, quoted inside the how-to text. */
.c-modal__body .is-hot { color: #8e3325; }
.s-steps li::before {
  content: counter(step);
  position: absolute;
  left: 10px;
  top: 9px;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: #fdf4e4;
  background: linear-gradient(180deg, #7d3b2a, #632819);
}
.s-steps b { color: #2d2820; }
.s-flow { width: min(94vw, 620px); }
.s-picks { display: grid; gap: 7px; }
.s-pick {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  text-align: left;
  border-radius: 2px;
  border: 1px solid rgba(120, 100, 68, .4);
  background: linear-gradient(180deg, #fffdf4, #efe3c9);
  box-shadow: 0 2px 0 rgba(120, 100, 68, .18);
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  transition: transform .07s ease, filter .12s ease;
}
.s-pick:hover { filter: brightness(1.03); transform: translateY(-1px); }
.s-pick:active { transform: none; }
.s-pick:focus-visible { outline: 2px solid #8a6a34; outline-offset: 2px; }
.s-pick__mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 34px;
  color: #4a4433;
}
.s-pick__mark svg { height: 100%; width: auto; }
.s-pick__t { display: block; font-family: var(--font-serif); font-size: 15.5px; font-weight: 700; }
.s-pick__d { display: block; font-size: 12.5px; line-height: 1.4; color: rgba(80, 68, 52, .78); }


/* ---------- Result ---------- */
.s-verdict {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 8px;
}
.s-verdict__num {
  font-family: var(--font-mono);
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  color: #2b2419;
  font-variant-numeric: tabular-nums;
}
.s-verdict__num small { font-size: 13px; font-weight: 600; color: rgba(70, 60, 46, .5); margin-left: 2px; }
.s-verdict__who { font-size: 13px; color: rgba(80, 68, 52, .8); }
.s-eras { display: grid; gap: 5px; margin: 8px 0 2px; }
.s-era-row {
  display: grid;
  grid-template-columns: 68px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px dotted rgba(120, 100, 68, .3);
}
.s-era-row span:first-child { font-weight: 700; color: #33291c; }
.s-era-row span:last-child { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.s-era-row .is-you { color: #3f4a2f; }
.s-era-row .is-them { color: #7e2c1e; }

/* ---------- Toast ---------- */
.c-toast {
  position: fixed;
  left: 50%;
  bottom: 78px;
  z-index: 70;
  transform: translateX(-50%);
  max-width: min(92vw, 460px);
  padding: 9px 16px;
  border-radius: 2px;
  font-size: 13.5px;
  line-height: 1.4;
  color: #f6ecd8;
  background: rgba(28, 19, 12, .94);
  border: 1px solid rgba(255, 232, 196, .18);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .5);
  animation: sToast .18s ease-out both;
}
.c-toast[hidden] { display: none; }
@keyframes sToast {
  0% { transform: translate(-50%, 6px); opacity: 0; }
  100% { transform: translate(-50%, 0); opacity: 1; }
}

/* ---------- Narrow screens ---------- */
@media (max-width: 760px) {
  .s-desk { width: 96vw; gap: 8px; }
  .s-weather { gap: 6px; flex-direction: column; }
  .s-env__name { font-size: 18px; }
  .s-env--next .s-env__name { font-size: 16px; }
  /* Keep a weather card on one line: it is read at a glance, not studied. */
  .s-env { gap: 2px 10px; padding: 5px 10px 6px; }
  .s-env__rows { gap: 2px 10px; }
  .s-env__row { gap: 5px; }
  .s-env__top { gap: 7px; }
  .s-trait { font-size: 11px; padding: 1px 6px 1px 5px; gap: 4px; }
  .s-trait::before { width: 7px; height: 7px; }
  .s-lines { grid-template-columns: 1fr; gap: 8px; }
  .s-plate { --w: 108px; }
  .s-plate__art { height: 56px; }
  .s-plate__latin { display: none; }
  /* Three patches stack down the screen. A duel is a pair and a pair has to be
     read side by side, so the patches go one under another rather than the
     plates shrinking until the name and the number stop fitting. */
  .s-ground {
    --pw: clamp(84px, 22vw, 118px);
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    min-height: 0;
  }
  .s-patch__row { justify-content: center; }
  .s-ground .s-plate__art { height: 40px; }
  .s-ground .s-plate__name { font-size: 10.5px; }
  .s-ground .s-ghost__t { font-size: 10.5px; }
  .s-patch { padding: 5px 6px; gap: 4px; }
  /* The flag lane is only about 76px wide here, so a PREY stamp and a growth
     tally cannot both fit on the same line. Being the meal is the fact that
     matters; the tally is already printed on the plate's number. */
  .s-plate:has(.s-prey) .s-mut,
  .s-plate:has(.s-eaten) .s-mut { display: none; }
  .s-line__cards .s-plate { --w: clamp(96px, 24vw, 126px); }
  .s-line__cards .s-plate__art { height: 42px; }
  .s-line__cards .s-plate__name { font-size: 11.5px; }
  .s-lines.is-solo .s-line__cards .s-plate { --w: clamp(104px, 24vw, 126px); }
  .s-lines.is-solo .s-line__cards .s-plate__art { height: 42px; }
  .s-lines.is-solo .s-line__cards .s-plate__name { font-size: 11.5px; }
  .s-lines.is-solo .s-line__cards .s-body { font-size: 8.5px; }
  .s-lines.is-solo .s-line__cards .s-body b { font-size: 15px; }
  .s-lines.is-solo .s-line__cards .s-fit { font-size: 13px; line-height: 18px; min-width: 27px; }
  /* A hand that does not fit becomes a swipe: one row tall instead of three.
     The faded right edge is the hint that there is more that way. */
  .s-line__cards {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-top: 8px;
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 26px), transparent 100%);
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 26px), transparent 100%);
  }
  .s-line__cards::-webkit-scrollbar { width: 0; height: 0; }
  .c-bar { gap: 6px 10px; padding: 6px 10px 7px; }
  .c-bar__title { font-size: 18px; }
  .c-bar__stats { gap: 10px; }
  .stat { font-size: 12px; }
  .stat b { font-size: 13px; }
  .c-bar .c-btn { font-size: 12.5px; padding: 5px 10px; }
  .s-act { padding: 8px 10px 9px 150px; flex-wrap: wrap; row-gap: 6px; }
  .s-act__status { font-size: 13px; }
}

@media (max-width: 420px) {
  .c-bar__title { font-size: 18px; }
  .c-bar__stats { gap: 9px; }
  .s-plate { --w: 96px; }
  .s-ground { --pw: 88px; }
  .s-plate__latin { display: none; }
  .s-line__cards .s-plate { --w: 82px; }
  .s-line__cards .s-plate__art { height: 34px; }
  .s-line__cards .s-plate__name { font-size: 10px; }
  .c-modal { padding: 10px; }
  .c-modal__body { padding: 10px 14px 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .c-modal__panel,
  .c-toast,
  .s-plate.is-new,
  .s-patch__pop,
  .stat b.is-gain,
  .stat b.is-loss,
  .s-line--them.is-thinking { animation: none; }
  /* A corpse still has to look like one with the animation switched off. */
  .s-plate.is-dead {
    animation: none;
    transform: translateY(7px) rotate(-2.5deg) scale(.94);
    opacity: .32;
    filter: grayscale(1) sepia(.4);
  }
  .s-patch__pop { opacity: 1; transform: translate(-50%, -60%); }
  .s-plate { transition: none; }
}
