/* Structural CSS only — every color/radius/font/animation value comes from
   CSS custom properties injected by src/client/theme.ts (applyTheme()).
   Reskinning the whole app should never require touching this file. */

* {
  box-sizing: border-box;
}

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

#app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  margin: 0 0 8px;
}

button {
  font-family: var(--font-display);
  cursor: pointer;
}

input,
select {
  font-family: var(--font-body);
}

/* ---- Buttons ---- */

.btn {
  display: inline-block;
  padding: 12px 22px;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-raised);
  color: var(--color-text);
  font-weight: 700;
  font-size: 1rem;
  box-shadow: var(--shadow-block);
  transition: transform var(--anim-fast) var(--anim-bouncy), box-shadow var(--anim-fast) var(--anim-bouncy);
}
.btn:hover:not(:disabled) {
  transform: translateY(-2px);
}
.btn:active:not(:disabled) {
  transform: translateY(2px) scale(0.97);
  box-shadow: var(--shadow-block-small);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn--primary {
  background: var(--color-success);
  color: #05230f;
}
.btn--accent {
  background: var(--color-accent-alt);
  color: #2b1900;
}
.btn--ghost {
  background: transparent;
}
.btn--big {
  width: 100%;
  padding: 16px;
  font-size: 1.1rem;
  margin-top: 12px;
}

/* ---- Inputs ---- */

.input {
  display: block;
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 12px;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 1rem;
}
.input--code {
  text-align: center;
  letter-spacing: 0.3em;
  font-weight: 800;
  text-transform: uppercase;
}

/* ---- Panels ---- */

.panel {
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-block);
}
.panel__title {
  margin-bottom: 14px;
}

/* ---- Banners ---- */

.banner {
  position: relative;
  padding: 14px 40px 14px 16px;
  border-radius: var(--radius-md);
  border: var(--border-width) solid var(--color-border);
  margin-bottom: 16px;
  font-weight: 700;
  animation: pop-in var(--anim-med) var(--anim-bouncy);
}
.banner--error {
  background: var(--color-danger);
  color: #2b0000;
}
.banner--warn {
  background: var(--color-accent-alt);
  color: #2b1900;
}
.banner--success {
  background: var(--color-success);
  color: #05230f;
}
.banner__dismiss {
  position: absolute;
  right: 8px;
  top: 8px;
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: inherit;
  font-weight: 800;
}

/* ---- Home screen ---- */

.brand {
  text-align: center;
  font-size: 2.2rem;
}
.brand-sub {
  text-align: center;
  color: var(--color-text-muted);
  margin-bottom: 28px;
}
.home__columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 640px) {
  .home__columns {
    grid-template-columns: 1fr;
  }
}

/* ---- Lobby screen ---- */

.lobby {
  max-width: 480px;
  margin: 0 auto;
}
.panel--code {
  text-align: center;
  margin-bottom: 20px;
}
.code-label {
  color: var(--color-text-muted);
  margin-bottom: 8px;
}
.code-display {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  font-family: var(--font-display);
  margin-bottom: 12px;
}
.player-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}
.player-row__name {
  flex: 1;
  font-weight: 700;
}
.hint {
  color: var(--color-text-muted);
  text-align: center;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}
.dot--connected {
  background: var(--color-success);
}
.dot--disconnected {
  background: var(--color-danger);
}

.pill {
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 800;
}
.pill--host {
  background: var(--color-accent-alt);
  color: #2b1900;
}

/* ---- Game screen ---- */

.game-header {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
  font-weight: 700;
}
.game-header__phase {
  text-transform: capitalize;
  margin-left: auto;
  background: var(--color-surface-raised);
  border-radius: var(--radius-pill);
  padding: 4px 14px;
}

.scoreboard {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.scoreboard__row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
}
.scoreboard__score {
  font-weight: 800;
  color: var(--color-accent-alt);
}

.zone {
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 12px;
  min-height: 90px;
}
.zone--territory {
  border-color: var(--zone-accent, var(--color-border));
  border-width: var(--border-width-thick);
}
.zone--highlighted {
  box-shadow: 0 0 0 3px var(--zone-accent, var(--color-accent-alt));
  animation: pulse var(--anim-slow) var(--anim-bouncy) infinite alternate;
}
.zone--clickable {
  cursor: pointer;
}
.zone__label {
  font-weight: 800;
  margin-bottom: 8px;
  font-family: var(--font-display);
}
.zone__count {
  color: var(--color-text-muted);
  font-weight: 500;
}
.zone__pieces {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.zone__count-only {
  font-weight: 800;
  color: var(--color-text-muted);
  align-self: center;
}

/* ---- Territory clusters (board layout) ---- */

.board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.cluster {
  display: grid;
  grid-template-columns: minmax(60px, 0.7fr) minmax(90px, 1.4fr) minmax(60px, 0.7fr);
  grid-template-areas:
    "nw    north ne"
    "west  center east"
    ".     south  .";
  gap: 8px;
  background: var(--color-surface);
  border: var(--border-width-thick) solid var(--zone-accent, var(--color-border));
  border-radius: var(--radius-lg);
  padding: 12px;
  overflow: visible;
}
.cluster--highlighted {
  box-shadow: 0 0 0 3px var(--zone-accent, var(--color-accent-alt));
  animation: pulse var(--anim-slow) var(--anim-bouncy) infinite alternate;
}

.cluster__slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.cluster__slot--north { grid-area: north; }
.cluster__slot--south { grid-area: south; }
.cluster__slot--west { grid-area: west; }
.cluster__slot--east { grid-area: east; }
.cluster__slot--nw { grid-area: nw; }
.cluster__slot--ne { grid-area: ne; }
.cluster__slot--you .cluster__slot-name {
  color: var(--color-accent-alt);
}
.cluster__slot-name {
  font-size: 0.7rem;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
}
.cluster__slot-empty {
  width: 88px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
}

.cluster__center {
  grid-area: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-radius: var(--radius-md);
}
.cluster__center--clickable {
  cursor: pointer;
}
.cluster__label {
  font-family: var(--font-display);
  font-weight: 800;
  text-align: center;
}
.cluster__event {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--color-surface-raised);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 700;
}
.cluster__deck-count {
  font-size: 0.65rem;
  color: var(--color-text-muted);
}
.cluster__resource {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}
.cluster__resource-label {
  font-size: 0.8rem;
}
.cluster__resource .token {
  width: 26px;
  height: 26px;
  font-size: 0.9rem;
}

@media (max-width: 480px) {
  .cluster {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .cluster__slot-name { max-width: 60px; }
}

/* ---- Reveal ticker ---- */

.reveal-ticker {
  background: var(--color-surface-raised);
  border: var(--border-width) solid var(--color-accent-alt);
  border-radius: var(--radius-pill);
  padding: 10px 20px;
  margin-bottom: 16px;
  font-weight: 700;
  text-align: center;
  animation: pop-in var(--anim-med) var(--anim-bouncy);
}

/* ---- Rules legend ---- */

.legend {
  margin-bottom: 20px;
}
.legend__toggle {
  background: transparent;
  border: none;
  color: var(--color-text);
  font-weight: 800;
  padding: 6px 0;
}
.legend__body {
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.legend__heading {
  margin: 0 0 8px;
  font-size: 0.9rem;
}
.legend__grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.legend__row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}
.legend__icon {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
}
.legend__name {
  font-weight: 700;
  min-width: 90px;
}
.legend__arrow {
  color: var(--color-text-muted);
  font-size: 0.75rem;
}
.legend__pill {
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 800;
  color: #05230f;
}
.legend__pill--wetland { background: var(--color-wetland); }
.legend__pill--desert { background: var(--color-desert); }
.legend__pill--forest { background: var(--color-forest); }
.legend__pill--grassland { background: var(--color-grassland); }
.legend__desc {
  color: var(--color-text-muted);
}

/* ---- Cards ---- */

.card {
  width: 88px;
  min-height: 116px;
  border-radius: var(--radius-md);
  border: var(--border-width) solid var(--color-border);
  background: var(--color-surface-raised);
  padding: 8px;
  position: relative;
  display: flex;
  flex-direction: column;
  animation: pop-in var(--anim-med) var(--anim-bouncy);
  transition: transform var(--anim-med) var(--anim-bouncy), box-shadow var(--anim-med) var(--anim-bouncy);
  z-index: 1;
}
.card--clickable {
  cursor: pointer;
}
/* Hover-to-enlarge on every card (front or back) so details are readable from a small hand. */
.card:hover {
  transform: scale(1.6);
  z-index: 30;
  box-shadow: var(--shadow-block);
}
.card--clickable:hover {
  transform: scale(1.6) translateY(-6px);
}
.card--selected {
  outline: 4px solid var(--color-accent-alt);
  transform: translateY(-6px);
  z-index: 5;
}
.card--selected:hover {
  transform: scale(1.6) translateY(-6px);
  z-index: 30;
}
.card--front {
  border-top: 6px solid var(--card-accent, var(--color-border));
}
.card--back {
  background: repeating-linear-gradient(
    45deg,
    var(--color-surface),
    var(--color-surface) 6px,
    var(--color-surface-raised) 6px,
    var(--color-surface-raised) 12px
  );
}
.card__header {
  font-size: 1.6rem;
  text-align: center;
}
.card__name {
  font-weight: 800;
  font-size: 0.8rem;
  text-align: center;
  flex: 1;
}
.card__tag {
  font-size: 0.65rem;
  text-transform: uppercase;
  text-align: center;
  color: var(--color-text-muted);
  font-weight: 700;
}
.card__hint {
  font-size: 0.6rem;
  text-align: center;
  font-weight: 700;
  border-radius: var(--radius-sm);
  padding: 1px 4px;
  margin-top: 2px;
  background: var(--color-surface);
  color: var(--color-text-muted);
}
.card__hint--biome-wetland { color: var(--color-wetland); }
.card__hint--biome-desert { color: var(--color-desert); }
.card__hint--biome-forest { color: var(--color-forest); }
.card__hint--biome-grassland { color: var(--color-grassland); }
.card__hint--prefers {
  color: var(--color-text);
}
.card__energy-badge {
  position: absolute;
  bottom: -8px;
  right: -8px;
  background: var(--color-accent-alt);
  color: #2b1900;
  border-radius: var(--radius-pill);
  border: 3px solid var(--color-border);
  min-width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
}
.card__energy-badge--eaten {
  background: var(--color-danger);
  color: #2b0000;
}
.card__energy-badge--starved {
  background: var(--color-text-muted);
  color: #1a1a1a;
}
.card__ribbon {
  position: absolute;
  top: 6px;
  left: -6px;
  font-size: 0.55rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--color-danger);
  color: #2b0000;
  transform: rotate(-8deg);
}
.card__ribbon--starved {
  background: var(--color-text-muted);
  color: #1a1a1a;
}

.token {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  border: var(--border-width) solid var(--color-border);
  background: var(--token-color, var(--color-surface-raised));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  animation: pop-in var(--anim-med) var(--anim-bouncy);
}
.token--hidden {
  opacity: 0.5;
}
.token:has(.token__badge) {
  position: relative;
}
.token__badge {
  position: absolute;
  right: -8px;
  bottom: -8px;
  min-width: 22px;
  padding: 0 5px;
  border: 3px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-accent-alt);
  color: var(--color-border);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
}

.marker {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  border: var(--border-width) solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Hand & dice ---- */

.hand-section {
  margin-bottom: 20px;
}
.hand-controls {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.dice-pool {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dice-pool__dice {
  display: flex;
  gap: 6px;
}
.die {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: var(--border-width) solid var(--color-border);
  background: var(--color-surface-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}
.die--spent {
  opacity: 0.4;
}

/* ---- Event feed ---- */

.event-feed {
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 14px;
  max-height: 220px;
  overflow-y: auto;
}
/* Newest first (the shell already reverses the list), so fresh events never hide below the fold. */
.event-feed__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.event-feed__item {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  animation: pop-in var(--anim-fast) var(--anim-bouncy);
}

/* ---- Animations ---- */

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.7) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes pulse {
  from {
    box-shadow: 0 0 0 2px var(--zone-accent, var(--color-accent-alt));
  }
  to {
    box-shadow: 0 0 0 6px var(--zone-accent, var(--color-accent-alt));
  }
}

/* ======================================================================
   Generic archetypes added for tile/grid/track games (all values via theme vars)
   ====================================================================== */

.btn--danger {
  background: var(--color-danger);
  color: #2b0000;
}

.card__value {
  position: absolute;
  top: 4px;
  right: 6px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--card-accent, var(--color-text));
  line-height: 1;
}

.token--clickable {
  cursor: pointer;
  transition: transform var(--anim-fast) var(--anim-bouncy);
}
.token--clickable:hover {
  transform: scale(1.15);
}
.token--selected {
  outline: 4px solid var(--color-accent-alt);
}

/* ---- Tiles ---- */

.tile-face {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--color-tile-floor);
  border-radius: var(--radius-sm);
}
.tile-face__svg {
  width: 100%;
  height: 100%;
  display: block;
  transition: transform var(--anim-med) var(--anim-bouncy);
}
.tile-face__icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--grid-cell) * 0.32);
  pointer-events: none;
}
.tile-door {
  stroke: var(--color-border);
  stroke-width: 3;
}
.tile-door--open {
  opacity: 0.25;
}
.tile-door__label {
  font: 800 14px var(--font-display);
  fill: #1a1300;
}

.tile-piece {
  width: var(--grid-cell);
  height: var(--grid-cell);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  animation: pop-in var(--anim-med) var(--anim-bouncy);
  transition: transform var(--anim-fast) var(--anim-bouncy);
  background: var(--color-tile-floor);
}
.tile-piece--clickable {
  cursor: pointer;
}
.tile-piece--clickable:hover {
  transform: scale(1.1);
}
.tile-piece--selected {
  outline: 4px solid var(--color-accent-alt);
}
.tile-piece--back {
  background: repeating-linear-gradient(45deg, var(--color-surface), var(--color-surface) 6px, var(--color-surface-raised) 6px, var(--color-surface-raised) 12px);
}

/* ---- Grid boards ---- */

.grid-scroll {
  overflow: auto;
  max-height: 70vh;
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 12px;
}
.grid-board {
  display: grid;
  gap: 2px;
  width: max-content;
  margin: 0 auto;
  background-image: radial-gradient(circle, var(--color-surface-raised) 1.5px, transparent 1.5px);
  background-size: calc(var(--grid-cell) + 2px) calc(var(--grid-cell) + 2px);
}
.grid-tile {
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  animation: pop-in var(--anim-med) var(--anim-bouncy);
}
.grid-overlay {
  border-radius: var(--radius-sm);
  z-index: 2;
}
.grid-overlay--clickable {
  cursor: pointer;
}
.grid-overlay--target {
  border: 3px solid var(--color-success);
  animation: pulse-target var(--anim-slow) var(--anim-bouncy) infinite alternate;
}
.grid-overlay--target:hover {
  background: color-mix(in srgb, var(--color-success) 25%, transparent);
}
.grid-overlay--rotate {
  border: 3px dashed var(--color-accent-alt);
  opacity: 0.7;
}
.grid-overlay--move {
  border: 3px solid var(--color-accent-alt);
  background: color-mix(in srgb, var(--color-accent-alt) 18%, transparent);
  animation: pulse-target var(--anim-slow) var(--anim-bouncy) infinite alternate;
}
.grid-overlay--move:hover {
  background: color-mix(in srgb, var(--color-accent-alt) 40%, transparent);
}
.grid-ghost {
  width: 100%;
  height: 100%;
  opacity: 0.55;
  pointer-events: none;
}
.grid-tokens {
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-end;
  gap: 2px;
  padding: 3px;
  pointer-events: none;
}
.pawn {
  width: calc(var(--grid-cell) * 0.34);
  height: calc(var(--grid-cell) * 0.34);
  border-radius: var(--radius-pill);
  background: var(--pawn-color, var(--color-accent));
  border: 3px solid var(--color-border);
  color: var(--color-border);
  font: 800 0.7rem var(--font-display);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-block-small);
  animation: pop-in var(--anim-med) var(--anim-bouncy);
}
.pawn--small {
  width: 22px;
  height: 22px;
  border-width: 2px;
  vertical-align: middle;
}

@keyframes pulse-target {
  from { box-shadow: 0 0 0 0 var(--color-accent-alt); }
  to { box-shadow: 0 0 0 3px var(--color-accent-alt); }
}

/* ---- Tracks ---- */

.track {
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  flex: 1;
  min-width: 240px;
}
.track__header {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-display);
  font-weight: 800;
  margin-bottom: 8px;
}
.track__value {
  background: var(--color-surface-raised);
  border-radius: var(--radius-pill);
  padding: 0 10px;
}
.track--danger .track__value {
  background: var(--color-danger);
  color: #2b0000;
  animation: pop-in var(--anim-med) var(--anim-bouncy);
}
.track__bar {
  display: flex;
  gap: 3px;
}
.track__seg {
  flex: 1;
  height: 18px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-raised);
  transition: background var(--anim-med) var(--anim-bouncy);
}
.track__seg--filled {
  background: var(--color-accent-alt);
}
.track__seg--filled.track__seg--danger {
  background: var(--color-danger);
}
/* Meters react to change: a jolt when they climb, a soft glow when they fall. */
.track--rise {
  animation: track-shake 480ms ease-out;
}
.track--rise .track__value {
  animation: pop-in var(--anim-med) var(--anim-bouncy);
  background: var(--color-danger);
  color: var(--color-border);
}
.track--fall {
  animation: track-soothe 900ms ease-out;
}
@keyframes track-shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-7px) rotate(-1deg); }
  30% { transform: translateX(6px) rotate(1deg); }
  45% { transform: translateX(-5px); }
  60% { transform: translateX(4px); }
  80% { transform: translateX(-2px); }
}
@keyframes track-soothe {
  0% { box-shadow: 0 0 0 0 var(--color-success); }
  40% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--color-success) 60%, transparent); }
  100% { box-shadow: 0 0 0 14px transparent; }
}

/* A new tile emerges out of the dark. */
.grid-tile--reveal {
  animation: tile-reveal var(--anim-reveal) var(--anim-bouncy);
}
@keyframes tile-reveal {
  0% { opacity: 0; transform: scale(0.55) rotate(-10deg); filter: brightness(0) blur(3px); }
  55% { opacity: 1; filter: brightness(1.9) blur(0); }
  100% { transform: none; filter: none; }
}

/* Background art behind a board, dimmed toward the surface color so the board stays readable. */
.backdrop .grid-scroll {
  background:
    linear-gradient(color-mix(in srgb, var(--color-surface) 62%, transparent), color-mix(in srgb, var(--color-surface) 78%, transparent)),
    var(--backdrop) center / cover;
  transition: background var(--anim-slow) ease;
}

@media (prefers-reduced-motion: reduce) {
  .track--rise, .track--fall, .grid-tile--reveal, .track--rise .track__value { animation: none; }
}

.ask-panel__whisper {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.entity-prompt__peek {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.entity-prompt__peek .tile-face {
  width: var(--grid-cell);
  height: var(--grid-cell);
}

.moods {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  flex-basis: 100%;
  font-size: 0.85rem;
}
.moods__label {
  font-family: var(--font-display);
  font-weight: 800;
}
.moods__none,
.moods__vision {
  color: var(--color-text-muted);
}
.moods__pill {
  background: var(--color-accent);
  color: var(--color-border);
  border: 3px solid var(--color-border);
  animation: pop-in var(--anim-med) var(--anim-bouncy);
}
@media (max-width: 640px) {
  .entity-top .moods { grid-column: 1 / -1; }
}

.tile-unknown {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-sm);
  background: repeating-linear-gradient(135deg, var(--color-border), var(--color-border) 6px, var(--color-surface) 6px, var(--color-surface) 12px);
  color: var(--color-text-muted);
  font: 800 1rem var(--font-display);
  opacity: 0.8;
}

.grid-tile--faded {
  opacity: 0.38;
  filter: grayscale(0.85);
}
.pawn--icon {
  background: var(--color-border);
  font-size: calc(var(--grid-cell) * 0.24);
  animation: art-breathe var(--anim-breathe) ease-in-out infinite;
}

.track__markers {
  position: relative;
  height: 24px;
}
.track__marker {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  font-size: 1.1rem;
  line-height: 1;
  transition: left var(--anim-slow) var(--anim-bouncy);
}
.track__marker::after {
  /* a little pointer down to the space it's on */
  content: "";
  display: block;
  width: 0;
  margin: 1px auto 0;
  border: 5px solid transparent;
  border-top-color: var(--color-text);
  border-bottom: 0;
}
.track__ends {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* ======================================================================
   Entity layout
   ====================================================================== */

.entity-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.pill--turn {
  background: var(--color-accent-alt);
  color: #2b1900;
  font-size: 0.85rem;
}
.entity-top {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}
.ask-panel {
  position: relative;
  overflow: hidden;
  background: var(--color-surface);
  border: var(--border-width-thick) solid var(--ask-color, var(--color-border));
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  padding-right: 130px; /* room for the Entity's face */
  min-width: 220px;
  flex: 1;
}
.ask-panel > :not(.art) {
  position: relative; /* text sits above the face */
}
.ask-panel__art {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 128px;
  height: 112px;
  margin-top: -56px;
}
.ask-panel--calm .ask-panel__art {
  opacity: 0.35;
  animation-duration: calc(var(--anim-breathe) * 2);
}

/* ---- Art (generic tinted silhouette) ---- */

.art {
  background: var(--art-tint, var(--color-text));
  -webkit-mask: var(--art-url) center / contain no-repeat;
  mask: var(--art-url) center / contain no-repeat;
  animation: art-breathe var(--anim-breathe) ease-in-out infinite;
}
.art--enter {
  animation: art-enter var(--anim-slow) var(--anim-bouncy), art-breathe var(--anim-breathe) ease-in-out var(--anim-slow) infinite;
}
@keyframes art-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
@keyframes art-enter {
  from { opacity: 0; transform: scale(0.4) rotate(-8deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}
@media (prefers-reduced-motion: reduce) {
  .art, .art--enter { animation: none; }
}
.ask-panel__label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.ask-panel__card {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--ask-color, var(--color-text));
  animation: pop-in var(--anim-med) var(--anim-bouncy);
}
.ask-panel__forecast {
  font-weight: 700;
  font-size: 0.9rem;
}
.ask-panel__forecast--good {
  color: var(--color-success);
}
.ask-panel__offering {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.ask-panel__offering .card {
  width: 60px;
  min-height: 80px;
  font-size: 0.7rem;
}

.entity-prompt {
  background: var(--color-surface-raised);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 14px;
}
.entity-prompt:empty {
  display: none;
}
.entity-prompt__text {
  margin: 0 0 10px;
  font-weight: 700;
}
.entity-prompt__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.entity-prompt__buttons .btn {
  padding: 8px 14px;
  font-size: 0.9rem;
}
.entity-prompt__tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.reorder-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.reorder-item__badge {
  font-weight: 800;
  font-family: var(--font-display);
}

.entity-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 14px;
  margin-bottom: 14px;
}
@media (max-width: 760px) {
  .entity-main {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .hotseat { padding: 8px 10px; gap: 6px 10px; }
  .hotseat__label { display: none; }
}
.hotseat__follow-short { display: none; }
@media (max-width: 640px) {
  .hotseat__follow-long { display: none; }
  .hotseat__follow-short { display: inline; }
}

.team {
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 12px;
  align-self: start;
}
.team__title {
  margin-bottom: 8px;
}
.team__row {
  border-radius: var(--radius-md);
  padding: 8px;
  margin-bottom: 6px;
  background: var(--color-surface-raised);
  border: 3px solid transparent;
}
.team__row--active {
  border-color: var(--color-accent-alt);
}
.team__name {
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.team__meta {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}
.team__items {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}
.team__items .token {
  width: 30px;
  height: 30px;
  font-size: 1rem;
}
.team__start {
  color: var(--color-accent-alt);
}
.team__offline {
  color: var(--color-danger);
  font-weight: 700;
}
.team__peek .card {
  width: 54px;
  min-height: 70px;
  font-size: 0.65rem;
}

.entity-mine {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}
.entity-mine .hand-section {
  flex: 1;
  min-width: 260px;
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 12px;
  margin: 0;
}

.trade-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.trade-row__label {
  font-weight: 800;
  min-width: 80px;
}

/* Mini cards (peeked hands, offerings): keep the value badge clear of the icon. */
.team__peek .card__header,
.ask-panel__offering .card__header {
  font-size: 1rem;
  text-align: left;
}
.team__peek .card__value,
.ask-panel__offering .card__value {
  font-size: 0.9rem;
}

/* ---- Hotseat (in-Claude) mode: home screen ---- */

.home > .panel {
  max-width: 560px;
  margin: 0 auto 20px;
}
.hint--left {
  text-align: left;
}
.field-label {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-text-muted);
  margin: 14px 0 8px;
}
.local-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.local-games {
  display: grid;
  gap: 10px;
}
.game-choice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  text-align: left;
  padding: 12px 16px;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
  color: var(--color-text);
  box-shadow: var(--shadow-block-small);
  transition: transform var(--anim-fast) var(--anim-bouncy);
}
.game-choice:hover {
  transform: translateY(-2px);
}
.game-choice--selected {
  outline: var(--border-width) solid var(--color-accent-alt);
  outline-offset: -2px;
}
.game-choice__name {
  font-size: 1.15rem;
  font-weight: 800;
}
.game-choice__desc {
  flex-basis: 100%;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-text-muted);
}
.pill--draft {
  background: var(--color-accent);
  color: #2b0008;
}
.local-names .input {
  margin-bottom: 8px;
}

/* ---- Hotseat bar: who's at the screen ---- */

.hotseat {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 10px 14px;
  margin-bottom: 16px;
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-block-small);
}
.hotseat__seats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.hotseat__label {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-text-muted);
}
.hotseat__seat {
  padding: 6px 14px;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-raised);
  color: var(--color-text);
  font-weight: 700;
  transition: transform var(--anim-fast) var(--anim-bouncy);
}
.hotseat__seat:hover {
  transform: translateY(-2px);
}
.hotseat__seat--active {
  background: var(--seat-color);
  color: var(--color-border);
  animation: pop-in var(--anim-med) var(--anim-bouncy);
}
.hotseat__waiting {
  color: var(--color-accent-alt);
}
.hotseat__seat--active .hotseat__waiting {
  color: var(--color-border);
}
.hotseat__follow {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}
.hotseat__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.hotseat__controls .btn {
  padding: 6px 14px;
}
.hotseat__status {
  font-weight: 700;
}

/* ======================================================================
   Immersive (full-screen) game layouts — GameUi.immersive
   ====================================================================== */

body.immersive {
  overflow: hidden;
}
body.immersive #app {
  max-width: none;
  padding: 0;
}
.game--immersive {
  position: fixed;
  inset: 0;
  overflow: hidden;
}
.game-topbar {
  display: flex;
  justify-content: center;
}
.game-topbar .hotseat {
  margin: 0;
  padding: 4px 10px;
  gap: 6px 12px;
  font-size: 0.85rem;
}
.game-topbar .hotseat__seat {
  padding: 2px 10px;
}
.game-topbar .hotseat__controls .btn {
  padding: 3px 10px;
}

/* ---- Hand fan (generic) ---- */

.hand-fan {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 0 24px;
}
.hand-fan__slot {
  position: relative;
  margin: 0 -16px;
  transform: rotate(var(--fan-rot)) translateY(var(--fan-drop));
  transform-origin: 50% 120%;
  transition:
    transform var(--anim-med) var(--anim-bouncy),
    margin var(--anim-med) var(--anim-bouncy);
  z-index: 1;
}
/* Looking into your hand: the cards spread and straighten, the one you point at lifts out. */
.hand-fan:hover .hand-fan__slot {
  margin: 0 4px;
  transform: rotate(calc(var(--fan-rot) * 0.4)) translateY(calc(var(--fan-drop) * 0.5));
}
.hand-fan .hand-fan__slot:hover {
  transform: translateY(-30px) scale(1.16);
  z-index: 10;
}
.hand-fan .card,
.hand-fan .card:hover,
.hand-fan .card--selected,
.hand-fan .card--selected:hover {
  transform: none;
}
.hand-fan .card {
  width: 128px;
  min-height: 176px;
  box-shadow: var(--shadow-block);
}
.hand-fan .card--selected {
  outline-offset: 2px;
}
.hand-fan__slot:has(.card--selected) {
  transform: translateY(-22px);
  z-index: 5;
}
.hand-fan:hover .hand-fan__slot:has(.card--selected):not(:hover) {
  transform: translateY(-22px);
}
.hand-fan .card__header {
  font-size: 1.3rem;
}
.hand-fan .card__value {
  font-size: 1.5rem;
}
@media (max-width: 640px) {
  .hand-fan {
    padding: 0 12px;
  }
  .hand-fan__slot {
    margin: 0 -12px;
  }
  .hand-fan:hover .hand-fan__slot {
    margin: 0 -4px;
  }
  .hand-fan .card {
    width: 96px;
    min-height: 136px;
    padding: 6px;
  }
  .hand-fan .hand-fan__slot:hover {
    transform: translateY(-18px) scale(1.08);
  }
}

/* What a card does, printed on it. */
.card__notes {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 6px;
}
.card__note {
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.15;
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--card-accent, var(--color-text)) 30%, transparent);
}
.card__note--off {
  background: transparent;
  color: var(--color-text-muted);
  opacity: 0.6;
}
.card--disabled {
  filter: grayscale(0.75) brightness(0.75);
}
.card--disabled.card--selected {
  filter: grayscale(0.4) brightness(0.9);
}
@media (max-width: 640px) {
  .card__note {
    font-size: 0.6rem;
    padding: 1px 3px;
  }
}

/* ---- Drawer (generic collapsible side panel) ---- */

.drawer {
  position: absolute;
  top: var(--hud-top, 0);
  transition: top var(--anim-med) ease;
  bottom: 12px;
  left: 0;
  width: min(320px, 86vw);
  display: flex;
  transform: translateX(-100%);
  pointer-events: none;
  z-index: 20;
}
.drawer--open {
  transform: none;
}
.drawer--opening {
  animation: drawer-in var(--anim-slow) var(--anim-bouncy) both;
}
.drawer--closing {
  animation: drawer-out var(--anim-med) ease-in both;
}
@keyframes drawer-in {
  from { transform: translateX(-100%); }
  to { transform: none; }
}
@keyframes drawer-out {
  from { transform: none; }
  to { transform: translateX(-100%); }
}
.drawer__body {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: color-mix(in srgb, var(--color-surface) 94%, transparent);
  border: var(--border-width) solid var(--color-border);
  border-left: 0;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  box-shadow: var(--shadow-block);
  pointer-events: auto;
}
.drawer:not(.drawer--open):not(.drawer--closing) .drawer__body {
  visibility: hidden;
}
.drawer__tab {
  position: absolute;
  left: 100%;
  top: 12px;
  margin-left: -2px;
  padding: 10px 12px;
  border: var(--border-width) solid var(--color-border);
  border-left: 0;
  border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
  background: var(--color-surface-raised);
  color: var(--color-text);
  font-weight: 800;
  white-space: nowrap;
  box-shadow: var(--shadow-block-small);
  pointer-events: auto;
  transition: transform var(--anim-fast) var(--anim-bouncy);
}
.drawer__tab:hover {
  transform: translateX(3px);
}
.drawer--open .drawer__tab {
  padding: 10px 8px;
}
.drawer-section {
  background: var(--color-surface-raised);
  border-radius: var(--radius-md);
  padding: 10px;
}
.drawer-section__title {
  font-size: 1rem;
  margin-bottom: 8px;
}
.drawer-section .team__row {
  background: var(--color-surface);
}
.drawer-section--stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.drawer-section--log {
  padding: 0;
  background: none;
}
.drawer-section--log .event-feed {
  max-height: none;
}

/* ---- Modal (generic) ---- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: color-mix(in srgb, var(--color-border) 70%, transparent);
  animation: fade-in var(--anim-med) ease-out;
}
.modal__box {
  width: min(860px, 100%);
  max-height: 100%;
  overflow-y: auto;
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-block);
  padding: 14px 18px;
  animation: pop-in var(--anim-slow) var(--anim-bouncy);
}
.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.modal__close {
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-raised);
  color: var(--color-text);
  width: 38px;
  height: 38px;
  font-weight: 800;
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---- Entity, full screen ---- */

.entity {
  position: absolute;
  inset: 0;
  /* Measured at runtime (measureHud); these are first-paint guesses. */
  --hud-top: 210px;
  --hud-bottom: 300px;
}
.entity .maze {
  position: absolute;
  inset: 0;
}
.entity .grid-scroll {
  position: relative;
  display: flex;
  height: 100%;
  max-height: none;
  border: 0;
  border-radius: 0;
  padding: var(--hud-top) 80px var(--hud-bottom);
  cursor: grab;
  scrollbar-width: thin;
}
.entity .grid-scroll.is-panning {
  cursor: grabbing;
  user-select: none;
}
.entity .grid-board {
  margin: auto;
  flex: none;
}
.entity .grid-overlay--clickable {
  cursor: pointer;
}
.grid-focus {
  pointer-events: none;
}

.entity-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.entity-header {
  position: absolute;
  top: 6px;
  left: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  z-index: 25; /* notices float over the side panel's tab */
}
.entity-header > * {
  pointer-events: auto;
  max-width: 100%;
}
.entity-notices {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.entity-notices .banner,
.entity-notices .reveal-ticker {
  margin: 0;
  box-shadow: var(--shadow-block);
}

/* The objective banner. */
.objective {
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: minmax(250px, 1.1fr) minmax(220px, 1fr) minmax(240px, 1.1fr);
  gap: 10px;
  padding: 8px;
  background: color-mix(in srgb, var(--color-surface) 90%, transparent);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-block);
  backdrop-filter: blur(3px);
}
.objective .ask-panel {
  min-width: 0;
  padding: 6px 10px;
  padding-right: 84px;
  background: var(--color-surface-raised);
}
.objective .ask-panel__art {
  width: 80px;
  height: 72px;
  margin-top: -36px;
  right: 2px;
}
.objective .ask-panel__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.objective .ask-panel__card {
  font-size: 1.4rem;
  line-height: 1.1;
}
.objective .ask-panel__forecast {
  font-size: 0.8rem;
}
.objective .ask-panel__whisper {
  font-size: 0.75rem;
}
.objective .ask-panel__offering {
  margin-top: 4px;
}
.objective .ask-panel__offering .card {
  width: 44px;
  min-height: 56px;
  padding: 3px;
}
.objective .ask-panel__offering .card:hover {
  transform: scale(1.4) translateY(10px);
}
.objective__meters {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.objective .track {
  min-width: 0;
  padding: 4px 10px 6px;
  background: var(--color-surface-raised);
  border-width: 3px;
}
.objective .track__header {
  font-size: 0.85rem;
  margin-bottom: 2px;
}
.objective .track__seg {
  height: 10px;
}
.objective .track__bar {
  gap: 2px;
}
.objective .track__markers {
  height: 18px;
}
.objective .track__marker {
  font-size: 0.9rem;
}
.objective .track__ends {
  display: none;
}
.objective__info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.objective .entity-status {
  margin: 0;
  gap: 4px 10px;
  font-size: 0.8rem;
}
.entity-status__rules {
  border: 0;
  cursor: pointer;
  background: var(--color-surface-raised);
  color: var(--color-text);
  margin-left: auto;
}
.objective .moods {
  margin: 0;
  gap: 4px 6px;
  font-size: 0.78rem;
}

/* Map tools: zoom and "center on me". */
.map-tools {
  position: absolute;
  right: 12px;
  top: calc(var(--hud-top) + 4px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: auto;
  z-index: 12;
}
.map-tools__btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  border: var(--border-width) solid var(--color-border);
  background: var(--color-surface-raised);
  color: var(--color-text);
  font-size: 1.2rem;
  font-weight: 800;
  box-shadow: var(--shadow-block-small);
  transition: transform var(--anim-fast) var(--anim-bouncy);
}
.map-tools__btn:hover:not(:disabled) {
  transform: scale(1.1);
}
.map-tools__btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* The dock: action bar + your hand, pinned to the bottom. */
.entity-dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px; /* room for a card lifted out of the hand */
  padding: 0 8px 14px;
  pointer-events: none;
  z-index: 10;
}
.entity-dock > * {
  pointer-events: auto;
}
.entity-dock .entity-prompt {
  margin: 0;
  width: min(780px, 100%);
  max-height: 38vh;
  overflow-y: auto;
  padding: 8px 14px;
  background: color-mix(in srgb, var(--color-surface-raised) 94%, transparent);
  box-shadow: var(--shadow-block);
  backdrop-filter: blur(3px);
}
.entity-dock .entity-prompt__text {
  margin-bottom: 4px;
  font-size: 0.92rem;
}
.entity-dock .entity-prompt__buttons {
  margin-top: 4px;
}
.entity-prompt__card {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 3px solid var(--color-border);
}
.entity-prompt__card-title {
  font-family: var(--font-display);
  font-weight: 800;
}
.entity-dock__row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
  max-width: 100%;
}
.entity-dock__row > * {
  pointer-events: auto;
}
.entity-dock__hand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
}
.entity-dock__label {
  position: relative;
  z-index: 20;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.8rem;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--color-surface) 85%, transparent);
}
.entity-dock__items {
  margin-bottom: 10px;
  background: var(--color-surface-raised);
}

/* Wide screens: the action bar sits in the corner beside the hand, leaving the middle to the map. */
@media (min-width: 1200px) {
  .entity-dock .entity-prompt {
    position: absolute;
    right: 12px;
    bottom: 14px;
    width: calc(50vw - 330px);
    max-height: calc(100vh - var(--hud-top) - 24px);
  }
  .entity-dock .entity-prompt:has(.entity-prompt__tiles, .trade-row) {
    width: calc(50vw - 300px);
  }
  .entity--drawer-open .grid-scroll {
    padding-left: 340px;
  }
}
@media (max-width: 900px) {
  .objective {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .objective .ask-panel {
    grid-row: span 2;
  }
  .objective__info {
    grid-column: 2;
  }
}
@media (max-width: 640px) {
  .entity {
    --hud-top: 230px;
    --hud-bottom: 240px;
  }
  .entity-header {
    top: 4px;
    left: 4px;
    right: 4px;
    gap: 4px;
  }
  .objective {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    padding: 5px;
  }
  .objective .ask-panel {
    grid-row: auto;
    padding-right: 64px;
  }
  .objective .ask-panel__art {
    width: 60px;
    height: 54px;
    margin-top: -27px;
  }
  .objective .ask-panel__card {
    font-size: 1.15rem;
  }
  .objective__meters {
    flex-direction: row;
  }
  .objective__meters .track {
    flex: 1;
  }
  .objective .track__header {
    font-size: 0.72rem;
  }
  .objective .track__markers {
    height: 14px;
  }
  .objective__info {
    grid-column: auto;
  }
  .objective .moods__label,
  .objective .moods__vision,
  .objective .moods__none {
    display: none;
  }
  /* Folded: just the Ask and the meters; tap "more" for whose turn, stats and moods. */
  .objective:not(.objective--open) .objective__info,
  .objective:not(.objective--open) .ask-panel__label,
  .objective:not(.objective--open) .ask-panel__whisper {
    display: none;
  }
  .objective .objective__fold {
    display: block;
    position: absolute;
    right: 8px;
    bottom: -14px;
  }
  .objective {
    position: relative;
    margin-bottom: 8px;
  }
  .game-topbar .hotseat {
    flex-wrap: nowrap;
    font-size: 0.75rem;
    gap: 6px;
    padding: 3px 6px;
  }
  .game-topbar .hotseat__seats,
  .game-topbar .hotseat__controls {
    flex-wrap: nowrap;
    gap: 4px;
  }
  .game-topbar .hotseat__controls .btn {
    padding: 2px 8px;
    font-size: 0.75rem;
  }
  .game-topbar .hotseat__seat,
  .game-topbar .hotseat__controls .btn,
  .game-topbar .hotseat__follow {
    white-space: nowrap;
  }
  .team__peek .hint {
    font-size: 0.75rem;
  }
  .entity-dock {
    padding: 0 4px 8px;
    gap: 22px;
  }
  .entity-dock .entity-prompt {
    padding: 6px 10px;
    max-height: 34vh;
  }
  .entity-dock .entity-prompt__text {
    font-size: 0.82rem;
  }
  .entity-dock .entity-prompt__buttons .btn {
    padding: 6px 10px;
    font-size: 0.8rem;
  }
  .map-tools {
    right: 6px;
  }
  .map-tools__btn {
    width: 38px;
    height: 38px;
  }
  .entity .grid-scroll {
    padding-left: 40px;
    padding-right: 40px;
  }
}
.objective__fold {
  display: none;
  border: 3px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-raised);
  color: var(--color-text);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 1px 10px;
}
.drawer .team__peek .hint {
  font-size: 0.8rem;
}
@media (prefers-reduced-motion: reduce) {
  .drawer--opening, .drawer--closing, .hand-fan__slot { animation: none; transition: none; }
}

/* ---- Long meters (continuous tracks) ---- */
.track__bar--continuous {
  height: 18px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-raised);
  overflow: hidden;
}
.track__fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--color-danger);
  transition: width var(--anim-slow) var(--anim-bouncy);
}

/* ---- Bags & slot rows (generic) ---- */
.bag__label {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.85rem;
  margin-bottom: 4px;
}
.bag__count {
  color: var(--color-text-muted);
}
.bag__tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  padding: 2px 8px 8px 0;
}
.bag .token {
  width: 34px;
  height: 34px;
  font-size: 1.05rem;
}
.bag__empty {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}
.slot-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.slot-row__empty {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  border: 3px dashed var(--color-surface-raised);
}

/* ======================================================================
   Table pieces (generic): drag & drop, rings, mats, scrolls
   ====================================================================== */
.draggable {
  touch-action: none;
  cursor: grab;
}
body.is-dragging,
body.is-dragging * {
  cursor: grabbing !important;
  user-select: none;
}
.drag-ghost {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1.25) rotate(-6deg);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.45);
  animation: none;
}
.drop-target--ready {
  outline: 3px dashed var(--color-accent-alt);
  outline-offset: 3px;
}
.drop-target--hover {
  outline-style: solid;
  filter: brightness(1.18);
}

/* Concentric rings around a center. Sizes scale off --rings-size. */
.rings {
  --size: var(--rings-size, 780px);
  --rc: calc(var(--size) * 0.33);
  position: relative;
  width: var(--size);
  height: var(--size);
  flex: none;
}
.ring {
  --band: calc((var(--size) * 0.5 - var(--rc)) / var(--ring-count));
  --outer: calc(var(--rc) + var(--band) * (var(--ring-index) + 1));
  --pip: min(36px, calc(var(--band) * 0.6));
  position: absolute;
  left: calc(50% - var(--outer));
  top: calc(50% - var(--outer));
  width: calc(var(--outer) * 2);
  height: calc(var(--outer) * 2);
  border-radius: 50%;
  border: var(--band) solid color-mix(in srgb, var(--color-ritual) calc(14% + var(--ring-index) * 6%), var(--color-surface));
  box-shadow: inset 0 0 0 3px var(--color-border), 0 0 0 3px var(--color-border);
  transition: filter var(--anim-fast) ease;
}
.ring--done {
  border-color: color-mix(in srgb, var(--color-success) 35%, var(--color-surface));
}
/* A ring with art for its band: the image fills the border box, the band itself goes clear. */
.ring--textured {
  border-color: transparent;
  background: var(--ring-image) center / 100% 100% no-repeat;
  background-origin: border-box;
  box-shadow: 0 0 0 3px var(--color-border);
}
/* Empty slots have to read over the runes: solid dark middle, glowing dashed edge. */
.ring--textured .ring__pip:not(.ring__pip--filled) {
  background: color-mix(in srgb, var(--color-background) 85%, transparent);
  box-shadow: 0 0 8px var(--pip-color);
}
.ring--textured.ring--done {
  border-color: transparent;
  filter: drop-shadow(0 0 10px var(--color-success));
}
.ring.drop-target--ready {
  outline: none;
  box-shadow: inset 0 0 0 3px var(--color-accent-alt), 0 0 0 3px var(--color-accent-alt), 0 0 22px color-mix(in srgb, var(--color-accent-alt) 50%, transparent);
}
.ring__pip {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--pip);
  height: var(--pip);
  margin: calc(var(--pip) / -2) 0 0 calc(var(--pip) / -2);
  transform: rotate(var(--pip-angle)) translateY(calc((var(--outer) - var(--band) / 2) * -1)) rotate(calc(var(--pip-angle) * -1));
  border-radius: 50%;
  border: 3px dashed var(--pip-color);
  background: color-mix(in srgb, var(--color-surface) 70%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--pip) * 0.5);
}
.ring__pip--filled {
  border: 3px solid var(--color-border);
  background: var(--pip-fill);
  animation: pop-in var(--anim-med) var(--anim-bouncy);
}
.ring__label {
  position: absolute;
  left: 50%;
  top: calc(100% + var(--band) / -2);
  transform: translate(-50%, -50%);
  z-index: 4;
  white-space: nowrap;
  padding: 1px 4px 1px 10px;
  border-radius: var(--radius-pill);
  border: 3px solid var(--color-border);
  background: var(--color-surface);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: max(0.62rem, calc(var(--band) * 0.24));
  pointer-events: none;
}
.ring__count {
  display: inline-block;
  padding: 0 7px;
  border-radius: var(--radius-pill);
  background: var(--color-ritual);
  color: var(--color-border);
}
.ring--done .ring__count {
  background: var(--color-success);
}
.rings__center {
  padding-bottom: calc(var(--rc) * 0.12);
  position: absolute;
  left: calc(50% - var(--rc));
  top: calc(50% - var(--rc));
  width: calc(var(--rc) * 2);
  height: calc(var(--rc) * 2);
  border-radius: 50%;
  border: var(--border-width) solid var(--color-border);
  background: radial-gradient(circle, var(--color-surface-raised), var(--color-surface));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

/* Art behind something you hold, with content laid on top. */
.mat {
  position: relative;
  background: var(--mat-image) center / contain no-repeat;
}
.mat__content {
  position: absolute;
  inset: 0;
}

/* A parchment scroll. */
.scroll {
  display: flex;
  flex-direction: column;
  min-width: 0;
  filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35));
}
.scroll__rod {
  height: 14px;
  margin: 0 -10px;
  border-radius: var(--radius-pill);
  border: 3px solid var(--color-border);
  background: linear-gradient(var(--color-parchment-dark), #8a6a3a);
}
.scroll__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--color-parchment-ink);
  background: var(--color-parchment);
  padding: 4px 12px 0;
  border-left: 3px solid var(--color-border);
  border-right: 3px solid var(--color-border);
}
.scroll__body {
  display: flex;
  gap: 8px;
  padding: 6px 10px 10px;
  overflow-x: auto;
  background: linear-gradient(var(--color-parchment), var(--color-parchment-dark));
  border-left: 3px solid var(--color-border);
  border-right: 3px solid var(--color-border);
  color: var(--color-parchment-ink);
  scrollbar-width: thin;
}

/* ======================================================================
   Pocket Magic — the table
   ====================================================================== */
.pm-table {
  position: absolute;
  inset: 0;
  --hud-top: 240px;
  --hud-bottom: 230px;
  --side-width: 290px;
}
.pm-stage {
  position: absolute;
  inset: 0;
  overflow: auto;
  display: flex;
  padding: var(--hud-top) calc(var(--side-width) + 24px) var(--hud-bottom) 40px;
  cursor: grab;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--color-ritual) 12%, var(--color-background)), var(--color-background) 70%);
  scrollbar-width: thin;
}
.pm-stage > .rings {
  margin: auto;
}
.pm-stage.is-panning {
  cursor: grabbing;
}
.pm-table .drawer {
  bottom: var(--hud-bottom);
}
.btn--small {
  padding: 4px 10px;
  font-size: 0.75rem;
}
/* Empty segments only — filled ones keep the theme's fill (this used to blank the instability pips). */
.pm-banner .track__seg:not(.track__seg--filled),
.pm-banner .track__bar--continuous {
  background: var(--color-surface);
}
.pm-banner .track__ends {
  display: none;
}
.pm-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}
.pm-hud > * {
  pointer-events: auto;
}
.pm-header {
  position: absolute;
  top: 6px;
  left: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  z-index: 25;
}
.pm-header > * {
  pointer-events: auto;
  max-width: 100%;
}
.pm-notices {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.pm-notices .banner,
.pm-notices .reveal-ticker {
  margin: 0;
  box-shadow: var(--shadow-block);
}

/* The enemy banner */
.pm-banner {
  width: min(1240px, 100%);
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(260px, 1.4fr) minmax(200px, 1fr) minmax(190px, 0.8fr);
  gap: 10px;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--color-surface) 92%, transparent);
  border: var(--border-width) solid var(--color-curse);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-block);
  backdrop-filter: blur(3px);
}
.pm-banner--molted {
  border-color: var(--color-danger);
}
.pm-banner__enemy {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  align-items: center;
}
.pm-banner__face {
  font-size: 2.4rem;
  animation: art-breathe var(--anim-breathe) ease-in-out infinite;
}
.pm-banner__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
}
.pm-banner__sub {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.pm-banner__hp {
  grid-column: 1 / -1;
}
.pm-banner .track {
  min-width: 0;
  padding: 4px 10px 6px;
  border-width: 3px;
  background: var(--color-surface-raised);
}
.pm-banner .track__header {
  font-size: 0.85rem;
  margin-bottom: 2px;
}
.pm-banner .track__seg {
  height: 10px;
}
.pm-banner .track__ends {
  font-size: 0.65rem;
}
.pm-banner__intent {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  min-width: 0;
}
.pm-banner__line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
.pm-target {
  background: var(--color-surface-raised);
  font-size: 0.72rem;
}
.pm-ability {
  background: var(--color-curse);
  font-size: 0.72rem;
  white-space: normal;
}
.pm-ability__text {
  font-weight: 600;
}
.pm-effect {
  background: color-mix(in srgb, var(--color-success) 35%, var(--color-surface-raised));
  font-size: 0.72rem;
}
.pm-label {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.78rem;
  margin-right: 4px;
}
.pm-banner__odds {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  min-width: 0;
}
.pm-odds {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.pm-odds__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 800;
}
.pm-odds .token {
  width: 32px;
  height: 32px;
  font-size: 1rem;
}
.pm-banner__track {
  min-width: 0;
}

/* Market in the middle of the rings */
.pm-market {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.pm-market__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}
.pm-market__cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: calc(var(--rc) * 1.5);
}
.pm-market__card {
  position: relative;
  border-radius: var(--radius-md);
}
.pm-market .card {
  width: calc(var(--rc) * 0.38);
  min-height: calc(var(--rc) * 0.5);
  padding: 4px;
  font-size: max(8px, calc(var(--rc) * 0.052));
}
.pm-market .card__header {
  font-size: 1.1em;
}
.pm-market .card__name {
  font-size: 1em;
}
.pm-market .card__note {
  font-size: 0.85em;
}
.pm-market .card:hover {
  transform: scale(1.7);
}
.pm-staged {
  position: absolute;
  left: 50%;
  bottom: -14px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 4px;
  border-radius: var(--radius-pill);
  background: var(--color-border);
  z-index: 3;
}
.pm-staged .token {
  width: 22px;
  height: 22px;
  font-size: 0.7rem;
  border-width: 2px;
}
.pm-staged__count {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0 3px;
}
.pm-staged__undo {
  border: 2px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-raised);
  color: var(--color-text);
  font-size: 0.75rem;
  padding: 0 6px;
}

/* Side: your turn, choices, items, tools */
.pm-side {
  position: absolute;
  right: 8px;
  top: var(--hud-top);
  bottom: var(--hud-bottom);
  width: var(--side-width);
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  z-index: 12;
  scrollbar-width: thin;
}
.pm-turncard,
.pm-chooser,
.pm-items {
  background: color-mix(in srgb, var(--color-surface) 94%, transparent);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 8px 10px;
  box-shadow: var(--shadow-block-small);
}
.pm-turncard {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.pm-turncard--mine {
  border-color: var(--color-accent-alt);
}
.pm-turncard__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.pm-turncard__title {
  font-family: var(--font-display);
  font-weight: 800;
}
.pm-turncard__text {
  font-size: 0.82rem;
}
.pm-turncard__hint {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--color-accent-alt);
}
.pm-portrait {
  width: 64px;
  height: 64px;
  object-fit: cover;
  object-position: 50% 12%;
  border-radius: 50%;
  border: var(--border-width) solid var(--color-border);
  background: var(--color-surface-raised);
  flex: none;
}
.pm-portrait--small {
  width: 42px;
  height: 42px;
  border-width: 3px;
}
.pm-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pm-buttons .btn {
  padding: 6px 12px;
  font-size: 0.85rem;
}
.pm-chooser {
  border-color: var(--color-accent);
  animation: pop-in var(--anim-med) var(--anim-bouncy);
}
.pm-chooser__text {
  margin: 0 0 6px;
  font-weight: 700;
  font-size: 0.85rem;
}
.pm-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pm-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  text-align: left;
  font-family: var(--font-body);
  font-size: 0.78rem;
  padding: 4px 6px;
  border: 3px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
  color: var(--color-text);
}
.pm-item--off {
  opacity: 0.55;
  cursor: default;
}
.pm-item__icon {
  font-size: 1.2rem;
}
.pm-item__text {
  color: var(--color-text-muted);
}
.pm-ritual {
  font-size: 0.78rem;
  padding: 4px 6px;
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
}
.pm-rituals .hint {
  font-size: 0.72rem;
}
.pm-ritual--done {
  opacity: 0.6;
}
.pm-ritual__count {
  background: var(--color-ritual);
  color: var(--color-border);
  font-size: 0.7rem;
}
.pm-tools {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin-top: auto;
}

/* Dock: off hand · spellbook scroll · main hand + bag */
.pm-dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 0 8px 6px;
  z-index: 10;
  pointer-events: none;
}
.pm-dock > * {
  pointer-events: auto;
}
.pm-mat {
  height: 190px;
  border-radius: var(--radius-lg);
}
.pm-mat--off {
  width: 170px;
  background-position: 30% 100%;
}
.pm-mat--main {
  width: 200px;
  background-position: 70% 100%;
}
.pm-mat__label {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.75rem;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--color-surface) 85%, transparent);
}
/* Tokens sit on the palm. */
.pm-mat--off .slot-row {
  position: absolute;
  left: 22%;
  right: 8%;
  top: 46%;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}
.pm-mat__tokens {
  position: absolute;
  left: 6%;
  right: 22%;
  top: 30%;
  bottom: 8%;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 4px;
}
.pm-mat .token,
.pm-mat .slot-row__empty {
  width: 40px;
  height: 40px;
  font-size: 1.15rem;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.45);
}
.pm-mat .slot-row__empty {
  box-shadow: none;
  border-color: color-mix(in srgb, var(--color-text) 45%, transparent);
  background: color-mix(in srgb, var(--color-border) 35%, transparent);
}
.pm-mat__empty {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  background: color-mix(in srgb, var(--color-border) 60%, transparent);
  padding: 0 6px;
  border-radius: var(--radius-pill);
}
.pm-mat.drop-target--ready {
  outline-offset: -6px;
}
.pm-dock__right {
  display: flex;
  align-items: flex-end;
  gap: 0;
}
.pm-bag {
  position: relative;
  width: 120px;
  height: 120px;
  margin-left: -26px;
  margin-bottom: 4px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transition: transform var(--anim-fast) var(--anim-bouncy);
}
.pm-bag:hover {
  transform: scale(1.06) rotate(-3deg);
}
.pm-bag--pulling {
  animation: bag-shake 500ms ease-out;
}
@keyframes bag-shake {
  0%, 100% { transform: none; }
  25% { transform: rotate(-6deg) scale(1.05); }
  60% { transform: rotate(4deg); }
}
.pm-bag__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.4));
}
.pm-bag__count {
  position: absolute;
  right: 6px;
  bottom: 8px;
  min-width: 28px;
  padding: 0 6px;
  border: 3px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-accent-alt);
  color: var(--color-border);
  font-family: var(--font-display);
  font-weight: 800;
}

/* Spell entries on the scroll */
.spell {
  position: relative;
  flex: 0 0 150px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 8px;
  border: 3px solid color-mix(in srgb, var(--color-parchment-ink) 55%, transparent);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, white 25%, transparent);
  cursor: default;
  transition: transform var(--anim-fast) var(--anim-bouncy);
}
.spell--ready {
  border-color: var(--color-parchment-ink);
  background: color-mix(in srgb, white 45%, transparent);
  cursor: pointer;
}
.spell--ready:hover {
  transform: translateY(-4px);
}
.spell--off {
  opacity: 0.5;
}
.spell--choosing {
  outline: 4px solid var(--color-accent);
}
.spell__head {
  display: flex;
  gap: 4px;
  align-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.9rem;
}
.spell__pips {
  display: flex;
  gap: 3px;
}
.spell__pip {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px dashed var(--pip-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  background: color-mix(in srgb, var(--pip-color) 25%, transparent);
}
.spell__pip--paid {
  border: 2px solid var(--color-border);
  background: var(--pip-fill);
  animation: pop-in var(--anim-med) var(--anim-bouncy);
}
.spell__text {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.15;
}
.spell__undo {
  position: absolute;
  top: 4px;
  right: 4px;
}

/* Party (in the side drawer) */
.pm-player {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  margin-bottom: 6px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 3px solid transparent;
}
.pm-player .track {
  min-width: 0;
  padding: 4px 8px;
}
.pm-player .track__seg {
  height: 10px;
}
.pm-player--active {
  border-color: var(--color-accent-alt);
}
.pm-player--down {
  opacity: 0.6;
}
.pm-player__head {
  display: flex;
  gap: 8px;
  align-items: center;
}
.pm-player__name {
  font-weight: 800;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
.pm-player__wards {
  font-size: 0.78rem;
}
.pm-first {
  background: var(--color-surface-raised);
}
.pm-down {
  background: var(--color-danger);
  color: var(--color-border);
}
.pm-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
.pm-row .token {
  width: 30px;
  height: 30px;
  font-size: 0.9rem;
}

/* The enemy's turn, one pull at a time */
.pm-enemyturn {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pm-enemyturn__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pm-enemyturn__pull {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
  border: 3px solid var(--color-border);
  animation: pop-in var(--anim-slow) var(--anim-bouncy) both;
}
.pm-enemyturn__token {
  width: 54px;
  height: 54px;
  flex: none;
  border-radius: 50%;
  border: var(--border-width) solid var(--color-border);
  background: var(--pull-color, var(--color-overload));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}
.pm-enemyturn__name {
  font-family: var(--font-display);
  font-weight: 800;
}
.pm-enemyturn__text {
  font-size: 0.9rem;
}
.pm-enemyturn__go {
  align-self: flex-end;
  animation: pop-in var(--anim-slow) var(--anim-bouncy) both;
}
.pm-baglist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pm-baglist__row {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 0.9rem;
}
.pm-baglist__icon {
  font-size: 1.6rem;
  width: 44px;
  text-align: center;
}

@media (max-width: 1100px) {
  .pm-banner {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

/* Tokens with art: the image is the token (it has its own rim). */
.token--art {
  background: none;
  border: none;
  overflow: visible;
}
.token__art {
  width: 118%;
  height: 118%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.45));
}
.token--art.token--selected {
  outline: none;
}
.token--art.token--selected .token__art {
  filter: drop-shadow(0 0 0 var(--color-accent-alt)) drop-shadow(0 0 6px var(--color-accent-alt)) drop-shadow(0 3px 0 rgba(0, 0, 0, 0.45));
  transform: translateY(-4px) scale(1.06);
}
.pm-mat .token--art {
  box-shadow: none;
}
.ring__pip .token__art,
.spell__pip .token__art {
  width: 120%;
  height: 120%;
  object-fit: contain;
  filter: none;
}
.spell__pip:not(.spell__pip--paid) .token__art {
  opacity: 0.45;
  filter: grayscale(0.3);
}
.ring__pip--filled:has(.token__art),
.spell__pip--paid:has(.token__art) {
  background: none;
  border-color: transparent;
}

/* ---- Tabs & sheets (generic) ---- */
.tabbar {
  display: flex;
  justify-content: space-around;
  gap: 2px;
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  background: var(--color-surface);
  border-top: var(--border-width) solid var(--color-border);
}
.tabbar__tab {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 2px;
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  color: var(--color-text-muted);
  font-size: 0.68rem;
  font-weight: 800;
}
.tabbar__icon {
  font-size: 1.25rem;
  line-height: 1;
}
.tabbar__tab--active {
  background: var(--color-surface-raised);
  color: var(--color-text);
}
.tabbar__badge {
  position: absolute;
  top: 0;
  right: calc(50% - 22px);
  min-width: 18px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--color-border);
  background: var(--color-accent-alt);
  color: var(--color-border);
  font-size: 0.62rem;
  line-height: 14px;
}
.sheet {
  position: absolute;
  left: 4px;
  right: 4px;
  top: var(--hud-top, 60px);
  bottom: var(--hud-bottom, 200px);
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-block);
  z-index: 30;
  pointer-events: auto;
  animation: sheet-up var(--anim-med) var(--anim-bouncy);
}
@keyframes sheet-up {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 3px solid var(--color-border);
}
.sheet__title {
  font-family: var(--font-display);
  font-weight: 800;
}
.sheet__close {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  border: 3px solid var(--color-border);
  background: var(--color-surface-raised);
  color: var(--color-text);
  font-weight: 800;
}
.sheet__body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---- Pocket Magic on phones ---- */
.pm-table--phone .pm-stage {
  padding: var(--hud-top) 16px var(--hud-bottom) 16px;
}
.pm-table--phone .pm-header {
  top: 4px;
  left: 4px;
  right: 4px;
}
.pm-strip {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 3px solid var(--color-curse);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--color-surface) 94%, transparent);
  color: var(--color-text);
  box-shadow: var(--shadow-block-small);
  font-family: var(--font-display);
}
.pm-strip__face {
  font-size: 1.3rem;
}
.pm-strip__hp {
  flex: 1;
  position: relative;
  height: 18px;
  min-width: 60px;
}
.pm-strip__bar {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-pill);
  background: var(--color-surface-raised);
  overflow: hidden;
}
.pm-strip__fill {
  display: block;
  height: 100%;
  background: var(--color-danger);
  transition: width var(--anim-slow) var(--anim-bouncy);
}
.pm-strip__num {
  position: relative;
  display: block;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 18px;
}
.pm-strip__inst,
.pm-strip__turn {
  font-size: 0.7rem;
  background: var(--color-surface-raised);
  white-space: nowrap;
}
.pm-strip__inst--danger {
  background: var(--color-danger);
  color: var(--color-border);
}
.pm-strip__turn--mine {
  background: var(--color-accent-alt);
  color: var(--color-border);
}
.pm-dock--phone {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: 0;
}
.pm-phone-hands {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) auto;
  align-items: end;
  gap: 2px;
  padding: 0 2px;
}
.pm-dock--phone .pm-mat {
  height: 128px;
}
.pm-dock--phone .pm-mat--off {
  width: 100px;
}
.pm-dock--phone .pm-mat--main {
  width: 120px;
}
.pm-dock--phone .pm-mat .token,
.pm-dock--phone .pm-mat .slot-row__empty {
  width: 30px;
  height: 30px;
  font-size: 0.85rem;
}
.pm-dock--phone .pm-mat__label {
  font-size: 0.65rem;
}
.pm-dock--phone .pm-bag {
  width: 64px;
  height: 64px;
  margin-left: -34px;
}
.pm-phone-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding-bottom: 6px;
  text-align: center;
}
.pm-phone-actions .btn {
  width: 100%;
  max-width: 130px;
}
.pm-dock--phone .scroll {
  margin: 0 8px;
}
.pm-dock--phone .scroll__title {
  display: none;
}
.pm-dock--phone .scroll__rod {
  height: 8px;
}
.pm-dock--phone .scroll__body {
  padding: 4px 6px;
}
.pm-dock--phone .spell {
  flex-basis: 112px;
  padding: 3px 6px;
}
.pm-dock--phone .spell__text {
  font-size: 0.62rem;
}
.pm-dock--phone .spell__pip {
  width: 18px;
  height: 18px;
}
.sheet .pm-banner {
  grid-template-columns: minmax(0, 1fr);
  border: 0;
  box-shadow: none;
  padding: 0;
  background: none;
}
.sheet .pm-items {
  border: 0;
  box-shadow: none;
  padding: 0;
  background: none;
}
.sheet .pm-chooser {
  border: 0;
  box-shadow: none;
  padding: 0;
  animation: none;
}
.sheet .game-topbar .hotseat {
  flex-wrap: wrap;
}
.pm-table--phone .modal__box {
  padding: 10px 12px;
}

/* The mana supply in the middle of the rings */
.pm-supply {
  display: flex;
  gap: 4px;
  justify-content: center;
}
.pm-supply__coin {
  position: relative;
  width: calc(var(--rc) * 0.22);
  height: calc(var(--rc) * 0.22);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: calc(var(--rc) * 0.12);
  transition: transform var(--anim-fast) var(--anim-bouncy);
}
.pm-supply__coin:hover {
  transform: scale(1.12) translateY(-2px);
}
.pm-supply__coin .token__art {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.45));
}
.pm-supply__coin--off {
  opacity: 0.45;
  cursor: default;
}
.pm-supply__price {
  position: absolute;
  right: -4px;
  bottom: -4px;
  min-width: 18px;
  padding: 0 4px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-accent-alt);
  color: var(--color-border);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.65rem;
  line-height: 14px;
}
.pm-market .pm-market__title {
  margin-top: 2px;
}

/* Market cards stay compact so three markets fit inside the inner ring; hover to read the whole card. */
.pm-market .card {
  height: calc(var(--rc) * 0.46);
  min-height: 0;
  overflow: hidden;
}
.pm-market .card:hover {
  height: auto;
  min-height: calc(var(--rc) * 0.46);
  overflow: visible;
  z-index: 40;
}
.pm-market__card:hover {
  z-index: 40;
}
.pm-market .card__tag {
  display: none;
}

.pm-reroll {
  margin-left: 4px;
  padding: 0 6px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-raised);
  color: var(--color-text);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.68rem;
  cursor: pointer;
}
.pm-reroll:hover {
  background: var(--color-accent-alt);
  color: var(--color-border);
}

/* One-shot burst effect (playBurst) — e.g. an overload exploding out of the bag. */
.burst {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  filter: drop-shadow(0 0 18px rgba(255, 140, 40, 0.8));
}

/* The market's item slot (the rest are spells): a little apart, with a pill so it reads as different. */
.pm-market__card--item {
  margin-left: 8px;
}
.pm-market__card--item::before {
  content: "Item";
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--color-border);
  background: var(--color-item);
  color: var(--color-border);
  font-size: 0.6rem;
  font-weight: 800;
}

/* Frozen tokens (a game status on the piece): an icy glaze, a frost rim, a snowflake badge. */
.token--status-nulled {
  filter: grayscale(1) brightness(0.8);
  outline: 3px dashed var(--color-text-muted);
}
.token--status-frozen {
  position: relative;
  filter: saturate(0.35) brightness(1.15);
  box-shadow: 0 0 0 3px var(--color-ice), 0 0 14px var(--color-ice);
  border-radius: 50%;
}
.token--status-frozen::after {
  content: "❄️";
  position: absolute;
  right: -6px;
  top: -6px;
  font-size: 0.85rem;
  filter: drop-shadow(0 0 3px var(--color-ice));
  animation: pop-in var(--anim-med) var(--anim-bouncy);
}
.token--status-frozen::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, color-mix(in srgb, var(--color-ice) 55%, transparent), transparent 60%);
  pointer-events: none;
}

/* An enemy's portrait (Ethan's art) in the banner and the phone strip. */
.pm-enemy-portrait {
  display: block;
  border-radius: 50%;
  border: 3px solid var(--color-ice);
  object-fit: cover;
  box-shadow: 0 0 12px color-mix(in srgb, var(--color-ice) 60%, transparent);
}
.pm-banner__img.pm-enemy-portrait {
  width: 64px;
  height: 64px;
}
.pm-strip__img.pm-enemy-portrait {
  width: 30px;
  height: 30px;
  border-width: 2px;
}
.pm-enemy-portrait--molted {
  filter: hue-rotate(160deg) saturate(1.6);
}
.pm-enemyturn__art {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  object-position: center 20%;
  border-radius: var(--radius-md, 12px);
  border: var(--border-width) solid var(--color-border);
  margin-bottom: 8px;
}
.pm-armor {
  margin-top: 4px;
  display: inline-block;
  background: var(--color-ice);
  color: var(--color-border);
  font-weight: 800;
  font-size: 0.75rem;
}

/* Bounded grids (Entity's search mode): the whole board is drawn, empty cells as faint slots. */
.grid-board--bounded {
  padding: 6px;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-md, 12px);
  background: color-mix(in srgb, var(--color-surface) 55%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-accent) 35%, transparent);
}
.grid-empty {
  border: 2px dashed color-mix(in srgb, var(--color-text) 15%, transparent);
  border-radius: var(--radius-sm);
  margin: 3px;
}
/* A face-down tile: a card back rather than the fog's hatching. */
.tile-facedown {
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--color-accent-alt) 45%, var(--color-surface)), var(--color-surface) 75%);
  font-size: calc(var(--grid-cell, 64px) * 0.32);
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--color-accent-alt) 50%, transparent);
}
.grid-overlay--flip {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--color-accent-alt);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-accent-alt) 22%, transparent);
  animation: pop-in var(--anim-med) var(--anim-bouncy);
}
.grid-flip {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--color-border);
  background: var(--color-accent-alt);
  color: var(--color-border);
  font-weight: 800;
  font-size: 0.75rem;
}

/* ======================================================================
   Pocket Magic — desktop "board on a table" layout (renderDesk)
   Everything shared is laid out on one big board you pan (drag) and zoom;
   your own pieces sit along the bottom; your private stuff is behind a tab.
   ====================================================================== */
.pm-table--desk {
  --hud-top: 64px;
}
.pm-stage--board {
  padding: var(--hud-top) 72px var(--hud-bottom) 24px;
  display: block;
  background:
    radial-gradient(ellipse at 50% 55%, color-mix(in srgb, var(--color-ritual) 14%, transparent), transparent 60%),
    repeating-linear-gradient(45deg, color-mix(in srgb, var(--color-surface) 35%, transparent) 0 2px, transparent 2px 22px),
    var(--color-background);
}
/* The board itself: enemy across the top, rituals | rings | party below. */
.pm-board {
  display: grid;
  grid-template-columns: 320px auto 340px;
  grid-template-areas:
    "enemy enemy enemy"
    "rituals rings party";
  gap: 36px 40px;
  align-items: start;
  justify-content: center;
  width: max-content;
  margin: 0 auto;
  padding: 40px 60px 80px;
}
.pm-area--enemy {
  grid-area: enemy;
  justify-self: center;
  width: 100%;
  max-width: 1300px;
}
.pm-area--rituals {
  grid-area: rituals;
  align-self: center;
}
.pm-area--rings {
  grid-area: rings;
}
.pm-area--party {
  grid-area: party;
  align-self: center;
}
.pm-board .pm-banner {
  width: 100%;
  backdrop-filter: none;
}
/* Ritual cards and player boards sit on the table like printed boards. */
.pm-board .pm-rituals,
.pm-board .pm-party {
  padding: 12px;
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-block);
}
.pm-board .pm-rituals {
  border-color: var(--color-ritual);
}
.pm-board .pm-ritual {
  padding: 8px 10px;
}

/* Camera controls down the right edge. */
.pm-camera {
  position: absolute;
  top: var(--hud-top);
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 20;
}
.pm-camera__gap {
  height: 6px;
}
.pm-camera .map-tools__btn {
  width: 46px;
  height: 46px;
}
.map-tools__btn--on {
  background: var(--color-accent);
  color: var(--color-border);
}

/* Your turn controls, right above your hands. */
.pm-front {
  position: absolute;
  left: 50%;
  bottom: calc(var(--hud-bottom) - 4px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 15;
  width: min(760px, calc(100% - 200px));
}
.pm-turnbar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 10px;
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-block);
}
.pm-turnbar--mine {
  border-color: var(--color-accent);
  animation: pop-in var(--anim-med) var(--anim-bouncy);
}
.pm-turnbar__body {
  flex: 1;
  min-width: 0;
}
.pm-turnbar__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
}
.pm-turnbar__text {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.pm-turnbar .pm-buttons {
  flex-wrap: nowrap;
}
.pm-front .pm-chooser {
  width: 100%;
  box-shadow: var(--shadow-block);
}

/* Your tab (items, wards…) opens as a panel on the right, not over the whole table. */
.pm-table--desk .sheet {
  left: auto;
  right: 66px;
  width: min(380px, calc(100% - 90px));
  bottom: var(--hud-bottom);
}

/* Shorter screens: a slimmer dock so the table gets the room. */
@media (max-height: 820px) {
  .pm-table--desk .spell {
    min-height: 0;
    padding: 4px 8px;
    width: 130px;
  }
  .pm-table--desk .spell__text {
    font-size: 0.7rem;
  }
  .pm-table--desk .pm-mat {
    transform: scale(0.85);
    transform-origin: bottom center;
  }
}

/* ======================================================================
   Sidestep — the room grid with telegraphs, the dock (pool + hand)
   ====================================================================== */
.ss-table {
  position: absolute;
  inset: 0;
  --hud-top: 64px;
  --hud-bottom: 170px;
}
.ss-stage {
  position: absolute;
  inset: 0;
  overflow: auto;
  cursor: grab;
  padding: var(--hud-top) 70px var(--hud-bottom) 50px;
  background:
    repeating-linear-gradient(0deg, color-mix(in srgb, var(--color-surface) 45%, transparent) 0 2px, transparent 2px 24px),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--color-surface) 45%, transparent) 0 2px, transparent 2px 24px),
    var(--color-background);
}
.ss-stage.is-panning {
  cursor: grabbing;
}
/* One table: info along the top edge, enemies + party left, the room in the middle, the pool right. */
.ss-tableboard {
  display: grid;
  grid-template-columns: 250px auto 250px;
  grid-template-areas:
    "info info info"
    "enemies room pool"
    "party room pool";
  grid-template-rows: auto auto 1fr;
  gap: 18px;
  width: max-content;
  margin: 0 auto;
  padding: 22px;
  border-radius: 28px;
  background: color-mix(in srgb, var(--color-surface) 55%, var(--color-background));
  border: 6px solid var(--color-border);
  box-shadow: var(--shadow-block);
  align-items: start;
}
.ss-area {
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  border: 4px dashed color-mix(in srgb, var(--color-text-muted) 45%, transparent);
  background: color-mix(in srgb, var(--color-background) 55%, transparent);
  min-width: 0;
}
.ss-area__title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1rem;
}
.ss-area--info {
  grid-area: info;
  border-style: solid;
}
.ss-area--enemies {
  grid-area: enemies;
}
.ss-area--party {
  grid-area: party;
}
.ss-area--room {
  grid-area: room;
  border: none;
  background: none;
  padding: 0;
  justify-self: center;
}
.ss-area--room .grid-scroll {
  overflow: visible;
}
.ss-area--pool {
  grid-area: pool;
}
.ss-area--live {
  border-style: solid;
  border-color: var(--color-accent);
  animation: ss-pop var(--anim-medium, 0.3s) var(--anim-bouncy);
}
@keyframes ss-pop {
  from {
    transform: scale(0.96);
  }
}
.ss-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.ss-info__pill {
  font-weight: 800;
}
.ss-info__turn {
  background: var(--color-accent);
  color: var(--color-border);
}
.ss-info__slow {
  background: var(--color-yellow);
  color: var(--color-border);
}
.ss-info__hint {
  margin: 6px 0 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
/* Telegraphs: the enemy's colour, striped, with a ⚠ (or 💥2 for heavy hits). */
.ss-tg {
  --tg: var(--color-red);
  border-radius: var(--radius-sm);
  border: 3px solid var(--tg);
  background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--tg) 45%, transparent) 0 6px, color-mix(in srgb, var(--tg) 20%, transparent) 6px 12px);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  pointer-events: auto;
  animation: ss-pulse 1.6s ease-in-out infinite;
}
.ss-tg--red { --tg: var(--color-red); }
.ss-tg--blue { --tg: var(--color-blue); }
.ss-tg--yellow { --tg: var(--color-yellow); }
.ss-tg--seat2 { --tg: var(--color-seat2); }
.ss-tg--seat4 { --tg: var(--color-seat4); }
.ss-tg--seat5 { --tg: var(--color-seat5); }
.ss-tg--heavy {
  border-width: 5px;
}
.ss-tg--picked {
  outline: 4px solid var(--color-text);
}
@keyframes ss-pulse {
  50% {
    filter: brightness(1.35);
  }
}
.ss-mark {
  font-size: calc(var(--grid-cell) * 0.22);
  font-weight: 800;
  padding: 1px 3px;
  pointer-events: none;
}
.ss-hazard {
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-danger) 35%, transparent);
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
}
.ss-path {
  border-radius: 50%;
  margin: 30%;
  background: color-mix(in srgb, var(--color-accent) 70%, transparent);
}
.ss-reach {
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-accent-alt) 18%, transparent);
  pointer-events: none;
}
/* A square you can reach by spending ⚡ on tweaks: quieter than the card's own 👣. */
.ss-dest--tweak {
  border-style: dashed;
  opacity: 0.8;
}
.ss-dest--tweak .ss-mark {
  color: var(--color-yellow);
}
.ss-dest--tweak2 {
  opacity: 0.6;
}
.ss-dest,
.ss-aim {
  display: flex;
  align-items: center;
  justify-content: center;
}
.pawn--faded {
  opacity: 0.55;
  filter: grayscale(0.6);
}
.grid-tokens .pawn {
  position: relative;
}
.grid-tokens .pawn .token__badge {
  font-size: 0.6rem;
}
.ss-area--room .pawn {
  width: calc(var(--grid-cell) * 0.5);
  height: calc(var(--grid-cell) * 0.5);
  font-size: calc(var(--grid-cell) * 0.26);
}

.ss-enemy {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  padding: 3px 0;
}
.ss-enemy__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--enemy-color);
  border: 2px solid var(--color-border);
}
.ss-enemy__hp {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
}
.ss-enemy__bar {
  width: 60px;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-raised);
  overflow: hidden;
}
.ss-enemy__fill {
  display: block;
  height: 100%;
  background: var(--enemy-color);
}
.ss-player {
  padding: 6px 8px;
  border-radius: var(--radius-md);
  border: 3px solid transparent;
  margin-bottom: 4px;
  background: var(--color-surface-raised);
}
.ss-player--active {
  border-color: var(--color-accent);
}
.ss-player--ghost {
  opacity: 0.7;
}
.ss-player__name {
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ss-player__tags {
  font-size: 0.78rem;
}
.ss-first {
  background: var(--color-accent);
  color: var(--color-border);
  font-size: 0.65rem;
}
.ss-camera {
  top: var(--hud-top);
}

/* Off the table: your turn line and your small attack cards */
.ss-dock {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 12;
  pointer-events: none;
}
.ss-dock > * {
  pointer-events: auto;
}
.ss-turnbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 10px;
  padding: 3px 4px 3px 14px;
  background: var(--color-surface);
  border: 3px solid var(--color-border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-block);
  max-width: 100%;
}
.ss-turnbar--mine {
  border-color: var(--color-accent);
}
.ss-turnbar__text {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 4px 0;
}
.ss-turnbar .btn {
  padding: 4px 12px;
  font-size: 0.85rem;
}
.ss-handwrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  max-width: 100%;
}
.ss-held {
  max-width: min(520px, 100%);
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--color-surface);
  border: 3px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-block);
}
.ss-label {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.8rem;
}
.ss-cards {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  margin-top: 4px;
}
.ss-cards--free {
  max-width: 420px;
  align-items: center;
}
.ss-free__label {
  width: 100%;
  text-align: center;
  font-size: 0.72rem;
  color: var(--color-text-muted);
}
.ss-move {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 4px 6px;
  border-radius: var(--radius-md);
  border: 3px solid var(--color-border);
  background: var(--color-surface-raised);
  color: var(--color-text);
  font-weight: 800;
  cursor: pointer;
  transition: transform var(--anim-fast) var(--anim-bouncy);
}
.ss-move:hover:not(:disabled) {
  transform: translateY(-3px);
}
.ss-move:disabled {
  opacity: 0.45;
  cursor: default;
}
.ss-move--live {
  border-color: var(--color-accent);
}
.ss-move--chosen {
  background: var(--color-accent);
  color: var(--color-border);
}
.ss-move--free {
  min-width: 40px;
  padding: 2px 6px;
}
.ss-move--star {
  font-size: 0.75rem;
}
.ss-move__arrows {
  font-size: 1.15rem;
  letter-spacing: -2px;
}
.ss-move__name {
  font-size: 0.6rem;
}
/* Your hand: small cards (icon + name); the text shows in the turn bar when you pick one up. */
.ss-hand {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: flex-end;
  max-width: 100%;
}
.ss-hand .card {
  width: 84px;
  min-height: 0;
  padding: 6px;
  gap: 2px;
}
.ss-hand .card__header {
  font-size: 1.3rem;
  line-height: 1;
}
.ss-hand .card__name {
  font-size: 0.72rem;
}
.ss-hand .card:hover,
.ss-hand .card--selected,
.ss-hand .card--selected:hover {
  transform: translateY(-6px);
}
.ss-hand__ghost {
  max-width: 320px;
  padding: 6px 10px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
}

/* Class pick / upgrade dialogs */
.ss-choose__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}
.ss-class {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border-radius: var(--radius-lg);
  border: var(--border-width) solid var(--color-border);
  background: var(--color-surface-raised);
}
.ss-class--taken {
  opacity: 0.5;
}
.ss-class--mine {
  border-color: var(--color-accent);
  opacity: 1;
}
.ss-class__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
}
.ss-class__id {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.ss-class__cards {
  margin: 0;
  padding-left: 18px;
  font-size: 0.78rem;
}
.ss-rules {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ss-rule {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
  font-size: 0.85rem;
}
@media (max-width: 760px) {
  .ss-table {
    --hud-top: 56px;
    --hud-bottom: 150px;
  }
  .ss-stage {
    padding: var(--hud-top) 60px var(--hud-bottom) 10px;
  }
  /* Phones: the table stacks — info, the room, the pool right under it, enemies, party. */
  .ss-tableboard {
    grid-template-columns: auto;
    grid-template-areas: "info" "room" "pool" "enemies" "party";
    grid-template-rows: none;
    padding: 12px;
    gap: 12px;
  }
  /* The room sets the table's width; everything else wraps to fit under it. */
  .ss-area:not(.ss-area--room) {
    width: 0;
    min-width: 100%;
    box-sizing: border-box;
  }
  .ss-dock {
    left: 6px;
    right: 6px;
  }
  .ss-turnbar {
    padding: 2px 4px 2px 10px;
    gap: 4px 6px;
  }
  .ss-turnbar__text {
    font-size: 0.72rem;
  }
  .ss-turnbar .btn {
    padding: 3px 9px;
    font-size: 0.78rem;
  }
  .ss-hand .card {
    width: 72px;
    padding: 4px;
  }
  .ss-hand .card__header {
    font-size: 1.1rem;
  }
  .ss-hand .card__name {
    font-size: 0.65rem;
  }
}
/* Sidestep tokens wear their colour: players their seat colour, enemies the colour of their telegraphs. */
.ss-area--room .pawn,
.ss-area--room .pawn--icon {
  background: var(--pawn-color, var(--color-surface-raised));
  border: 3px solid var(--color-border);
}

/* ======================================================================
   Last Light — one table: tracks along the top edge, the night on the left,
   the base in the middle, build cards on the right, the expedition below.
   Off the table: the squad's cards and the lock-in line.
   ====================================================================== */
.ll-table {
  position: absolute;
  inset: 0;
  --hud-top: 64px;
  --hud-bottom: 200px;
}
.ll-stage {
  position: absolute;
  inset: 0;
  overflow: auto;
  cursor: grab;
  padding: var(--hud-top) 70px var(--hud-bottom) 50px;
  background:
    radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--color-yellow) 8%, transparent), transparent 55%),
    var(--color-background);
}
.ll-stage.is-panning {
  cursor: grabbing;
}
.ll-tableboard {
  display: grid;
  grid-template-columns: 300px auto 340px;
  grid-template-areas:
    "tracks tracks tracks"
    "night base builds"
    "night expedition builds";
  gap: 18px;
  width: max-content;
  margin: 0 auto;
  padding: 24px;
  border-radius: 28px;
  background: color-mix(in srgb, var(--color-surface) 55%, var(--color-background));
  border: 6px solid var(--color-border);
  box-shadow: var(--shadow-block);
  align-items: start;
}
.ll-area {
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  border: 4px dashed color-mix(in srgb, var(--color-text-muted) 45%, transparent);
  background: color-mix(in srgb, var(--color-background) 55%, transparent);
  min-width: 0;
}
.ll-area__title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1rem;
}
.ll-area--tracks {
  grid-area: tracks;
  border-style: solid;
}
.ll-area--night {
  grid-area: night;
}
.ll-area--base {
  grid-area: base;
  border: none;
  background: none;
  padding: 0;
  justify-self: center;
}
.ll-area--builds {
  grid-area: builds;
}
.ll-area--expedition {
  grid-area: expedition;
}
.ll-round {
  text-align: center;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}
.ll-round b {
  color: var(--color-text);
}
.ll-tracks {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 8px;
}
.ll-track .track {
  min-width: 0;
  padding: 4px 10px 6px;
  border-width: 3px;
  border-radius: var(--radius-md);
}
.ll-track .track__header {
  font-size: 0.8rem;
}
.ll-track .track__value {
  padding: 0 6px;
  font-size: 0.75rem;
}
.ll-track .track__seg {
  height: 10px;
}
.ll-track .track__ends {
  display: none;
}
.ll-piles {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
}
.ll-pile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.ll-pile .card {
  width: 84px;
  min-height: 112px;
}
.ll-pile__label {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--color-text-muted);
}
.ll-event-card {
  width: 150px !important;
  min-height: 112px;
}
.ll-intel,
.ll-siege {
  margin-top: 10px;
}
.ll-sub {
  margin: 8px 0 4px;
  font-family: var(--font-display);
  font-size: 0.9rem;
}
.ll-line {
  font-size: 0.82rem;
  margin: 3px 0;
}
.ll-line--warn {
  color: var(--color-yellow);
}
.ll-line--dim {
  color: var(--color-text-muted);
}
.ll-line--result {
  font-weight: 800;
}
.ll-event {
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-raised);
}
.ll-event--bad {
  border-left: 4px solid var(--color-danger);
}
.ll-event--good {
  border-left: 4px solid var(--color-success);
}
.ll-zombies {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.ll-zombie {
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-raised);
  border: 3px solid var(--color-border);
  font-weight: 800;
}
.ll-zombie--removed {
  opacity: 0.4;
  text-decoration: line-through;
}
.ll-builds {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.ll-build-card {
  width: auto !important;
  min-height: 0;
}
.ll-build-card .card__note {
  font-size: 0.66rem;
}
.ll-build-card:hover {
  transform: translateY(-3px);
}
.ll-build-card--built {
  border-color: var(--color-success);
}

/* The base */
.ll-area--base .grid-scroll {
  overflow: visible;
}
.ll-area--base .grid-board {
  gap: 6px;
}
.ll-area--base .grid-empty {
  background: transparent;
  border: none;
}
.ll-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 2px;
  pointer-events: none;
  text-align: center;
}
.ll-cell--room {
  justify-content: flex-start;
  padding-top: 4px;
}
.ll-cell__icon {
  font-size: calc(var(--grid-cell) * 0.3);
  line-height: 1;
}
.ll-cell__label {
  font-size: calc(var(--grid-cell) * 0.13);
  font-weight: 800;
  line-height: 1.1;
}
.ll-opening,
.ll-side,
.ll-corner,
.ll-room {
  border-radius: var(--radius-md);
  border: 4px solid var(--color-border);
}
.ll-opening {
  background: var(--color-surface);
}
.ll-opening--stable {
  border-color: var(--color-text-muted);
}
.ll-opening--reinforced {
  border-color: var(--color-success);
  background: color-mix(in srgb, var(--color-success) 25%, var(--color-surface));
}
.ll-opening--broken {
  border-color: var(--color-danger);
  border-style: dashed;
  background: color-mix(in srgb, var(--color-danger) 25%, var(--color-surface));
}
.ll-side {
  background: color-mix(in srgb, var(--color-surface) 60%, transparent);
  border-style: dotted;
}
.ll-side--attacked {
  border: 5px solid var(--color-danger);
  background: color-mix(in srgb, var(--color-danger) 30%, var(--color-surface));
  animation: ll-pulse 1.4s ease-in-out infinite;
}
@keyframes ll-pulse {
  50% {
    filter: brightness(1.3);
  }
}
.ll-side__def {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: calc(var(--grid-cell) * 0.2);
}
.ll-corner {
  border-color: transparent;
}
.ll-corner--on {
  border-color: var(--color-yellow);
  background: color-mix(in srgb, var(--color-yellow) 20%, transparent);
}
.ll-corner--off {
  border-color: var(--color-text-muted);
  opacity: 0.6;
}
.ll-room {
  background: var(--color-surface-raised);
}
.ll-room--lit {
  border-color: var(--color-yellow);
  box-shadow: 0 0 18px color-mix(in srgb, var(--color-yellow) 45%, transparent);
}
.ll-room--dark {
  filter: brightness(0.6);
}
.ll-room--unbuilt {
  opacity: 0.3;
  border-style: dashed;
}
.ll-area--base .grid-overlay--clickable:hover {
  filter: brightness(1.25);
}
.ll-area--base .grid-tokens {
  align-self: end;
  justify-self: center;
  margin-bottom: 4px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  z-index: 3;
  pointer-events: auto;
}
.ll-area--base .pawn {
  width: calc(var(--grid-cell) * 0.34);
  height: calc(var(--grid-cell) * 0.34);
  font-size: calc(var(--grid-cell) * 0.19);
  background: var(--pawn-color, var(--color-surface));
  border: 3px solid var(--color-border);
  position: relative;
}
.ll-camera {
  top: var(--hud-top);
}

/* Off the table: the lock-in line and the squad's cards */
.ll-dock {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 12;
  pointer-events: none;
}
.ll-dock > * {
  pointer-events: auto;
}
.ll-turnbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 4px 3px 14px;
  background: var(--color-surface);
  border: 3px solid var(--color-border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-block);
  max-width: 100%;
}
.ll-turnbar--mine {
  border-color: var(--color-accent);
}
.ll-turnbar__text {
  font-size: 0.82rem;
  font-weight: 700;
}
.ll-squad {
  display: flex;
  gap: 8px;
  justify-content: center;
  max-width: 100%;
  overflow-x: auto;
  padding: 8px 4px 2px;
}
.ll-squad .card {
  width: 116px;
  min-height: 0;
  flex: 0 0 auto;
  position: relative;
  padding: 6px;
  gap: 2px;
}
.ll-squad .card__tag {
  display: none;
}
.ll-squad .card:hover,
.ll-squad .card--selected,
.ll-squad .card--selected:hover {
  transform: translateY(-6px);
}
.ll-card--out {
  opacity: 0.8;
  border-style: dashed;
}
.ll-card--idle {
  box-shadow: 0 0 0 4px var(--color-accent);
}
.ll-card--fallen {
  filter: grayscale(1);
  opacity: 0.5;
}
.ll-card__owner {
  position: absolute;
  top: -8px;
  right: -6px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--color-accent-alt);
  color: var(--color-border);
  font-size: 0.6rem;
  font-weight: 800;
}

/* Dialogs */
.ll-orders,
.ll-pick,
.ll-choice,
.ll-rules {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ll-id {
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
}
.ll-id__head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
}
.ll-id__stats {
  font-size: 0.8rem;
  font-weight: 800;
  margin: 2px 0;
}
.ll-id__ability {
  font-size: 0.78rem;
  margin: 2px 0;
}
.ll-id__flavor {
  font-size: 0.72rem;
  font-style: italic;
  color: var(--color-text-muted);
  margin-top: 4px;
}
.ll-orders__opts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ll-orders__btn {
  text-align: left;
}
.ll-why {
  font-size: 0.7rem;
  opacity: 0.8;
}
.ll-orders__build {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  padding: 4px 0;
  border-bottom: 2px solid var(--color-surface-raised);
}
.ll-orders__bname {
  font-weight: 800;
  font-size: 0.85rem;
}
.ll-orders__btext {
  grid-column: 1;
  font-size: 0.72rem;
  color: var(--color-text-muted);
}
.ll-orders__places {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  gap: 4px;
  align-items: center;
}
.ll-choice__prompt {
  font-weight: 700;
  margin: 0;
}
.ll-choice__opts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ll-pick__cat--off {
  opacity: 0.45;
}
.ll-pick__cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}
.ll-pick__card {
  padding: 8px 10px;
  border-radius: var(--radius-lg);
  border: var(--border-width) solid var(--color-border);
  background: var(--color-surface-raised);
}
.ll-pick__card--clickable {
  cursor: pointer;
  transition: transform var(--anim-fast) var(--anim-bouncy);
}
.ll-pick__card--clickable:hover {
  transform: translateY(-3px);
}
.ll-pick__card--on {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent);
}
.ll-pick__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  position: sticky;
  bottom: 0;
  background: var(--color-surface);
  padding-top: 6px;
}
.ll-rule {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px;
  font-size: 0.85rem;
}

@media (max-width: 760px) {
  .ll-table {
    --hud-top: 56px;
    --hud-bottom: 190px;
  }
  .ll-stage {
    padding: var(--hud-top) 60px var(--hud-bottom) 10px;
  }
  /* Phones: the table stacks — tracks, base, night, expedition, builds — and you scroll/pan it. */
  .ll-tableboard {
    grid-template-columns: auto;
    grid-template-areas: "tracks" "base" "night" "expedition" "builds";
    padding: 14px;
  }
  .ll-tracks {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }
  .ll-squad {
    justify-content: flex-start;
    gap: 6px;
  }
  .ll-squad .card {
    width: 92px;
    padding: 4px;
  }
  .ll-squad .card__name {
    font-size: 0.72rem;
  }
  .ll-squad .card__note {
    font-size: 0.62rem;
  }
}
