/* Bluff Catcher · casino americano sobrio. Colores de marca: canales/bluff-catcher/branding/marca.py
   Fuentes OFL alojadas en /fonts (licencias junto a ellas). Contraste: test/contraste.test.js */
@font-face { font-family: "Playfair Display"; font-weight: 700; font-display: swap; src: url(../fonts/playfair-display-700.woff2) format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 400 700; font-display: swap; src: url(../fonts/source-sans-3.woff2) format("woff2"); }

:root {
  color-scheme: dark;
  --noche: #07120e; --superficie: #0d2119; --tapete: #0e543c; --tapete-hondo: #082a1e;
  --hueso: #f0eadc; --hueso-suave: #d3ccbb; --rojo: #b51c23; --rojo-vivo: #d12a31;
  --oro: #e2bc6a; --oro-claro: #f1d592; --par: #6b5019; --tinta: #121214; --foco: #8fd8ff;
  --borde: #7d6532; --linea: #ffffff2b;

  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", system-ui, "Segoe UI", sans-serif;
  --t-s: .9rem;
  --t-base: clamp(1.0625rem, 1.02rem + .2vw, 1.1875rem);
  --t-l: clamp(1.18rem, 1.1rem + .4vw, 1.4rem);
  --t-h3: clamp(1.22rem, 1.14rem + .4vw, 1.45rem);
  --t-h2: clamp(1.5rem, 1.32rem + .9vw, 2.05rem);
  --t-h1: clamp(2rem, 1.5rem + 2.4vw, 3.15rem);

  --e1: .25rem; --e2: .5rem; --e3: .75rem; --e4: 1rem; --e5: 1.5rem; --e6: 2.5rem; --e7: 3.5rem;
  --r1: .35rem; --r2: .6rem; --r3: 1rem;
  --sombra: 0 .6rem 1.8rem #0007;
  --ancho: 66rem; --medida: 70ch; --toque: 2.75rem;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 5.5rem; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { margin: 0; background: var(--noche) radial-gradient(ellipse 80rem 34rem at 50% 0, #0d3a29 0, #07120e00 100%) no-repeat; color: var(--hueso); font: var(--t-base)/1.6 var(--sans); }
img { max-width: 100%; height: auto; }

a { color: var(--oro); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--oro-claro); text-decoration-thickness: 2px; }
a:active { color: var(--hueso); }
:focus-visible { outline: 3px solid var(--foco); outline-offset: 2px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.18; text-wrap: balance; }
h1 { font-size: var(--t-h1); margin: var(--e4) 0 var(--e3); letter-spacing: -.005em; }
h2 { font-size: var(--t-h2); color: var(--oro); margin: var(--e6) 0 var(--e3); }
h3 { font-size: var(--t-h3); margin: var(--e5) 0 var(--e2); }
p, ul, ol { margin: 0 0 var(--e4); }
main p, main li, main dd, footer p, footer li { max-width: var(--medida); }
main li + li { margin-top: var(--e1); }
strong { font-weight: 700; }

main, .cabecera-in, .pie-in, .migas { max-width: var(--ancho); margin-inline: auto; padding-inline: var(--e4); }
main { padding-block: var(--e2) var(--e6); }
.lectura main, .lectura .migas { max-width: 54rem; }

.salto { position: absolute; left: var(--e2); top: -10rem; z-index: 20; background: var(--oro); color: var(--tinta); padding: var(--e3) var(--e4); border-radius: var(--r1); }
.salto:focus { top: var(--e2); color: var(--tinta); }
.mayores { background: var(--rojo); color: #fff; margin: 0; padding: var(--e2) var(--e4); text-align: center; font-size: var(--t-s); line-height: 1.45; }
.mayores a { color: #fff; font-weight: 700; }

/* Cabecera y menú */
.cabecera { position: sticky; top: 0; z-index: 10; background: #07120ef2; border-bottom: 1px solid var(--borde); }
.cabecera-in { display: flex; justify-content: space-between; align-items: center; gap: var(--e3); padding-block: var(--e2); }
.marca { display: flex; align-items: center; gap: var(--e3); min-height: var(--toque); text-decoration: none; color: var(--hueso); font: 700 1.2rem/1.1 var(--serif); text-transform: uppercase; letter-spacing: .04em; }
.marca:hover { color: var(--hueso); }
.marca em { color: var(--oro); font-style: normal; }
.marca small { display: block; font: 400 .78rem/1.4 var(--sans); text-transform: none; letter-spacing: .02em; color: var(--hueso-suave); }
.marca img { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 2px solid var(--oro); }
#menu { position: static; display: flex; align-items: center; gap: var(--e1); margin: 0; padding: 0; border: 0; background: none; color: inherit; width: auto; height: auto; overflow: visible; }
#menu a { display: inline-flex; align-items: center; min-height: var(--toque); padding: 0 .6rem; border-bottom: 2px solid transparent; text-decoration: none; color: var(--hueso); font-size: 1rem; }
#menu a:hover { color: var(--oro-claro); border-bottom-color: var(--borde); }
#menu a[aria-current] { color: var(--oro); border-bottom-color: var(--rojo-vivo); }
.menu-boton, .menu-cierra { display: none; }
@media (max-width: 62rem) {
  .menu-boton { display: inline-flex; }
  #menu:not(:popover-open) { display: none; }
  #menu:popover-open { position: fixed; inset: var(--e3) var(--e3) auto auto; width: min(20rem, calc(100% - 1.5rem)); max-height: calc(100% - 1.5rem); overflow: auto; flex-direction: column; align-items: stretch; padding: var(--e3); background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--r3); box-shadow: var(--sombra); }
  #menu::backdrop { background: #000a; }
  #menu .menu-cierra { display: inline-flex; align-self: flex-end; }
  #menu a { font-size: 1.1rem; }
}

.migas { font-size: var(--t-s); padding-top: var(--e3); }
.migas ol { display: flex; flex-wrap: wrap; align-items: center; list-style: none; margin: 0; padding: 0; color: var(--hueso-suave); }
.migas li + li::before { content: "›"; padding: 0 var(--e2); color: var(--borde); }
.migas li { display: flex; align-items: center; min-height: 2rem; }

.entrada { font-size: var(--t-l); line-height: 1.5; color: var(--hueso-suave); }
.revision { font-size: var(--t-s); color: var(--hueso-suave); }
.resumen { border: 1px solid var(--borde); border-left: 4px solid var(--oro); border-radius: var(--r2); background: var(--superficie); padding: var(--e4) var(--e4) 0; margin: var(--e5) 0; }

/* Botones y campos */
button, input, select, textarea { font: inherit; }
button, .boton { display: inline-flex; align-items: center; justify-content: center; min-height: var(--toque); cursor: pointer; background: var(--noche); color: var(--hueso); border: 1px solid var(--borde); border-radius: var(--r1); padding: var(--e2) var(--e4); line-height: 1.2; }
button:hover:not(:disabled) { border-color: var(--oro); background: var(--superficie); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: default; }
button.principal, .boton { background: var(--oro); border-color: var(--oro); color: var(--tinta); font-weight: 700; }
button.principal:hover:not(:disabled) { background: var(--oro-claro); }
button.enlace { border: 0; background: none; color: var(--oro); text-decoration: underline; padding: 0; justify-content: flex-start; font-size: var(--t-s); }
button.enlace:hover:not(:disabled) { background: none; color: var(--oro-claro); }
button[aria-pressed="true"]:not(.hueco) { background: var(--oro); border-color: var(--oro); color: var(--tinta); font-weight: 700; }
input, select, textarea { min-height: var(--toque); background: var(--hueso); color: var(--tinta); border: 2px solid var(--borde); border-radius: var(--r1); padding: var(--e2) var(--e3); max-width: 100%; }
input:hover, select:hover, textarea:hover { border-color: var(--oro); }
input[type="text"], textarea { width: 100%; }
input[type="search"] { width: 100%; max-width: 26rem; }
#semilla { width: 8rem; }
form label { display: grid; gap: var(--e1); max-width: 26rem; margin-bottom: var(--e3); }
.contacto { border-radius: var(--r3); }

/* Calculadora */
.pestanas { display: flex; flex-wrap: wrap; gap: var(--e1); }
.pestanas button { border-radius: var(--r2) var(--r2) 0 0; border-bottom: 0; }
.pestanas button[aria-selected="true"] { background: var(--tapete); border-color: var(--borde); color: #fff; font-weight: 700; box-shadow: inset 0 3px var(--oro); }
.tapete { background: radial-gradient(ellipse at 50% 0, var(--tapete), var(--tapete-hondo) 85%); border: 1px solid var(--borde); border-radius: 0 var(--r3) var(--r3) var(--r3); padding: var(--e5); margin-block: 0 var(--e5); box-shadow: var(--sombra); }
.tapete > h2:first-child, .tapete > h3:first-child { margin-top: 0; }
.tapete > :last-child { margin-bottom: 0; }
.tapete a { color: var(--oro-claro); }
article.tapete, .util, .contacto { border-radius: var(--r3); }
.acciones { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e2); margin: var(--e3) 0; }
.filas { display: flex; flex-wrap: wrap; gap: var(--e2); }
/* Reserva el hueco que rellena el JavaScript: así nada salta al cargar */
[id^="sel-"]:empty { min-height: 22rem; }
[id^="rg-"]:empty { min-height: 38rem; }
fieldset { border: 1px solid var(--linea); border-radius: var(--r2); display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; min-width: 0; padding: var(--e2) var(--e3) var(--e3); }
legend { font-size: var(--t-s); padding: 0 var(--e1); }
.hueco { width: 3.1rem; height: 4.2rem; padding: 0; border: 2px dashed #ffffff80; background: #00000040; }
.naipe { display: inline-flex; align-items: center; justify-content: center; background: var(--hueso); color: var(--tinta); border: 1px solid #beb8aa; border-radius: var(--r1); font-family: Georgia, "Segoe UI Symbol", serif; font-weight: 700; white-space: nowrap; }
.naipe.roja { color: var(--rojo); }
span.naipe { min-width: 2.3rem; padding: .05rem .25rem; margin: 0 .15rem .15rem 0; font-size: .95em; line-height: 1.5; }
button.naipe:hover:not(:disabled) { background: #fff; border-color: var(--oro); }
.hueco.naipe { border: 2px solid #beb8aa; background: var(--hueso); font-size: 1.15rem; }
.hueco.activo { border: 3px solid var(--oro); box-shadow: 0 0 0 3px #e2bc6a66; }
.baraja { display: grid; grid-template-columns: repeat(13, minmax(0, 3rem)); gap: .25rem; margin-top: var(--e3); }
.baraja button { padding: 0; min-width: 0; min-height: 2.9rem; }
.baraja button:nth-child(13n+1) { grid-column-start: 1; }

.resultado { overflow-x: auto; }
.resultado:not(:empty) { background: #07120ed9; border-radius: var(--r2); padding: var(--e3) var(--e4); }
.fila-res { border-bottom: 1px solid var(--linea); padding-bottom: var(--e2); }
.fila-res p { margin: var(--e2) 0; }
.barra { height: .6rem; background: #ffffff1f; border-radius: 1rem; overflow: hidden; }
.barra span { display: block; height: 100%; background: var(--oro); }
.cifra { font: 700 var(--t-h2)/1.25 var(--serif); color: var(--oro); }
.explica { border-left: 4px solid var(--oro); padding-left: var(--e3); margin-top: var(--e4); }
.veredicto { font-weight: 700; padding: var(--e2) var(--e3); border-radius: var(--r1); }
.veredicto.si { background: var(--tapete); }
.veredicto.no, .error { background: var(--rojo); color: #fff; }
.error { padding: var(--e2) var(--e3); border-radius: var(--r1); }
.nota { font-size: var(--t-s); color: var(--hueso-suave); }
.aviso { border-left: 4px solid var(--oro); background: #07120eb3; padding: var(--e2) var(--e3); border-radius: 0 var(--r1) var(--r1) 0; }
.avanzadas { margin-top: var(--e3); }
.avanzadas label { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e2); }
summary { cursor: pointer; padding-block: var(--e2); min-height: var(--toque); }
summary:hover { color: var(--oro-claro); }

/* Tablas */
.ancho { overflow-x: auto; margin: var(--e4) 0 var(--e5); }
table { border-collapse: collapse; width: 100%; font-size: var(--t-s); line-height: 1.45; font-variant-numeric: tabular-nums; }
th, td { border: 1px solid var(--linea); padding: var(--e2) var(--e3); text-align: left; vertical-align: top; }
thead th, tr:first-child > th[scope="col"] { background: var(--tapete-hondo); color: var(--oro-claro); }
tbody tr:nth-child(even) { background: #ffffff0a; }
tbody tr:hover { background: #ffffff14; }
tbody th { font-weight: 700; }
caption { text-align: left; font-size: var(--t-s); padding-bottom: var(--e2); color: var(--hueso-suave); }
.matriz { font-size: .75rem; table-layout: fixed; min-width: 38rem; }
.matriz td { padding: .2rem 0; text-align: center; font-weight: 700; }
.matriz small { display: block; font-weight: 400; font-size: .75rem; }
.matriz .par { background: var(--par); }
.matriz .suit { background: var(--tapete); }

/* Bloques de contenido */
article.tapete { margin: var(--e5) 0; }
.formula { background: var(--noche); border: 1px solid var(--linea); padding: var(--e3) var(--e4); border-radius: var(--r1); font-family: Consolas, ui-monospace, monospace; font-size: var(--t-s); overflow-x: auto; }
.etiqueta { display: inline-block; background: var(--rojo); color: #fff; border-radius: var(--r1); padding: .1rem .6rem; font-weight: 700; margin: var(--e4) 0 0; }
.indice { columns: 2 18rem; }
.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr)); gap: var(--e4); padding: 0; }
.pasos { list-style: none; counter-reset: paso; }
.rejilla > li { margin: 0; }
.pasos li, .tarjeta { background: linear-gradient(160deg, #0f3527, var(--superficie)); border: 1px solid var(--borde); border-radius: var(--r3); padding: var(--e4) var(--e4) 0; }
.pasos li { counter-increment: paso; }
.pasos h3::before { content: counter(paso) ". "; color: var(--oro); }
.tarjeta h3, .pasos h3 { margin-top: 0; font-size: 1.2rem; }
.tarjeta { transition: border-color .15s, transform .15s; }
.tarjeta:hover { border-color: var(--oro); transform: translateY(-2px); }
.tarjeta h3 a { text-decoration: none; display: inline-block; padding-block: var(--e1); }
.lista-enlaces { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr)); column-gap: var(--e5); }
.lista-enlaces li { margin: 0; border-bottom: 1px solid var(--linea); }
.lista-enlaces a, .relacionadas a { display: flex; align-items: center; min-height: var(--toque); padding-block: var(--e1); text-decoration: none; }
.lista-enlaces a:hover, .relacionadas a:hover { text-decoration: underline; }
.faq { border-bottom: 1px solid var(--borde); padding: var(--e1) 0; }
.faq summary { font-weight: 700; }
.relacionadas { margin-top: var(--e6); border-top: 1px solid var(--borde); }
.relacionadas ul { list-style: none; padding: 0; }
.relacionadas li { margin: 0; border-bottom: 1px solid var(--linea); }
.relacionadas a::before { content: "♠"; margin-right: var(--e3); color: var(--hueso-suave); }
.fuentes { font-size: var(--t-s); overflow-wrap: anywhere; color: var(--hueso-suave); }
.diccionario { columns: 2 20rem; column-gap: var(--e6); }
.diccionario div { break-inside: avoid; margin-bottom: var(--e3); }
.diccionario dt { font-weight: 700; color: var(--oro); }
.diccionario dd { margin: 0; }
.retrato img { display: block; width: min(15rem, 100%); border-radius: 50%; border: 3px solid var(--oro); box-shadow: var(--sombra); aspect-ratio: 1; }

/* Herramientas */
.barra-herr { display: flex; flex-wrap: wrap; gap: var(--e2); margin: 0 0 var(--e4); }
.barra-herr a { display: inline-flex; align-items: center; min-height: var(--toque); border: 1px solid var(--borde); border-radius: 2rem; padding: 0 var(--e4); font-size: var(--t-s); white-space: nowrap; text-decoration: none; }
.barra-herr a:hover { border-color: var(--oro); background: var(--superficie); }
.rango-caja { overflow-x: auto; overscroll-behavior-x: contain; padding: 3px; }
.rango { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 2px; max-width: 40rem; }
.rango button { padding: 0; min-width: 0; min-height: 2.5rem; font-size: .82rem; border: 1px solid var(--linea); border-radius: .2rem; background: #00000055; }
.rango button.par { background: var(--par); }
.rango button.suit { background: var(--tapete); }
.rango button[aria-pressed="true"] { background: var(--hueso); color: var(--tinta); border-color: var(--oro); box-shadow: inset 0 0 0 2px var(--rojo); }
.desliza { display: none; }
.par-campos { display: grid; grid-template-columns: 1fr 1fr; gap: var(--e3); max-width: 26rem; }
.par-campos label { margin-bottom: var(--e2); }
.par-campos input { width: 100%; min-width: 0; }
.cien { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; max-width: 26rem; margin-bottom: var(--e3); }
.cien span { aspect-ratio: 1; border-radius: 50%; background: #ffffff26; }
.cien span.si { background: var(--oro); }

/* Pie */
footer { border-top: 3px double var(--borde); background: #050d0a; font-size: var(--t-s); }
.pie-in { padding-block: var(--e5) var(--e6); }
.responsable h2 { margin-top: 0; font-size: var(--t-h3); }
.pie-columnas { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr)); gap: var(--e5); border-block: 1px solid var(--linea); padding-block: var(--e5) var(--e2); margin-block: var(--e5) var(--e4); }
.pie-titulo { font: 700 1.1rem var(--serif); margin-bottom: var(--e2); }
.pie-columnas ul { list-style: none; padding: 0; }
.pie-columnas a { display: inline-flex; align-items: center; min-height: 2.1rem; text-decoration: none; }
.pie-columnas a:hover { text-decoration: underline; }
.pie-columnas a[aria-current] { color: var(--hueso); }

@media (max-width: 40rem) {
  main, .migas, .cabecera-in, .pie-in { padding-inline: var(--e3); }
  .tapete { padding: var(--e4) var(--e3); }
  .pestanas button { flex: 1 1 auto; padding-inline: var(--e2); font-size: var(--t-s); }
  /* 7 columnas: cada carta mide al menos 44 px a 390 px de ancho */
  .baraja { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
  .baraja button { min-height: var(--toque); }
  [id^="sel-"]:empty { min-height: 38rem; }
  [id^="rg-"]:empty { min-height: 52rem; }
  /* La rejilla 13×13 no encoge: se desliza dentro de su caja con casillas de 44 px */
  .rango { min-width: calc(13 * var(--toque) + 24px); }
  .rango button { min-height: var(--toque); }
  .desliza { display: block; }
  .barra-herr { flex-wrap: nowrap; overflow-x: auto; padding: 3px; }
  .ancho th, .ancho td { padding: var(--e2); min-width: 5.2rem; }
  .ancho tbody th { min-width: 10.5rem; }
  .ancho .matriz th, .ancho .matriz td { min-width: 0; padding: .3rem 0; }
  .pie-columnas { grid-template-columns: 1fr 1fr; gap: var(--e3); }
  .migas li, .migas a { min-height: var(--toque); }
  .migas a, .pie-columnas a { display: inline-flex; align-items: center; min-height: var(--toque); }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
