/* ============================================================
   Cacho (Dudo) — mesa de paño con baranda de madera, cubiletes de
   cuero, dados de marfil (templates/play_cacho.html, cacho_hub.html).
   Sin imágenes externas: las texturas son ruido SVG en línea y los
   dibujos salen de static/js/cacho-art.js.
   La mesa es un objeto físico: el paño y la madera no cambian con el
   tema; el panel lateral sí usa los tokens del portal.
   ============================================================ */

.ch-shell, .ch-hub {
  --ch-felt-1: #2F7352; --ch-felt-2: #1E5139; --ch-felt-3: #133626;
  --ch-wood-1: #6E4126; --ch-wood-2: #4B2a16; --ch-wood-3: #2C170B;
  --ch-cream: #F6EBD6; --ch-cream-2: rgba(246, 235, 214, .74);
  --ch-gold: #E2B66E;
  --ch-die-bg: #FBF7EF; --ch-die-edge: #CFC2AB; --ch-pip: #2B2622; --ch-ace: #B3261E;
  --ch-ease: cubic-bezier(.22, .9, .25, 1);
}

/* ---------- portada ---------- */
.ch-hub-art { margin: -4px -4px 14px; }
.ch-hub-svg { display: block; width: 100%; height: auto; }
.ch-fs { margin-top: 14px !important; }
.ch-fs[hidden] { display: none; }
.ch-hub-rivals { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; min-height: 58px; }
.ch-hub-rival { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 58px; font-size: .68rem; color: var(--muted); text-align: center; line-height: 1.15; }
.ch-hub-rival .ch-av { width: 40px; height: 40px; }
.ch-hub-hint { margin: 8px 0 0; font-size: var(--t-xs); color: var(--muted); }
.ch-rules-note { margin: 0 0 8px; color: var(--ink-2); font-size: var(--t-sm); }
.ch-rules { margin: 0 0 8px; display: grid; gap: 0; border-top: 1px solid var(--line); }
.ch-rules > div { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.ch-rules dt { font-weight: 600; color: var(--ink); font-size: var(--t-sm); }
.ch-rules dd { margin: 0; color: var(--ink-2); font-size: var(--t-sm); line-height: 1.5; }
@media (max-width: 560px) { .ch-rules > div { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- avatares ---------- */
.ch-av { display: block; width: 100%; height: 100%; border-radius: 50%; }

/* ---------- dados ---------- */
.ch-die { display: block; width: 100%; height: 100%; overflow: visible; }
.ch-die-body { fill: var(--ch-die-bg); stroke: var(--ch-die-edge); stroke-width: 1.4; }
.ch-die-shine { fill: #fff; opacity: .5; }
.ch-pip { fill: var(--ch-pip); }
.ch-die.is-ace .ch-pip { fill: var(--ch-ace); }

/* ---------- cubilete ---------- */
.ch-cup { display: block; width: 100%; height: auto; overflow: visible; }
.ch-cup-shadow { fill: rgba(0, 0, 0, .35); }
.ch-cup-body { fill: url(#ch-leather); }
.ch-cup-light { fill: rgba(255, 220, 170, .12); }
.ch-cup-band { fill: url(#ch-leather-band); }
.ch-cup-stitch { fill: none; stroke: #E8C48A; stroke-width: 1.3; stroke-dasharray: 3 3; opacity: .7; }
.ch-cup-top { fill: #2a150a; }

/* ---------- mesa ---------- */
.ch-room {
  border-radius: var(--r-xl); padding: clamp(8px, 1.6vw, 18px);
  background:
    radial-gradient(120% 70% at 20% -10%, rgba(255, 196, 120, .22), transparent 58%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 0.9 -0.35'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E"),
    linear-gradient(170deg, #2B1A10 0%, #1A0F09 55%, #0E0805 100%);
  box-shadow: var(--shadow-md);
}
.ch-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: clamp(10px, 1.6vw, 18px); align-items: start; }
.ch-table-wrap { min-width: 0; position: relative; }
.ch-table {
  position: relative; width: 100%; aspect-ratio: 16 / 11; min-height: 440px; max-height: calc(100vh - 190px);
  color: var(--ch-cream); user-select: none; -webkit-user-select: none;
}
.ch-felt {
  position: absolute; inset: 3% 2.5%; border-radius: 50% / 47%;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.1  0 0 0 0 0.25  0 0 0 0 0.15  0 0 0 0.55 -0.12'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E"),
    radial-gradient(70% 62% at 50% 46%, var(--ch-felt-1) 0%, var(--ch-felt-2) 62%, var(--ch-felt-3) 100%);
  box-shadow:
    inset 0 0 0 2px rgba(0, 0, 0, .25), inset 0 10px 40px rgba(0, 0, 0, .35), inset 0 -6px 30px rgba(0, 0, 0, .3),
    0 0 0 clamp(8px, 1.4vw, 15px) var(--ch-wood-2),
    0 0 0 calc(clamp(8px, 1.4vw, 15px) + 2px) var(--ch-wood-3),
    0 18px 40px -10px rgba(0, 0, 0, .7);
}
.ch-felt::before {
  content: ""; position: absolute; inset: calc(-1 * clamp(8px, 1.4vw, 15px)); border-radius: inherit; pointer-events: none;
  background: linear-gradient(160deg, rgba(255, 214, 160, .25), transparent 30%, transparent 70%, rgba(0, 0, 0, .3));
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - clamp(8px, 1.4vw, 15px)), #000 0);
}
.ch-felt::after {
  content: ""; position: absolute; inset: 9% 7%; border-radius: 50%; border: 1.5px solid rgba(246, 235, 214, .12); pointer-events: none;
}

/* asientos alrededor del óvalo */
.ch-seats { position: absolute; inset: 0; }
.ch-seat {
  position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%);
  width: 118px; display: flex; flex-direction: column; align-items: center; gap: 3px; z-index: 2;
  transition: opacity .3s;
}
.ch-seat-top { position: relative; display: flex; align-items: flex-end; gap: 2px; }
.ch-seat-av {
  position: relative; width: 54px; height: 54px; border-radius: 50%; flex: none;
  box-shadow: 0 0 0 2.5px rgba(246, 235, 214, .85), 0 6px 14px rgba(0, 0, 0, .45);
  transition: box-shadow .25s, transform .25s var(--ch-ease);
}
.ch-seat-cup { width: 30px; margin-left: -4px; transition: transform .45s var(--ch-ease), opacity .45s; transform-origin: 50% 100%; }
.ch-seat-info { display: flex; flex-direction: column; align-items: center; gap: 2px; max-width: 100%; }
.ch-seat-name {
  font-size: .78rem; font-weight: 600; letter-spacing: .01em; color: var(--ch-cream); text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 112px;
}
.ch-seat-pips { display: inline-flex; gap: 3px; }
.ch-seat-pips i { width: 8px; height: 8px; border-radius: 2px; background: rgba(246, 235, 214, .18); box-shadow: inset 0 0 0 1px rgba(246, 235, 214, .3); }
.ch-seat-pips i.on { background: var(--ch-die-bg); box-shadow: 0 1px 1px rgba(0, 0, 0, .4); }
.ch-seat-pips i.lost { animation: ch-lost 1s ease both; }
@keyframes ch-lost { 0% { background: var(--ch-ace); transform: scale(1.5); } 100% { background: rgba(246, 235, 214, .18); transform: none; } }
.ch-seat.is-turn .ch-seat-av { box-shadow: 0 0 0 3px var(--ch-gold), 0 0 0 7px rgba(226, 182, 110, .25), 0 6px 14px rgba(0, 0, 0, .45); transform: scale(1.06); }
.ch-seat.is-out { opacity: .38; }
.ch-seat.is-out .ch-seat-cup { opacity: 0; }
.ch-seat.is-obl .ch-seat-name::after { content: " · obliga"; color: var(--ch-gold); }
.ch-seat.is-lose .ch-seat-av { animation: ch-shake-x .5s ease; }
.ch-seat.is-gain .ch-seat-av { animation: ch-pop .6s ease; }
@keyframes ch-shake-x { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@keyframes ch-pop { 40% { transform: scale(1.15); } }

/* pensando */
.ch-think { position: absolute; right: -4px; top: -6px; display: none; gap: 2px; padding: 4px 5px; border-radius: 10px; background: var(--ch-cream); box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
.ch-think i { width: 4px; height: 4px; border-radius: 50%; background: #4B2a16; animation: ch-dot 1s infinite ease-in-out; }
.ch-think i:nth-child(2) { animation-delay: .15s; } .ch-think i:nth-child(3) { animation-delay: .3s; }
.ch-seat.is-thinking .ch-think { display: inline-flex; }
@keyframes ch-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }

/* dados de cada asiento (en el destape) */
.ch-seat-dice { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; min-height: 0; max-width: 118px; }
.ch-sdie { width: 20px; height: 20px; animation: ch-roll .45s var(--ch-ease) both; animation-delay: calc(var(--k, 0) * 45ms); transition: transform .2s, opacity .3s, filter .3s; }
.ch-seat.is-up .ch-seat-cup { transform: translateY(-16px) rotate(-18deg); opacity: .45; }

/* globo con el canto */
.ch-bubble {
  position: absolute; left: 50%; top: -12px; transform: translate(-50%, -100%) scale(.8); opacity: 0; pointer-events: none;
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px 5px 6px; border-radius: 12px; white-space: nowrap;
  background: var(--ch-cream); color: #2B1A10; font-size: .78rem; font-weight: 600; box-shadow: 0 6px 16px rgba(0, 0, 0, .4);
  transition: opacity .25s, transform .3s var(--ch-ease); z-index: 5;
}
.ch-bubble::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; background: inherit; transform: translateX(-50%) rotate(45deg); border-radius: 2px; }
.ch-bubble.is-on { opacity: 1; transform: translate(-50%, -100%) scale(1); }
.ch-bubble.is-call { background: var(--ch-ace); color: #fff; font-size: .9rem; letter-spacing: .02em; }
.ch-bb-die { width: 18px; height: 18px; display: inline-block; }
/* asientos de la mitad de arriba: el globo va debajo */
.ch-seat.is-top .ch-bubble { top: auto; bottom: -10px; transform: translate(-50%, 100%) scale(.8); }
.ch-seat.is-top .ch-bubble.is-on { transform: translate(-50%, 100%) scale(1); }
.ch-seat.is-top .ch-bubble::after { bottom: auto; top: -5px; }

/* asientos de los costados: el globo no se sale de la mesa */
.ch-seat.is-left .ch-bubble { left: 0; transform: translate(0, -100%) scale(.8); }
.ch-seat.is-left .ch-bubble.is-on { transform: translate(0, -100%) scale(1); }
.ch-seat.is-left .ch-bubble::after { left: 26px; }
.ch-seat.is-right .ch-bubble { left: auto; right: 0; transform: translate(0, -100%) scale(.8); }
.ch-seat.is-right .ch-bubble.is-on { transform: translate(0, -100%) scale(1); }
.ch-seat.is-right .ch-bubble::after { left: auto; right: 20px; transform: rotate(45deg); }

.ch-seat.is-top.is-left .ch-bubble, .ch-seat.is-top.is-left .ch-bubble.is-on { transform: translate(0, 100%); }
.ch-seat.is-top.is-right .ch-bubble, .ch-seat.is-top.is-right .ch-bubble.is-on { transform: translate(0, 100%); }

/* canto actual al centro */
.ch-center {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; transition: opacity .3s;
  pointer-events: none; width: 46%;
}
.ch-center-k { font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ch-cream-2); }
.ch-center-bet {
  display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: clamp(1.25rem, 1rem + 1.3vw, 2rem);
  line-height: 1.1; color: var(--ch-cream); text-shadow: 0 2px 6px rgba(0, 0, 0, .45);
}
.ch-cb-die { width: clamp(28px, 3vw, 38px); height: clamp(28px, 3vw, 38px); flex: none; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .4)); }
.ch-center-badge {
  margin-top: 4px; padding: 3px 10px; border-radius: var(--r-pill); font-size: .7rem; font-weight: 600; letter-spacing: .04em;
  color: #2B1A10; background: var(--ch-gold);
}
.ch-center-badge[hidden] { display: none; }
.ch-table.is-reveal .ch-center { opacity: 0; }

/* tu cacho (bandeja de abajo) */
.ch-tray {
  position: absolute; left: 50%; bottom: 5.5%; transform: translateX(-50%); z-index: 3;
  width: min(62%, 400px); display: flex; flex-direction: column; align-items: center; gap: 6px;
  --cup: 92px; --die: 50px; --shift: 188px;
}
.ch-tray-dice { display: flex; gap: 8px; justify-content: center; min-height: var(--die); align-items: center; }
.ch-tdie { width: var(--die); height: var(--die); filter: drop-shadow(0 4px 5px rgba(0, 0, 0, .45)); transition: transform .25s, opacity .3s, filter .3s; }
.ch-tray.is-open .ch-tdie { animation: ch-roll .5s var(--ch-ease) both; animation-delay: calc(var(--k, 0) * 60ms); }
.ch-tray:not(.is-open) .ch-tray-dice { opacity: 0; }
.ch-tray-cup {
  position: absolute; left: 50%; bottom: 22px; width: var(--cup); margin-left: calc(var(--cup) / -2); z-index: 2;
  transform-origin: 50% 100%; transition: transform .55s var(--ch-ease);
}
.ch-tray.is-open .ch-tray-cup { transform: translateX(calc(-1 * var(--shift))) translateY(-6px) rotate(-14deg) scale(.82); }
.ch-tray-label {
  margin: 0; font-size: .74rem; letter-spacing: .06em; color: var(--ch-cream-2); text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}
.ch-tray .ch-bubble { top: -6px; }
.ch-tray.is-lose .ch-tray-dice { animation: ch-shake-x .5s ease; }
@keyframes ch-roll {
  0% { opacity: 0; transform: translateY(-14px) rotate(-120deg) scale(.6); }
  70% { opacity: 1; transform: translateY(2px) rotate(8deg) scale(1.03); }
  100% { opacity: 1; transform: none; }
}

/* agitar todos los cachos */
.ch-table.is-shaking .ch-tray-cup, .ch-table.is-shaking .ch-seat-cup { animation: ch-shake .16s ease-in-out infinite alternate; }
.ch-table.is-shaking .ch-seat:nth-child(2n) .ch-seat-cup { animation-duration: .19s; }
@keyframes ch-shake {
  0% { transform: translate(-3px, -10px) rotate(-7deg); }
  100% { transform: translate(3px, -16px) rotate(7deg); }
}

/* conteo del destape */
.ch-sdie.is-miss, .ch-tdie.is-miss { opacity: .35; filter: saturate(.4); }
.ch-sdie.is-hit, .ch-tdie.is-hit { transform: translateY(-3px) scale(1.08); filter: drop-shadow(0 0 0 transparent); }
.ch-sdie.is-hit .ch-die-body, .ch-tdie.is-hit .ch-die-body { stroke: var(--ch-gold); stroke-width: 3; }
.ch-sdie.is-wild .ch-die-body, .ch-tdie.is-wild .ch-die-body { stroke: #ff8a7a; stroke-width: 3; stroke-dasharray: 5 3; }
.ch-tdie.is-hit { filter: drop-shadow(0 0 8px rgba(226, 182, 110, .75)); }

.ch-reveal {
  position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); z-index: 6; width: min(64%, 360px);
  animation: tt-rise .3s var(--ease) both;
}
.ch-reveal[hidden] { display: none; }
.ch-reveal-card {
  padding: 12px 16px 14px; border-radius: var(--r-lg); text-align: center;
  background: rgba(20, 12, 7, .82); border: 1px solid rgba(226, 182, 110, .35); color: var(--ch-cream);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
}
.ch-reveal-card .eyebrow { margin: 0 0 2px; color: var(--ch-gold); }
.ch-rv-count { margin: 0; font-family: var(--font-display); font-size: 1.15rem; }
.ch-rv-count b { font-family: var(--font-num); font-size: 2.1rem; font-weight: 500; color: #fff; margin-right: 4px; }
.ch-rv-text { margin: 4px 0 0; font-size: .86rem; line-height: 1.4; color: var(--ch-cream-2); }
.ch-reveal .btn { margin-top: 10px; }
.ch-reveal .btn[hidden] { display: none; }

/* cortina del modo local */
.ch-curtain {
  position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 16px;
  background: rgba(14, 8, 5, .9); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  animation: tt-fade .25s ease both;
}
.ch-curtain[hidden] { display: none; }
.ch-curtain-card { width: min(100%, 360px); text-align: center; padding: 22px; border-radius: var(--r-xl); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
.ch-curtain-card h2 { margin: 4px 0 8px; font-family: var(--font-display); font-weight: 400; font-size: 1.6rem; line-height: 1.1; }
.ch-curtain-card .eyebrow { margin: 0; }
.ch-curtain-av { width: 64px; height: 64px; margin: 0 auto 10px; }
.ch-curtain-p { margin: 0 0 16px; color: var(--ink-2); font-size: var(--t-sm); }
.ch-curtain-card .btn { white-space: normal; max-width: 100%; }
@media (max-width: 400px) { .ch-curtain-card { padding: 18px 14px; } .ch-curtain-card h2 { font-size: 1.35rem; } }

/* resultado: el panel de tabletop sobre la mesa */
.ch-table .tt-result { --tt-table: #1A0F09; border-radius: var(--r-lg); }

/* ---------- panel lateral ---------- */
.ch-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ch-status {
  display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 10px 12px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line); font-size: var(--t-sm); color: var(--ink); min-height: 44px; line-height: 1.4;
}
.ch-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ch-gold); margin-top: 6px; flex: none; }
.ch-bid { padding: 12px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; transition: opacity .2s; }
.ch-bid.is-off { opacity: .62; }
.ch-bid-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ch-lbl { font-size: var(--t-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ch-stepper { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); }
.ch-step {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface); color: var(--ink); font-size: 1.35rem; line-height: 1;
  cursor: pointer; box-shadow: var(--shadow-sm); transition: background var(--dur), transform var(--dur);
}
.ch-step:hover:not(:disabled) { background: var(--surface-3); }
.ch-step:active:not(:disabled) { transform: scale(.94); }
.ch-step:disabled { opacity: .35; cursor: default; }
#ch-qty { min-width: 44px; text-align: center; font-family: var(--font-num); font-size: 1.5rem; font-weight: 500; color: var(--ink); }
.ch-pintas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.ch-pinta {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px 6px; min-height: 76px;
  font: inherit; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md); cursor: pointer;
  transition: border-color var(--dur), background var(--dur), transform var(--dur), box-shadow var(--dur);
}
.ch-pinta:hover:not(:disabled) { background: var(--surface-2); }
.ch-pinta[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); color: var(--ink); background: var(--surface-2); }
.ch-pinta:disabled { opacity: .38; cursor: default; }
.ch-pinta-die { width: 30px; height: 30px; display: block; }
.ch-pinta-name { font-size: .82rem; font-weight: 600; color: var(--ink); }
.ch-pinta-min { font-size: .68rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ch-cantar { min-height: 48px; font-size: 1rem; }
.ch-calls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ch-call {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 56px; padding: 6px;
  font: inherit; font-size: 1.05rem; font-weight: 700; letter-spacing: .01em; border-radius: var(--r-md); cursor: pointer;
  border: 1.5px solid currentColor; background: var(--surface); transition: background var(--dur), color var(--dur), opacity var(--dur), transform var(--dur);
}
.ch-call small { font-size: .7rem; font-weight: 500; opacity: .8; }
.ch-call.is-dudo { color: var(--accent); }
.ch-call.is-calzo { color: var(--sel); }
.ch-call:hover:not(:disabled) { color: #fff; }
.ch-call.is-dudo:hover:not(:disabled) { background: var(--accent-solid); border-color: var(--accent-solid); }
.ch-call.is-calzo:hover:not(:disabled) { background: var(--sel); border-color: var(--sel); }
.ch-call:active:not(:disabled) { transform: scale(.97); }
.ch-call:disabled { opacity: .35; cursor: default; }
.ch-why { margin: 0; min-height: 1.2em; font-size: var(--t-xs); color: var(--warn); line-height: 1.4; }
:root[data-theme="dark"] .ch-why { color: var(--present); }
.ch-shell button:focus-visible, .ch-shell .btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.ch-panel { padding: 10px 12px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.ch-panel-h { margin: 0 0 6px; font-size: var(--t-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.ch-hist { list-style: none; margin: 0; padding: 0; max-height: 196px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.ch-hist li { display: grid; grid-template-columns: 22px minmax(0, 1fr) 20px auto; align-items: center; gap: 8px; padding: 4px 6px; border-radius: var(--r-sm); font-size: var(--t-sm); color: var(--ink-2); }
.ch-hist li.is-last { background: var(--surface-2); color: var(--ink); }
.ch-hist .ch-hist-empty, .ch-hist .ch-h-call { display: block; color: var(--muted); font-style: italic; }
.ch-hist .ch-h-call { color: var(--accent); font-style: normal; font-weight: 600; }
.ch-h-av { width: 22px; height: 22px; }
.ch-h-who { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-h-die { width: 20px; height: 20px; }
.ch-h-bet { font-weight: 600; color: var(--ink); white-space: nowrap; }
.ch-score { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ch-score li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto 34px; align-items: center; gap: 8px; padding: 4px 6px; border-radius: var(--r-sm); font-size: var(--t-sm); }
.ch-score li.is-turn { background: var(--surface-2); }
.ch-score li.is-out { opacity: .45; }
.ch-sc-av { width: 24px; height: 24px; }
.ch-sc-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.ch-sc-n { text-align: right; color: var(--muted); font-size: var(--t-xs); }
.ch-score .ch-seat-pips i { background: var(--surface-3); box-shadow: none; }
.ch-score .ch-seat-pips i.on { background: var(--ink); }

/* ---------- capas ---------- */
.ch-setup { max-width: 520px; }
.ch-setup fieldset { margin-top: 14px !important; }
.ch-setup fieldset:first-child { margin-top: 0 !important; }
.ch-names { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.ch-name { display: flex; flex-direction: column; gap: 3px; font-size: var(--t-xs); color: var(--muted); }
.ch-name input {
  min-height: 42px; padding: 0 10px; font: inherit; font-size: var(--t-sm); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
}
.ch-name input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.ch-vol { display: grid; grid-template-columns: 1fr; gap: 6px; margin: 12px 0; font-size: var(--t-sm); color: var(--ink-2); }
.ch-vol input { width: 100%; accent-color: var(--accent); min-height: 40px; }
.ch-vol output { font-family: var(--font-num); color: var(--ink); }
.ch-mute { display: flex; align-items: center; gap: 8px; min-height: 40px; font-size: var(--t-sm); }
.ch-mute input { width: 20px; height: 20px; accent-color: var(--accent); }
.ch-help { max-width: 640px; }
.ch-help-sub { margin: 16px 0 6px; font-size: var(--t-sm); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ch-help .ch-rules > div { grid-template-columns: 120px 1fr; }
.ch-stat-table { width: 100%; margin-top: 14px; border-collapse: collapse; font-size: var(--t-sm); }
.ch-stat-table th, .ch-stat-table td { padding: 6px 4px; text-align: left; border-bottom: 1px solid var(--line); }
.ch-stat-table th { font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.ch-stat-table caption { caption-side: bottom; padding-top: 8px; color: var(--muted); font-size: .75rem; text-align: left; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .ch-layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .ch-seat { width: 100px; }
}
@media (max-width: 900px) {
  .ch-layout { grid-template-columns: 1fr; }
  .ch-table { max-height: none; aspect-ratio: 4 / 3.3; min-height: 380px; }
  .ch-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ch-status, .ch-bid { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .ch-room { padding: 6px; border-radius: var(--r-lg); margin: 0 -4px; }
  .ch-table { aspect-ratio: auto; height: clamp(320px, 90vw, 400px); min-height: 0; }
  .ch-felt { inset: 2% 3%; border-radius: 46% / 40%; }
  .ch-seat { width: 76px; gap: 2px; }
  .ch-seat-av { width: 40px; height: 40px; }
  .ch-seat-cup { width: 22px; }
  .ch-seat-name { font-size: .7rem; max-width: 74px; }
  .ch-seat-pips i { width: 6px; height: 6px; }
  .ch-seat-dice { max-width: 76px; gap: 2px; }
  .ch-sdie { width: 15px; height: 15px; }
  .ch-bubble { font-size: .7rem; padding: 4px 7px 4px 5px; }
  .ch-bb-die { width: 14px; height: 14px; }
  .ch-center { top: 47%; width: 70%; }
  .ch-tray { width: 92%; --cup: 64px; --die: 40px; --shift: 140px; bottom: 3%; }
  .ch-tray-dice { gap: 6px; }
  .ch-reveal { position: static; transform: none; width: auto; margin-top: 6px; }
  .ch-side { display: flex; gap: 8px; }
  .ch-names { grid-template-columns: 1fr; }
  .ch-status { min-height: 0; padding: 8px 10px; }
  .ch-bid { padding: 10px; gap: 8px; }
  .ch-pintas { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
  .ch-pinta { min-height: 64px; padding: 6px 2px 4px; gap: 2px; border-radius: var(--r-sm); }
  .ch-pinta-die { width: 24px; height: 24px; }
  .ch-pinta-name { font-size: .68rem; }
  .ch-pinta-min { font-size: .6rem; }
  .ch-step { width: 42px; height: 42px; }
  .ch-cantar { min-height: 46px; }
  .ch-call { min-height: 50px; }
  .ch-center-bet { font-size: 1.2rem; }
  .ch-seat-dice { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); width: 92px; max-width: none; margin-top: 2px; }
}
@media (max-width: 360px) {
  .ch-table { height: 320px; }
  .ch-pinta-name { font-size: .6rem; }
  .ch-seat { width: 66px; }
  .ch-seat-av { width: 36px; height: 36px; }
  .ch-seat-name { max-width: 64px; }
  .ch-tray { --die: 34px; --cup: 56px; --shift: 118px; }
  .ch-pinta { min-height: 70px; }
}

@media (prefers-reduced-motion: reduce) {
  .ch-sdie, .ch-tray.is-open .ch-tdie, .ch-seat.is-lose .ch-seat-av, .ch-seat.is-gain .ch-seat-av,
  .ch-table.is-shaking .ch-tray-cup, .ch-table.is-shaking .ch-seat-cup, .ch-think i, .ch-seat-pips i.lost, .ch-reveal { animation: none !important; }
  .ch-tray-cup, .ch-seat-cup, .ch-bubble, .ch-seat-av { transition: none !important; }
}
.ch-setup { text-align: left; }
.ch-setup .eyebrow, .ch-setup h2 { text-align: center; }
