/* ══════════════════════════════════════════════════════════════════════════
   DOMA TRUCO — estilos de la mesa.
   Todo el color sale de los tokens de marca de global.css.

   Un solo HTML y dos layouts:
     · ALTO (teléfono parado, y el WebView de la app de Android): barra,
       marcador, mesa y acciones apilados. Es lo que describe casi todo este
       archivo.
     · ANCHO (PC, tablet apaisada, teléfono acostado): la mesa a la izquierda
       ocupando todo el alto y un panel lateral a la derecha con el marcador,
       el estado y los cantos. Vive en el @media del final.

   Nada de esto scrollea: la partida entera entra en pantalla siempre. El
   tamaño de la carta no es fijo ni sale de media queries — lo calcula
   fitBoard() midiendo la mesa después de cada render (ver el <script>).
   ══════════════════════════════════════════════════════════════════════════ */
:root {
    --tc-felt-1: #10040d;
    --tc-felt-2: #1d0a19;
    --tc-line:   rgba(163, 67, 134, 0.28);
    --tc-glow:   rgba(192, 92, 177, 0.45);

    /* Alto real de la ventana. `100vh` no sirve para esto: en Android mide la
       ventana como si la barra de URL estuviera escondida, así que la mesa
       terminaba más alta que la pantalla y la barra de acciones quedaba abajo
       del borde. fitViewport() lo reescribe con innerHeight en cada resize y
       en cada rotación; el 100vh de acá es sólo el valor del primer pintado. */
    --tc-vh: 100vh;
}

body.tc-body {
    background:
        radial-gradient(ellipse at 50% 0%, var(--tc-felt-2) 0%, var(--tc-felt-1) 55%, #050505 100%) fixed;
    /* La partida ocupa exactamente la ventana y no scrollea. Las vistas con
       contenido largo (menú, reglas, ranking, amigos) scrollean adentro con
       .tc-shell--scroll. */
    height: var(--tc-vh);
    min-height: var(--tc-vh);
    overflow: hidden;
    /* global.css centra los hijos del body: sin esto la mesa se encogía al
       ancho de su contenido y en PC se veía una columna angosta en el medio. */
    align-items: stretch;
}

#truco-app {
    /* Medidas de la carta. El ancho lo decide fitBoard() escribiendo --card-w
       ACÁ, y por eso las tres derivadas se declaran acá y no en :root: una
       custom property se resuelve en el elemento donde está declarada, así que
       desde :root habrían seguido calculándose contra el valor de arranque —
       la carta salía ancha pero baja. Los factores .82 y .62 están replicados
       en el JS (CARD.played / CARD.back): si cambian acá, cambian allá. */
    --card-w:      76px;
    --card-w-sm:   calc(var(--card-w) * .82);   /* cartas ya jugadas */
    --card-w-back: calc(var(--card-w) * .62);   /* dorsos del rival */
    --card-h:      calc(var(--card-w) * 113 / 73);

    width: 100%;
    height: calc(var(--tc-vh) - var(--header-height));
    display: flex; flex-direction: column;
}

.tc-shell { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#truco-app > .tc-shell.tc-shell--scroll { overflow-y: auto; }

/* ── Botones ──────────────────────────────────────────────────────────── */
.tc-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    font-weight: 700; border-radius: 12px; padding: .75rem .9rem;
    border: 1px solid var(--border-default); background: var(--color-surface-2); color: var(--color-text);
    cursor: pointer; transition: background .18s, border-color .18s, transform .12s, box-shadow .18s;
    font-family: var(--font-primary); font-size: .95rem; line-height: 1.2; text-align: center;
}
.tc-btn:hover:not(:disabled) { background: var(--color-surface-3); border-color: var(--border-hover); }
.tc-btn:active:not(:disabled) { transform: translateY(1px); }
.tc-btn:disabled { opacity: .4; cursor: not-allowed; }
.tc-btn--primary {
    background: var(--color-brand); border-color: var(--color-brand);
    box-shadow: 0 0 18px var(--color-brand-glow);
}
.tc-btn--primary:hover:not(:disabled) { background: var(--color-brand-hover); border-color: var(--color-brand-hover); }
.tc-btn--yes { background: #1f7a45; border-color: #2a9c58; }
.tc-btn--yes:hover:not(:disabled) { background: #2a9c58; }
.tc-btn--no { background: #7a2020; border-color: #a12a2a; }
.tc-btn--no:hover:not(:disabled) { background: #a12a2a; }
.tc-btn--envido { background: #1e3a6b; border-color: #2d5496; }
.tc-btn--envido:hover:not(:disabled) { background: #2d5496; }
.tc-btn--truco { background: #7a4a12; border-color: #a8681c; }
.tc-btn--truco:hover:not(:disabled) { background: #a8681c; }
.tc-btn--sm { padding: .5rem .4rem; font-size: .78rem; border-radius: 10px; white-space: nowrap; }
.tc-btn--block { width: 100%; }

/* La tecla que dispara el botón, y el renglón de ayuda del final del panel.
   Los dos aparecen sólo donde hay teclado (ver el @media del final). */
.tc-hint {
    display: none; align-items: center; justify-content: center; flex-wrap: wrap;
    gap: .25rem; margin-top: auto; padding-top: .6rem;
    font-size: .68rem; color: var(--color-text-dim); text-align: center;
}
.tc-key {
    display: none; font-size: .62rem; font-weight: 800; line-height: 1;
    padding: .18rem .3rem; border-radius: 5px; min-width: 1.1rem;
    background: rgba(0, 0, 0, .35); border: 1px solid rgba(255, 255, 255, .18);
    color: rgba(255, 255, 255, .72);
}

/* ── Paneles ──────────────────────────────────────────────────────────── */
.tc-panel {
    background: rgba(15, 15, 15, .82); border: 1px solid var(--tc-line);
    border-radius: 18px; box-shadow: var(--shadow-lg); backdrop-filter: blur(6px);
}

/* ── Cartas ───────────────────────────────────────────────────────────── */
.tc-card {
    width: var(--card-w); height: var(--card-h); border-radius: 7px; flex: none;
    padding: 0; border: none; background: transparent; position: relative; display: block;
}
.tc-card img {
    width: 100%; height: 100%; display: block; border-radius: 7px;
    image-rendering: pixelated; user-select: none; -webkit-user-drag: none;
    box-shadow: 0 6px 14px rgba(0, 0, 0, .7);
}
.tc-card--sm   { width: var(--card-w-sm);   height: calc(var(--card-w-sm) * 113 / 73); }
.tc-card--back { width: var(--card-w-back); height: calc(var(--card-w-back) * 113 / 73); }
/* El dorso es el general de todos los juegos de cartas (/assets/cards/back.png):
   viene en alta resolución, así que se achica suave y no pixelado. */
.tc-card--back img { image-rendering: auto; }
.tc-card--play { cursor: pointer; }

/* El reparto anima con `translate`/`scale` y no con `transform`: la mano propia
   usa `transform` para el abanico, y una animación sobre la misma propiedad lo
   pisaba al terminar (dejaba las tres cartas derechas de golpe). */
.tc-card--dealt { animation: tcDeal .3s ease-out both; }
@keyframes tcDeal {
    from { opacity: 0; translate: 0 -14px; scale: .9; }
    to   { opacity: 1; translate: 0 0;     scale: 1; }
}

/* ── Mesa ─────────────────────────────────────────────────────────────── */
.tc-table {
    flex: 1; min-height: 0; display: flex; flex-direction: column;
    justify-content: space-between; align-items: center; gap: .5rem;
    padding: .6rem .75rem; border-radius: 16px; position: relative;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .03);
}

/* Las tres rondas, con su lugar marcado aunque todavía no se haya tirado:
   el rival arriba, el pip en el medio y tu carta abajo. */
.tc-rounds {
    flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(3, 1fr);
    gap: .5rem; align-content: center; justify-items: center;
    width: 100%; max-width: calc(var(--card-w-sm) * 5.4); margin: 0 auto;
}
.tc-round { display: flex; flex-direction: column; align-items: center; gap: .35rem; }
.tc-slot {
    width: var(--card-w-sm); height: calc(var(--card-w-sm) * 113 / 73);
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px; background: rgba(255, 255, 255, .022);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .045);
    transition: box-shadow .2s, background .2s;
}
/* Último recurso: pantallas tan bajas que ni con la carta más chica entra la
   mesa entera (un teléfono acostado con la barra del navegador a la vista).
   Antes que achicar las cartas hasta que no se distingan, la mesa scrollea.
   La clase la pone fitBoard() cuando se queda sin margen. */
.tc-table--tight { justify-content: flex-start; overflow-y: auto; }

/* La ronda que se está jugando: el ojo sabe dónde va la próxima carta. */
.tc-round--live .tc-slot { background: rgba(163, 67, 134, .08); box-shadow: inset 0 0 0 1px var(--tc-line); }

.tc-pip { width: 12px; height: 12px; border-radius: 50%; background: #262626; border: 1px solid #3a3a3a; flex: none; }
.tc-pip--player { background: var(--color-brand); border-color: var(--color-brand-hover); box-shadow: 0 0 8px var(--color-brand-glow); }
.tc-pip--ai { background: var(--color-danger); border-color: var(--color-danger); box-shadow: 0 0 8px rgba(255, 82, 82, .5); }
.tc-pip--tie { background: var(--color-warning); border-color: var(--color-warning); }

/* ── Manos ────────────────────────────────────────────────────────────── */
.tc-hand { display: flex; justify-content: center; align-items: flex-end; gap: .45rem; flex: none; }
/* La fila del rival reserva su alto aunque se quede sin cartas: la mesa no
   salta cada vez que él tira, y el toast siempre tiene dónde pararse. */
.tc-hand:not(.tc-hand--own) { min-height: calc(var(--card-w-back) * 113 / 73); }
.tc-hand--own { gap: .55rem; padding: .3rem 0 .1rem; }
.tc-hand--locked .tc-card { opacity: .55; pointer-events: none; }

/* Abanico: las cartas de los costados salen apenas abiertas, como en la mano.
   El giro y el levante van por variables para que el hover componga con el
   abanico en vez de reemplazarlo. */
.tc-hand .tc-card {
    --tc-rot: 0deg; --tc-lift: 0px;
    transform: rotate(var(--tc-rot)) translateY(var(--tc-lift));
    transform-origin: 50% 145%;
    transition: transform .16s ease, filter .16s ease;
}
.tc-hand--own .tc-card:first-child:not(:only-child) { --tc-rot: -5deg; }
.tc-hand--own .tc-card:last-child:not(:only-child)  { --tc-rot: 5deg; }
/* El rival también sostiene sus cartas, no las tiene apoyadas en fila. */
.tc-hand:not(.tc-hand--own) .tc-card:first-child:not(:only-child) { --tc-rot: 4deg; }
.tc-hand:not(.tc-hand--own) .tc-card:last-child:not(:only-child)  { --tc-rot: -4deg; }
.tc-hand--own .tc-card--play:hover,
.tc-hand--own .tc-card--play:focus-visible {
    --tc-lift: -16px; z-index: 3; outline: none;
    filter: drop-shadow(0 0 12px var(--tc-glow));
}
.tc-hand--own .tc-card--play:active { --tc-lift: -8px; }

@media (prefers-reduced-motion: reduce) {
    .tc-card--dealt { animation: none; }
    .tc-hand .tc-card { transition: none; }
}

/* ── Cabecera de la partida ───────────────────────────────────────────── */
.tc-head { flex: none; display: flex; flex-direction: column; }
.tc-topbar {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    padding: .45rem .75rem; border-bottom: 1px solid var(--tc-line); background: rgba(0, 0, 0, .35);
}
.tc-banner { text-align: center; font-size: .75rem; padding: .4rem .75rem; background: rgba(255, 82, 82, .15); color: #ff8a8a; }

/* ── Marcador ─────────────────────────────────────────────────────────── */
.tc-scorebar {
    flex: none; display: flex; align-items: center; justify-content: center; gap: 1rem;
    padding: .45rem .75rem; border-bottom: 1px solid var(--tc-line); background: rgba(0, 0, 0, .35);
}
.tc-side { display: flex; align-items: center; gap: .55rem; min-width: 0; }
.tc-face {
    width: 34px; height: 34px; border-radius: 8px; flex: none; overflow: hidden;
    border: 2px solid var(--border-default); background: var(--color-surface-2);
    display: flex; align-items: center; justify-content: center;
}
.tc-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tc-face .material-icons-round { font-size: 20px; color: var(--color-text-muted); }
.tc-face--ai .material-icons-round { color: var(--color-danger); }
.tc-side--on .tc-face { border-color: var(--color-brand); }
.tc-side-name { font-size: .8rem; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 8rem; }
.tc-side--on .tc-side-name { color: var(--color-brand-hover); }
.tc-score { font-size: 1.75rem; font-weight: 800; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; }
.tc-mano { font-size: .6rem; text-transform: uppercase; letter-spacing: .08em; color: var(--color-brand-hover); }
.tc-sep { color: #4a4a4a; font-weight: 900; font-size: 1.25rem; }

/* ── Barra de acciones ────────────────────────────────────────────────── */
.tc-actions {
    flex: none; border-top: 1px solid var(--tc-line); background: rgba(0, 0, 0, .55);
    padding: .55rem .75rem calc(.55rem + env(safe-area-inset-bottom, 0px));
    display: flex; flex-direction: column; align-items: center; gap: .5rem;
}
.tc-actions-row { display: flex; gap: .5rem; width: 100%; max-width: 32rem; }
.tc-actions-row > * { flex: 1; }
.tc-status { font-size: .8rem; color: var(--color-text-muted); text-align: center; min-height: 1.2rem; }
.tc-stake {
    display: inline-flex; align-items: center; gap: .4rem; font-size: .7rem; text-transform: uppercase;
    letter-spacing: .06em; color: var(--color-brand-hover); border: 1px solid var(--border-brand);
    border-radius: 999px; padding: .2rem .7rem; background: rgba(163, 67, 134, .12);
    white-space: nowrap; flex: none;
}

/* ── Ban Cards: la pantalla donde se sacan las cartas ─────────────────── */
/* Las ocho candidatas. En teléfono van de a cuatro en dos filas y desde 640px
   entran las ocho de una, siempre lo más grandes que permita el ancho: son
   pocas y hay que poder mirarlas bien antes de elegir. */
.tc-ban-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem;
    width: 100%; max-width: 46rem; margin: 0 auto;
}
@media (min-width: 640px) { .tc-ban-grid { grid-template-columns: repeat(8, 1fr); gap: .6rem; max-width: 58rem; } }

.tc-ban-card {
    padding: 0; border: none; background: none; position: relative; cursor: pointer;
    border-radius: 5px; transition: transform .14s ease, filter .14s ease;
}
.tc-ban-card img {
    width: 100%; height: auto; display: block; border-radius: 5px;
    image-rendering: pixelated; box-shadow: 0 2px 6px rgba(0, 0, 0, .6);
}
.tc-ban-card:hover:not(:disabled), .tc-ban-card:focus-visible:not(:disabled) {
    transform: translateY(-5px); outline: none; filter: drop-shadow(0 0 9px var(--tc-glow));
}
.tc-ban-card:disabled { cursor: default; }
.tc-ban-card.is-out img { filter: grayscale(1) brightness(.4); }
/* El aro dice quién la sacó: marca de la casa si fuiste vos, rojo si la máquina. */
.tc-ban-card.is-out::after {
    content: ''; position: absolute; inset: 0; border-radius: 5px;
    box-shadow: inset 0 0 0 2px var(--tc-ban-mark);
}
.tc-ban-card--player { --tc-ban-mark: var(--color-brand); }
.tc-ban-card--ai     { --tc-ban-mark: var(--color-danger); }

.tc-ban-slots { display: flex; align-items: center; justify-content: center; gap: .5rem; flex-wrap: wrap; }
.tc-ban-who { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.tc-ban-slot {
    width: 42px; aspect-ratio: 73 / 113; border-radius: 6px;
    border: 1px dashed rgba(255, 255, 255, .14); overflow: hidden;
}
.tc-ban-slot img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }

/* ── Cartas prohibidas (la fila de arriba de la mesa) ─────────────────── */
.tc-banned { flex: none; display: flex; align-items: center; justify-content: center; gap: .35rem; }
.tc-banned img { width: 26px; border-radius: 3px; image-rendering: pixelated; filter: grayscale(1) brightness(.5); }
.tc-banned span { font-size: .6rem; text-transform: uppercase; letter-spacing: .08em; color: #b4525a; font-weight: 700; }

/* ── Toast ────────────────────────────────────────────────────────────── */
/* Se para sobre la fila de dorsos del rival: es la única franja de la mesa sin
   información a la vista, y nunca tapa una carta recién jugada. Las coordenadas
   las escribe fitBoard(), así que sirve igual en el layout alto y en el ancho. */
#tcToast {
    position: fixed; left: var(--tc-toast-x, 50%); top: var(--tc-toast-y, calc(var(--header-height) + 88px));
    transform: translate(-50%, -12px);
    background: var(--color-brand); color: #fff; font-weight: 700; font-size: .85rem;
    padding: .5rem 1.1rem; border-radius: 999px; box-shadow: 0 0 22px var(--color-brand-glow);
    z-index: 900; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
    max-width: min(92vw, 30rem); text-align: center;
}
#tcToast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ── Overlays ─────────────────────────────────────────────────────────── */
.tc-overlay {
    position: fixed; inset: 0; z-index: 950; display: flex; align-items: center; justify-content: center;
    padding: 1rem; background: rgba(0, 0, 0, .8); backdrop-filter: blur(4px);
}
.tc-dialog {
    width: 100%; max-width: 26rem; background: var(--color-surface); border: 1px solid var(--color-brand);
    border-radius: 18px; padding: 1.5rem; box-shadow: 0 0 40px var(--color-brand-glow);
    max-height: calc(var(--tc-vh) - 2rem); overflow-y: auto;
}
.tc-envido-grid { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .75rem; margin: 1rem 0; }
.tc-envido-num { font-size: 2.25rem; font-weight: 800; line-height: 1; }

/* ── Menú / stats ─────────────────────────────────────────────────────── */
.tc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.tc-stat { background: rgba(255, 255, 255, .03); border: 1px solid var(--border-default); border-radius: 12px; padding: .6rem .4rem; text-align: center; }
.tc-stat b { display: block; font-size: 1.35rem; color: #fff; line-height: 1.1; }
.tc-stat span { font-size: .65rem; text-transform: uppercase; letter-spacing: .05em; color: var(--color-text-dim); }

.tc-option {
    text-align: left; padding: .85rem 1rem; border-radius: 12px; border: 1px solid var(--border-default);
    background: var(--color-surface-2); color: var(--color-text-muted); cursor: pointer; width: 100%;
    transition: all .18s; font-family: var(--font-primary);
}
.tc-option:hover { border-color: var(--border-hover); background: var(--color-surface-3); }
.tc-option.is-on { border-color: var(--color-brand); background: rgba(163, 67, 134, .16); color: var(--color-brand-hover); }
.tc-option b { display: block; color: inherit; font-weight: 700; margin-bottom: .15rem; }
.tc-option small { color: var(--color-text-dim); font-weight: 400; }

.tc-rank { display: grid; gap: .35rem; }
.tc-rank-row { display: flex; align-items: center; gap: .6rem; font-size: .85rem; color: var(--color-text-muted); }
.tc-rank-row img { width: 30px; border-radius: 3px; image-rendering: pixelated; }

/* Teléfonos chicos parados (un 320×568, o cualquiera con la barra del
   navegador a la vista): todo lo que no es la mesa se achica un poco, porque
   cada píxel que deja de gastar el cromo se lo lleva la carta. */
@media (max-height: 660px) and (max-aspect-ratio: 5/4) {
    .tc-topbar  { padding: .3rem .6rem; }
    .tc-scorebar { padding: .3rem .6rem; gap: .7rem; }
    .tc-score { font-size: 1.4rem; }
    .tc-face { width: 28px; height: 28px; }
    .tc-face .material-icons-round { font-size: 17px; }
    .tc-actions { padding: .4rem .6rem calc(.4rem + env(safe-area-inset-bottom, 0px)); gap: .4rem; }
    .tc-status { min-height: 1rem; font-size: .75rem; }
    .tc-actions .tc-btn { padding: .55rem .6rem; }
}

/* ══════════════════════════════════════════════════════════════════════════
   LAYOUT ANCHO — PC, tablet apaisada y teléfono acostado.

   Mismo HTML: la partida pasa de columna a grilla de dos columnas. La mesa se
   lleva todo el alto disponible a la izquierda y a la derecha queda un panel
   fijo con el marcador arriba y los cantos abajo, que es como se ordena una
   mesa de cartas cuando sobra ancho en vez de alto.

   El corte no es sólo por ancho: una tablet parada (768×1024) tiene ancho de
   sobra pero la mesa alta le queda mejor, así que también se pide que la
   pantalla sea más ancha que alta.
   ══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 780px) and (min-aspect-ratio: 5/4) {
    .tc-shell--game {
        display: grid;
        grid-template-columns: minmax(0, 1fr) clamp(16rem, 23vw, 21rem);
        grid-template-rows: auto auto minmax(0, 1fr);
        grid-template-areas:
            "head  head"
            "board score"
            "board acts";
        gap: .75rem; padding: .75rem;
    }

    .tc-shell--game > .tc-head     { grid-area: head; border-radius: 14px; overflow: hidden; border: 1px solid var(--tc-line); }
    .tc-shell--game > .tc-table    { grid-area: board; }
    .tc-shell--game > .tc-scorebar { grid-area: score; }
    .tc-shell--game > .tc-actions  { grid-area: acts; }

    .tc-shell--game .tc-topbar { border-bottom: none; padding: .5rem .9rem; }

    /* El paño: un óvalo de fieltro con el brillo en el centro, que es donde
       caen las cartas de cada ronda. */
    .tc-shell--game > .tc-table {
        padding: 1.25rem;
        /* El paño no se estira hasta el borde de la pantalla: una mesa de
           cartas tiene una proporción, y a partir de cierto ancho lo único que
           crece es el vacío a los costados. Se ata al tamaño de la carta, que
           ya sale del alto disponible. */
        width: 100%; max-width: calc(var(--card-w) * 6.6); justify-self: center;
        border: 1px solid var(--tc-line);
        border-radius: 22px;
        background:
            radial-gradient(ellipse 70% 55% at 50% 45%, rgba(74, 24, 66, .55) 0%, rgba(20, 6, 17, .5) 60%, rgba(8, 2, 7, .6) 100%);
        box-shadow: inset 0 0 90px rgba(0, 0, 0, .65), 0 10px 40px rgba(0, 0, 0, .5);
    }

    /* Marcador y acciones dejan de ser barras de punta a punta y pasan a ser
       las dos piezas del panel lateral. */
    .tc-shell--game > .tc-scorebar,
    .tc-shell--game > .tc-actions {
        border: 1px solid var(--tc-line); border-radius: 16px;
        background: rgba(10, 4, 9, .72); backdrop-filter: blur(6px);
    }
    .tc-shell--game > .tc-scorebar {
        flex-direction: column; align-items: stretch; gap: .5rem; padding: .85rem .8rem;
    }
    .tc-shell--game .tc-side { gap: .6rem; }
    .tc-shell--game .tc-side .min-w-0 { flex: 1; }
    .tc-shell--game .tc-side-name { max-width: none; font-size: .9rem; }
    .tc-shell--game .tc-sep { display: none; }
    /* El segundo jugador viene escrito al revés (puntaje, nombre, cara) para
       quedar espejado en la barra horizontal. Acá las dos filas van en la misma
       dirección, así que se lo da vuelta. */
    .tc-shell--game .tc-side:last-child { flex-direction: row-reverse; justify-content: flex-end; }
    .tc-shell--game .tc-score { font-size: 2rem; }

    .tc-shell--game > .tc-actions {
        justify-content: flex-start; gap: .5rem; padding: .9rem .8rem; overflow-y: auto;
    }
    .tc-shell--game .tc-status { font-size: .88rem; min-height: 2.4rem; display: flex; align-items: center; justify-content: center; }
    /* Con ancho de sobra los cantos se apilan: botones grandes, uno por línea,
       con la etiqueta entera y sin abreviar. */
    .tc-shell--game .tc-actions-row { flex-direction: column; max-width: none; }
    .tc-shell--game .tc-actions-row > .tc-btn--sm { padding: .7rem .6rem; font-size: .88rem; border-radius: 12px; }

    /* Teléfono acostado (y ventanas muy bajas): cada píxel de alto es de la
       mesa, así que la cabecera se muda al panel de la derecha y el paño se
       queda con la columna entera. */
    @media (max-height: 560px) {
        .tc-shell--game {
            grid-template-areas:
                "board head"
                "board score"
                "board acts";
            gap: .5rem; padding: .5rem;
        }
        .tc-shell--game > .tc-table { padding: .5rem; border-radius: 16px; }
        .tc-shell--game > .tc-scorebar { padding: .5rem .7rem; gap: .35rem; }
        .tc-shell--game .tc-score { font-size: 1.5rem; }
        .tc-shell--game > .tc-actions { padding: .6rem .7rem; }
        /* Los cantos vuelven a ir en fila: apilados no entraban y la mitad
           quedaba abajo del borde del panel. */
        .tc-shell--game .tc-actions-row { flex-direction: row; }
        .tc-shell--game .tc-status { min-height: 1.2rem; font-size: .8rem; }
        .tc-shell--game .tc-hint { display: none !important; }
    }

    /* Los atajos sólo se anuncian donde hay teclado de verdad. */
    @media (hover: hover) and (pointer: fine) {
        .tc-key { display: inline-block; }
        .tc-shell--game .tc-hint { display: flex; }
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   MESA DE 4 Y DE 6 (2v2 y 3v3) — spec truco_pulido.md, T6.

   Cada jugador tiene su lugar alrededor del paño (grid-area = su lugar visto
   desde vos, TrucoTable.PLACES) con su placa (cara, nombre, dorsos que le
   quedan) y las tres cartas que fue tirando, en fila, como en la mesa de
   verdad. Tu mano queda abajo, grande, como en el 1v1. El tamaño de las cartas
   jugadas (--tc-pc) lo calcula fitBoard() igual que el de la mano.
   ══════════════════════════════════════════════════════════════════════════ */
.tc-table--team { --tc-pc: 40px; justify-content: flex-start; gap: .35rem; }
.tc-ring {
    flex: 1; min-height: 0; width: 100%; display: grid; gap: .35rem;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
    align-items: center; justify-items: center;
}
.tc-table--4 .tc-ring { grid-template-areas: ". top ." "l mid r" ". me ."; grid-template-rows: auto 1fr auto; }
.tc-table--6 .tc-ring { grid-template-areas: "lt top rt" "lb mid rb" ". me ."; grid-template-rows: auto 1fr auto; }

.tc-seat { display: flex; flex-direction: column; align-items: center; gap: .3rem; min-width: 0; max-width: 100%; transition: opacity .2s; }
.tc-seat--idle { opacity: .4; }
.tc-plate {
    display: flex; align-items: center; gap: .35rem; max-width: 100%;
    padding: .2rem .5rem .2rem .2rem; border-radius: 999px;
    background: rgba(0, 0, 0, .45); border: 1px solid rgba(255, 255, 255, .08);
    transition: border-color .2s, box-shadow .2s;
}
.tc-seat--ours .tc-plate { border-color: rgba(163, 67, 134, .45); }
.tc-seat--turn .tc-plate { border-color: var(--color-brand); box-shadow: 0 0 14px var(--color-brand-glow); }
.tc-seat--theirs.tc-seat--turn .tc-plate { border-color: var(--color-danger); box-shadow: 0 0 14px rgba(255, 82, 82, .4); }
.tc-plate-face {
    width: 26px; height: 26px; border-radius: 7px; flex: none; overflow: hidden;
    background: var(--color-surface-2); display: flex; align-items: center; justify-content: center;
}
.tc-plate-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tc-plate-face .material-icons-round { font-size: 16px; color: var(--color-text-muted); }
.tc-seat--theirs .tc-plate-face .material-icons-round { color: var(--color-danger); }
.tc-plate-name { font-size: .72rem; font-weight: 700; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tc-badge {
    flex: none; display: inline-flex; align-items: center; justify-content: center;
    min-width: 16px; height: 16px; padding: 0 .2rem; border-radius: 5px;
    font-size: .58rem; font-weight: 800; color: var(--color-text-muted); background: rgba(255, 255, 255, .08);
}
.tc-badge .material-icons-round { font-size: 12px; }
.tc-badge--mano { color: #fff; background: var(--color-brand); }
.tc-badge--afk { color: #fff; background: var(--color-danger); }
.tc-minibacks { display: inline-flex; flex: none; }
.tc-minibacks img { width: 11px; height: 17px; border-radius: 2px; margin-left: -4px; box-shadow: 0 1px 2px rgba(0, 0, 0, .7); }
.tc-minibacks img:first-child { margin-left: 0; }

.tc-played { display: flex; gap: 3px; }
.tc-pslot {
    width: var(--tc-pc); height: calc(var(--tc-pc) * 113 / 73); border-radius: 5px; flex: none;
    background: rgba(255, 255, 255, .022); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .045);
    display: flex; align-items: center; justify-content: center;
}
.tc-pslot--empty { background: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .025); }
.tc-pslot--live { background: rgba(163, 67, 134, .08); box-shadow: inset 0 0 0 1px var(--tc-line); }
.tc-pslot .tc-card { width: 100%; height: 100%; }
.tc-pslot .tc-card img { border-radius: 5px; box-shadow: 0 3px 8px rgba(0, 0, 0, .7); }

.tc-mid { display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.tc-pips { display: flex; gap: .5rem; }
.tc-phase {
    font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800;
    color: var(--color-warning); border: 1px solid currentColor; border-radius: 999px; padding: .15rem .55rem;
}
.tc-head-label { font-size: 11px; color: var(--color-text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.tc-reveal-seats { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem .8rem; margin: -.25rem 0 1rem; font-size: .75rem; color: var(--color-text-dim); }
.tc-reveal-seats b { color: var(--color-text); }
.tc-reveal-seats .is-ours b { color: var(--color-brand-hover); }

.tc-ban-wrap { width: 100%; max-width: 64rem; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; padding: .5rem 0; }
.tc-ban-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }

/* Anti-AFK: el cartel con la cuenta regresiva. */
.tc-banner--afk { background: rgba(255, 171, 64, .14); color: var(--color-warning); }
.tc-banner--afk b { font-variant-numeric: tabular-nums; }

/* Teléfono: en la mesa de 4 y de 6 cada columna mide ~120 px. Los dorsos que le quedan a
   cada uno se dejan de dibujar (se ven igual en su fila de cartas jugadas) para
   que entre el nombre. */
@media (max-width: 520px) {
    .tc-table--team .tc-minibacks { display: none; }
    .tc-plate { padding-right: .4rem; gap: .25rem; }
    .tc-plate-face { width: 22px; height: 22px; }
    .tc-plate-name { font-size: .66rem; }
}

@media (min-width: 780px) and (min-aspect-ratio: 5/4) {
    /* El paño de 4 y de 6 necesita más ancho que el de 2: hay jugadores a los costados. */
    .tc-shell--game > .tc-table--team { max-width: none; }
    .tc-plate-name { font-size: .8rem; }
    .tc-plate-face { width: 30px; height: 30px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   MENÚ Y PANTALLAS (spec truco_pulido.md, T6)

   El menú tiene tres acciones grandes (Online, Contra la máquina, Con amigos)
   y lo demás en una barra secundaria. En escritorio va en dos columnas (marca
   y estadísticas a la izquierda, acciones a la derecha), no una columna de
   celular en el medio de la pantalla (UI_GUIDELINES §7.1).
   ══════════════════════════════════════════════════════════════════════════ */
.tc-page { width: 100%; max-width: 72rem; margin: 0 auto; padding: 1.25rem 1rem 2rem; display: flex; flex-direction: column; gap: 1.25rem; flex: 1 0 auto; }
.tc-page--narrow { max-width: 40rem; }
.tc-page-head { display: flex; align-items: center; gap: .75rem; }
.tc-page-head h2 { font-size: 1.5rem; font-weight: 900; color: #fff; line-height: 1.1; }
.tc-page-head p { font-size: .8rem; color: var(--color-text-dim); }
.tc-back {
    flex: none; width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border-default); background: var(--color-surface-2); color: var(--color-text); cursor: pointer;
}
.tc-back:hover { border-color: var(--border-hover); background: var(--color-surface-3); }

.tc-menu { display: grid; gap: 1.25rem; align-content: center; flex: 1; }
@media (min-width: 900px) {
    .tc-menu { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 2.5rem; align-items: center; }
}
.tc-brand h1 {
    font-size: clamp(3rem, 9vw, 5.5rem); font-weight: 900; line-height: .95; letter-spacing: -.02em;
    color: transparent; background: linear-gradient(135deg, #e9b8ff, var(--color-brand)); -webkit-background-clip: text; background-clip: text;
}
.tc-brand-sub { font-size: .8rem; letter-spacing: .35em; text-transform: uppercase; color: var(--color-text-dim); margin-top: .35rem; }
.tc-brand-copy { color: var(--color-text-muted); font-size: .95rem; margin-top: 1rem; max-width: 26rem; }
.tc-brand .tc-stats { margin-top: 1.25rem; max-width: 26rem; }
.tc-stats-origin { font-size: 11px; color: var(--color-text-dim); margin-top: .5rem; }
@media (max-width: 899px) {
    .tc-brand { text-align: center; }
    .tc-brand-copy, .tc-brand .tc-stats { margin-left: auto; margin-right: auto; }
}

.tc-actions-main { display: flex; flex-direction: column; gap: .75rem; }
.tc-choice {
    display: flex; align-items: center; gap: 1rem; width: 100%; text-align: left;
    padding: 1rem 1.1rem; border-radius: 16px; cursor: pointer; color: var(--color-text);
    border: 1px solid var(--border-default); background: rgba(15, 15, 15, .82);
    transition: border-color .18s, background .18s, transform .12s; font-family: var(--font-primary); text-decoration: none;
}
.tc-choice:hover { border-color: var(--border-brand); background: rgba(163, 67, 134, .1); }
.tc-choice:active { transform: translateY(1px); }
.tc-choice--main { background: linear-gradient(135deg, rgba(163, 67, 134, .35), rgba(15, 15, 15, .85)); border-color: var(--border-brand); box-shadow: 0 0 24px rgba(163, 67, 134, .2); }
.tc-choice-icon {
    flex: none; width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
    background: rgba(163, 67, 134, .18); color: var(--color-brand-hover);
}
.tc-choice-icon .material-icons-round { font-size: 26px; }
.tc-choice b { display: block; font-size: 1.05rem; font-weight: 800; }
.tc-choice small { display: block; font-size: .78rem; color: var(--color-text-dim); margin-top: .1rem; }
.tc-choice .tc-chev { margin-left: auto; color: var(--color-text-dim); }

.tc-subnav { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.tc-subnav a, .tc-subnav button {
    display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .7rem .25rem; border-radius: 12px;
    border: 1px solid var(--border-default); background: var(--color-surface-2); color: var(--color-text-muted);
    font-size: .72rem; font-weight: 600; cursor: pointer; text-decoration: none; font-family: var(--font-primary);
}
.tc-subnav a:hover, .tc-subnav button:hover { border-color: var(--border-hover); color: var(--color-text); }
.tc-subnav .material-icons-round { font-size: 22px; color: var(--color-brand-hover); }

/* Formularios de las pantallas de configuración */
.tc-form { display: grid; gap: 1rem; }
@media (min-width: 900px) { .tc-form--2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.tc-field > p { font-size: .8rem; font-weight: 700; color: var(--color-text-muted); margin-bottom: .5rem; }
.tc-field > small { display: block; font-size: .72rem; color: var(--color-text-dim); margin-top: .4rem; }
.tc-seg { display: flex; gap: .4rem; flex-wrap: wrap; }
.tc-seg > button {
    flex: 1; min-width: 4.5rem; padding: .65rem .6rem; border-radius: 12px; cursor: pointer;
    border: 1px solid var(--border-default); background: var(--color-surface-2); color: var(--color-text-muted);
    font-family: var(--font-primary); font-weight: 700; font-size: .9rem; transition: all .15s;
}
.tc-seg > button:hover { border-color: var(--border-hover); }
.tc-seg > button.is-on { border-color: var(--color-brand); background: rgba(163, 67, 134, .2); color: #fff; }
.tc-seg > button small { display: block; font-weight: 500; font-size: .68rem; color: var(--color-text-dim); }
.tc-tabs { display: flex; padding: .25rem; gap: .25rem; border-radius: 14px; background: rgba(0, 0, 0, .4); border: 1px solid var(--border-default); }
.tc-tabs > button {
    flex: 1; padding: .6rem; border-radius: 10px; border: none; background: none; cursor: pointer;
    color: var(--color-text-muted); font-family: var(--font-primary); font-weight: 700; font-size: .9rem;
}
.tc-tabs > button.is-on { background: var(--color-brand); color: #fff; box-shadow: 0 0 14px var(--color-brand-glow); }
.tc-note { font-size: .78rem; color: var(--color-text-dim); display: flex; gap: .4rem; align-items: flex-start; }
.tc-note .material-icons-round { font-size: 16px; color: var(--color-brand-hover); }

/* Elegir bots */
.tc-bots { display: grid; gap: .5rem; }
.tc-botrow { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: 12px; background: rgba(255, 255, 255, .03); border: 1px solid var(--border-default); }
.tc-botrow-role { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; width: 4.6rem; flex: none; }
.tc-botrow-role--ours { color: var(--color-brand-hover); }
.tc-botrow-role--theirs { color: var(--color-danger); }
.tc-botrow select {
    flex: 1; min-width: 0; background: var(--color-surface-2); color: var(--color-text); border: 1px solid var(--border-default);
    border-radius: 10px; padding: .5rem .6rem; font-family: var(--font-primary); font-size: .88rem;
}
.tc-botrow small { display: none; }
@media (min-width: 900px) { .tc-botrow small { display: block; font-size: .72rem; color: var(--color-text-dim); flex: 1.2; min-width: 0; } }

.tc-input {
    flex: 1; min-width: 0; background: rgba(0, 0, 0, .4); border: 1px solid var(--border-default); border-radius: 10px;
    padding: .55rem .75rem; color: #fff; font-family: var(--font-primary);
}
.tc-code { font-size: 2.25rem; font-weight: 900; letter-spacing: .3em; text-align: center; padding: 1rem; border-radius: 14px; background: rgba(163, 67, 134, .15); color: var(--color-brand-hover); }
.tc-list { display: flex; flex-direction: column; gap: .4rem; }
.tc-row { display: flex; align-items: center; gap: .65rem; padding: .55rem .7rem; border-radius: 12px; background: rgba(255, 255, 255, .03); }
.tc-row--me { background: rgba(163, 67, 134, .18); border: 1px solid var(--border-brand); }
.tc-row-avatar { width: 36px; height: 36px; border-radius: 9px; object-fit: cover; flex: none; background: var(--color-surface-2); display: flex; align-items: center; justify-content: center; }
.tc-row-name { flex: 1; min-width: 0; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-section-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--color-text-dim); margin-bottom: .5rem; }
.tc-error { color: #ff8a8a; font-size: .85rem; text-align: center; }

/* ══════════════════════════════════════════════════════════════════════════
   SKINS (spec truco_pulido.md, T7)
   ══════════════════════════════════════════════════════════════════════════ */
.tc-skins { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .6rem; }
.tc-skin {
    display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: .7rem .5rem;
    border-radius: 14px; border: 1px solid var(--border-default); background: var(--color-surface-2);
    color: var(--color-text); cursor: pointer; font-family: var(--font-primary); text-align: center; transition: border-color .15s;
}
.tc-skin:hover:not(:disabled) { border-color: var(--border-hover); }
.tc-skin.is-on { border-color: var(--color-brand); box-shadow: 0 0 16px var(--color-brand-glow); }
.tc-skin.is-locked { cursor: default; opacity: .55; }
.tc-skin b { font-size: .78rem; }
.tc-skin small { display: inline-flex; align-items: center; gap: .2rem; font-size: .66rem; color: var(--color-text-dim); }
.tc-skin small .material-icons-round { font-size: 12px; }
.tc-skin-art { display: flex; justify-content: center; gap: 2px; height: 72px; }
.tc-skin-art img { height: 100%; width: auto; border-radius: 4px; image-rendering: pixelated; box-shadow: 0 2px 6px rgba(0, 0, 0, .6); }

.tc-face-grid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
@media (max-width: 520px) { .tc-face-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.tc-face-pick { padding: 0; border: none; background: none; cursor: pointer; border-radius: 4px; position: relative; }
.tc-face-pick img { width: 100%; display: block; border-radius: 4px; image-rendering: pixelated; }
.tc-face-pick.is-on { outline: 2px solid var(--color-brand); outline-offset: 1px; }
.tc-face-pick.is-custom::after {
    content: ''; position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%;
    background: var(--color-brand); box-shadow: 0 0 0 2px var(--color-surface);
}
.tc-face-options { padding: .75rem; border-radius: 12px; background: rgba(0, 0, 0, .35); border: 1px solid var(--border-default); }
.tc-face-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.tc-face-opt {
    display: flex; flex-direction: column; align-items: center; gap: .25rem; width: 5.5rem; padding: .4rem;
    border-radius: 10px; border: 1px solid var(--border-default); background: var(--color-surface-2); cursor: pointer; color: var(--color-text);
    font-family: var(--font-primary);
}
.tc-face-opt.is-on { border-color: var(--color-brand); }
.tc-face-opt img { width: 3.2rem; image-rendering: pixelated; border-radius: 4px; }
.tc-face-opt small { font-size: .62rem; text-align: center; color: var(--color-text-muted); }
/* La muestra de un pack: cuatro cartas abiertas en abanico, sin pasarse del ancho de la ficha. */
.tc-skin-fan { display: flex; height: 100%; }
.tc-skin-fan img { margin-left: -24px; }
.tc-skin-fan img:first-child { margin-left: 0; }
.tc-skin-fan img:nth-child(1) { transform: rotate(-8deg); }
.tc-skin-fan img:nth-child(2) { transform: rotate(-3deg); }
.tc-skin-fan img:nth-child(3) { transform: rotate(3deg); }
.tc-skin-fan img:nth-child(4) { transform: rotate(8deg); }
