/* ============================================================
   Póker (Texas Hold'em) — mesa, cartas, fichas y portada
   (templates/play_poker.html, poker_hub.html). Sin imágenes externas:
   el paño es un degradado con grano SVG en línea (feTurbulence); las
   caras de las cartas vienen de static/js/blackjack-cards.js y el dorso
   de static/js/poker-cards.js.

   La mesa es un objeto oscuro (paño verde y riel de cuero) en ambos
   temas del portal; lo demás usa los tokens (--surface, --ink, --line…).
   Animaciones solo con transform/opacity; prefers-reduced-motion las
   apaga. FICHAS FICTICIAS, sin ningún valor.
   ============================================================ */

.pk-shell, .pk-hub, .pk-hub-combos, .pk-fx, #pk-combos, .pk-notice {
  --pk-gold: #CDA65A; --pk-gold-2: #E8CC8C; --pk-gold-deep: #9C7A36;
  --pk-cream: #F6EEDC; --pk-cream-2: rgba(246, 238, 220, .72);
  --pk-ease: cubic-bezier(.22, .9, .25, 1);
  --pk-felt-1: #237552; --pk-felt-2: #144A33; --pk-felt-3: #0A2A1C;
  --pk-rail-1: #4A2C1A; --pk-rail-2: #24140B;
  --pk-grain: 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='0.85' numOctaves='2' seed='11' 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.5 -0.2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
}

/* ============================================================ aviso de fichas ficticias */
.pk-notice {
  display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 11px 14px; border-radius: 12px;
  font-size: var(--t-sm); line-height: 1.45; color: var(--ink-2);
  background: color-mix(in srgb, var(--pk-gold) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--pk-gold) 45%, var(--line));
}
.pk-notice strong { color: var(--ink); }
.pk-notice-ico { width: 20px; height: 20px; flex: none; margin-top: 1px; color: var(--pk-gold-deep); }
[data-theme="dark"] .pk-notice-ico { color: var(--pk-gold); }

/* ============================================================ la sala */
.pk-shell { max-width: 1280px; }
.play-poker .page { max-width: 1280px; }
.pk-room { margin-top: 4px; }
.pk-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: clamp(14px, 2vw, 24px); align-items: start; }
.pk-main { min-width: 0; display: flex; flex-direction: column; gap: 12px; }

/* ---------- mesa: riel de cuero con filete dorado y paño verde ---------- */
.pk-table {
  --cw: clamp(46px, min(4.7vw, 8.8vh), 76px);
  position: relative; isolation: isolate; padding: 14px; border-radius: 210px;
  background: linear-gradient(180deg, var(--pk-rail-1), var(--pk-rail-2));
  box-shadow: inset 0 1px 0 rgba(255, 220, 170, .2), inset 0 -2px 0 rgba(0, 0, 0, .45),
              0 0 0 1px rgba(0, 0, 0, .4), 0 26px 50px -26px rgba(0, 0, 0, .7);
}
.pk-table::before {   /* filete del riel */
  content: ""; position: absolute; inset: 5px; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(232, 204, 140, .28);
}
.pk-felt {
  position: relative; overflow: hidden; border-radius: 198px; color: var(--pk-cream);
  display: grid; grid-template-columns: minmax(170px, 1fr) minmax(0, 2fr) minmax(170px, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: ". top ." "left center right" ". me .";
  align-items: center; min-height: 0; padding: 14px clamp(30px, 3.6vw, 56px) 14px;
  background: var(--pk-grain), radial-gradient(110% 85% at 50% 42%, var(--pk-felt-1) 0%, var(--pk-felt-2) 60%, var(--pk-felt-3) 100%);
  box-shadow: inset 0 0 0 1.5px var(--pk-gold-deep), inset 0 0 0 8px rgba(0, 0, 0, .16), inset 0 0 0 9px rgba(205, 166, 90, .4),
              inset 0 22px 70px -24px rgba(0, 0, 0, .55), inset 0 -40px 80px -40px rgba(0, 0, 0, .6);
}
.pk-felt::after {    /* línea de apuestas impresa en el paño */
  content: ""; position: absolute; left: 13%; right: 13%; top: 25%; bottom: 30%; border-radius: 999px; pointer-events: none;
  border: 1.5px solid rgba(232, 204, 140, .16); z-index: 0;
}

/* ---------- asientos ---------- */
.pk-seat { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.pk-seat[data-pos="top"] { grid-area: top; justify-self: center; }
.pk-seat[data-pos="left"] { grid-area: left; justify-self: start; }
.pk-seat[data-pos="right"] { grid-area: right; justify-self: end; }
.pk-seat[data-pos="me"] { grid-area: me; justify-self: center; flex-direction: row; align-items: center; gap: 14px; }
.pk-seat[data-pos="left"], .pk-seat[data-pos="right"] { align-self: start; margin-top: 4px; max-width: 100%; }
.pk-seat[data-pos="left"] .pk-plate, .pk-seat[data-pos="right"] .pk-plate { min-width: 0; max-width: 100%; }

.pk-plate {
  position: relative; display: flex; align-items: center; gap: 9px; padding: 4px 14px 4px 4px; min-width: 150px;
  border-radius: 999px; background: linear-gradient(180deg, rgba(14, 22, 18, .9), rgba(8, 14, 11, .92));
  box-shadow: inset 0 0 0 1px rgba(232, 204, 140, .45), 0 8px 18px -10px rgba(0, 0, 0, .8);
  transition: box-shadow .3s ease, opacity .3s ease, transform .3s var(--pk-ease);
}
.pk-ava-wrap { position: relative; flex: none; width: 42px; height: 42px; }
.pk-ava { display: block; width: 100%; height: 100%; border-radius: 50%; }
.pk-plate-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; overflow: hidden; }
.pk-name { font-size: .88rem; font-weight: 600; color: var(--pk-cream); white-space: nowrap; }
.pk-machine {
  display: block; margin: 1px 0 1px; font-size: .56rem; font-weight: 700; letter-spacing: .07em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-transform: uppercase; color: var(--pk-gold-2); opacity: .85;
}
.pk-stack { display: inline-flex; align-items: center; gap: 5px; margin-top: 2px; font-family: var(--font-num); font-size: .92rem; color: var(--pk-gold-2); font-variant-numeric: tabular-nums; }
.pk-chipico { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: radial-gradient(circle, #F2E3B8 0 28%, var(--pk-gold-deep) 30% 100%); box-shadow: 0 0 0 1.5px rgba(242, 227, 184, .6) inset; }

/* botón del repartidor y ciegas */
.pk-dbtn {
  position: absolute; right: -7px; bottom: -5px; width: 22px; height: 22px; border-radius: 50%; display: none;
  place-items: center; font: 800 .7rem/1 var(--font-ui, system-ui); color: #1A1A1A;
  background: radial-gradient(circle at 35% 30%, #FFFFFF, #E4E0D6); box-shadow: 0 2px 5px rgba(0, 0, 0, .55), inset 0 0 0 1.5px #B9B3A5;
}
.pk-seat.is-button .pk-dbtn { display: grid; animation: pk-pop .35s var(--pk-ease); }
.pk-blind {
  position: absolute; top: -9px; right: 10px; padding: 1px 7px; border-radius: 999px; font-family: var(--font-num); font-size: .62rem; font-weight: 700;
  color: #2A1A08; background: linear-gradient(180deg, var(--pk-gold-2), var(--pk-gold)); box-shadow: 0 2px 4px rgba(0, 0, 0, .4);
}
.pk-blind[hidden] { display: none; }

/* lo que dice cada asiento */
.pk-say {
  position: absolute; z-index: 4; top: calc(100% + 5px); left: 50%; translate: -50% 0; padding: 2px 10px; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap;
  color: var(--pk-cream); opacity: 0; transform: translateY(-4px) scale(.94); transition: opacity .22s ease, transform .3s var(--pk-ease);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.pk-say.is-on { opacity: 1; transform: none; background: rgba(0, 0, 0, .42); box-shadow: inset 0 0 0 1px rgba(232, 204, 140, .35); }
.pk-say.is-raise, .pk-say.is-bet { background: #E8CC8C; color: #2A1A08; box-shadow: none; }
.pk-say.is-allin { background: #B8322B; color: #FFF3EE; box-shadow: 0 0 0 1px #F0A39A inset; }
.pk-say.is-fold, .pk-say.is-muck { color: rgba(246, 238, 220, .7); }
.pk-say.is-win { background: linear-gradient(180deg, #F3DB98, #D2A748); color: #2A1A08; box-shadow: 0 0 18px -2px rgba(232, 204, 140, .7); }
.pk-say.is-hand { background: #F6EEDC; color: #1C3A2B; }
.pk-say.is-out { background: rgba(0, 0, 0, .55); color: #E6B9B2; }

.pk-seat[data-pos="top"] .pk-say { top: auto; bottom: 12px; left: calc(100% + 10px); translate: none; }
.pk-seat[data-pos="me"] .pk-say { top: auto; bottom: 14px; left: calc(100% + 10px); translate: none; }
/* turno, retirado, eliminado, ganador */
.pk-seat.is-turn .pk-plate { box-shadow: inset 0 0 0 1.5px var(--pk-gold-2), 0 0 0 3px rgba(232, 204, 140, .28), 0 0 28px -4px rgba(232, 204, 140, .65); animation: pk-breathe 1.6s ease-in-out infinite; }
.pk-seat.is-folded .pk-plate { opacity: .55; }
.pk-seat.is-folded[data-pos="me"] .pk-hole { opacity: .45; filter: grayscale(.4); }
.pk-seat.is-out .pk-plate { opacity: .38; filter: grayscale(1); }
.pk-seat.is-winner .pk-plate { box-shadow: inset 0 0 0 1.5px var(--pk-gold-2), 0 0 34px -2px rgba(232, 204, 140, .85); }
@keyframes pk-breathe { 50% { box-shadow: inset 0 0 0 1.5px var(--pk-gold-2), 0 0 0 5px rgba(232, 204, 140, .16), 0 0 34px -2px rgba(232, 204, 140, .75); } }
@keyframes pk-pop { from { opacity: 0; transform: scale(.4); } }

/* apuesta frente a cada asiento (hacia el centro) */
.pk-bet {
  position: absolute; z-index: 3; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 999px;
  font-family: var(--font-num); font-size: .84rem; color: var(--pk-cream); background: rgba(0, 0, 0, .38);
  box-shadow: inset 0 0 0 1px rgba(232, 204, 140, .3); white-space: nowrap; animation: pk-pop .3s var(--pk-ease);
}
.pk-bet[hidden] { display: none; }
.pk-seat[data-pos="top"] .pk-bet { top: calc(100% + 6px); left: 50%; transform: translateX(-50%); }
.pk-seat[data-pos="left"] .pk-bet { top: calc(100% + 36px); left: 58%; }
.pk-seat[data-pos="right"] .pk-bet { top: calc(100% + 36px); right: 58%; }
.pk-seat[data-pos="me"] .pk-bet { bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); }

/* fichas (CSS): discos con borde de rombos */
.pk-chips { position: relative; display: inline-block; width: 20px; height: 20px; flex: none; }
.pk-chips::before, .pk-chips::after {
  content: ""; position: absolute; left: 0; width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle, #F5EBD3 0 27%, transparent 29%), repeating-conic-gradient(#B8322B 0 30deg, #F5EBD3 30deg 45deg);
  box-shadow: inset 0 0 0 2px #8E211C, 0 1px 2px rgba(0, 0, 0, .5);
}
.pk-chips::after { top: -3px; background: radial-gradient(circle, #F5EBD3 0 27%, transparent 29%), repeating-conic-gradient(#1F4E8C 0 30deg, #F5EBD3 30deg 45deg); box-shadow: inset 0 0 0 2px #163A6A, 0 1px 2px rgba(0, 0, 0, .5); }
.pk-chips-lg { width: 24px; height: 24px; }
.pk-chips-lg::before, .pk-chips-lg::after { width: 24px; height: 24px; }
.pk-fx { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.pk-fly-chip {
  position: fixed; width: 18px; height: 18px; border-radius: 50%; will-change: transform, opacity;
  background: radial-gradient(circle, #F5EBD3 0 27%, transparent 29%), repeating-conic-gradient(#B8322B 0 30deg, #F5EBD3 30deg 45deg);
  box-shadow: inset 0 0 0 2px #8E211C, 0 3px 6px rgba(0, 0, 0, .5);
}
.pk-fly-chip.c1 { background: radial-gradient(circle, #F5EBD3 0 27%, transparent 29%), repeating-conic-gradient(#1F4E8C 0 30deg, #F5EBD3 30deg 45deg); box-shadow: inset 0 0 0 2px #163A6A, 0 3px 6px rgba(0, 0, 0, .5); }
.pk-fly-chip.c2 { background: radial-gradient(circle, #F5EBD3 0 27%, transparent 29%), repeating-conic-gradient(#1D1D1D 0 30deg, #E8CC8C 30deg 45deg); box-shadow: inset 0 0 0 2px #000, 0 3px 6px rgba(0, 0, 0, .5); }

/* ---------- cartas ---------- */
.pk-card {
  --w: var(--cw); position: relative; flex: none; width: var(--w); aspect-ratio: 100 / 140; perspective: 900px;
  transition: transform .45s var(--pk-ease), opacity .35s ease, filter .35s ease; will-change: transform;
}
.pk-card-in { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .5s var(--pk-ease); }
.pk-card.is-down .pk-card-in { transform: rotateY(180deg); }
.pk-face {
  position: absolute; inset: 0; border-radius: calc(var(--w) * .08); overflow: hidden;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .25), 0 6px 14px -6px rgba(0, 0, 0, .6);
}
.pk-backf { transform: rotateY(180deg); }
.pk-face svg { display: block; width: 100%; height: 100%; }
.pk-card.is-best { transform: translateY(-7px); }
.pk-card.is-best .pk-face { box-shadow: 0 0 0 2px var(--pk-gold-2), 0 0 22px -2px rgba(232, 204, 140, .9), 0 8px 16px -6px rgba(0, 0, 0, .6); }
.pk-card.is-dim { filter: brightness(.5) saturate(.6); }
.pk-card.is-mucked { transform: translateY(26px) scale(.7) rotate(8deg); opacity: 0; }
.pk-card.is-mini { --w: 42px; }

/* cartas de cada asiento */
.pk-hole { display: flex; justify-content: center; min-height: calc(var(--cw) * .62 * 1.4); margin-bottom: -12px; position: relative; z-index: 0; }
.pk-seat:not([data-pos="me"]) .pk-card { --w: calc(var(--cw) * .62); }
.pk-seat:not([data-pos="me"]) .pk-card:first-child { rotate: -7deg; }
.pk-seat:not([data-pos="me"]) .pk-card + .pk-card { margin-left: calc(var(--w) * -.45); rotate: 7deg; }
.pk-seat[data-pos="me"] .pk-hole { min-height: calc(var(--cw) * 1.3 * 1.4); min-width: calc(var(--cw) * 1.3 * 1.78); margin-bottom: 0; }
.pk-seat[data-pos="me"] .pk-card { --w: calc(var(--cw) * 1.3); }
.pk-seat[data-pos="me"] .pk-card:first-child { rotate: -4deg; }
.pk-seat[data-pos="me"] .pk-card + .pk-card { margin-left: calc(var(--w) * -.22); rotate: 4deg; }
.pk-seat[data-pos="me"] .pk-plate { z-index: 2; }

/* ---------- centro: botes, mesa y mensajes ---------- */
.pk-center { grid-area: center; position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; padding: 40px 0 34px; }
.pk-pots { display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 34px; }
.pk-pot {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 14px 4px 6px; border-radius: 999px;
  background: rgba(0, 0, 0, .4); box-shadow: inset 0 0 0 1px rgba(232, 204, 140, .5); color: var(--pk-cream);
  transition: opacity .3s ease;
}
.pk-pot span { font-size: .66rem; letter-spacing: .16em; text-transform: uppercase; color: var(--pk-cream-2); }
.pk-pot b { font-family: var(--font-num); font-size: 1.05rem; font-weight: 600; color: var(--pk-gold-2); }
.pk-pot.is-empty { visibility: hidden; }
.pk-side-pots { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.pk-sp { padding: 2px 9px; border-radius: 999px; font-family: var(--font-num); font-size: .72rem; color: var(--pk-cream); background: rgba(0, 0, 0, .3); box-shadow: inset 0 0 0 1px rgba(232, 204, 140, .3); }
.pk-board { display: flex; gap: clamp(5px, .8vw, 10px); justify-content: center; }
.pk-slot {
  position: relative; width: var(--cw); aspect-ratio: 100 / 140; border-radius: calc(var(--cw) * .08);
  box-shadow: inset 0 0 0 1.5px rgba(232, 204, 140, .2); background: rgba(0, 0, 0, .08);
}
.pk-slot.has-card { box-shadow: none; background: none; }
.pk-slot .pk-card { position: absolute; inset: 0; width: 100%; --w: var(--cw); }
.pk-msg {
  margin: 0; min-height: 2.7em; max-width: 44ch; text-align: center; font-size: var(--t-sm); line-height: 1.38;
  color: var(--pk-cream); text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
}

/* mazo */
.pk-deck { position: absolute; left: clamp(70px, 15%, 170px); bottom: clamp(30px, 13%, 74px); z-index: 1; width: calc(var(--cw) * .58); aspect-ratio: 100 / 140; }
.pk-deck span {
  position: absolute; inset: 0; border-radius: 5px; background: #14284A;
  box-shadow: inset 0 0 0 1px var(--pk-gold), inset 0 0 0 3px #1C3763, inset 0 0 0 3.6px rgba(217, 181, 103, .5);
}
.pk-deck span:nth-child(1) { transform: translate(3px, 3px); background: #0E1D36; }
.pk-deck span:nth-child(2) { transform: translate(1.5px, 1.5px); }
.pk-deck.is-shuffling span:nth-child(3) { animation: pk-shuffle .5s ease; }
@keyframes pk-shuffle { 30% { transform: translate(-6px, -3px) rotate(-8deg); } 65% { transform: translate(5px, -2px) rotate(6deg); } }

/* panel de resultado sobre la mesa */
.pk-table { --tt-table: var(--pk-felt-3); }
.pk-table .tt-result { border-radius: inherit; }

/* ============================================================ barra de jugadas */
.pk-bar {
  position: sticky; bottom: 8px; z-index: 30; display: grid; grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "coach coach" "best raise" "act act"; align-items: center; gap: 8px 16px; padding: 10px;
  border-radius: 18px; background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--line);
  box-shadow: 0 14px 32px -20px rgba(0, 0, 0, .5); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.pk-best { grid-area: best; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin: 0 4px; font-size: var(--t-sm); color: var(--muted); }
.pk-best b { color: var(--ink); font-weight: 600; }
.pk-best.is-strong b { color: var(--success); }
.pk-raise { grid-area: raise; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; align-items: center; }
.pk-raise[hidden] { display: none; }
.pk-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.pk-q {
  min-height: 38px; min-width: 52px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2);
  color: var(--ink); font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background var(--dur), border-color var(--dur), color var(--dur);
}
.pk-q:hover:not(:disabled) { border-color: var(--ink-2); }
.pk-q.is-on { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.pk-q:disabled { opacity: .4; cursor: default; }
.pk-q:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.pk-amount { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pk-amount input[type="range"] { flex: 1 1 auto; min-width: 0; min-height: 36px; accent-color: #2F7550; }
.pk-num input {
  width: 92px; min-height: 40px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface);
  color: var(--ink); font-family: var(--font-num); font-size: .95rem; text-align: right;
}
.pk-num input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.pk-actions { grid-area: act; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1.2fr); gap: 8px; }
.pk-act {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 6px 10px;
  border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font: inherit; font-size: var(--t-sm); cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: background var(--dur), border-color var(--dur), transform .12s, box-shadow var(--dur), opacity var(--dur);
}
.pk-act b { font-weight: 600; line-height: 1.15; text-align: center; }
.pk-act kbd {
  font-family: var(--font-num); font-size: .66rem; line-height: 1; padding: 3px 5px; border-radius: 5px;
  border: 1px solid var(--line-2); color: var(--muted); background: var(--surface-2);
}
.pk-act:hover:not(:disabled) { border-color: var(--ink-2); background: var(--surface-2); }
.pk-act:active:not(:disabled) { transform: translateY(1px); }
.pk-act:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.pk-act:disabled { opacity: .4; cursor: default; }
.pk-fold:not(:disabled) { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line-2)); }
.pk-call:not(:disabled) { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.pk-call:not(:disabled) kbd, .pk-raisebtn:not(:disabled) kbd, .pk-deal:not(:disabled) kbd { background: transparent; color: inherit; border-color: currentColor; opacity: .6; }
.pk-call:hover:not(:disabled) { background: var(--ink-2); }
.pk-raisebtn:not(:disabled) { background: #2F7550; border-color: #2F7550; color: #FFFFFF; }
.pk-raisebtn:hover:not(:disabled) { background: #265F41; }
.pk-allin:not(:disabled) { color: #9E2A23; border-color: #C9776F; background: color-mix(in srgb, #B8322B 8%, var(--surface)); }
[data-theme="dark"] .pk-allin:not(:disabled) { color: #F0A39A; }
.pk-deal:not(:disabled) { background: linear-gradient(180deg, #E8CC8C, #CDA65A); border-color: #B88A3A; color: #2A1A08; }
.pk-deal:hover:not(:disabled) { background: linear-gradient(180deg, #F0D89F, #D6B067); }
.is-coach { position: relative; z-index: 2; box-shadow: 0 0 0 3px #E8CC8C, 0 0 0 6px rgba(232, 204, 140, .35) !important; animation: pk-coach 1.2s ease-in-out infinite; }
@keyframes pk-coach { 50% { box-shadow: 0 0 0 3px #E8CC8C, 0 0 0 10px rgba(232, 204, 140, .15) !important; } }

/* ============================================================ tutorial */
.pk-shell.is-tutorial .pk-deal { display: none !important; }
.pk-shell.is-tutorial .pk-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pk-coach {
  grid-area: coach; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 16px;
  background: color-mix(in srgb, var(--pk-gold) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--pk-gold) 55%, var(--line));
  box-shadow: 0 10px 26px -18px rgba(0, 0, 0, .55);
}
.pk-coach[hidden] { display: none; }
.pk-coach-ava { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 50%; background: #14284A; color: var(--pk-gold-2); }
.pk-coach-ava svg { width: 20px; height: 20px; }
.pk-coach-body { min-width: 0; flex: 1; }
.pk-coach-step { margin: 0 0 2px; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.pk-coach-text { margin: 0; font-size: var(--t-sm); line-height: 1.5; color: var(--ink); }
.pk-coach-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.pk-coach-actions:empty { display: none; }
.pk-coach-hint { font-size: var(--t-xs); color: var(--muted); font-style: italic; }

/* ============================================================ panel lateral */
.pk-side { display: flex; flex-direction: column; gap: 12px; }
.pk-panel { padding: 14px 14px 10px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.pk-panel-h { margin: 0 0 8px; font-size: var(--t-xs); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.pk-hist { list-style: none; margin: 0; padding: 0; max-height: 330px; overflow: auto; font-size: .82rem; line-height: 1.4; color: var(--ink-2); }
.pk-hist li { padding: 4px 0 4px 10px; border-left: 2px solid var(--line); }
.pk-hist li.is-head { margin-top: 2px; border-left-color: var(--ink); font-weight: 600; color: var(--ink); }
.pk-hist li.is-street { border-left-color: #2F7550; color: var(--ink); font-weight: 600; }
.pk-hist li.is-mine { border-left-color: var(--pk-gold); }
.pk-hist li.is-win { border-left-color: var(--pk-gold-deep); color: var(--ink); font-weight: 600; }
.pk-hist li.is-show { color: var(--ink); }
.pk-hist li.is-note { color: var(--muted); font-style: italic; }
.pk-hist li.is-out { color: var(--danger); }
.pk-hist:empty::before { content: "Aquí se anota cada jugada de la mano."; color: var(--muted); font-style: italic; }
.pk-hist-card { max-width: 520px; }
.pk-hist-card .pk-hist { max-height: min(60vh, 520px); }
.pk-mini { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; margin: 0; padding: 12px 16px; border-radius: var(--r-lg); background: var(--surface-2); font-size: var(--t-sm); }
.pk-mini dt { color: var(--muted); }
.pk-mini dd { margin: 0; text-align: right; font-family: var(--font-num); color: var(--ink); }

/* sonido */
.pk-sound-pop { min-width: 220px; padding: 8px; }
.pk-vol { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px 6px; font-size: var(--t-sm); color: var(--ink-2); }
.pk-vol input { width: 100%; accent-color: #2F7550; min-height: 28px; }
.tool-btn.is-off { color: var(--muted); }
.tool-btn.is-off svg { opacity: .5; }

/* ============================================================ diálogos */
.pk-setup { max-width: 560px; }
.pk-setup fieldset { border: 0; margin: 14px 0 0; padding: 0; min-width: 0; }
.pk-setup legend { margin-bottom: 8px; font-size: var(--t-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pk-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.pk-mode-opt {
  position: relative; display: flex; flex-direction: column; gap: 3px; padding: 11px 12px 10px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: left;
  transition: border-color var(--dur), background var(--dur), box-shadow var(--dur);
}
.pk-mode-opt input { position: absolute; opacity: 0; pointer-events: none; }
.pk-mode-opt strong { font-size: .95rem; color: var(--ink); }
.pk-mode-opt em { font-style: normal; font-family: var(--font-num); font-size: .72rem; color: var(--muted); }
.pk-mode-opt:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); background: var(--surface-2); }
.pk-mode-opt:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.pk-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.pk-seg label { position: relative; flex: 1 1 auto; }
.pk-seg input { position: absolute; opacity: 0; pointer-events: none; }
.pk-seg span {
  display: flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line-2); font-size: var(--t-sm); font-weight: 500; color: var(--ink-2); background: var(--surface);
  cursor: pointer; white-space: nowrap; transition: background var(--dur), color var(--dur), border-color var(--dur);
}
.pk-seg input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.pk-seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.pk-setup-note { font-size: var(--t-xs); margin-top: 12px !important; }
.pk-final-card { text-align: center; }
.pk-final-badge {
  display: grid; place-items: center; width: 76px; height: 76px; margin: 0 auto 10px; border-radius: 50%;
  font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: #F6EEDC;
  background: radial-gradient(circle, #F5EBD3 0 30%, transparent 31%), repeating-conic-gradient(#4F5966 0 30deg, #D7DBE1 30deg 45deg);
  box-shadow: inset 0 0 0 4px #39414B, 0 10px 22px -10px rgba(0, 0, 0, .6);
  text-shadow: none; -webkit-text-fill-color: #2A2F36;
}
.pk-final-badge.is-win {
  background: radial-gradient(circle, #FFF3CF 0 30%, transparent 31%), repeating-conic-gradient(#B8322B 0 30deg, #F5EBD3 30deg 45deg);
  box-shadow: inset 0 0 0 4px #8E211C, 0 0 0 4px rgba(232, 204, 140, .5), 0 12px 26px -10px rgba(184, 50, 43, .6);
  -webkit-text-fill-color: #7A1A15;
}
.pk-final-lines { display: flex; flex-direction: column; gap: 3px; margin: 6px 0 0; color: var(--ink-2); font-size: var(--t-sm); }
.pk-stats-best { margin-top: 12px !important; font-size: var(--t-sm); }
.pk-combos-card { max-width: 640px; }
.pk-combos-card .pk-combos, .pk-combos-card .pk-combos-note { text-align: left; }
.pk-combos-card .pk-combos { max-height: min(62vh, 640px); overflow: auto; padding-right: 4px; }

/* combinaciones */
.pk-combos { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pk-combo {
  display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 6px 12px; align-items: center;
  padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
}
.pk-combo-rank { font-family: var(--font-num); font-size: .8rem; color: var(--muted); text-align: center; }
.pk-combo-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pk-combo-head strong { font-size: .98rem; color: var(--ink); }
.pk-combo-pct { font-family: var(--font-num); font-size: .72rem; color: var(--muted); }
.pk-combo p { margin: 2px 0 0; font-size: .82rem; line-height: 1.4; color: var(--ink-2); }
.pk-combo-cards { display: flex; gap: 0; padding: 6px 8px; border-radius: 10px; background: radial-gradient(120% 120% at 50% 30%, var(--pk-felt-1), var(--pk-felt-3)); }
.pk-combo-cards .pk-card + .pk-card { margin-left: -12px; }
.pk-combos-note { margin: 10px 0 0; font-size: var(--t-xs); color: var(--muted); }

/* ============================================================ portada */
.pk-hub-cover { margin: 0 0 6px; }
.pk-hub .pk-notice { margin: 4px 0 6px; max-width: 60ch; }
.pk-hub-stats { margin: 10px 0 0; max-width: 520px; }
.pk-hub-stats[hidden] { display: none; }
.pk-hub-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.pk-hub-links .btn svg { width: 16px; height: 16px; }
.pk-rivals { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-width: 60ch; }
.pk-rival { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.pk-rival .pk-ava { width: 46px; height: 46px; }
.pk-rival strong { font-size: .98rem; }
.pk-rival p { margin: 3px 0 0; font-size: var(--t-sm); color: var(--ink-2); line-height: 1.45; }
.pk-tag { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 999px; font-size: .66rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); vertical-align: 2px; }
.pk-fair { margin-top: 12px; font-size: var(--t-xs); max-width: 60ch; }
.pk-hub .pk-modes { grid-template-columns: 1fr 1fr; }
.pk-resume { margin: 0 0 4px; }
.pk-hub-combos { margin-top: clamp(28px, 4vw, 44px); }
.pk-hub-combos .pk-combos { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 430px), 1fr)); gap: 10px; }
.pk-hub-combos .pk-combo-cards .pk-card { --w: 40px; }

/* ============================================================ adaptable */
@media (max-width: 1100px) {
  .pk-layout { grid-template-columns: minmax(0, 1fr); }
  .pk-side { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; }
  .pk-side .pk-notice { grid-column: 1 / -1; }
}
/* pantallas bajas en horizontal: menos alto */
@media (max-width: 720px) {
  .play-poker .page { padding-bottom: calc(var(--pk-bar-h, 150px) + 18px); }

  /* barra de jugadas fija abajo */
  .pk-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin: 0; border-radius: 18px 18px 0 0;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); border-width: 1px 0 0;
    box-shadow: 0 -10px 30px -16px rgba(0, 0, 0, .45);
  }
  .pk-best { font-size: .78rem; justify-content: center; text-align: center; }
  .pk-raise { display: none; grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .pk-bar.is-raise-open .pk-raise:not([hidden]) { display: grid; }
  .pk-quick { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .pk-q { min-width: 0; min-height: 44px; padding: 0 2px; font-size: .74rem; }
  .pk-num input { width: 84px; min-height: 44px; }
  .pk-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .pk-act { flex-direction: column; gap: 2px; min-height: 50px; padding: 4px 3px; font-size: .78rem; border-radius: 12px; }
  .pk-act kbd { display: none; }
  .pk-deal { grid-column: 1 / -1; flex-direction: row; }
  .pk-bar.is-between .pk-fold, .pk-bar.is-between .pk-call, .pk-bar.is-between .pk-raisebtn, .pk-bar.is-between .pk-allin { display: none; }
  .pk-bar:not(.is-between) .pk-deal { display: none; }
  .pk-coach { padding: 9px 10px; gap: 8px; border-radius: 12px; max-height: 34vh; overflow: auto; }
  .pk-coach-ava { display: none; }
  .pk-coach-step { font-size: .6rem; }
  .pk-coach-text { font-size: .8rem; line-height: 1.4; }
  .pk-coach-actions { margin-top: 6px; }
  .pk-coach-hint { display: none; }
  .pk-side { grid-template-columns: minmax(0, 1fr); }
  .pk-hub .pk-modes { grid-template-columns: 1fr; }
  .pk-combo { grid-template-columns: 22px minmax(0, 1fr); }
  .pk-combo-cards { grid-column: 1 / -1; justify-self: start; }
}
/* mesa compacta: móvil en vertical y pantallas bajas en horizontal */
@media (max-width: 720px), (min-width: 721px) and (max-height: 560px) {
  .pk-table { --cw: min(58px, calc((100vw - 66px) / 5.6)); padding: 6px; border-radius: 34px; }
  .pk-table::before { inset: 3px; }
  .pk-hud-x { display: none; }
  .pk-felt {
    border-radius: 29px; min-height: 0; padding: 10px 6px 12px; row-gap: 4px; column-gap: 4px;
    grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: auto auto auto;
    grid-template-areas: "left top right" "center center center" "me me me";
  }
  .pk-felt::after { left: 6%; right: 6%; top: 30%; bottom: 30%; }
  .pk-seat[data-pos="left"], .pk-seat[data-pos="right"], .pk-seat[data-pos="top"] { justify-self: stretch; align-self: start; }
  .pk-seat:not([data-pos="me"]) .pk-plate { flex-direction: column; gap: 3px; min-width: 0; width: 100%; max-width: 112px; padding: 5px 4px 6px; border-radius: 16px; text-align: center; }
  .pk-seat:not([data-pos="me"]) .pk-plate-t { align-items: center; }
  .pk-seat:not([data-pos="me"]) .pk-ava-wrap { width: 30px; height: 30px; }
  .pk-name { font-size: .74rem; white-space: normal; line-height: 1.1; }
  .pk-machine { margin: 1px auto 0; font-size: .52rem; }
  .pk-style-t { display: none; }
  .pk-seat[data-pos="left"], .pk-seat[data-pos="right"] { margin-top: 0; }
  .pk-seat:not([data-pos="me"]) .pk-say { top: calc(100% + 3px); bottom: auto; left: 50%; translate: -50% 0; }
  .pk-stack { font-size: .8rem; margin-top: 1px; }
  .pk-dbtn { width: 19px; height: 19px; font-size: .62rem; right: -10px; bottom: -3px; }
  .pk-blind { top: -7px; right: 2px; font-size: .56rem; padding: 0 5px; }
  .pk-say { font-size: .66rem; padding: 1px 7px; }
  .pk-hole { min-height: calc(var(--cw) * .5 * 1.4); margin-bottom: -8px; }
  .pk-seat:not([data-pos="me"]) .pk-card { --w: calc(var(--cw) * .5); }
  .pk-seat:not([data-pos="me"]) .pk-bet { top: calc(100% + 26px); left: 50%; right: auto; transform: translateX(-50%); }
  .pk-bet { font-size: .72rem; padding: 2px 8px 2px 3px; gap: 4px; }
  .pk-bet .pk-chips, .pk-bet .pk-chips::before, .pk-bet .pk-chips::after { width: 15px; height: 15px; }
  .pk-center { padding: 50px 0 4px; gap: 7px; }
  .pk-pot b { font-size: .95rem; }
  .pk-msg { font-size: .8rem; min-height: 2.6em; padding: 0 6px; }
  .pk-seat[data-pos="me"] { margin-top: 18px; flex-direction: column; gap: 0; }
  .pk-seat[data-pos="me"] .pk-hole { min-width: 0; margin-bottom: -12px; }
  .pk-seat[data-pos="me"] .pk-say { top: auto; bottom: 8px; left: calc(50% + 70px); translate: none; }
  .pk-seat[data-pos="me"] .pk-card { --w: calc(var(--cw) * 1.4); }
  .pk-seat[data-pos="me"] .pk-hole { min-height: calc(var(--cw) * 1.4 * 1.4); }
  .pk-seat[data-pos="me"] .pk-bet { bottom: auto; top: 30%; left: calc(50% + var(--cw) * 1.35); transform: none; }
  .pk-seat[data-pos="me"] .pk-plate { min-width: 0; padding-right: 12px; }
  .pk-seat[data-pos="me"] .pk-ava-wrap { width: 34px; height: 34px; }
  .pk-deck { left: 16px; bottom: 18px; width: calc(var(--cw) * .5); }

}
/* horizontal bajo (teléfono apaisado): la barra de jugadas va a la derecha de la mesa */
@media (min-width: 721px) and (max-height: 560px) {
  .pk-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, 280px); align-items: start; gap: 12px; }
  .pk-table { --cw: min(46px, 10.5vh); }
  .pk-seat[data-pos="me"] .pk-card { --w: calc(var(--cw) * 1.3); }
  .pk-center { padding-top: 44px; }
  .pk-bar { position: sticky; top: 8px; bottom: auto; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
  .pk-best { font-size: .8rem; }
  .pk-raise { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .pk-quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .pk-q { min-width: 0; min-height: 40px; padding: 0 4px; font-size: .74rem; }
  .pk-actions { grid-template-columns: 1fr 1fr; gap: 6px; }
  .pk-shell.is-tutorial .pk-actions { grid-template-columns: 1fr 1fr; }
  .pk-deal { grid-column: 1 / -1; }
  .pk-act { min-height: 46px; font-size: .8rem; }
  .pk-act kbd { display: none; }
  .pk-coach { padding: 10px; }
  .pk-coach-ava { display: none; }
  .pk-coach-text { font-size: .8rem; }
}
@media (max-width: 360px) {
  .pk-seat:not([data-pos="me"]) .pk-ava-wrap { width: 26px; height: 26px; }
  .pk-name { font-size: .68rem; }
  .pk-stack { font-size: .74rem; }
  .pk-act { font-size: .72rem; }
  .pk-q { font-size: .68rem; }
}
@media (prefers-reduced-motion: reduce) {
  .pk-card, .pk-card-in, .pk-plate, .pk-say, .pk-pot { transition: none !important; }
  .pk-seat.is-turn .pk-plate, .pk-bet, .pk-seat.is-button .pk-dbtn, .pk-deck.is-shuffling span, .is-coach { animation: none !important; }
  .pk-fly-chip { display: none; }
}
