/* ==========================================================================
   Clout Hunters web theme
   --------------------------------------------------------------------------
   Built from two sources:
     1. The official promo art (box art + logo): cream background, coral and
        magenta from the CLOUT letters and sparkles, the teal shadow under
        HUNTERS, dusty purple dinosaur, thick black ink outlines.
   Main highlights are coral/magenta and dark green-teal. The table is
   dark stained wood.
     2. The card frame layers: aged parchment, heavy hand-inked borders,
        riveted wood and metal strips, colored speed badges, pastel keyword
        pills.

   How to use:
     <link rel="stylesheet" href="clout-theme.css">
   Everything here is prefixed "ch-" so it never collides with existing
   class names. Change the look in one place by editing the tokens in :root.

   This copy only keeps the pieces the workshop, welcome page and game table
   use. The full component set (keyword pills, speed badges, trays, HUD...)
   is the design reference in docs/web_style/clout-theme.css; copy a piece
   from there when a page starts using it.
   ========================================================================== */

/* ---------- Fonts (shipped in ./fonts) ---------- */
@font-face {
  font-family: "Super Normal";
  src: url("fonts/SuperNormal.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Super Rugged";
  src: url("fonts/SuperRugged.ttf") format("truetype");
  font-display: swap;
}

/* ---------- Design tokens ---------- */
:root {
  /* Promo art */
  --ch-cream: #fdfcea;          /* box art background */
  --ch-cream-2: #f7edcc;
  --ch-ink: #0b0d1a;            /* outlines, near-black navy */
  --ch-navy: #0e2455;           /* HUNTERS lettering */
  --ch-navy-2: #1e315f;
  --ch-navy-3: #2d3a6a;
  --ch-navy-deep: #071431;
  --ch-teal: #47a4b6;           /* HUNTERS drop shadow (logo) */
  --ch-teal-deep: #2b7680;
  --ch-teal-dark: #1d4f55;      /* dark green-teal, main highlight */
  --ch-gold: #efcf82;           /* CLOUT top */
  --ch-gold-2: #eac26f;
  --ch-gold-dark: #b8862f;
  --ch-peach: #dda486;
  --ch-coral: #d27665;          /* CLOUT bottom (logo), main highlight */
  --ch-coral-light: #ec9a86;
  --ch-magenta: #c95a78;        /* eye and sparkles in the logo */
  --ch-pink: #d89499;
  --ch-plum: #807188;           /* dino body */
  --ch-plum-2: #b58696;
  --ch-plum-deep: #4d465d;

  /* Card frames */
  --ch-parchment: #f3d9b1;
  --ch-parchment-2: #e9c99b;
  --ch-parchment-3: #c9a774;
  --ch-paper-grey: #dfe0e3;     /* improvised / scrap paper */
  --ch-paper-pink: #f0c9c1;     /* monster card back */
  --ch-bonus-box: #f2e2bf;      /* bonus text box on cards */
  --ch-wood: #6d5941;
  --ch-wood-light: #a57b4f;
  --ch-metal: #9c958d;
  --ch-back-green: #527867;     /* standard card back emblem */

  /* Speed badges (assets/layers/speed_*.png) */
  --ch-speed-1: #3b3f93;
  --ch-speed-2: #9e4899;
  --ch-speed-3: #a53333;
  --ch-speed-t: #323135;
  --ch-monster-heart: #561b1b;
  --ch-monster-red: #ba3b40;

  /* Keyword pills (soft tints seen on the cards) */
  --ch-kw-deal: #f6c6c0;
  --ch-kw-move: #d5dcf8;
  --ch-kw-mark: #f5e6a0;
  --ch-kw-clash: #f3d0dc;
  --ch-kw-status: #e0d5f3;
  --ch-kw-fire: #f8d4b0;
  --ch-kw-heal: #cfe9d6;

  /* Player seat colors, readable on the dark wood table */
  --ch-seat-1: #e0735f;  /* coral */
  --ch-seat-2: #efc25c;  /* gold */
  --ch-seat-3: #47a4b6;  /* teal */
  --ch-seat-4: #a58bc4;  /* lilac */
  --ch-seat-5: #7fb36a;  /* moss */
  --ch-seat-6: #e9e3d0;  /* bone */

  /* Gradients */
  --ch-clout-gradient: linear-gradient(180deg, #f8e19a 0%, #efc574 45%, #e39b72 80%, #d98572 100%);
  --ch-gold-button: linear-gradient(180deg, #f7dd93 0%, #ecbd68 70%, #e0a364 100%);
  --ch-accent-gradient: linear-gradient(180deg, #e9927b 0%, #d27665 50%, #c45f76 100%);
  --ch-teal-gradient: linear-gradient(180deg, #2f8590 0%, #1d4f55 100%);

  /* Type */
  --ch-font-display: "Super Normal", "Arial Black", Impact, sans-serif;
  --ch-font-flavor: "Super Rugged", "Comic Sans MS", cursive;
  --ch-font-body: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;

  /* Shape and depth: cartoon style means thick ink lines and hard offset shadows */
  --ch-line: 3px;
  --ch-line-thin: 2px;
  --ch-radius: 10px;
  --ch-radius-sm: 6px;
  --ch-shadow-hard: 3px 4px 0 var(--ch-ink);
  --ch-shadow-hard-sm: 2px 2px 0 var(--ch-ink);
  --ch-shadow-lift: 0 14px 28px rgba(4, 8, 24, 0.55), 0 4px 8px rgba(4, 8, 24, 0.45);

  /* Cards: 63 x 88 mm, same ratio as the 2232 x 3118 frame layers */
  --ch-card-ratio: 0.716;
  --ch-card-w: clamp(64px, 7.5vw, 120px);
  --ch-card-radius: 5.5%;
  --ch-paper-tile: url("img/paper-grain.svg");

  /* Tabletop */
  --ch-table: #2a180e;          /* dark stained wood */
  --ch-table-dark: #120a05;
  --ch-night: #2a1a12;          /* panels floating over the table */
  --ch-night-2: #3a271c;
  --ch-night-3: #4b3324;
  --ch-felt-line: rgba(255, 228, 196, 0.26);
  --ch-zone-fill: rgba(16, 8, 4, 0.32);
  --ch-zone-hot: rgba(210, 118, 101, 0.2);
  --ch-select: #e47f6c;         /* coral selection ring */
  --ch-hover: #47a4b6;          /* teal hover / focus */
}

/* ---------- Base (opt in with class="ch") ---------- */
.ch {
  font-family: var(--ch-font-body);
  color: var(--ch-ink);
  background: var(--ch-cream);
  font-size: 15px;
  line-height: 1.5;
}
.ch *, .ch *::before, .ch *::after { box-sizing: border-box; }

.ch h1, .ch h2, .ch h3 {
  font-family: var(--ch-font-display);
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1.05;
  color: var(--ch-teal-dark);
  text-transform: uppercase;
}
.ch h1 { font-size: clamp(30px, 4vw, 46px); margin: 0 0 0.3em; }
.ch h2 { font-size: clamp(22px, 2.6vw, 30px); margin: 1.4em 0 0.5em; }
.ch h3 { font-size: 19px; margin: 1em 0 0.4em; }
.ch-eyebrow {
  font-family: var(--ch-font-display);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ch-coral);
}

.ch-muted { color: var(--ch-plum-deep); opacity: 0.85; font-size: 0.9em; }

/* ---------- Panels ---------- */
.ch-panel {
  background: var(--ch-paper-tile) repeat, var(--ch-parchment);
  border: var(--ch-line) solid var(--ch-ink);
  border-radius: var(--ch-radius);
  box-shadow: var(--ch-shadow-hard);
  padding: 20px 22px;
}
.ch-panel--cream { background: var(--ch-cream); }

/* ---------- Buttons ---------- */
.ch-btn {
  --btn-bg: var(--ch-cream);
  --btn-fg: var(--ch-ink);
  font-family: var(--ch-font-display);
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px 9px;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: var(--ch-line) solid var(--ch-ink);
  border-radius: var(--ch-radius-sm);
  box-shadow: var(--ch-shadow-hard);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease;
  user-select: none;
}
.ch-btn:hover { filter: brightness(1.06); transform: translate(-1px, -1px); box-shadow: 4px 5px 0 var(--ch-ink); }
.ch-btn:active { transform: translate(3px, 4px); box-shadow: 0 0 0 var(--ch-ink); }
.ch-btn:focus-visible { outline: 3px solid var(--ch-teal); outline-offset: 3px; }
.ch-btn:disabled, .ch-btn[aria-disabled="true"] { filter: grayscale(0.8); opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: var(--ch-shadow-hard-sm); }

.ch-btn--primary { --btn-bg: var(--ch-accent-gradient); }
.ch-btn--teal { --btn-bg: var(--ch-teal-gradient); --btn-fg: var(--ch-cream); }

.ch-btn--dark { --btn-bg: var(--ch-night-2); --btn-fg: var(--ch-cream); }
.ch-btn--danger { --btn-bg: var(--ch-monster-red); --btn-fg: var(--ch-cream); }

.ch-btn--sm { font-size: 12px; padding: 7px 10px 6px; border-width: var(--ch-line-thin); box-shadow: var(--ch-shadow-hard-sm); }

/* ---------- Form fields ---------- */
.ch-field { display: block; margin: 12px 0; font-family: var(--ch-font-display); font-size: 13px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ch-teal-dark); }
.ch-input, .ch-select {
  display: block;
  width: 100%;
  margin-top: 6px;
  font: 15px var(--ch-font-body);
  text-transform: none;
  letter-spacing: 0;
  color: var(--ch-ink);
  background: var(--ch-cream);
  border: var(--ch-line-thin) solid var(--ch-ink);
  border-radius: var(--ch-radius-sm);
  padding: 9px 11px;
  box-shadow: inset 2px 2px 0 rgba(11, 13, 26, 0.12);
}
.ch-input:focus, .ch-select:focus { outline: 3px solid var(--ch-teal); outline-offset: 1px; }

/* ---------- Cards ---------- */
/* A card is just a rendered card image inside .ch-card. The frame,
   ink border and parchment all come from the image itself, so CSS only
   handles shape, depth and states. */
.ch-card {
  position: relative;
  width: var(--ch-card-w);
  aspect-ratio: var(--ch-card-ratio);
  border-radius: var(--ch-card-radius) / calc(var(--ch-card-radius) * var(--ch-card-ratio));
  background: var(--ch-ink);
  box-shadow: 0 2px 0 rgba(0,0,0,0.6), 0 6px 12px rgba(4, 8, 24, 0.45);
  overflow: hidden;
  flex: none;
  transition: transform 0.14s ease, box-shadow 0.14s ease, outline-color 0.14s;
  outline: 3px solid transparent;
  outline-offset: 2px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.ch-card > img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.ch-card:hover { outline-color: var(--ch-hover); transform: translateY(-6px); box-shadow: var(--ch-shadow-lift); z-index: 5; }
.ch-card.is-selected { outline-color: var(--ch-select); box-shadow: 0 0 0 6px rgba(228, 127, 108, 0.35), var(--ch-shadow-lift); }
.ch-card.is-dragging { cursor: grabbing; transform: scale(1.08) rotate(-3deg); box-shadow: 0 26px 40px rgba(0,0,0,0.6); z-index: 50; }
.ch-card.is-tapped { transform: rotate(90deg); }          /* exhausted / used */
.ch-card.is-tapped:hover { transform: rotate(90deg) translateX(-6px); }
.ch-card.is-dimmed { filter: grayscale(0.6) brightness(0.75); }
/* Face down: shows the card back art */
.ch-card.is-facedown > img { visibility: hidden; }
.ch-card.is-facedown { background: url("img/card-back.webp") center / cover, var(--ch-parchment); }

/* Sizes */

.ch-card--landscape { aspect-ratio: calc(1 / var(--ch-card-ratio)); }

/* Counter dropped on a card (damage, status) */
.ch-token {
  position: absolute;
  min-width: 26px; height: 26px;
  padding: 0 6px;
  display: grid; place-items: center;
  font: 14px/1 var(--ch-font-display);
  color: #fff;
  background: var(--ch-monster-red);
  border: var(--ch-line-thin) solid var(--ch-ink);
  border-radius: 999px;
  box-shadow: var(--ch-shadow-hard-sm);
  z-index: 2;
}

.ch-token--tr { top: 6%; right: 6%; }

/* Deck pile: a card with stacked edges and a count */
.ch-deck {
  position: relative;
  width: var(--ch-card-w);
  aspect-ratio: var(--ch-card-ratio);
  border-radius: var(--ch-card-radius) / calc(var(--ch-card-radius) * var(--ch-card-ratio));
  background: url("img/card-back.webp") center / cover, var(--ch-parchment);
  box-shadow:
    2px 2px 0 -1px var(--ch-parchment-3), 2px 2px 0 0 var(--ch-ink),
    4px 4px 0 -1px var(--ch-parchment-3), 4px 4px 0 0 var(--ch-ink),
    6px 6px 0 -1px var(--ch-parchment-3), 6px 6px 0 0 var(--ch-ink),
    0 14px 22px rgba(0,0,0,0.5);
  cursor: pointer;
}

.ch-deck--empty { background: transparent; box-shadow: none; border: var(--ch-line-thin) dashed var(--ch-felt-line); }
.ch-deck-count {
  position: absolute; right: -10px; bottom: -10px;
  min-width: 30px; height: 30px; display: grid; place-items: center;
  font: 15px/1 var(--ch-font-display);
  background: var(--ch-cream); color: var(--ch-ink);
  border: var(--ch-line-thin) solid var(--ch-ink); border-radius: 999px;
  box-shadow: var(--ch-shadow-hard-sm);
}
.ch-deck-label { display: block; margin-top: 12px; text-align: center; font: 12px var(--ch-font-display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ch-cream); opacity: 0.8; }

/* Hand: cards fan out and overlap a little */
.ch-hand { display: flex; justify-content: center; align-items: flex-end; padding: 10px 24px 0; min-height: calc(var(--ch-card-w) / var(--ch-card-ratio) + 16px); }
.ch-hand > .ch-card { margin: 0 calc(var(--ch-card-w) * -0.12); }
.ch-hand > .ch-card:nth-child(odd) { rotate: -2deg; }
.ch-hand > .ch-card:nth-child(even) { rotate: 2deg; }
.ch-hand > .ch-card:hover { rotate: 0deg; transform: translateY(-22%) scale(1.15); z-index: 10; }

/* Big card preview (hover to read) */
.ch-zoom {
  position: fixed; z-index: 200; pointer-events: none;
  /* Every card zooms to the same readable size, whatever its size on the table */
  width: var(--ch-zoom-w, clamp(260px, 24vw, 360px));
  aspect-ratio: var(--ch-card-ratio);
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 30px 60px rgba(0,0,0,0.65), 0 0 0 3px var(--ch-ink);
}
.ch-zoom img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Tabletop ---------- */
/* Dark stained wooden table, lit warm from above like a game night
   lamp. Planks run sideways with fine grain. Pure CSS, no image needed. */
.ch-table {
  position: relative;
  color: var(--ch-cream);
  background-color: var(--ch-table);
  background-image:
    radial-gradient(ellipse at 50% 40%, rgba(255, 170, 100, 0.13), transparent 58%),
    radial-gradient(ellipse at 50% 50%, transparent 45%, rgba(6, 3, 1, 0.88) 100%),
    repeating-linear-gradient(0deg, transparent 0 116px, rgba(8, 4, 2, 0.7) 116px 118px, rgba(255, 200, 150, 0.06) 118px 119px),
    repeating-linear-gradient(0deg,
      transparent 0 7px, rgba(255, 190, 130, 0.045) 7px 8px,
      transparent 8px 19px, rgba(10, 5, 2, 0.18) 19px 21px,
      transparent 21px 33px, rgba(255, 190, 130, 0.035) 33px 35px,
      transparent 35px 52px, rgba(10, 5, 2, 0.12) 52px 53px),
    repeating-linear-gradient(90deg, rgba(10, 5, 2, 0.1) 0 1px, transparent 1px 260px),
    linear-gradient(90deg, rgba(10, 5, 2, 0.25), transparent 30% 70%, rgba(10, 5, 2, 0.25));
  overflow: hidden;
}
/* Paper grain overlay for warmth */
.ch-table::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: var(--ch-paper-tile) repeat;
  mix-blend-mode: overlay; opacity: 0.35;
}

/* Zones: chalked dashed areas where cards go. No rules, just a hint. */

.ch-zone-label {
  position: absolute; top: -11px; left: 14px;
  padding: 2px 10px 1px;
  font: 12px/1.3 var(--ch-font-display); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ch-ink);
  background: var(--ch-coral);
  border: var(--ch-line-thin) solid var(--ch-ink);
  border-radius: 4px;
  rotate: -1.5deg;
}

/* Seat colors (used by goblin meeples, portraits and banners) */
.ch-seat-1 { --seat: var(--ch-seat-1); } .ch-seat-2 { --seat: var(--ch-seat-2); }
.ch-seat-3 { --seat: var(--ch-seat-3); } .ch-seat-4 { --seat: var(--ch-seat-4); }
.ch-seat-5 { --seat: var(--ch-seat-5); } .ch-seat-6 { --seat: var(--ch-seat-6); }

/* Top bar on the table screen */
.ch-topbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px;
  background:
    repeating-linear-gradient(0deg, transparent 0 5px, rgba(0, 0, 0, 0.12) 5px 6px, transparent 6px 13px),
    linear-gradient(180deg, #2c1b12, #1c110b);
  border-bottom: var(--ch-line) solid var(--ch-ink);
  box-shadow: 0 3px 0 var(--ch-teal-dark);
  color: var(--ch-cream);
  position: relative; z-index: 3;
}
.ch-topbar .ch-logo { height: 38px; }
.ch-topbar .ch-spacer { flex: 1; }

/* Player HUD: a parchment nameplate with counters */

.ch-counter {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 4px 3px 8px;
  background: var(--ch-cream);
  border: var(--ch-line-thin) solid var(--ch-ink);
  border-radius: 999px;
  font: 15px/1 var(--ch-font-display);
}
.ch-counter img { width: 18px; height: 18px; }
.ch-counter button {
  width: 22px; height: 22px; padding: 0; border-radius: 50%;
  border: var(--ch-line-thin) solid var(--ch-ink); background: var(--ch-parchment-2);
  font: 700 15px/1 var(--ch-font-body); cursor: pointer;
  display: inline-grid; place-items: center; color: var(--ch-ink);
}
.ch-counter button:hover { background: var(--ch-coral-light); }

/* Action log line */
.ch-log { font-size: 13px; line-height: 1.45; }
.ch-log p { margin: 0; padding: 5px 0; border-bottom: 1px dashed rgba(253, 252, 234, 0.15); }
.ch-log b { font-family: var(--ch-font-display); font-weight: 400; letter-spacing: 0.03em; }

/* Toast */
.ch-toast {
  position: fixed; left: 50%; bottom: 24px; translate: -50% 0;
  padding: 10px 18px 9px;
  font: 15px var(--ch-font-display); text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--ch-cream); color: var(--ch-ink);
  border: var(--ch-line) solid var(--ch-ink); border-radius: var(--ch-radius-sm);
  box-shadow: var(--ch-shadow-hard);
  z-index: 300;
}

/* Dialog */
.ch-dialog {
  border: var(--ch-line) solid var(--ch-ink);
  border-radius: var(--ch-radius);
  box-shadow: var(--ch-shadow-hard), 0 30px 60px rgba(0,0,0,0.5);
  background: var(--ch-paper-tile) repeat, var(--ch-parchment);
  padding: 24px;
  max-width: min(720px, 94vw);
}
.ch-dialog::backdrop { background: rgba(14, 8, 5, 0.72); backdrop-filter: blur(2px); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ch-btn, .ch-card { transition: none; }
}

/* ==========================================================================
   Goblin touches (draft 3)
   From the art brief: goblins are colorful, teal/green, sketchy, big ears,
   scrappy engineers wearing junk, leather, metal and pelts.
   ========================================================================== */
:root {
  --ch-goblin-skin: #6fae7c;     /* teal-green goblin skin */
  --ch-goblin-skin-dark: #3f7a52;
  --ch-leather: #6b3a26;
  --ch-leather-dark: #4a2618;
  --ch-hide: #4f1f20;            /* monster mat, deep red hide */
  --ch-hide-dark: #2f1112;
  --ch-dino-magenta: #ff1d65;    /* the dinosaur swatch from the art brief */
  --ch-stitch: rgba(243, 217, 177, 0.75);
  --ch-part-w: calc(var(--ch-card-w) * 1.4);  /* monster parts are tarot-sized: about 1.4x a normal card */
}

/* ---------- Goblin meeple ----------
   A little goblin pawn: big ears, a tuft of hair, glowing yellow eyes and a
   toothy grin, body tinted with the seat color. Markup: <span class="ch-meeple ch-seat-1"></span>
   Size it with font-size (1em = 1 goblin wide is about 30px at 15px font size). */
.ch-meeple {
  position: relative;
  display: inline-block;
  flex: none;
  width: 2em;
  height: 2.2em;
  clip-path: none;
  background: none;
  filter:
    drop-shadow(1.4px 0 0 var(--ch-ink)) drop-shadow(-1.4px 0 0 var(--ch-ink))
    drop-shadow(0 1.4px 0 var(--ch-ink)) drop-shadow(0 -1.4px 0 var(--ch-ink))
    drop-shadow(2px 3px 0 rgba(0, 0, 0, 0.45));
  cursor: grab;
  touch-action: none;
  transition: transform 0.12s ease;
}
.ch-meeple::before, .ch-meeple::after { content: ""; position: absolute; inset: 0; }
/* Ink outline layer underneath the body (the goblin meeple has no face, only its silhouette and belt) */
.ch-meeple::before { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 44'%3E%3Cg fill='%230b0d1a'%3E%3Cpath d='M12.6 11.6 L0.6 5.8 Q3.4 14.6 12.2 19.8 Z'/%3E%3Cpath d='M27.4 11.6 L39.4 5.8 Q36.6 14.6 27.8 19.8 Z'/%3E%3Cpath d='M17.6 7.8 L19.4 2.6 L20.6 6 L22.6 3.4 L22.4 8.2 Z'/%3E%3Ccircle cx='20' cy='16' r='9'/%3E%3Cpath d='M13.4 22.6 Q9 31 7 40 Q6.6 43.4 10.2 43.4 L29.8 43.4 Q33.4 43.4 33 40 Q31 31 26.6 22.6 Z'/%3E%3C/g%3E%3Ccircle cx='16' cy='15.4' r='2.7' fill='%23f5d867'/%3E%3Ccircle cx='24' cy='15.4' r='2.7' fill='%23f5d867'/%3E%3Ccircle cx='16.6' cy='15.8' r='1.1' fill='%230b0d1a'/%3E%3Ccircle cx='23.4' cy='15.8' r='1.1' fill='%230b0d1a'/%3E%3Cpath d='M17 21 L18 22.6 L19 21.4 Z M21 21.4 L22 22.6 L23 21 Z' fill='%23fdfcea'/%3E%3C/svg%3E") center / 100% 100% no-repeat; }
/* Seat-colored body with a little light from the top left */
.ch-meeple::after {
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.35), transparent 45%),
    linear-gradient(180deg, transparent 60%, rgba(0, 0, 0, 0.18)),
    var(--seat, var(--ch-seat-1));
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 44'%3E%3Cdefs%3E%3Cmask id='m'%3E%3Crect width='40' height='44' fill='white'/%3E%3Crect x='8' y='33' width='24' height='1.6' fill='black'/%3E%3C/mask%3E%3C/defs%3E%3Cg mask='url(%23m)'%3E%3Cpath d='M12.6 11.6 L0.6 5.8 Q3.4 14.6 12.2 19.8 Z'/%3E%3Cpath d='M27.4 11.6 L39.4 5.8 Q36.6 14.6 27.8 19.8 Z'/%3E%3Cpath d='M17.6 7.8 L19.4 2.6 L20.6 6 L22.6 3.4 L22.4 8.2 Z'/%3E%3Ccircle cx='20' cy='16' r='9'/%3E%3Cpath d='M13.4 22.6 Q9 31 7 40 Q6.6 43.4 10.2 43.4 L29.8 43.4 Q33.4 43.4 33 40 Q31 31 26.6 22.6 Z'/%3E%3C/g%3E%3C/svg%3E") center / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 44'%3E%3Cdefs%3E%3Cmask id='m'%3E%3Crect width='40' height='44' fill='white'/%3E%3Crect x='8' y='33' width='24' height='1.6' fill='black'/%3E%3C/mask%3E%3C/defs%3E%3Cg mask='url(%23m)'%3E%3Cpath d='M12.6 11.6 L0.6 5.8 Q3.4 14.6 12.2 19.8 Z'/%3E%3Cpath d='M27.4 11.6 L39.4 5.8 Q36.6 14.6 27.8 19.8 Z'/%3E%3Cpath d='M17.6 7.8 L19.4 2.6 L20.6 6 L22.6 3.4 L22.4 8.2 Z'/%3E%3Ccircle cx='20' cy='16' r='9'/%3E%3Cpath d='M13.4 22.6 Q9 31 7 40 Q6.6 43.4 10.2 43.4 L29.8 43.4 Q33.4 43.4 33 40 Q31 31 26.6 22.6 Z'/%3E%3C/g%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.ch-meeple:hover { transform: translateY(-3px) rotate(-6deg); }

/* Each seat's goblin carries its own belly mark (circle, triangle, square, diamond, star, cross),
   so the goblins can be told apart without relying on colour. Markup: <span class="ch-meeple-mark"></span> inside the meeple. */
.ch-meeple-mark {
  position: absolute; z-index: 1; left: 35%; top: 50%; width: 30%; height: 25%; pointer-events: none;
  background: var(--ch-ink);
  -webkit-mask: var(--mark) center / contain no-repeat; mask: var(--mark) center / contain no-repeat;
}
.ch-meeple.ch-seat-1 > .ch-meeple-mark { --mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Ccircle cx='5' cy='5' r='4.3'/%3E%3C/svg%3E"); }  /* circle */
.ch-meeple.ch-seat-2 > .ch-meeple-mark { --mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M5 0.4 L9.7 9.3 L0.3 9.3Z'/%3E%3C/svg%3E"); }  /* triangle */
.ch-meeple.ch-seat-3 > .ch-meeple-mark { --mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Crect x='1' y='1' width='8' height='8'/%3E%3C/svg%3E"); }  /* square */
.ch-meeple.ch-seat-4 > .ch-meeple-mark { --mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M5 0 L10 5 L5 10 L0 5Z'/%3E%3C/svg%3E"); }  /* diamond */
.ch-meeple.ch-seat-5 > .ch-meeple-mark { --mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M5 0.2 L6.5 3.4 L9.9 3.7 L7.3 6 L8.1 9.6 L5 7.7 L1.9 9.6 L2.7 6 L0.1 3.7 L3.5 3.4Z'/%3E%3C/svg%3E"); }  /* star */
.ch-meeple.ch-seat-6 > .ch-meeple-mark { --mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M3.4 0.2h3.2v3.2h3.2v3.2h-3.2v3.2h-3.2v-3.2h-3.2v-3.2h3.2z'/%3E%3C/svg%3E"); }  /* cross */

.ch-meeple.is-dragging { cursor: grabbing; transform: scale(1.3) rotate(-10deg); z-index: 100; }

/* The hunt leader / marked goblin gets a little crown star */
.ch-meeple.is-leader { overflow: visible; }
.ch-meeple.is-leader::before { box-shadow: none; }

/* ---------- Goblin portrait with ears ----------
   <div class="ch-avatar ch-seat-1"><img src="..." alt=""></div>
   Without an image it shows the goblin meeple face on the seat color. */
.ch-avatar {
  --av: 58px;
  position: relative;
  width: var(--av); height: var(--av);
  flex: none;
  margin-inline: calc(var(--av) * 0.45);
  background: var(--seat, var(--ch-seat-1));
  border: var(--ch-line) solid var(--ch-ink);
  border-radius: 12px 14px 10px 16px;
  box-shadow: var(--ch-shadow-hard);
  rotate: -3deg;
}
.ch-avatar > img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; position: relative; z-index: 1; }
.ch-avatar:not(:has(img)) { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 44'%3E%3Cg fill='%230b0d1a'%3E%3Cpath d='M12.6 11.6 L0.6 5.8 Q3.4 14.6 12.2 19.8 Z'/%3E%3Cpath d='M27.4 11.6 L39.4 5.8 Q36.6 14.6 27.8 19.8 Z'/%3E%3Cpath d='M17.6 7.8 L19.4 2.6 L20.6 6 L22.6 3.4 L22.4 8.2 Z'/%3E%3Ccircle cx='20' cy='16' r='9'/%3E%3Cpath d='M13.4 22.6 Q9 31 7 40 Q6.6 43.4 10.2 43.4 L29.8 43.4 Q33.4 43.4 33 40 Q31 31 26.6 22.6 Z'/%3E%3C/g%3E%3Ccircle cx='16' cy='15.4' r='2.7' fill='%23f5d867'/%3E%3Ccircle cx='24' cy='15.4' r='2.7' fill='%23f5d867'/%3E%3Ccircle cx='16.6' cy='15.8' r='1.1' fill='%230b0d1a'/%3E%3Ccircle cx='23.4' cy='15.8' r='1.1' fill='%230b0d1a'/%3E%3Cpath d='M17 21 L18 22.6 L19 21.4 Z M21 21.4 L22 22.6 L23 21 Z' fill='%23fdfcea'/%3E%3C/svg%3E") center 70% / 70% no-repeat, var(--seat, var(--ch-seat-1)); }
.ch-avatar::before, .ch-avatar::after {
  content: ""; position: absolute; top: 6%; width: 52%; height: 42%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 24'%3E%3Cpath d='M29 7 L2 2 Q6 15 29 21 Z' fill='%236fae7c' stroke='%230b0d1a' stroke-width='2.4' stroke-linejoin='round'/%3E%3Cpath d='M24 9 L8 6 Q11 13 24 16' fill='none' stroke='%233f7a52' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.ch-avatar::before { left: -46%; rotate: -8deg; }
.ch-avatar::after { right: -46%; rotate: 8deg; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 24'%3E%3Cg transform='translate(30 0) scale(-1 1)'%3E%3Cpath d='M29 7 L2 2 Q6 15 29 21 Z' fill='%236fae7c' stroke='%230b0d1a' stroke-width='2.4' stroke-linejoin='round'/%3E%3Cpath d='M24 9 L8 6 Q11 13 24 16' fill='none' stroke='%233f7a52' stroke-width='2' stroke-linecap='round'/%3E%3C/g%3E%3C/svg%3E"); }

/* ---------- Torn name banner (rag strip, like a torn pelt) ---------- */
.ch-banner {
  display: inline-block;
  padding: 6px 30px 5px 14px;
  font: 20px/1.1 var(--ch-font-display);
  text-transform: uppercase;
  color: var(--ch-cream);
  background: var(--ch-leather);
  clip-path: polygon(0 6%, 4% 0, 30% 5%, 58% 0, 86% 4%, 92% 0, 100% 22%, 94% 40%, 100% 58%, 93% 76%, 99% 100%, 70% 94%, 42% 100%, 14% 95%, 3% 100%, 0 80%);
  filter: drop-shadow(2px 2px 0 var(--ch-ink));
}
.ch-banner--seat { background: var(--seat, var(--ch-leather)); color: var(--ch-ink); }

/* ---------- Stitched leather panel (goblin gear) ---------- */
.ch-panel--leather {
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 210, 160, 0.12), transparent 60%),
    var(--ch-paper-tile) repeat,
    linear-gradient(180deg, var(--ch-leather), var(--ch-leather-dark));
  color: var(--ch-cream);
  outline: 2px dashed var(--ch-stitch);
  outline-offset: -9px;
}
.ch-panel--leather h1, .ch-panel--leather h2, .ch-panel--leather h3 { color: var(--ch-coral-light); }

/* Scrap-metal button: a riveted plate */

/* ==========================================================================
   The monster mat
   --------------------------------------------------------------------------
   A free-form area where players arrange the monster's parts themselves,
   like on a real table. Nothing snaps or is checked. A part is placed with
   --x and --y, measured in part widths from the mat's top left corner, and
   can be turned with --r. Wide parts (orientation H) use .ch-part--h.

   Space budget: the largest monster (Slime King, 5 wide + 2 tall parts)
   fits in about 5 x 3 part widths. The mat is 6.4 x 3.8 part widths so
   there is room for goblins standing on parts and for parts that get
   knocked aside when they break.

   <div class="ch-mat">
     <span class="ch-zone-label">Dino</span>
     <div class="ch-part ch-part--h" style="--x:0; --y:0">
       <img src="DI01.png" alt="Head">
       <span class="ch-token ch-token--tr">2</span>
       <div class="ch-part-goblins"><span class="ch-meeple ch-seat-1"></span></div>
     </div>
   </div>
   ========================================================================== */

.ch-mat {
  /* Parts shrink when the space is narrow so the whole layout always fits */
  --u: min(var(--ch-part-w), calc((100cqw - var(--ch-card-w) - 24px) / var(--mat-w)));
  --mat-w: 6.4;
  --mat-h: 3.8;
  position: relative;
  width: calc(var(--u) * var(--mat-w));
  max-width: 100%;
  height: calc(var(--u) * var(--mat-h));
  border-radius: 18px 22px 16px 24px;
  border: var(--ch-line) solid var(--ch-ink);
  background:
    radial-gradient(ellipse at 50% 45%, rgba(255, 29, 101, 0.10), transparent 65%),
    var(--ch-paper-tile) repeat,
    linear-gradient(180deg, var(--ch-hide), var(--ch-hide-dark));
  box-shadow: var(--ch-shadow-hard), inset 0 0 40px rgba(0, 0, 0, 0.55);
  outline: 2px dashed var(--ch-stitch);
  outline-offset: -12px;
  overflow: hidden;
}
.ch-mat > .ch-zone-label { background: var(--ch-dino-magenta); color: var(--ch-cream); top: 12px; left: 22px; z-index: 3; }
.ch-mat.is-drop-target { outline-color: var(--ch-coral-light); outline-style: solid; }

.ch-part {
  --x: 0; --y: 0; --r: 0deg;
  position: absolute;
  left: calc(var(--x) * var(--u, var(--ch-part-w)));
  top: calc(var(--y) * var(--u, var(--ch-part-w)));
  width: var(--u, var(--ch-part-w));
  aspect-ratio: var(--ch-card-ratio);
  rotate: var(--r);
  border-radius: 6%;
  background: var(--ch-ink);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.6), 0 10px 18px rgba(0, 0, 0, 0.5);
  outline: 3px solid transparent;
  outline-offset: 2px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: outline-color 0.12s, box-shadow 0.12s;
}
.ch-part > img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; pointer-events: none; }
/* Wide part: the rendered image is stored upright, so turn it on its side */
.ch-part--h { width: calc(var(--u, var(--ch-part-w)) / var(--ch-card-ratio)); aspect-ratio: calc(1 / var(--ch-card-ratio)); border-radius: 4.5%; }
.ch-part--h > img {
  position: absolute; left: 50%; top: 50%;
  width: calc(100% * var(--ch-card-ratio));
  height: calc(100% / var(--ch-card-ratio));
  translate: -50% -50%;
  rotate: 90deg;
  border-radius: 6%;
}
.ch-part:hover { outline-color: var(--ch-hover); z-index: 4; }
.ch-part.is-selected { outline-color: var(--ch-select); z-index: 5; }
.ch-part.is-dragging { cursor: grabbing; z-index: 20; box-shadow: 0 24px 36px rgba(0, 0, 0, 0.6); }
/* Broken part: faded with a stamp */
.ch-part.is-broken > img { filter: grayscale(0.85) brightness(0.75) sepia(0.2); }
.ch-part.is-broken::after {
  content: "Broken";
  position: absolute; left: 50%; top: 42%;
  translate: -50% -50%; rotate: -14deg;
  padding: 4px 10px 2px;
  font: calc(var(--u, var(--ch-part-w)) * 0.17) / 1 var(--ch-font-display);
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ch-cream);
  background: var(--ch-monster-red);
  border: var(--ch-line-thin) solid var(--ch-ink);
  border-radius: 4px;
  box-shadow: var(--ch-shadow-hard-sm);
  z-index: 2;
}
/* Goblins standing on a part line up along its bottom edge */
.ch-part-goblins {
  position: absolute; left: 50%; bottom: -0.5em; translate: -50% 0;
  display: flex; gap: 2px; z-index: 3;
  font-size: calc(var(--u, var(--ch-part-w)) * 0.17);
  min-width: 2em; min-height: 2.2em;
}
.ch-part-goblins:empty { pointer-events: none; }

/* Side rail next to the mat: monster card, monster and mutation decks */

/* ==========================================================================
   Game screen pieces (draft 4, from the rulebook)
   ========================================================================== */

/* Phase stepper: Preparation, Shop, Hunt (Position, Reveal, Resolve,
   Reposition), Loot. It only shows where the table is; players move it. */
.ch-stepper { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.ch-step {
  font: 13px/1 var(--ch-font-display); letter-spacing: 0.05em; text-transform: uppercase;
  padding: 7px 10px 6px;
  color: var(--ch-cream);
  background: rgba(255, 228, 196, 0.08);
  border: var(--ch-line-thin) solid rgba(255, 228, 196, 0.25);
  border-radius: 999px;
  cursor: pointer;
}
.ch-step:hover { border-color: var(--ch-coral-light); }
.ch-step.is-done { opacity: 0.55; }
.ch-step.is-current { color: var(--ch-ink); background: var(--ch-accent-gradient); border-color: var(--ch-ink); box-shadow: var(--ch-shadow-hard-sm); }
.ch-step--sub { font-size: 11px; padding: 5px 8px 4px; }
.ch-step--sub.is-current { background: var(--ch-teal-gradient); color: var(--ch-cream); }
.ch-step-group { display: flex; gap: 3px; padding: 3px; border: var(--ch-line-thin) dashed rgba(255, 228, 196, 0.25); border-radius: 999px; }

/* A stat with an icon: hand size, Scrap, Clout, Finishing Blows */
.ch-stat { display: inline-flex; align-items: center; gap: 3px; font: 15px/1 var(--ch-font-display); white-space: nowrap; }
.ch-stat img { width: 18px; height: 18px; image-rendering: pixelated; }
.ch-stat small { font: 10px/1 var(--ch-font-body); opacity: 0.75; margin-left: 2px; text-transform: none; }

/* Modifier chip (Marked, Dazed, Poisoned, Empowered, Stunned) */
.ch-mod {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px 1px 3px;
  font: 11px/1.3 var(--ch-font-display); text-transform: uppercase;
  color: var(--ch-ink); background: var(--ch-kw-status);
  border: var(--ch-line-thin) solid var(--ch-ink); border-radius: 999px;
}
.ch-mod img { width: 14px; height: 14px; image-rendering: pixelated; }
.ch-mod--marked { background: var(--ch-kw-mark); }
.ch-mod--poison { background: #d9c4ec; }
.ch-mod--empowered { background: var(--ch-kw-fire); }
.ch-mod--off { opacity: 0.35; filter: grayscale(1); }

/* Commit slot: where a hunter places an action face down */
.ch-slot {
  position: relative;
  width: calc(var(--ch-card-w) + 8px); flex: none;
  aspect-ratio: var(--ch-card-ratio);
  display: grid; place-items: center;
  border: var(--ch-line-thin) dashed var(--ch-coral-light);
  border-radius: 10px;
  background: rgba(210, 118, 101, 0.08);
  font: 11px/1.2 var(--ch-font-display); text-transform: uppercase; text-align: center;
  color: var(--ch-coral-light);
  padding: 4px;
}
.ch-slot > .ch-card { position: absolute; inset: 4px; width: auto; }
.ch-slot.is-drop-target { background: var(--ch-zone-hot); border-style: solid; }

/* Counter showing how many parts still need to break */

/* Resolution order helper: lists revealed actions by Speed. It is only a
   reading aid; players still resolve everything by hand. */

/* Crown for the Hunt Leader */
.ch-leader {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px;
  background: var(--ch-gold); border: var(--ch-line-thin) solid var(--ch-ink); border-radius: 50%;
  box-shadow: var(--ch-shadow-hard-sm);
}
.ch-leader img { width: 15px; height: 15px; image-rendering: pixelated; }

/* Vote markers under a monster during Preparation */
.ch-votes { display: flex; gap: 2px; justify-content: center; min-height: 2.4em; font-size: 11px; padding-top: 4px; }
/* Zoomed preview of a wide monster part */
.ch-zoom.is-wide { aspect-ratio: calc(1 / var(--ch-card-ratio)); width: calc(var(--ch-zoom-w, clamp(260px, 24vw, 360px)) / var(--ch-card-ratio)); }
.ch-zoom.is-wide img { position: absolute; left: 50%; top: 50%; width: calc(100% * var(--ch-card-ratio)); height: calc(100% / var(--ch-card-ratio)); translate: -50% -50%; rotate: 90deg; }
