/*
 * GtR identity colors (GtR material / role palettes).
 * Material and its leadable role share one hue; buildings use their material color.
 */

.mat,
.role-ink {
  font-weight: 600;
}

/* Site supply pills — material fill; name hidden on max-sm via markup.
   Layout lives here so HAML never needs fractional utilities (px-1.5, …). */
.site-pill {
  display: inline-flex;
  cursor: pointer;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid transparent;
  border-radius: 0.375rem;
  padding: 0.125rem 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25rem;
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}

@media (min-width: 640px) {
  .site-pill {
    gap: 0.375rem;
    padding: 0.25rem 0.5rem;
  }
}

/* Profile record tiles — same fills as .site-pill.mat-*. */
.record-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-width: 0;
  padding: 0.75rem 0.4rem;
  border: 1px solid transparent;
  border-radius: 0.75rem;
  text-align: center;
}

.record-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.record-stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.2;
}

.achievement-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .achievement-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.achievement-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.65rem 0.4rem;
  text-align: center;
}

.achievement-token {
  width: 4.5rem;
  height: 4.5rem;
  object-fit: contain;
}

.achievement-tile.is-locked {
  cursor: pointer;
}

.achievement-tile.is-locked .achievement-token {
  filter: grayscale(1);
  opacity: 0.4;
}

.achievement-name {
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.25;
}

.achievement-strip {
  display: flex;
  justify-content: center;
  gap: 0.2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.achievement-chip {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 0.2rem;
  border: 2px solid var(--chip);
  background: var(--chip);
}

.achievement-chip.is-empty {
  background: transparent;
  opacity: 0.45;
}

.achievement-toast-tray {
  position: fixed;
  top: 4.5rem;
  right: 1rem;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(22rem, calc(100vw - 2rem));
  pointer-events: none;
}

/* Same query as achievement_toast_controller STICKY_QUERY. */
@media (max-width: 639px), (pointer: coarse) {
  .achievement-toast-tray {
    left: 1rem;
    right: 1rem;
    max-width: none;
  }
}

.achievement-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgb(214 211 209);
  border-radius: 0.75rem;
  background: rgb(255 251 235);
  box-shadow: 0 8px 24px rgb(28 25 23 / 0.14);
  cursor: pointer;
}

.achievement-toast.is-sticky {
  cursor: default;
}

.dark .achievement-toast {
  border-color: rgb(68 64 60);
  background: rgb(28 25 23);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.4);
}

.achievement-toast-token {
  width: 2.75rem;
  height: 2.75rem;
  object-fit: contain;
  flex-shrink: 0;
}

.achievement-toast-kicker {
  margin: 0;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgb(146 64 14);
}

.dark .achievement-toast-kicker {
  color: rgb(253 230 138);
}

.achievement-toast-name {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.25;
}

.achievement-toast-dismiss {
  flex-shrink: 0;
  margin-left: auto;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: inherit;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.achievement-toast.is-sticky .achievement-toast-dismiss {
  width: 2.75rem;
  height: 2.75rem;
}

.achievement-chip.mat-rubble { --chip: var(--gtr-rubble); }
.achievement-chip.mat-wood { --chip: var(--gtr-wood); }
.achievement-chip.mat-brick { --chip: var(--gtr-brick); }
.achievement-chip.mat-concrete { --chip: var(--gtr-concrete); }
.achievement-chip.mat-stone { --chip: var(--gtr-stone); }
.achievement-chip.mat-marble { --chip: var(--gtr-marble); }

/* Plain tips (player strip, supply chips): always position:fixed so they stay
   out of document flow (visibility:hidden still occupies space if static).
   tip_controller updates top/left while closed, then sets data-state=open.
   Do not use the HTML hidden attribute for open/close — it reflows the page.
   Card zoom uses .site-tip.gtr-card-zoom (CSS overlay; own rules below). */
.site-tip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  box-sizing: border-box;
  margin: 0;
  padding: 0.55rem 0.75rem;
  border: 1px solid rgb(214 211 209);
  border-radius: 0.5rem;
  background: rgb(255 255 255);
  color: rgb(41 37 36);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.14);
  font-size: 0.75rem;
  line-height: 1.35;
  max-width: min(16rem, calc(100vw - 1rem));
  white-space: normal;
  text-align: left;
  visibility: hidden;
  pointer-events: none;
}

.site-tip[data-state="open"] {
  visibility: visible;
  pointer-events: auto;
}

/* Heatmap count chip: display-only, do not steal the next cell's hover. */
.site-tip.site-tip-passive,
.site-tip.site-tip-passive[data-state="open"] {
  pointer-events: none;
  white-space: nowrap;
  max-width: min(24rem, calc(100vw - 1rem));
}

.dark .site-tip {
  border-color: rgb(68 64 60);
  background: rgb(28 25 23);
  color: rgb(231 229 228);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.45);
}

.site-tip-label {
  font-weight: 700;
  text-transform: capitalize;
  margin-bottom: 0.15rem;
}

.site-tip-hint {
  margin-top: 0.35rem;
  font-size: 0.68rem;
  color: rgb(120 113 108);
}

.dark .site-tip-hint {
  color: rgb(168 162 158);
}

/* Tap/click board card → centered ~2× preview (hand, structures, catalogue).
   Zoom panel is portaled to <body> on open (tip_controller) so position:fixed
   is not trapped by catalogue fans (overflow + -webkit-overflow-scrolling). */
.gtr-card-zoomable {
  flex: 0 0 auto;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.gtr-card-fan-xs > .gtr-card-zoomable { width: 5.75rem; }
.gtr-card-fan-sm > .gtr-card-zoomable { width: 7.25rem; }
.gtr-card-fan > .gtr-card-zoomable { width: 8.75rem; }

.gtr-card-zoomable:focus-visible {
  outline: 2px solid rgb(217 119 6);
  outline-offset: 2px;
  border-radius: 0.5rem;
}

/* Full-viewport scrim; tip_controller moves this node under <body> while open. */
.site-tip.gtr-card-zoom {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  max-width: none;
  max-height: none;
  overflow: hidden;
  background: rgb(0 0 0 / 0.45);
  z-index: 80;
  visibility: hidden;
  pointer-events: none;
}

.site-tip.gtr-card-zoom[data-state="open"] {
  visibility: visible;
  pointer-events: auto;
}

.site-tip.gtr-card-zoom > div {
  width: fit-content;
  height: fit-content;
  padding: 0.4rem;
  max-width: calc(100vw - 1rem);
  max-height: calc(100vh - 1rem);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: rgb(250 250 249);
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.28);
  border-radius: 0.45rem;
}

/* Dark: keep a translucent scrim (not a solid blackout). Card panel is separate. */
.dark .site-tip.gtr-card-zoom {
  background: rgb(0 0 0 / 0.55);
}

.dark .site-tip.gtr-card-zoom > div {
  background: rgb(28 25 23);
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.55);
}

/* Expanded preview is a real 2× card (no CSS zoom/transform — those clip the spine). */
.gtr-card-zoom-scale {
  width: fit-content;
  height: fit-content;
}

.site-tip.gtr-card-zoom .gtr-card:hover,
.site-tip.gtr-card-zoom .gtr-card:focus-within {
  transform: none;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.06);
}

.site-pill.mat-rubble,
.record-stat.mat-rubble {
  background: rgb(183, 149, 11);
  color: rgb(28 25 23);
  border-color: rgb(146 120 9 / 0.45);
}
.site-pill.mat-wood,
.record-stat.mat-wood {
  background: rgb(29, 131, 72);
  color: rgb(236 253 245);
  border-color: rgb(22 101 52 / 0.45);
}
.site-pill.mat-brick,
.record-stat.mat-brick {
  background: rgb(192, 57, 43);
  color: rgb(254 242 242);
  border-color: rgb(153 46 34 / 0.45);
}
.site-pill.mat-concrete,
.record-stat.mat-concrete {
  background: rgb(93, 109, 126);
  color: rgb(248 250 252);
  border-color: rgb(71 85 105 / 0.45);
}
.site-pill.mat-stone,
.record-stat.mat-stone {
  background: rgb(31, 97, 141);
  color: rgb(239 246 255);
  border-color: rgb(24 74 108 / 0.45);
}
.site-pill.mat-marble,
.record-stat.mat-marble {
  background: rgb(108, 52, 131);
  color: rgb(250 245 255);
  border-color: rgb(88 42 108 / 0.45);
}
.dark .site-pill.mat-rubble,
.dark .record-stat.mat-rubble {
  background: rgb(241, 196, 15);
  color: rgb(28 25 23);
  border-color: rgb(202 163 12 / 0.5);
}
.dark .site-pill.mat-wood,
.dark .record-stat.mat-wood {
  background: rgb(46, 204, 113);
  color: rgb(6 78 59);
  border-color: rgb(34 160 90 / 0.5);
}
.dark .site-pill.mat-brick,
.dark .record-stat.mat-brick {
  background: rgb(231, 76, 60);
  color: rgb(69 10 10);
  border-color: rgb(192 57 43 / 0.5);
}
.dark .site-pill.mat-concrete,
.dark .record-stat.mat-concrete {
  background: rgb(189, 195, 199);
  color: rgb(28 25 23);
  border-color: rgb(149 165 166 / 0.5);
}
.dark .site-pill.mat-stone,
.dark .record-stat.mat-stone {
  background: rgb(52, 152, 219);
  color: rgb(12 45 72);
  border-color: rgb(41 128 185 / 0.5);
}
.dark .site-pill.mat-marble,
.dark .record-stat.mat-marble {
  background: rgb(155, 89, 182);
  color: rgb(46 16 66);
  border-color: rgb(125 60 152 / 0.5);
}

/* No in-town sites left: material border + ink, no fill (out-of-town may remain). */
.site-pill.site-pill-outline.mat-rubble {
  background: transparent;
  color: rgb(183, 149, 11);
  border-color: rgb(183, 149, 11);
}
.site-pill.site-pill-outline.mat-wood {
  background: transparent;
  color: rgb(29, 131, 72);
  border-color: rgb(29, 131, 72);
}
.site-pill.site-pill-outline.mat-brick {
  background: transparent;
  color: rgb(192, 57, 43);
  border-color: rgb(192, 57, 43);
}
.site-pill.site-pill-outline.mat-concrete {
  background: transparent;
  color: rgb(93, 109, 126);
  border-color: rgb(93, 109, 126);
}
.site-pill.site-pill-outline.mat-stone {
  background: transparent;
  color: rgb(31, 97, 141);
  border-color: rgb(31, 97, 141);
}
.site-pill.site-pill-outline.mat-marble {
  background: transparent;
  color: rgb(108, 52, 131);
  border-color: rgb(108, 52, 131);
}
.dark .site-pill.site-pill-outline.mat-rubble {
  background: transparent;
  color: rgb(241, 196, 15);
  border-color: rgb(241, 196, 15);
}
.dark .site-pill.site-pill-outline.mat-wood {
  background: transparent;
  color: rgb(46, 204, 113);
  border-color: rgb(46, 204, 113);
}
.dark .site-pill.site-pill-outline.mat-brick {
  background: transparent;
  color: rgb(231, 76, 60);
  border-color: rgb(231, 76, 60);
}
.dark .site-pill.site-pill-outline.mat-concrete {
  background: transparent;
  color: rgb(189, 195, 199);
  border-color: rgb(189, 195, 199);
}
.dark .site-pill.site-pill-outline.mat-stone {
  background: transparent;
  color: rgb(52, 152, 219);
  border-color: rgb(52, 152, 219);
}
.dark .site-pill.site-pill-outline.mat-marble {
  background: transparent;
  color: rgb(155, 89, 182);
  border-color: rgb(155, 89, 182);
}

.site-pill-depleted {
  opacity: 0.38;
  filter: grayscale(0.35);
}

/* Deck (outline) / Jacks (filled) mini supply chips — sit beside site pills.
   Faces sit as a pair: N [deck][jack] M. Tight gap between icons only. */
.supply-chips {
  gap: 0.125rem;
}

.supply-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 1.5rem;
  padding: 0.1rem 0.4rem 0.1rem 0.25rem;
  border-radius: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  color: rgb(41 37 36);
}

.dark .supply-chip {
  color: rgb(231 229 228);
}

.supply-chip-face {
  display: block;
  width: 0.85rem;
  height: 1.15rem;
  border-radius: 0.15rem;
  border: 1.5px solid currentColor;
  flex-shrink: 0;
}

/* Jack: filled face (black on light / white on dark). */
.supply-chip-jack .supply-chip-face {
  background: rgb(28 25 23);
  border-color: rgb(28 25 23);
}

.dark .supply-chip-jack .supply-chip-face {
  background: rgb(250 250 249);
  border-color: rgb(250 250 249);
}

/* Deck: outline only; count sits left of the face (N <deck> <jack> M). */
.supply-chip-deck {
  padding: 0.1rem 0.05rem 0.1rem 0.4rem;
}

.supply-chip-jack {
  padding: 0.1rem 0.4rem 0.1rem 0.05rem;
}

.supply-chip-deck .supply-chip-face {
  background: transparent;
}

.supply-chip-count {
  min-width: 1ch;
}

/* Header player strip: names with gap only (no middot dust). */
.player-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.85rem;
  list-style: none;
  /* One modest gap above Sites — do not also stack space-y margin-top. */
  margin: 0 0 0.5rem;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.4;
  color: rgb(87 83 78);
}

/* Parent uses space-y-*; that would add a second gap under the strip. */
.player-strip + * {
  margin-top: 0 !important;
}

.dark .player-strip {
  color: rgb(214 211 209);
}

.player-strip-item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
}

.player-strip-name {
  color: inherit;
}

.player-strip-item.is-leader .player-strip-name {
  font-weight: 600;
  color: rgb(120 53 15);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.22em;
}

.dark .player-strip-item.is-leader .player-strip-name {
  color: rgb(253 230 138);
}

/* Acting = acting (amber). Not green — green is reserved for online. */
.player-strip-item.is-acting .player-strip-name {
  font-weight: 600;
  color: rgb(180 83 9);
}

.dark .player-strip-item.is-acting .player-strip-name {
  color: rgb(251 191 36);
}

/* Leader who is also acting: acting color + underline. */
.player-strip-item.is-leader.is-acting .player-strip-name {
  color: rgb(180 83 9);
}

.dark .player-strip-item.is-leader.is-acting .player-strip-name {
  color: rgb(251 191 36);
}

.player-strip-item.is-winner .player-strip-name {
  font-weight: 600;
  color: rgb(6 95 70);
}

.dark .player-strip-item.is-winner .player-strip-name {
  color: rgb(110 231 183);
}

/* Out of the game — mute the name, not the tip (opacity on the <li> would fade it). */
.player-strip-item.is-surrendered .player-strip-name {
  font-weight: 400;
  color: rgb(168 162 158);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

.dark .player-strip-item.is-surrendered .player-strip-name {
  color: rgb(120 113 108);
}

/* Presence dots: green = online on this table, gray = away. Guest = hidden.
   Hover the name (title attr) for the plain-language explanation. */
.presence-pip {
  display: none;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 9999px;
  flex-shrink: 0;
  align-self: center;
}

.presence-pip-online,
.presence-pip-away {
  display: inline-block;
}

.presence-pip-online {
  background: rgb(16 185 129);
}

.presence-pip-away {
  background: rgb(168 162 158);
  opacity: 0.55;
}

.dark .presence-pip-away {
  background: rgb(120 113 108);
  opacity: 0.8;
}

/* Split Notify control — kill UA button chrome (white fill in dark mode). */
.notify-split-btn {
  appearance: none;
  background: transparent;
  border: none;
  box-shadow: none;
  cursor: pointer;
  color: inherit;
}

.notify-split-btn:hover,
.notify-split-btn:focus-visible {
  background: transparent;
}

.notify-split:focus-within {
  border-color: rgb(217 119 6); /* amber-600 */
}

.dark .notify-split:focus-within {
  border-color: rgb(245 158 11); /* amber-500 */
}

.notify-split-btn:disabled {
  cursor: default;
}

/* Notify help hangs below the button, leftward so it stays on-screen at the
   right edge of the header (absolute + right:0 expands toward the center). */
.notify-help-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  left: auto;
  z-index: 50;
  width: 18rem;
  max-width: calc(100vw - 1.5rem);
}

/* Feedback screenshot viewer — stay in the PWA (no native image chrome). */
.feedback-lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  background: rgb(0 0 0 / 0.92);
  color: rgb(250 250 249);
}

.feedback-lightbox[hidden] {
  display: none;
}

.feedback-lightbox-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  padding-top: max(0.75rem, env(safe-area-inset-top, 0px));
  padding-right: max(1rem, env(safe-area-inset-right, 0px));
  padding-bottom: 0.75rem;
  padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
}

.feedback-lightbox-back {
  appearance: none;
  cursor: pointer;
  flex-shrink: 0;
  min-height: 2.75rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid rgb(231 229 228 / 0.35);
  border-radius: 0.5rem;
  background: rgb(28 25 23 / 0.55);
  color: rgb(255 251 235);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  -webkit-tap-highlight-color: transparent;
}

.feedback-lightbox-back:hover,
.feedback-lightbox-back:focus-visible {
  background: rgb(41 37 36 / 0.85);
  outline: 2px solid rgb(251 191 36);
  outline-offset: 2px;
}

.feedback-lightbox-caption {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
  color: rgb(214 211 209);
}

.feedback-lightbox-stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0 0.75rem max(0.75rem, env(safe-area-inset-bottom, 0px));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.feedback-lightbox-stage img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Connection status (Live / Reconnecting) — quiet utility, not a headline. */
.connection-status {
  font-variant: normal;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
}

.connection-status[data-state="live"]::before {
  content: "";
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  margin-right: 0.35rem;
  border-radius: 9999px;
  background: currentColor;
  vertical-align: 0.05em;
}

/*
 * Material hues are the primitive; roles alias the same CSS variables.
 * Legacy class names (.mat-*, .role-*) remain as aliases — prefer .ink-* in new markup.
 */
:root {
  --gtr-rubble: rgb(183, 149, 11);
  --gtr-wood: rgb(29, 131, 72);
  --gtr-brick: rgb(192, 57, 43);
  --gtr-concrete: rgb(93, 109, 126);
  --gtr-stone: rgb(31, 97, 141);
  --gtr-marble: rgb(108, 52, 131);
  --gtr-thinker: rgb(127, 140, 141);
  /* Jacks are B&W (physical game is black face / white ink) — not laborer gold. */
  --gtr-jack: rgb(28, 25, 23);
}

.dark {
  --gtr-rubble: rgb(241, 196, 15);
  --gtr-wood: rgb(46, 204, 113);
  --gtr-brick: rgb(231, 76, 60);
  --gtr-concrete: rgb(189, 195, 199);
  --gtr-stone: rgb(52, 152, 219);
  --gtr-marble: rgb(155, 89, 182);
  --gtr-thinker: rgb(149, 165, 166);
  --gtr-jack: rgb(250, 250, 249);
}

.ink-rubble,
.ink-laborer,
.mat-rubble,
.role-laborer { color: var(--gtr-rubble); }

.ink-wood,
.ink-craftsman,
.mat-wood,
.role-craftsman { color: var(--gtr-wood); }

.ink-brick,
.ink-legionary,
.mat-brick,
.role-legionary { color: var(--gtr-brick); }

.ink-concrete,
.ink-architect,
.mat-concrete,
.role-architect { color: var(--gtr-concrete); }

.ink-stone,
.ink-merchant,
.mat-stone,
.role-merchant { color: var(--gtr-stone); }

.ink-marble,
.ink-patron,
.mat-marble,
.role-patron { color: var(--gtr-marble); }

.ink-thinker,
.role-thinker { color: var(--gtr-thinker); }

.ink-jack,
.role-jack { color: var(--gtr-jack); }

/* Legionary miss — the table cry, a step bolder than role/material ink.
   Color matches the missed demand via .mat-*; bare .gtr-glory is old-wire gold. */
.gtr-glory {
  font-weight: 700;
  letter-spacing: 0.04em;
}

.gtr-glory:not(.mat) {
  color: var(--gtr-rubble);
}

/* Hold-to-confirm fill: soft wash of the role/material ink (via .role-* color). */
.hold-to-confirm-fill {
  background: currentColor;
  opacity: 0.28;
}

.chip {
  display: inline-block;
  border-radius: 9999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  line-height: 1.25rem;
  border: 1px solid currentColor;
  background: transparent;
  font-weight: 600;
}

/* --- /style living guide: force panel chrome (don't rely on Tailwind scanning helpers) --- */

.sg-pair {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
}

@media (min-width: 64rem) {
  .sg-pair {
    grid-template-columns: 1fr 1fr;
  }
}

.sg-panel {
  border-radius: 0.75rem;
  border: 1px solid rgb(231 229 228);
  padding: 1rem;
  background: rgb(255 255 255);
  color: rgb(28 25 23);
}

/* Local `.dark` scopes card/ink rules; solid fills match body chrome in dark-only mode. */
.sg-panel.dark {
  border-color: rgb(68 64 60);
  background: rgb(12 10 9); /* stone-950 — same as body dark:bg-stone-950 */
  color: rgb(245 245 244);
}

.sg-panel-label {
  margin-bottom: 0.5rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  color: rgb(120 113 108);
}

.sg-panel.dark .sg-panel-label {
  color: rgb(168 162 158);
}

/* Helper-first recipes (collapsed by default). */
.sg-recipe {
  margin-top: 0.5rem;
  border: 1px solid rgb(231 229 228);
  border-radius: 0.5rem;
  background: rgb(250 250 249);
  overflow: hidden;
}

.dark .sg-recipe,
.sg-panel.dark .sg-recipe {
  border-color: rgb(68 64 60);
  background: rgb(28 25 23);
}

.sg-recipe-summary {
  cursor: pointer;
  list-style: none;
  padding: 0.45rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: rgb(68 64 60);
  user-select: none;
}

.sg-recipe-summary::-webkit-details-marker {
  display: none;
}

.sg-recipe-summary::before {
  content: "▸ ";
  color: rgb(168 162 158);
  font-weight: 700;
}

.sg-recipe[open] > .sg-recipe-summary::before {
  content: "▾ ";
}

.dark .sg-recipe-summary,
.sg-panel.dark .sg-recipe-summary {
  color: rgb(214 211 209);
}

.sg-recipe-kicker {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgb(180 83 9); /* amber-700 */
}

.dark .sg-recipe-kicker,
.sg-panel.dark .sg-recipe-kicker {
  color: rgb(251 191 36); /* amber-400 */
}

.sg-recipe-code {
  margin: 0;
  padding: 0.75rem 0.85rem 0.9rem;
  border-top: 1px solid rgb(231 229 228);
  background: rgb(28 25 23);
  color: rgb(231 229 228);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.7rem;
  line-height: 1.5;
  white-space: pre;
  overflow-x: auto;
  max-height: 28rem;
  overflow-y: auto;
  tab-size: 2;
}

.dark .sg-recipe-code,
.sg-panel.dark .sg-recipe-code {
  border-top-color: rgb(68 64 60);
  background: rgb(12 10 9);
  color: rgb(231 229 228);
}

/*
 * Phone-portrait /style: same rule as table/list/lobby/catalog — drop
 * group-only cards, go edge-to-edge, separate with a wash and a hairline.
 * Light/Dark labels stay so stacked compare bands remain named.
 * sm+ keeps the rounded specimen panels.
 */
@media (max-width: 639px) {
  .sg-pair {
    gap: 0;
  }

  .sg-panel {
    margin-inline: -1rem;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    box-shadow: none;
    padding: 0.75rem;
    border-bottom: 1px solid rgb(231 229 228);
  }

  .sg-panel.dark {
    border-bottom-color: rgb(68 64 60);
  }
}

/* --- Physical-ish order cards (role spine · name · text · value/material) --- */

.gtr-card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-start;
}

.gtr-card-pending-discard {
  opacity: 0.45;
}

/* Pool: material groups side by side, each group fanned. */
.gtr-pool-fans {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem 1rem;
  min-width: 0;
  max-width: 100%;
}

/* Grid items default min-width:auto (= fan min-content). That lets a long
   clientele/stockpile blow out the camp and the layout viewport. */
.gtr-table-camp .grid,
.gtr-table-camp .grid > * {
  min-width: 0;
  max-width: 100%;
}

/* Catalogue material groups: each group is as wide as its fan. Short packs
   sit two-up when they fit; long fans take a full row instead of clipping. */
.gtr-card-catalog-groups {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 2rem 2.5rem;
}

.gtr-card-catalog-group {
  /* No shrink — wrap the group before squeezing the fan. */
  flex: 0 0 auto;
  max-width: 100%;
}

/* Camp zones / catalogue: horizontal fan — spines peek; hover raises a card.
   Zoomable faces are already full card_w (overflow the peek wrapper). Expand
   only raises z-index — never grows flex-basis — so open/close cannot reflow.

   width:max-content so short fans (1–2 cards) do not stretch across the zone —
   a full-width pan-x strip was a vertical-scroll dead zone beside the cards.
   max-width:100% only clamps when the camp grid item can shrink (min-width:0
   above); otherwise Safari grows the layout viewport and the log reflows.
   pan-x pan-y lets vertical swipes still scroll the page. */
.gtr-card-fan {
  --gtr-fan-peek: 1.35rem;
  --gtr-fan-card-w: 8.75rem; /* md */
  --gtr-fan-card-h: calc(var(--gtr-fan-card-w) * 22 / 17.5);
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  padding: 0.35rem 0.15rem 0.5rem;
  min-height: 0;
}

.gtr-card-fan-sm {
  --gtr-fan-card-w: 7.25rem;
}

.gtr-card-fan-xs {
  --gtr-fan-card-w: 5.75rem;
}

.gtr-card-fan-md {
  --gtr-fan-card-w: 8.75rem;
  /* Full-face catalogue: peek enough name to tell buildings apart. */
  --gtr-fan-peek: 2.75rem;
}

/* Bare cards (clientele / pool): overlap via negative margin. */
.gtr-card-fan > .gtr-card {
  flex: 0 0 auto;
  margin-inline-end: calc(-1 * (var(--gtr-fan-card-w) - var(--gtr-fan-peek)));
  transition: box-shadow 0.15s ease, margin 0.15s ease;
}

.gtr-card-fan > .gtr-card:last-child,
.gtr-card-fan > .gtr-card-zoomable:last-child {
  margin-inline-end: 0;
}

.gtr-card-fan > .gtr-card {
  flex: 0 0 auto;
  margin-inline-end: calc(-1 * (var(--gtr-fan-card-w) - var(--gtr-fan-peek)));
  transition: box-shadow 0.15s ease, margin 0.15s ease;
}

.gtr-card-fan > .gtr-card:last-child,
.gtr-card-fan > .gtr-card-zoomable:last-child {
  margin-inline-end: 0;
}

/*
 * Zoomable catalogue cards: wrapper is only peek-wide so each spine strip owns
 * its hit target. Full-width negative-margin stacks steal taps on touch (the
 * next card's box sits on top of the previous peek — desktop hover spread hid it).
 */
.gtr-card-fan > .gtr-card-zoomable {
  flex: 0 0 var(--gtr-fan-peek);
  width: var(--gtr-fan-peek);
  max-width: var(--gtr-fan-peek);
  overflow: visible;
  position: relative;
  z-index: 1;
  margin-inline-end: 0;
  touch-action: manipulation;
  /* Keep fan row tall enough for the overflowing card face. */
  min-height: var(--gtr-fan-card-h);
}

.gtr-card-fan > .gtr-card-zoomable > .gtr-card {
  /* Face paints at full card width; only the peek strip catches pointer events. */
  width: var(--gtr-fan-card-w);
}

.gtr-card-fan > .gtr-card-zoomable:last-child {
  flex-basis: var(--gtr-fan-card-w);
  width: var(--gtr-fan-card-w);
  max-width: var(--gtr-fan-card-w);
}

.gtr-card-fan > .gtr-card-zoomable:focus-within,
.gtr-card-fan > .gtr-card-zoomable:active {
  z-index: 8;
}

/* Bare-card fans (clientele / pool): spread margin on hover/keyboard — not
   touch. :focus-within on a scrub would drop the peek overlap (~one card
   width) and grow the fan, which Safari then promotes to page width. */
@media (hover: hover) and (pointer: fine) {
  .gtr-card-fan > .gtr-card:hover,
  .gtr-card-fan > .gtr-card:focus-within {
    z-index: 8;
    margin-inline-end: 0.35rem;
  }

  .gtr-card-fan > .gtr-card:last-child:hover,
  .gtr-card-fan > .gtr-card:last-child:focus-within {
    margin-inline-end: 0;
  }

  .gtr-card-fan > .gtr-card-zoomable:hover {
    z-index: 8;
  }
}

.gtr-card-fan > .gtr-card:focus-within {
  z-index: 8;
}

/* /cards/:name — one face + /card clip, then the HTML|PNG size grid. */
.gtr-card-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .gtr-card-hero {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
  }
}

.gtr-card-hero-face {
  flex: none;
}

.gtr-card-rules {
  flex: 1 1 20rem;
  max-width: 36rem;
}

/* Size chips sit under the hero; centering reads as a control, not a leftover. */
.gtr-card-size-nav {
  width: 100%;
}

/* Chips + faces as one block — space-y-8 on the show section was a 2rem hole. */
.gtr-card-sizes {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  scroll-margin-top: 1rem;
}

/*
 * Faces grid queries the show section (not itself — @container only sees ancestors).
 * ≥86rem fits four HTML|PNG pairs (78.5rem of cards + pair gaps) on one row.
 * Below that, one pair per row. A pair wraps when even two faces will not fit
 * (expanded is 35.75rem with gap).
 */
.gtr-card-show {
  container-type: inline-size;
}

.gtr-card-faces {
  display: grid;
  justify-content: center;
  gap: 2rem;
  grid-template-columns: minmax(0, 1fr);
}

.gtr-card-face-pair {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.gtr-card-face-pair-label,
.gtr-card-face-kind {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  color: rgb(120 113 108);
}

.gtr-card-face-kind {
  font-weight: 400;
  color: rgb(168 162 158);
}

.gtr-card-face-pair-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 0.75rem;
}

.gtr-card-face {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

@container (min-width: 86rem) {
  .gtr-card-faces {
    grid-template-columns: repeat(4, auto);
    align-items: end;
    gap: 1.25rem;
  }

  .gtr-card-face-pair-row {
    flex-wrap: nowrap;
  }
}

/* SVG-rasterized faces (drag off the page). Tailwind preflight sets
   img { max-width: 100% }; wrap the HTML|PNG pair and don't shrink the
   columns, or the PNG collapses into leftover space on narrow viewports. */
.gtr-card-png {
  height: auto;
  display: block;
  background: transparent;
  cursor: grab;
}

.gtr-card-png-md { width: 8.75rem; }
.gtr-card-png-sm { width: 7.25rem; }
.gtr-card-png-xs { width: 5.75rem; }
.gtr-card-png-expanded { width: 17.5rem; }

/* Inter (OFL) — closest licensed cousin of SF Pro for HTML + rsvg PNG faces. */
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/inter/Inter-Regular-b26b8893.ttf") format("truetype");
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/inter/Inter-SemiBold-9c4cd9d0.ttf") format("truetype");
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/inter/Inter-Bold-3617a504.ttf") format("truetype");
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/assets/inter/Inter-ExtraBold-ce1d9f91.ttf") format("truetype");
}

.gtr-card {
  --gtr-card-w: 8.75rem;
  --gtr-card-h: calc(var(--gtr-card-w) * 22 / 17.5);
  --gtr-card-spine-w: 1.15rem;
  display: grid;
  grid-template-columns: var(--gtr-card-spine-w) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  width: var(--gtr-card-w);
  height: var(--gtr-card-h);
  min-height: var(--gtr-card-h);
  max-height: var(--gtr-card-h);
  border: 1px solid rgb(214 211 209);
  border-radius: 0.45rem;
  background: rgb(255 255 255);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.06);
  overflow: hidden;
  position: relative;
  /* Contain .gtr-card-count z-index so overlapping fans cannot leak badges. */
  isolation: isolate;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  transition: box-shadow 0.15s ease, transform 0.15s ease, z-index 0s;
}

/* Shared badge chrome (stack ×N + structure progress). */
.gtr-card-count {
  position: absolute;
  z-index: 2;
  border-radius: 9999px;
  background: rgb(28 25 23 / 0.88);
  color: rgb(255 251 235);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* Stacked copies (hand / catalogue / pool): centered above the footer,
   same placement as cover-flow. Structure N/M stays .gtr-card-progress. */
.gtr-card-count:not(.gtr-card-progress) {
  top: auto;
  right: auto;
  bottom: 1.55rem;
  left: calc(var(--gtr-card-spine-w) + (100% - var(--gtr-card-spine-w)) / 2);
  transform: translateX(-50%);
  min-width: 1.6rem;
  max-width: none;
  padding: 0.1rem 0.35rem;
  font-size: 0.62rem;
}

.gtr-card-jack .gtr-card-count:not(.gtr-card-progress) {
  background: rgb(250 250 249);
  color: rgb(28 25 23);
}

.dark .gtr-card-jack .gtr-card-count:not(.gtr-card-progress) {
  background: rgb(28 25 23);
  color: rgb(250 250 249);
}

.dark .gtr-card-count {
  background: rgb(251 191 36 / 0.95);
  color: rgb(28 25 23);
}

/* Structure fill progress (N/M) — lower-middle of the *main* pane (not including spine).
   `bottom` clears the material footer so the badge doesn’t sit on its top border. */
.gtr-card-progress {
  top: auto;
  right: auto;
  bottom: 1.95rem;
  /* Center in the content column: spine width + half of remaining width. */
  left: calc(var(--gtr-card-spine-w) + (100% - var(--gtr-card-spine-w)) / 2);
  transform: translateX(-50%);
  min-width: 1.85rem;
  max-width: none;
  padding: 0.12rem 0.45rem;
  font-size: 0.72rem;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.22);
  /* Default when no site material class is present */
  background: rgb(28 25 23 / 0.88);
  color: rgb(255 251 235);
}

.gtr-card-sm .gtr-card-progress {
  bottom: 1.75rem;
  min-width: 1.7rem;
  padding: 0.1rem 0.4rem;
  font-size: 0.65rem;
}

.gtr-card-xs .gtr-card-progress {
  bottom: 1.55rem;
  min-width: 1.55rem;
  padding: 0.08rem 0.35rem;
  font-size: 0.6rem;
}

/* Site-material badge fills (override .mat-* text color with readable ink). */
.gtr-card-progress.mat-rubble {
  background: rgb(183, 149, 11);
  color: rgb(28 25 23);
}
.gtr-card-progress.mat-wood {
  background: rgb(29, 131, 72);
  color: rgb(236 253 245);
}
.gtr-card-progress.mat-brick {
  background: rgb(192, 57, 43);
  color: rgb(254 242 242);
}
.gtr-card-progress.mat-concrete {
  background: rgb(93, 109, 126);
  color: rgb(248 250 252);
}
.gtr-card-progress.mat-stone {
  background: rgb(31, 97, 141);
  color: rgb(239 246 255);
}
.gtr-card-progress.mat-marble {
  background: rgb(108, 52, 131);
  color: rgb(250 245 255);
}

.dark .gtr-card-progress.mat-rubble {
  background: rgb(241, 196, 15);
  color: rgb(28 25 23);
}
.dark .gtr-card-progress.mat-wood {
  background: rgb(46, 204, 113);
  color: rgb(6 78 59);
}
.dark .gtr-card-progress.mat-brick {
  background: rgb(231, 76, 60);
  color: rgb(69 10 10);
}
.dark .gtr-card-progress.mat-concrete {
  background: rgb(189, 195, 199);
  color: rgb(28 25 23);
}
.dark .gtr-card-progress.mat-stone {
  background: rgb(52, 152, 219);
  color: rgb(12 45 72);
}
.dark .gtr-card-progress.mat-marble {
  background: rgb(155, 89, 182);
  color: rgb(46 16 66);
}

/* Complete: keep site-material fill; add a crisp ring so finished stands out. */
.gtr-card-progress-complete {
  box-shadow:
    0 0 0 1.5px rgb(255 255 255 / 0.95),
    0 0 0 3px rgb(16 185 129 / 0.55),
    0 1px 2px rgb(0 0 0 / 0.22);
}

.dark .gtr-card-progress-complete {
  box-shadow:
    0 0 0 1.5px rgb(28 25 23 / 0.9),
    0 0 0 3px rgb(52 211 153 / 0.75),
    0 1px 2px rgb(0 0 0 / 0.3);
}

.gtr-card-structure-complete {
  box-shadow: 0 0 0 1px rgb(16 185 129 / 0.35), 0 1px 2px rgb(0 0 0 / 0.06);
}

.dark .gtr-card-structure-complete {
  box-shadow: 0 0 0 1px rgb(52 211 153 / 0.45), 0 1px 2px rgb(0 0 0 / 0.2);
}

.gtr-card-sm .gtr-card-count:not(.gtr-card-progress) {
  bottom: 1.45rem;
  min-width: 1.45rem;
  padding: 0.08rem 0.3rem;
  font-size: 0.55rem;
}

.gtr-card-xs .gtr-card-count:not(.gtr-card-progress) {
  bottom: 1.35rem;
  min-width: 1.25rem;
  padding: 0.06rem 0.25rem;
  font-size: 0.5rem;
}

.gtr-structure {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: var(--gtr-card-w, 7.25rem);
}

.gtr-card-sm {
  --gtr-card-w: 7.25rem;
  width: var(--gtr-card-w);
}

.gtr-card-xs {
  --gtr-card-w: 5.75rem;
  width: var(--gtr-card-w);
}

.gtr-card-xs .gtr-card-name {
  font-size: 0.58rem;
  -webkit-line-clamp: 2;
}

.gtr-card-xs .gtr-card-text {
  font-size: 0.48rem;
  -webkit-line-clamp: 3;
}

.gtr-card-xs .gtr-card-role {
  font-size: 0.52rem;
}

.dark .gtr-card {
  border-color: rgb(68 64 60);
  background: rgb(28 25 23);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.35);
}

/* Fine pointers only — touch sticky-:hover was lifting cards without opening zoom. */
@media (hover: hover) and (pointer: fine) {
  .gtr-card:hover,
  .gtr-card:focus-within {
    z-index: 5;
    box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
    transform: translateY(-2px);
  }

  .dark .gtr-card:hover,
  .dark .gtr-card:focus-within {
    box-shadow: 0 8px 24px rgb(0 0 0 / 0.55);
  }

  /* Cover-flow already yaws; the global -2px hover lift reads as a wiggle. */
  .gtr-card-carousel .gtr-card:hover,
  .gtr-card-carousel .gtr-card:focus-within {
    z-index: auto;
    transform: none;
  }
}

/* Zoomable owns the tap; never transform it (breaks position:fixed tip panels). */
.gtr-card-zoomable .gtr-card:hover,
.gtr-card-zoomable .gtr-card:focus-within {
  z-index: auto;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.06);
  transform: none;
}

.dark .gtr-card-zoomable .gtr-card:hover,
.dark .gtr-card-zoomable .gtr-card:focus-within {
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.35);
}

/* Left gutter: vertical role/material label (+ value pips on sm/xs). */
.gtr-card-spine {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid rgb(231 229 228);
  background: rgb(250 250 249);
}

.dark .gtr-card-spine {
  border-right-color: rgb(68 64 60);
  background: rgb(41 37 36);
}

.gtr-card-role {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0.35rem 0;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  letter-spacing: 0.08em;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

/* Catalogue fan: building name on the peek spine (tighter so long names fit). */
.gtr-card-spine-name .gtr-card-role {
  letter-spacing: 0.04em;
  font-size: 0.5rem;
  overflow: hidden;
}

.gtr-card-spine-name .gtr-card-role > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-height: 100%;
}

/* Default peek: name on the spine, role in the header. */
.gtr-card-spine-name .gtr-label-full {
  display: none;
}

/* Any fan: last / hover / focus is a full face — orthodox name + role spine. */
.gtr-card-fan > .gtr-card-zoomable:last-child .gtr-card-spine-name .gtr-label-peek,
.gtr-card-fan > .gtr-card-zoomable:hover .gtr-card-spine-name .gtr-label-peek,
.gtr-card-fan > .gtr-card-zoomable:focus-within .gtr-card-spine-name .gtr-label-peek,
.gtr-card-fan > .gtr-card:last-child .gtr-card-spine-name .gtr-label-peek,
.gtr-card-fan > .gtr-card:hover .gtr-card-spine-name .gtr-label-peek,
.gtr-card-fan > .gtr-card:focus-within .gtr-card-spine-name .gtr-label-peek {
  display: none;
}

.gtr-card-fan > .gtr-card-zoomable:last-child .gtr-card-spine-name .gtr-label-full,
.gtr-card-fan > .gtr-card-zoomable:hover .gtr-card-spine-name .gtr-label-full,
.gtr-card-fan > .gtr-card-zoomable:focus-within .gtr-card-spine-name .gtr-label-full,
.gtr-card-fan > .gtr-card:last-child .gtr-card-spine-name .gtr-label-full,
.gtr-card-fan > .gtr-card:hover .gtr-card-spine-name .gtr-label-full,
.gtr-card-fan > .gtr-card:focus-within .gtr-card-spine-name .gtr-label-full {
  display: revert;
}

.gtr-card-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 0.35rem 0.4rem 0;
  gap: 0.25rem;
  overflow: hidden;
}

.gtr-card-name {
  flex: 0 0 auto;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.15;
  text-transform: uppercase;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
  /* Long names wrap, then clamp so the fixed card height still holds. */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.gtr-card-sm .gtr-card-name {
  font-size: 0.65rem;
}

.gtr-card-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

/* Ability copy wraps within the fixed card; overflow is clamped.
   One <p> per ability key; YAML newlines within a key become <br>.
   Full copy is on the expanded / zoom face — not a native title tooltip. */
.gtr-card-text {
  margin: 0;
  width: 100%;
  text-align: center;
  font-size: 0.58rem;
  line-height: 1.3;
  color: rgb(87 83 78);
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 10;
  overflow: hidden;
}

.gtr-card-text > p {
  margin: 0;
}

.gtr-card-text > p + p {
  margin-top: 0.45em;
}

.gtr-card-sm .gtr-card-text {
  font-size: 0.52rem;
  -webkit-line-clamp: 4;
}

.dark .gtr-card-text {
  color: rgb(168 162 158);
}

/* Zoom / catalogue preview: 2× face. Height is always width × 22/17.5. */
.gtr-card-expanded {
  --gtr-card-w: 17.5rem;
  --gtr-card-spine-w: 2.3rem;
  width: var(--gtr-card-w);
  height: var(--gtr-card-h);
  min-height: var(--gtr-card-h);
  max-height: var(--gtr-card-h);
  grid-template-rows: minmax(0, 1fr);
}

.gtr-card-expanded .gtr-card-main {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 0.55rem 0.65rem 0;
  gap: 0.35rem;
}

.gtr-card-expanded .gtr-card-body {
  overflow: auto;
}

.gtr-card-expanded .gtr-card-text {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
  font-size: 1.05rem;
}

.gtr-card-expanded .gtr-card-text > p + p {
  margin-top: 0.55em;
}

/* House-rules lobby: checkbox per ability key inside expanded card copy. */
.gtr-house-rules-cards {
  gap: 0.75rem;
}

/* Checkbox rows only — plain ability <p>s stay centered via .gtr-card-text. */
.gtr-card-ability-toggles .gtr-card-text {
  text-align: left;
}

.gtr-card-ability:has(.gtr-card-ability-check) {
  display: flex;
  align-items: flex-start;
  gap: 0.4em;
  text-align: left;
}

.gtr-card-ability-check {
  margin-top: 0.2em;
  flex: none;
}

.gtr-card-ability-label {
  min-width: 0;
  cursor: pointer;
}

/* Live with the checkbox — do not wait on a Turbo round-trip. */
.gtr-card-ability:has(.gtr-card-ability-check:not(:checked)) {
  opacity: 0.45;
}

.gtr-card-ability:has(.gtr-card-ability-check:not(:checked)) .gtr-card-ability-label {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.gtr-card-expanded .gtr-card-name {
  font-size: 1.2rem;
}

.gtr-card-expanded .gtr-card-role {
  font-size: 1.05rem;
  padding: 0.5rem 0;
}

.gtr-card-expanded .gtr-card-material {
  font-size: 0.85rem;
}

.gtr-card-expanded .gtr-card-footer {
  min-height: 2rem;
}

.gtr-card-expanded .gtr-card-pip {
  width: 0.55rem;
  height: 0.55rem;
}

/* Catalogue / house-rules / zoom: above the footer line, lower than structure N/M. */
.gtr-card-expanded .gtr-card-count:not(.gtr-card-progress) {
  top: auto;
  right: auto;
  bottom: 2.35rem;
  left: calc(var(--gtr-card-spine-w) + (100% - var(--gtr-card-spine-w)) / 2);
  transform: translateX(-50%);
  min-width: 3.2rem;
  max-width: none;
  padding: 0.18rem 0.65rem;
  font-size: 1.15rem;
}

.gtr-card-expanded .gtr-card-progress {
  bottom: 3.1rem;
  min-width: 3.2rem;
  padding: 0.18rem 0.65rem;
  font-size: 1.15rem;
}

.gtr-card-expanded.gtr-card-wood,
.gtr-card-expanded.gtr-card-brick,
.gtr-card-expanded.gtr-card-concrete,
.gtr-card-expanded.gtr-card-stone,
.gtr-card-expanded.gtr-card-marble,
.gtr-card-expanded.gtr-card-rubble,
.gtr-card-expanded.gtr-card-jack {
  border-left-width: 5px;
}

.gtr-card-text-empty {
  opacity: 0.35;
}

/* Cover-flow of expanded faces. Index is --gtr-carousel-index (CSS, not scroll). */
.gtr-new-abilities {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.gtr-card-carousel {
  /* Face is always the 2× card. Do not scale it to the column. */
  --gtr-carousel-card: 17.5rem;
  --gtr-carousel-step: 2.35rem;
  --gtr-carousel-gap: 0px;
  /* Visual center of the first neighbor; further cards add --stack. */
  --gtr-carousel-first: calc(var(--gtr-carousel-card) * 0.48);
  --gtr-carousel-stack: 0.5rem;
  --gtr-carousel-stage: 42rem;
  --gtr-carousel-index: 0;
  --off: 0;
  --abs: 1;
  --dir: 0;
  position: relative;
  padding: 0;
}

/* Narrow: stay in the column so the current face can actually center. */
.gtr-card-carousel:not(.gtr-card-carousel-solo) {
  width: 100%;
  overflow: hidden;
  /* overflow-x:hidden computes overflow-y to hidden — pad so the
     reflection and any translateZ are not clipped. */
  padding-block: 1rem 4.5rem;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  /* Mask the viewport, not the track — a track mask rides the
     translate and hides the current face. */
  mask-image: linear-gradient(to right, transparent, #000 0.75rem, #000 calc(100% - 0.75rem), transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 0.75rem, #000 calc(100% - 0.75rem), transparent);
}

/* Wide: peek previous/next in the cream beside the tables column. */
@media (min-width: 48rem) {
  .gtr-card-carousel:not(.gtr-card-carousel-solo) {
    --gtr-carousel-step: 4.25rem;
    --gtr-carousel-gap: 0px;
    --gtr-carousel-first: 11rem;
    --gtr-carousel-stack: 0.65rem;
    --gtr-carousel-stage: 68rem;
    width: min(var(--gtr-carousel-stage), calc(100vw - 2rem));
    margin-inline: calc(50% - min(calc(var(--gtr-carousel-stage) / 2), 50vw - 1rem));
  }

  .gtr-card-carousel:not(.gtr-card-carousel-solo) {
    mask-image: linear-gradient(to right, transparent, #000 6rem, #000 calc(100% - 6rem), transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, #000 6rem, #000 calc(100% - 6rem), transparent);
  }
}

@media (min-width: 80rem) {
  .gtr-card-carousel:not(.gtr-card-carousel-solo) {
    --gtr-carousel-stack: 0.7rem;
    --gtr-carousel-stage: 76rem;
  }
}



/* Region is tabindex=0 for arrow keys; UA ring boxed the whole strip. */
.gtr-card-carousel:not(.gtr-card-carousel-solo):focus,
.gtr-card-carousel:not(.gtr-card-carousel-solo):focus-visible {
  outline: none;
}

.gtr-card-carousel-track {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--gtr-carousel-gap);
  overflow: visible;
}

.gtr-card-carousel:not(.gtr-card-carousel-solo) .gtr-card-carousel-track {
  width: 100%;
  transform: translate3d(
    calc(
      (100% - var(--gtr-carousel-step)) / 2
      - var(--gtr-carousel-index) * (var(--gtr-carousel-step) + var(--gtr-carousel-gap))
    ),
    0,
    0
  );
  transition: transform 0.32s ease;
}

.gtr-card-carousel-slide {
  --off: calc(var(--i) - var(--gtr-carousel-index));
  --abs: abs(var(--off));
  --dir: sign(var(--off));
  box-sizing: border-box;
  position: relative;
  z-index: calc(40 - var(--abs));
  flex: 0 0 var(--gtr-carousel-step);
  width: var(--gtr-carousel-step);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0 0.25rem;
}

/* Rotate the face, not the slide — slide transforms change scroll width.
   Neighbors yaw around their center so they face the current card. */
.gtr-card-carousel:not(.gtr-card-carousel-solo) .gtr-card-carousel-slide {
  /* Perspective without preserve-3d so each slide flattens; otherwise
     a yawed neighbor's near edge wins the depth test over the current face. */
  perspective: 220rem;
  isolation: isolate;
  cursor: pointer;
}

.gtr-card-carousel:not(.gtr-card-carousel-solo) .gtr-card-carousel-slide.is-current {
  z-index: 50;
  transform: translateZ(0);
  cursor: default;
}

.gtr-card-carousel-rig,
.gtr-card-carousel-mirror {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gtr-card-carousel:not(.gtr-card-carousel-solo) .gtr-card-carousel-rig {
  transform-origin: center center;
  transition: transform 0.32s ease, filter 0.32s ease;
  /* Opacity would punch through the fill and show stacked faces. */
  filter: brightness(calc(0.94 - (var(--abs) - 1) * 0.035));
}

/* Visual X = dir * (first + (abs-1)*stack); layout X = off * (step+gap). */
.gtr-card-carousel:not(.gtr-card-carousel-solo) .gtr-card-carousel-slide:not(.is-current) .gtr-card-carousel-rig {
  transform:
    rotateY(calc(var(--dir) * -62deg))
    translateX(
      calc(
        var(--dir) * (
          var(--gtr-carousel-first)
          + (var(--abs) - 1) * var(--gtr-carousel-stack)
          - var(--abs) * (var(--gtr-carousel-step) + var(--gtr-carousel-gap))
        )
      )
    )
    translateZ(-0.2rem)
    scale(0.94);
}

/* Hide the inner face so a yawed neighbor cannot paint over the current card. */
.gtr-card-carousel:not(.gtr-card-carousel-solo) .gtr-card-carousel-slide:not(.is-current) .gtr-card-expanded {
  clip-path: inset(
    0
    calc((1 - var(--dir)) * 20%)
    0
    calc((1 + var(--dir)) * 20%)
  );
}

.gtr-card-carousel-slide.is-current .gtr-card-carousel-rig {
  transform: none;
  filter: none;
  /* Wide current face would steal taps from the peeking spines. */
  pointer-events: none;
}

.gtr-card-carousel-slide.is-current .gtr-card-ability-check,
.gtr-card-carousel-slide.is-current input,
.gtr-card-carousel-slide.is-current label,
.gtr-card-carousel-slide.is-current button,
.gtr-card-carousel-slide.is-current a {
  pointer-events: auto;
}

.gtr-card-carousel-slide.is-current .gtr-card-expanded {
  box-shadow: 0 12px 28px rgb(0 0 0 / 0.14);
}

/* Mask is in the source's space, then the replica flips: white at the
   card bottom is the strip under the face. Stops are % of the card.
   Only the current face and two neighbors — 37 reflects crash iOS. */
.gtr-card-carousel:not(.gtr-card-carousel-solo):not(.is-idle):not(.is-dragging):not(.is-scrubbing)
  .gtr-card-carousel-slide.is-current .gtr-card-carousel-mirror,
.gtr-card-carousel:not(.gtr-card-carousel-solo):not(.is-idle):not(.is-dragging):not(.is-scrubbing)
  .gtr-card-carousel-slide.is-near .gtr-card-carousel-mirror {
  -webkit-box-reflect: below 0.5rem -webkit-gradient(
    linear,
    left top,
    left bottom,
    from(transparent),
    color-stop(0.88, transparent),
    color-stop(0.94, rgb(255 255 255 / 0.2)),
    to(rgb(255 255 255 / 0.4))
  );
}

.gtr-card-carousel-slide.is-far {
  visibility: hidden;
  pointer-events: none;
}

.gtr-card-carousel.is-idle .gtr-card-carousel-slide {
  perspective: none;
  isolation: auto;
}

.gtr-card-carousel.is-idle .gtr-card-carousel-slide:not(.is-current) {
  visibility: hidden;
  pointer-events: none;
}

.gtr-card-carousel.is-idle .gtr-card-carousel-rig,
.gtr-card-carousel.is-idle .gtr-card-carousel-track,
.gtr-card-carousel.is-dragging .gtr-card-carousel-rig,
.gtr-card-carousel.is-scrubbing .gtr-card-carousel-rig {
  filter: none;
}

.gtr-card-carousel.is-idle .gtr-card-carousel-slide:not(.is-current) .gtr-card-carousel-rig {
  transform: none;
}

.gtr-card-carousel:not(.gtr-card-carousel-solo) .gtr-card-carousel-slide:not(.is-current) .gtr-card-carousel-note {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .gtr-card-carousel:not(.gtr-card-carousel-solo) .gtr-card-carousel-rig,
  .gtr-card-carousel:not(.gtr-card-carousel-solo) .gtr-card-carousel-track {
    transition: none;
  }
}

.gtr-card-carousel.is-dragging .gtr-card-carousel-track,
.gtr-card-carousel.is-dragging .gtr-card-carousel-rig,
.gtr-card-carousel.is-scrubbing .gtr-card-carousel-track,
.gtr-card-carousel.is-scrubbing .gtr-card-carousel-rig {
  transition: none;
}

/* Cover Flow grabber: inset to the visible card stack. Groove + pill only —
   peek zones already step, so no end chevrons or outer capsule. */
.gtr-card-carousel-scrub {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  z-index: 70;
  box-sizing: border-box;
  width: min(
    calc(var(--gtr-carousel-card) + 2 * var(--gtr-carousel-first)),
    calc(100% - 1.5rem)
  );
  max-width: calc(100% - 1.5rem);
  height: 1.05rem;
  transform: translateX(-50%);
  touch-action: none;
}

.gtr-card-carousel-scrub-rail {
  --gtr-carousel-thumb: max(2.75rem, min(42%, calc(100% * 12 / max(1, var(--gtr-carousel-count)))));
  position: relative;
  height: 100%;
  cursor: pointer;
  border-radius: 9999px;
  background: linear-gradient(to bottom, rgb(196 191 186), rgb(231 229 228) 52%, rgb(214 211 209));
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.16);
}

.dark .gtr-card-carousel-scrub-rail {
  background: linear-gradient(to bottom, rgb(12 10 9), rgb(48 44 40) 55%, rgb(24 21 19));
  box-shadow: inset 0 2px 4px rgb(0 0 0 / 0.7);
}

.gtr-card-carousel-scrub-thumb {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: calc(
    var(--gtr-carousel-index) / max(1, var(--gtr-carousel-count) - 1)
    * (100% - var(--gtr-carousel-thumb))
  );
  width: var(--gtr-carousel-thumb);
  border-radius: 9999px;
  background: linear-gradient(to bottom, rgb(255 255 255), rgb(231 229 228) 48%, rgb(189 183 176));
  box-shadow:
    0 1px 1px rgb(0 0 0 / 0.18),
    inset 0 1px 0 rgb(255 255 255);
  pointer-events: none;
}

.dark .gtr-card-carousel-scrub-thumb {
  background: linear-gradient(to bottom, rgb(168 162 154), rgb(96 90 84) 48%, rgb(58 54 50));
  box-shadow:
    0 1px 1px rgb(0 0 0 / 0.55),
    inset 0 1px 0 rgb(255 255 255 / 0.28);
}

.gtr-card-carousel-scrub-rail:focus-visible {
  outline: 2px solid rgb(180 83 9);
  outline-offset: -2px;
}

.gtr-card-carousel-zone {
  position: absolute;
  top: 1rem;
  bottom: 4.5rem;
  z-index: 60;
  width: 4.25rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.gtr-card-carousel-zone-prev {
  left: 0;
}

.gtr-card-carousel-zone-next {
  right: 0;
}

.gtr-card-carousel-zone:disabled {
  pointer-events: none;
  cursor: default;
}

.gtr-card-carousel-zone:focus-visible {
  outline: 2px solid rgb(180 83 9);
  outline-offset: -2px;
}

.gtr-card-carousel .gtr-card-expanded {
  --gtr-card-w: var(--gtr-carousel-card);
}

/* Solid fill so stacked neighbors do not show through. Jacks keep their
   inverted face (black in light / white in dark) — this would flatten them. */
.gtr-card-carousel .gtr-card-expanded:not(.gtr-card-jack) {
  background: rgb(255 255 255);
}

.dark .gtr-card-carousel .gtr-card-expanded:not(.gtr-card-jack) {
  background: rgb(28 25 23);
}

.gtr-card-carousel-solo .gtr-card-carousel-track {
  padding-inline: 0;
  overflow: visible;
}

.gtr-card-carousel-solo .gtr-card-carousel-slide {
  flex-basis: 100%;
  width: 100%;
  padding-bottom: 0;
}

.gtr-card-carousel-solo .gtr-card-expanded {
  --gtr-card-w: 17.5rem;
}

.gtr-card-carousel-note {
  margin: 0.5rem 0 0;
  text-align: center;
}

.gtr-card-carousel-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.25rem 0 0;
}

.gtr-card-carousel-dot {
  width: 0.5rem;
  height: 0.5rem;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  background: rgb(168 162 158);
  cursor: pointer;
}

.gtr-card-carousel-dot:focus-visible {
  outline: 2px solid rgb(180 83 9);
  outline-offset: 2px;
}

.gtr-card-carousel-dot[aria-current="true"] {
  background: rgb(180 83 9);
}

.dark .gtr-card-carousel-dot {
  background: rgb(87 83 78);
}

.dark .gtr-card-carousel-dot[aria-current="true"] {
  background: rgb(251 191 36);
}

.gtr-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  padding-top: 0;
  border-top: 1px solid rgb(231 229 228);
  min-height: 1.4rem;
  flex: 0 0 auto;
}

.dark .gtr-card-footer {
  border-top-color: rgb(68 64 60);
}

.gtr-card-pips {
  display: inline-flex;
  gap: 0.15rem;
  align-items: center;
  flex-shrink: 0;
}

.gtr-card-pip {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 9999px;
  border: 1.5px solid currentColor;
  background: currentColor;
  opacity: 0.85;
}

/* Spine pips: hidden on full-size (footer carries value); shown on sm/xs. */
.gtr-card-pips-edge {
  display: none;
}

.gtr-card-material {
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
  margin-left: auto;
  min-width: 0;
}

/* Ability body: rules-book ALLCAPS for role/material ink — location, not locale. */
.gtr-card-ability .role-ink,
.gtr-card-ability .mat {
  text-transform: uppercase;
}

/* sm/xs: value lives in the left spine under the vertical label; footer is label-only. */
.gtr-card-sm .gtr-card-pips-edge,
.gtr-card-xs .gtr-card-pips-edge {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.08rem;
  padding: 0.2rem 0 0.3rem;
  border-top: 1px solid rgb(231 229 228);
}

.dark .gtr-card-sm .gtr-card-pips-edge,
.dark .gtr-card-xs .gtr-card-pips-edge {
  border-top-color: rgb(68 64 60);
}

.gtr-card-sm .gtr-card-pips-footer,
.gtr-card-xs .gtr-card-pips-footer {
  display: none;
}

.gtr-card-sm .gtr-card-footer,
.gtr-card-xs .gtr-card-footer {
  justify-content: center;
}

.gtr-card-sm .gtr-card-pip {
  width: 0.32rem;
  height: 0.32rem;
  border-width: 1.25px;
}

.gtr-card-xs .gtr-card-pip {
  width: 0.26rem;
  height: 0.26rem;
  border-width: 1px;
}

.gtr-card-sm .gtr-card-material,
.gtr-card-xs .gtr-card-material {
  margin-left: 0;
  flex: 1 1 auto;
  text-align: center;
  overflow: visible;
  white-space: nowrap;
}

.gtr-card-sm .gtr-card-material {
  font-size: 0.5rem;
  letter-spacing: 0.02em;
}

.gtr-card-xs .gtr-card-material {
  font-size: 0.42rem;
  letter-spacing: 0.01em;
}

/* Soft left edge tint by material (matches role spine hue family). */
.gtr-card-wood { border-left: 3px solid rgb(29, 131, 72); }
.gtr-card-brick { border-left: 3px solid rgb(192, 57, 43); }
.gtr-card-concrete { border-left: 3px solid rgb(93, 109, 126); }
.gtr-card-stone { border-left: 3px solid rgb(31, 97, 141); }
.gtr-card-marble { border-left: 3px solid rgb(108, 52, 131); }
.gtr-card-rubble { border-left: 3px solid rgb(183, 149, 11); }

/* Jack: invert the face — black body / white ink (physical GtR nod).
   Always black regardless of site theme so it stays “the reverse card”. */
.gtr-card-jack {
  border-color: rgb(68 64 60);
  border-left: 3px solid rgb(250 250 249);
  background: rgb(28 25 23);
  color: rgb(250 250 249);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.35);
}

.gtr-card-jack .gtr-card-spine {
  border-right-color: rgb(68 64 60);
  background: rgb(12 10 9);
}

.gtr-card-jack .gtr-card-role,
.gtr-card-jack .gtr-card-name,
.gtr-card-jack .role-jack,
.gtr-card-jack .gtr-card-material {
  color: rgb(250 250 249);
}

.gtr-card-jack .gtr-card-text {
  color: rgb(214 211 209);
}

.gtr-card-jack .gtr-card-footer {
  border-top-color: rgb(68 64 60);
}

@media (hover: hover) and (pointer: fine) {
  .gtr-card-jack:hover,
  .gtr-card-jack:focus-within {
    box-shadow: 0 8px 24px rgb(0 0 0 / 0.55);
  }
}

.gtr-card-zoomable .gtr-card-jack:hover,
.gtr-card-zoomable .gtr-card-jack:focus-within {
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.35);
}

/* Dark theme: other cards are already dark — flip Jack to white face / black ink. */
.dark .gtr-card-jack {
  border-color: rgb(214 211 209);
  border-left-color: rgb(28 25 23);
  background: rgb(250 250 249);
  color: rgb(28 25 23);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.12);
}

.dark .gtr-card-jack .gtr-card-spine {
  border-right-color: rgb(214 211 209);
  background: rgb(231 229 228);
}

.dark .gtr-card-jack .gtr-card-role,
.dark .gtr-card-jack .gtr-card-name,
.dark .gtr-card-jack .role-jack,
.dark .gtr-card-jack .gtr-card-material {
  color: rgb(28 25 23);
}

.dark .gtr-card-jack .gtr-card-text {
  color: rgb(87 83 78);
}

.dark .gtr-card-jack .gtr-card-footer {
  border-top-color: rgb(214 211 209);
}

@media (hover: hover) and (pointer: fine) {
  .dark .gtr-card-jack:hover,
  .dark .gtr-card-jack:focus-within {
    box-shadow: 0 8px 24px rgb(0 0 0 / 0.35);
  }
}

.dark .gtr-card-zoomable .gtr-card-jack:hover,
.dark .gtr-card-zoomable .gtr-card-jack:focus-within {
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.12);
}

/* --- Merchant bonus cards (scoring page) --- */

.gtr-merchant-bonuses {
  /* Block flex so wrapped chips stay centered in the player column —
     inline-flex grows to the cell width on wrap and packs to the start. */
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
}

.gtr-merchant-bonus {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.6rem;
  border-radius: 0.5rem;
  background: rgb(250 245 255 / 0.9);
  color: rgb(28 25 23);
}

.dark .gtr-merchant-bonus {
  background: rgb(28 25 23 / 0.9);
  color: rgb(250 245 255);
}

.gtr-merchant-bonus-pips {
  display: flex;
  gap: 0.25rem;
}

.gtr-merchant-pip {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 9999px;
  border: 2px solid currentColor;
  background: currentColor;
}

.gtr-merchant-bonus-label {
  font-size: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.gtr-merchant-bonus-material {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

html {
  /* 16/14 so Tailwind text-sm (0.875rem) computes to 16px: iOS Safari
     will not zoom on input focus. Rem type, spacing, and cards scale together.
     Viewport meta is unchanged, so pinch-zoom still works. */
  font-size: calc(100% * 16 / 14);
  scrollbar-gutter: stable;
}

/* Overlay scrollbars on phones: do not reserve a 15–17px gutter that
   shrinks the layout box and turns a tight header into x-overflow. */
@media (max-width: 639px) {
  html {
    scrollbar-gutter: auto;
  }
}

/* Form toggle switch (new lobby expansion, etc.) — fixed geometry so the thumb
   stays centered; peer/Tailwind toggles often look slightly off across browsers. */
.gtr-switch {
  position: relative;
  display: inline-block;
  width: 2.75rem; /* 44px */
  height: 1.5rem; /* 24px */
  flex-shrink: 0;
}

.gtr-switch input {
  position: absolute;
  inset: 0;
  z-index: 1;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.gtr-switch-track {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 9999px;
  background: rgb(120 113 108); /* stone-500 */
  transition: background-color 0.15s ease;
}

.gtr-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 9999px;
  background: rgb(255 255 255);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
  transition: transform 0.15s ease;
  pointer-events: none;
}

.gtr-switch input:checked + .gtr-switch-track {
  background: rgb(180 83 9); /* amber-700 */
}

.gtr-switch input:checked + .gtr-switch-track .gtr-switch-thumb {
  transform: translateX(20px); /* 44 - 20 - 2 - 2 */
}

.gtr-switch input:focus-visible + .gtr-switch-track {
  outline: 2px solid rgb(217 119 6); /* amber-600 */
  outline-offset: 2px;
}

.dark .gtr-switch-track {
  background: rgb(87 83 78); /* stone-600 */
}

.dark .gtr-switch input:checked + .gtr-switch-track {
  background: rgb(217 119 6); /* amber-600 */
}

/*
 * Phone-portrait table: drop group-only cards, go edge-to-edge, separate
 * sections with a wash and a hairline. sm+ (640px) keeps the desktop cards.
 * Cancels main px-4 (1rem) so sites/hand can use the full CSS viewport.
 */
@media (max-width: 639px) {
  .gtr-table {
    margin-inline: -1rem;
  }

  /* Tailwind v4 space-y uses margin-bottom on :not(:last-child), not
     margin-top on ~ siblings. Zero both so sites/pool/camps stack flush. */
  .gtr-table-stack > :not([hidden]) {
    margin-top: 0;
    margin-bottom: 0;
  }

  .gtr-table-col,
  .gtr-table-rail {
    gap: 0;
  }

  .gtr-table-band,
  .gtr-table-camp {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    padding: 0.65rem 0.75rem 0.75rem;
    box-shadow: none;
  }

  .gtr-table-band {
    border-bottom: 1px solid rgb(231 229 228);
    background: rgb(255 255 255);
  }

  .gtr-table-band-mute {
    background: rgb(250 250 249); /* stone-50 */
  }

  .gtr-table-camp {
    border-bottom: 1px solid rgb(231 229 228);
  }

  .gtr-table-camp-focus {
    border-color: rgb(253 230 138); /* amber-200 */
    background: rgb(255 251 235); /* amber-50 */
  }

  .gtr-hand {
    margin-top: 0.5rem;
    border: 0;
    border-radius: 0;
    padding: 0;
    background: transparent;
  }

  .gtr-table-sites {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.3rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .dark .gtr-table-band {
    border-bottom-color: rgb(68 64 60);
    background: rgb(28 25 23);
  }

  .dark .gtr-table-band-mute {
    background: rgb(12 10 9);
  }

  .dark .gtr-table-camp {
    border-bottom-color: rgb(68 64 60);
  }

  .dark .gtr-table-camp-focus {
    border-bottom-color: rgb(120 53 15);
    background: rgb(69 26 3 / 0.35);
  }
}

/*
 * Phone-portrait firehose + tables: same rule as the table page — drop
 * group-only cards, go edge-to-edge, separate with a wash and a hairline.
 * sm+ (640px) keeps the max-w-lg column and rounded surfaces.
 */
@media (max-width: 639px) {
  .gtr-list {
    margin-inline: -1rem;
    max-width: none;
  }

  /* Tailwind v4 space-y uses margin-bottom on :not(:last-child). */
  .gtr-list-stack > :not([hidden]) {
    margin-top: 0;
    margin-bottom: 0;
  }

  .gtr-list > header {
    padding: 0.5rem 0.75rem 0.65rem;
    text-align: left;
  }

  .gtr-list .gtr-new-abilities {
    padding: 0.5rem 0 0.65rem;
  }

  .gtr-list .gtr-new-abilities > h2 {
    padding-inline: 0.75rem;
  }

  .gtr-list #home_tables > .ui-hint {
    padding: 0.65rem 0.75rem;
  }

  .gtr-list-band {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    box-shadow: none;
  }

  .gtr-list-band.ui-surface {
    border-bottom: 1px solid rgb(231 229 228);
    background: rgb(255 255 255);
  }

  .gtr-list-band.ui-banner-attention {
    border-bottom: 1px solid rgb(253 230 138); /* amber-200 */
    background: rgb(255 251 235); /* amber-50 */
  }

  .gtr-list-band.gtr-list-controls {
    padding: 0.75rem;
    background: rgb(250 250 249); /* stone-50 */
  }

  .gtr-list-band > .ui-divider.border-b,
  .gtr-list .ui-banner-attention-header,
  .gtr-list details > summary {
    padding: 0.5rem 0.75rem;
  }

  .gtr-list .ui-list-row,
  .gtr-list .ui-list-row-attention,
  .gtr-list .ui-firehose-row,
  .gtr-list #firehose_empty {
    padding: 0.65rem 0.75rem;
  }

  /* Page title already names the feed; the inner group label is card chrome. */
  .gtr-list-firehose .gtr-list-heading {
    display: none;
  }

  .dark .gtr-list-band.ui-surface {
    border-bottom-color: rgb(68 64 60);
    background: rgb(28 25 23);
  }

  .dark .gtr-list-band.ui-banner-attention {
    border-bottom-color: rgb(120 53 15);
    background: rgb(69 26 3 / 0.35);
  }

  .dark .gtr-list-band.gtr-list-controls {
    background: rgb(12 10 9);
  }
}

/*
 * 1-col lobby: hoist column wrappers so invite/join can sort above seats
 * (md+ keeps seats | invite+chat). Phone flatten matches the table/list
 * bands — edge-to-edge, drop group-only cards.
 */
@media (max-width: 767px) {
  .gtr-lobby-col {
    display: contents;
  }
}

@media (max-width: 639px) {
  .gtr-lobby {
    margin-inline: -1rem;
  }

  .gtr-lobby-grid {
    gap: 0;
  }

  .gtr-lobby-band {
    margin-top: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    box-shadow: none;
  }

  .gtr-lobby-band.ui-surface {
    border-bottom: 1px solid rgb(231 229 228);
    background: rgb(255 255 255);
    padding: 0.75rem;
  }

  .gtr-lobby-band > summary {
    padding: 0.5rem 0.75rem;
  }

  .dark .gtr-lobby-band.ui-surface {
    border-bottom-color: rgb(68 64 60);
    background: rgb(28 25 23);
  }
}

/* Global /cards grid + New Cards solo: the face is the link (no zoom wrapper). */
a.gtr-catalog-face,
a.gtr-card-carousel-link {
  color: inherit;
  text-decoration: none;
}

a.gtr-card-carousel-link {
  display: block;
}

/* Short catalog packs (Republic / Imperium): all four faces in view. */
.gtr-catalog-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1rem;
  padding: 0.75rem 0.75rem 1rem;
}

/*
 * Phone-portrait card catalog: same rule as the table/list/lobby — drop
 * group-only cards, go edge-to-edge, separate with a wash and a hairline.
 * sm+ keeps the rounded pack details. Carousels stay full-bleed in the band.
 */
@media (max-width: 639px) {
  .gtr-catalog {
    margin-inline: -1rem;
  }

  /* Tailwind v4 space-y uses margin-bottom on :not(:last-child), not
     margin-top on ~ siblings. Zero both so pack bands stack flush. */
  .gtr-catalog-stack > :not([hidden]) {
    margin-top: 0;
    margin-bottom: 0;
  }

  .gtr-catalog > header {
    padding: 0.5rem 0.75rem 0.65rem;
  }

  .gtr-catalog-band {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    box-shadow: none;
    padding-bottom: 0;
  }

  .gtr-catalog-band.ui-surface {
    border-bottom: 1px solid rgb(231 229 228);
    background: rgb(255 255 255);
  }

  .gtr-catalog-band > summary {
    padding: 0.5rem 0.75rem;
  }

  .dark .gtr-catalog-band.ui-surface {
    border-bottom-color: rgb(68 64 60);
    background: rgb(28 25 23);
  }

  /* Flatten is edge-to-edge; keep the cover-flow off the bezel. Matches
     the pack-title / list-heading gutter. Mask is shorter so it does not
     eat the current face after the region shrinks. */
  .gtr-catalog .gtr-card-carousel:not(.gtr-card-carousel-solo),
  .gtr-list .gtr-card-carousel:not(.gtr-card-carousel-solo) {
    width: calc(100% - 1.5rem);
    margin-inline: auto;
    mask-image: linear-gradient(to right, transparent, #000 0.4rem, #000 calc(100% - 0.4rem), transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, #000 0.4rem, #000 calc(100% - 0.4rem), transparent);
  }
}

/*
 * Phone-portrait new lobby: same exclusive-accordion flatten as the catalog.
 * Below 640, drop the group cards, go edge-to-edge, hairline + wash.
 * sm+ keeps max-w-lg and rounded details.
 */
@media (max-width: 639px) {
  .gtr-new {
    margin-inline: -1rem;
    max-width: none;
  }

  /* Tailwind v4 space-y uses margin-bottom on :not(:last-child). */
  .gtr-new-stack > :not([hidden]) {
    margin-top: 0;
    margin-bottom: 0;
  }

  .gtr-new-band {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    box-shadow: none;
    padding-bottom: 0;
  }

  .gtr-new-band.ui-surface {
    border-bottom: 1px solid rgb(231 229 228);
    background: rgb(255 255 255);
  }

  .gtr-new-band > summary {
    padding: 0.5rem 0.75rem;
  }

  .gtr-new-body {
    padding: 0.75rem;
  }

  .dark .gtr-new-band.ui-surface {
    border-bottom-color: rgb(68 64 60);
    background: rgb(28 25 23);
  }
}
