/* Musvisto · Live tables of a tournament (views/tournament-live.js). Green felt drawn in CSS only. */
:root { --felt: #1f6a4b; --felt-deep: #17563c; --felt-edge: #6b4a2e; --felt-ink: #f4f1e8; --card-back: #a93b27; }
@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) { --felt: #1b5c41; --felt-deep: #134430; --felt-edge: #4f3622; --felt-ink: #f2f3ef; --card-back: #b4513c; }
}
:root[data-tema="oscuro"] { --felt: #1b5c41; --felt-deep: #134430; --felt-edge: #4f3622; --felt-ink: #f2f3ef; --card-back: #b4513c; }

/* ── Header ── */
.tt-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 8px 0 12px; }
.tt-titles { min-width: 0; }
.tt-titles h1 { margin: 0; font-size: clamp(26px, 7vw, 36px); line-height: 1.1; overflow-wrap: anywhere; }
.tt-titles p { margin: 6px 0 0; color: var(--ink-soft); overflow-wrap: anywhere; }
.tt-header > .button { flex: none; }
.tt .live-dot { display: inline-block; width: 8px; height: 8px; margin-right: 4px; border-radius: 50%; background: var(--warn); vertical-align: middle; }
@media (prefers-reduced-motion: no-preference) { .tt .live-dot { animation: tt-pulse 1.6s ease-in-out infinite; } }
@keyframes tt-pulse { 50% { opacity: 0.35; } }

/* ── Grid of small tables: equal boxes ── */
.tt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 148px), 1fr)); gap: var(--gap); margin-top: 12px; }
.tt-card { display: grid; grid-template-rows: 24px 1fr 24px; gap: 8px; height: 232px; min-width: 0; padding: 10px; border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; border: 2px solid transparent; }
.tt-card.mine { border-color: var(--accent); }
.tt-card:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.tt-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; font-size: 15px; }
.tt-head b { white-space: nowrap; }
.tt-badge { padding: 2px 8px; border-radius: 980px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 600; white-space: nowrap; }
.tt-badge.soft { background: var(--canvas); color: var(--ink-soft); }
.tt-felt { display: flex; flex-direction: column; align-items: center; justify-content: space-around; gap: 4px; min-width: 0; padding: 8px 6px; border-radius: 40px; background: radial-gradient(circle at 50% 45%, var(--felt), var(--felt-deep)); box-shadow: inset 0 0 0 4px var(--felt-edge); }
.tt-mid { display: flex; align-items: center; justify-content: space-between; gap: 2px; width: 100%; min-width: 0; }
.tt-deck { flex: none; width: 12px; height: 18px; border-radius: 3px; background: repeating-linear-gradient(45deg, var(--card-back) 0 3px, var(--felt-ink) 3px 4px); opacity: 0.85; }
.tt-seat { min-width: 0; max-width: 100%; padding: 3px 6px; border-radius: 980px; background: var(--surface); font-size: clamp(11px, 3vw, 12px); font-weight: 600; line-height: 1.2; text-align: center; white-space: nowrap; }
.tt-seat.pair-a { color: var(--accent); }
.tt-seat.pair-b { color: var(--pair-b); }
.tt-seat.won { box-shadow: 0 0 0 2px currentColor; }
.tt-score { align-self: center; text-align: center; font: 600 17px/1.2 "Bricolage Grotesque", system-ui, sans-serif; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tt-score.none { font: 500 14px/1.2 "Instrument Sans", system-ui, sans-serif; color: var(--ink-soft); }

/* ── One table, big, like the scoreboard: partners face each other ── */
.tt-big-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; }
.tt-big-head h2 { margin: 0; font-size: 22px; }
.tb-table { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr) minmax(0, 1fr); grid-template-areas: ". top ." "left felt right" ". bottom ."; align-items: center; justify-items: center; gap: 8px; max-width: 520px; margin: 0 auto; }
.tb-felt { grid-area: felt; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 100%; aspect-ratio: 1; padding: 12px; border-radius: 28px; background: radial-gradient(circle at 50% 45%, var(--felt), var(--felt-deep)); box-shadow: inset 0 0 0 6px var(--felt-edge); color: var(--felt-ink); text-align: center; }
.tb-brand { font: 600 15px/1.2 "Bricolage Grotesque", system-ui, sans-serif; overflow-wrap: anywhere; }
.tb-brand-sub { font-size: 12px; opacity: 0.85; overflow-wrap: anywhere; }
.tb-score { margin-top: 6px; font: 600 22px/1.1 "Bricolage Grotesque", system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.tb-cards { display: flex; gap: 3px; margin-bottom: 4px; }
.tb-cards i { width: 14px; height: 20px; border-radius: 3px; background: repeating-linear-gradient(45deg, var(--card-back) 0 3px, var(--felt-ink) 3px 4px); transform: rotate(-8deg); }
.tb-cards i:nth-child(2) { transform: rotate(-3deg); }
.tb-cards i:nth-child(3) { transform: rotate(3deg); }
.tb-cards i:nth-child(4) { transform: rotate(8deg); }
.tb-seat { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; max-width: 100%; text-align: center; }
.tb-seat.top { grid-area: top; }
.tb-seat.bottom { grid-area: bottom; }
.tb-seat.left { grid-area: left; }
.tb-seat.right { grid-area: right; }
.tb-face { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--surface); border: 3px solid currentColor; }
.tb-seat.pair-a { color: var(--accent); }
.tb-seat.pair-b { color: var(--pair-b); }
.tb-name { font-size: 15px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.tt-pairs { display: grid; gap: 4px; margin: 16px 0 0; font-size: 15px; overflow-wrap: anywhere; }
.tt-pairs .pair-a, .tt-rows-ro .pair-a { color: var(--accent); }
.tt-pairs .pair-b, .tt-rows-ro .pair-b { color: var(--pair-b); }
.tt-final { margin: 12px 0 0; font-weight: 600; }

/* ── Games entry ── */
.tt-rows { display: grid; gap: 12px; }
.tt-row-label { display: block; margin: 0 4px 6px; font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.tt-row .vacas-row { margin-bottom: 0; }
.tt-vaca-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); margin-top: 12px; }
.tt-preview { min-height: 24px; margin: 12px 4px 0; font-size: 17px; font-weight: 600; color: var(--accent); }
.tt-preview.warn { color: var(--warn); }
.tt-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); margin-top: 12px; }
.tt-actions .button[disabled] { opacity: 0.45; cursor: not-allowed; }
.tt-rows-ro li { display: flex; justify-content: space-between; gap: 12px; }
