/* Musvisto · Play screens: table-centre scoreboard, quick entry, matches, one match, live view and draw.
   Colours only through the variables of app.css (light and dark). Pair A = --accent, pair B = --pair-b. */
:root { --ease-out: cubic-bezier(0.16, 1, 0.3, 1); --tint-a: color-mix(in srgb, var(--accent) 9%, var(--surface)); --tint-b: color-mix(in srgb, var(--pair-b) 9%, var(--surface)); }

/* ── Common ── */
.play-head { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin: 8px 0 16px; }
.play-head h2 { margin: 4px 0 0; }
.play-head p { margin: 0; color: var(--ink-soft); }
.play-actions { margin-top: 24px; }
.play-actions.stack { display: grid; gap: 12px; }
.play-actions.stack > .button { width: 100%; }
.play-center { text-align: center; }
.play-rules { text-align: center; margin: 10px 0 0; }
.play-offline { margin: 0 0 12px; }
.linklike { min-height: 44px; padding: 0 6px; border: 0; background: none; color: var(--accent); font: inherit; font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.pface { width: 56px; height: 56px; border-radius: 50%; display: block; flex: none; object-fit: cover; background: var(--stone); }
.pface.blank { display: grid; place-items: center; border: 2px dashed var(--line); background: none; color: var(--ink-soft); font-size: 24px; font-weight: 600; }

/* ── The four seats seen from above: partners in opposite corners ── */
.seat-table { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 14px; border-radius: 24px; background: color-mix(in srgb, var(--accent) 12%, var(--canvas)); }
.seat-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.seat-lines line { stroke-width: 1.5; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; opacity: 0.55; }
.seat-lines .line-a { stroke: var(--accent); }
.seat-lines .line-b { stroke: var(--pair-b); }
.seat { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 116px; min-width: 0; padding: 8px; border: 2px solid transparent; border-radius: 18px; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; transition: border-color 160ms var(--ease-out), transform 120ms var(--ease-out); }
button.seat:active { transform: scale(0.97); }
.seat[aria-pressed="true"] { border-color: var(--ink); }
.seat.pair-a[aria-pressed="true"] { border-color: var(--accent); }
.seat.pair-b[aria-pressed="true"] { border-color: var(--pair-b); }
.seat-name { flex: none; max-width: 100%; font-size: 15px; font-weight: 600; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.seat-tag { flex: none; font-size: 12px; font-weight: 600; line-height: 1.2; }
.seat.pair-a .seat-tag { flex: none; color: var(--accent); }
.seat.pair-b .seat-tag { flex: none; color: var(--pair-b); }
.seat-table.readonly .seat { height: 104px; cursor: default; }
.seat-table.readonly .pface { width: 44px; height: 44px; }

/* ── Face grid ── */
.face-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.face-cell { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px; height: 112px; min-width: 0; padding: 6px 4px; border: 2px solid transparent; border-radius: 16px; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out), transform 120ms var(--ease-out); }
.face-cell:active { transform: scale(0.96); }
.face-cell[aria-pressed="true"] { border-color: var(--accent); background: var(--tint-a); }
.face-name { flex: none; max-width: 100%; height: 2.4em; font-size: 13px; font-weight: 600; line-height: 1.2; text-align: center; hyphens: auto; overflow-wrap: anywhere; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.face-mark { position: absolute; top: 6px; right: 6px; font-size: 12px; font-weight: 700; line-height: 20px; color: var(--accent); }
.face-mark:not(:empty) { min-width: 26px; padding: 0 5px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); }
@media (min-width: 600px) { .face-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* ── Choices (result, draw mode) ── */
.pick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pick { min-height: 56px; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; font-weight: 600; line-height: 1.2; cursor: pointer; transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out); }
.pick.pair-a { color: var(--accent); }
.pick.pair-b { color: var(--pair-b); }
.pick[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--canvas); }
.pick.pair-a[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pick.pair-b[aria-pressed="true"] { background: var(--pair-b); border-color: var(--pair-b); color: var(--surface); }

/* ── Quick entry ── */
.vacas-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px; margin-bottom: 8px; }
.vacas-mid { font-size: 14px; color: var(--ink-soft); }
.stepper { display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; align-items: center; height: 60px; padding: 0 4px; border-radius: 18px; background: var(--surface); }
.stepper output { text-align: center; font: 600 30px/1 "Bricolage Grotesque", system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.stepper.pair-a output { color: var(--accent); }
.stepper.pair-b output { color: var(--pair-b); }
.step { width: 48px; height: 48px; border: 0; border-radius: 50%; background: var(--canvas); color: var(--ink); font: inherit; font-size: 24px; font-weight: 600; cursor: pointer; }
.step[disabled] { opacity: 0.35; cursor: not-allowed; }
.vs-line { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.vs-line b { font: 600 28px/1 "Bricolage Grotesque", system-ui, sans-serif; color: var(--ink); }
.games-rows { display: grid; gap: 8px; margin-top: 8px; }
.games-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 14px minmax(0, 1fr) 44px; align-items: center; gap: 8px; }
.games-label { font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.games-in { width: 100%; height: 48px; padding: 0 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; font-size: 20px; font-weight: 600; text-align: center; }
.games-in.pair-a { color: var(--accent); }
.games-in.pair-b { color: var(--pair-b); }
.games-sep { text-align: center; color: var(--ink-soft); }
.games-del { width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; color: var(--ink-soft); font: inherit; font-size: 22px; cursor: pointer; }
.games-rows > .button { justify-self: start; }
.entry-errors { margin-top: 16px; }
.entry-errors p { margin: 0; }
.entry-errors p + p { margin-top: 4px; }

/* ── Pair faces and the mirrored match block ── */
.pair-faces { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pf-imgs { display: flex; flex: none; }
.pf-imgs .pface { width: 44px; height: 44px; border: 2px solid var(--surface); }
.pf-imgs .pface + .pface { margin-left: -12px; }
.pf-names { display: flex; flex-direction: column; min-width: 0; }
.pf-names b { font-size: 16px; font-weight: 600; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.pair-faces.big { flex-direction: column; gap: 8px; text-align: center; }
.pair-faces.big .pf-imgs .pface { width: 56px; height: 56px; }
.pair-faces.big.side-B .pf-imgs { flex-direction: row-reverse; }
.pair-faces.big.side-B .pf-imgs .pface + .pface { margin-left: 0; margin-right: -12px; }
.pair-faces.big .pf-names { align-items: center; width: 100%; }
.pair-faces.big .pf-names b { max-width: 100%; -webkit-line-clamp: 2; hyphens: auto; overflow-wrap: anywhere; }
.pair-faces.big.side-A .pf-names b { color: var(--accent); }
.pair-faces.big.side-B .pf-names b { color: var(--pair-b); }
.vs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; padding: 20px 12px; }
.vs-mid { display: flex; flex-direction: column; align-items: center; }
.vs-mid b { font: 600 clamp(34px, 10vw, 48px)/1 "Bricolage Grotesque", system-ui, sans-serif; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vs-mid small { margin-top: 4px; font-size: 13px; color: var(--ink-soft); }

/* ── Matches list (mirrored rows of equal height) ── */
.play-quick { display: grid; gap: 12px; margin-bottom: 8px; }
.play-quick .row-actions { margin-top: 0; }
.play-seasons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 16px; }
.play-seasons .pill { justify-content: center; min-width: 0; padding: 0 8px; }
.mrow { display: grid; grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1fr); align-items: center; gap: 6px; height: 76px; padding: 8px 12px; color: var(--ink); text-decoration: none; }
.mrow-side { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mrow-side.side-b { flex-direction: row-reverse; text-align: right; }
.mrow-faces { display: none; flex: none; }
@media (min-width: 600px) { .mrow-faces { display: flex; } }
.mrow-faces img { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--surface); object-fit: cover; background: var(--stone); }
.mrow-faces img + img { margin-left: -10px; }
.mrow-names { display: flex; flex-direction: column; min-width: 0; }
.mrow-names b { font-size: clamp(14px, 4vw, 16px); font-weight: 500; line-height: 1.25; color: var(--ink-soft); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.mrow-side.won .mrow-names b { font-weight: 700; color: var(--ink); }
.mrow-mid { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.mrow-mid b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mrow-mid small { max-width: 100%; font-size: 12px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; }
.mrow-act { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; gap: 8px; padding: 0 12px 12px; }
.mrow-act .legend { margin: 0; text-align: right; }

/* ── Live view ── */
.live-dot { display: inline-block; width: 10px; height: 10px; margin-right: 4px; border-radius: 50%; background: var(--pair-b); vertical-align: 1px; animation: live-pulse 1.6s var(--ease-out) infinite; }
@keyframes live-pulse { 0% { opacity: 1; } 70% { opacity: 0.35; } 100% { opacity: 1; } }
.live-points { margin-top: var(--gap); }
.live-side { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 168px; justify-content: center; text-align: center; }
.live-side small { color: var(--ink-soft); font-size: 14px; }
.live-num { font: 600 52px/1 "Bricolage Grotesque", system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.live-ev { display: flex; align-items: center; min-height: 52px; padding: 10px 16px; font-size: 16px; }

/* ── Amarracos and piedras ── */
.stones { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 5px; min-height: 14px; }
.amarraco { display: block; width: 24px; height: 11px; border-radius: 6px; background: currentColor; box-shadow: inset 0 -2px 0 rgb(0 0 0 / 0.18); }
.piedra { display: block; width: 11px; height: 11px; border-radius: 50%; background: color-mix(in srgb, currentColor 55%, var(--surface)); box-shadow: inset 0 -2px 0 rgb(0 0 0 / 0.14); }
.live-side.side-A .stones, .sb-half.side-A .stones { color: var(--accent); }
.live-side.side-B .stones, .sb-half.side-B .stones { color: var(--pair-b); }

/* ── Draw ── */
.draw-bulk { margin-top: 0; }
.draw-count { margin: 16px 0 0; text-align: center; font-weight: 600; }
.draw-table { margin-top: var(--gap); }
.draw-table .row-actions { margin-top: 12px; }
.draw-ruso { margin: 12px 0 6px; font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.draw-faces { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.draw-face { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 84px; min-width: 0; }
.draw-face img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--stone); }
.draw-face span { flex: none; max-width: 100%; font-size: 13px; font-weight: 600; line-height: 1.2; text-align: center; hyphens: auto; overflow-wrap: anywhere; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ── Table-centre scoreboard: full screen, top half turned for the pair across ── */
.sb { position: fixed; inset: 0; z-index: 30; display: grid; grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr); background: var(--canvas); user-select: none; -webkit-user-select: none; touch-action: manipulation; overscroll-behavior: none; }
.sb-half { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: clamp(4px, 1.2dvh, 10px); min-height: 0; padding: clamp(8px, 1.8dvh, 16px) 16px; padding-bottom: max(clamp(8px, 1.8dvh, 16px), env(safe-area-inset-bottom)); overflow: hidden; }
.sb-half.side-A { background: var(--tint-a); }
.sb-half.side-B { background: var(--tint-b); transform: rotate(180deg); padding-bottom: max(clamp(8px, 1.8dvh, 16px), env(safe-area-inset-top)); }
.sb-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.sb-head .pf-imgs .pface { border-color: var(--surface); }
.sb-score { display: flex; align-items: baseline; gap: 6px; }
.sb-score b { font: 600 clamp(40px, min(12vw, 8dvh), 64px)/1 "Bricolage Grotesque", system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.sb-half.side-A .sb-score b { color: var(--accent); }
.sb-half.side-B .sb-score b { color: var(--pair-b); }
.sb-score small { font-size: 14px; color: var(--ink-soft); }
.sb-tally { margin: 0; text-align: center; font-size: 14px; font-weight: 600; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.sb-lances { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.sb-lance { min-width: 0; height: clamp(44px, 6.5dvh, 56px); padding: 0 2px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); font: inherit; font-size: clamp(13px, 3.7vw, 16px); font-weight: 600; cursor: pointer; transition: background-color 140ms var(--ease-out), transform 100ms var(--ease-out); }
.sb-lance:active, .sb-add:active { transform: scale(0.95); }
.sb-half.side-A .sb-lance[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.sb-half.side-B .sb-lance[aria-pressed="true"] { background: var(--pair-b); border-color: var(--pair-b); color: var(--surface); }
.sb-amounts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.5fr); gap: 8px; }
.sb-add { min-width: 0; height: clamp(48px, 8dvh, 68px); border: 0; border-radius: 18px; color: var(--accent-ink); font: 600 clamp(20px, 6vw, 26px)/1 "Bricolage Grotesque", system-ui, sans-serif; cursor: pointer; transition: transform 100ms var(--ease-out), opacity 140ms var(--ease-out); }
.sb-half.side-A .sb-add { background: var(--accent); }
.sb-half.side-B .sb-add { background: var(--pair-b); color: var(--surface); }
.sb-half .sb-add.sb-ordago-btn { background: var(--ink); color: var(--canvas); font-size: clamp(16px, 4.6vw, 20px); }
.sb-hint { margin: 0; min-height: 18px; text-align: center; font-size: 13px; color: var(--ink-soft); line-height: 18px; white-space: nowrap; overflow: hidden; }
.sb-ordago { position: absolute; inset: 8px; z-index: 2; display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 14px; border-radius: 20px; background: var(--surface); box-shadow: 0 8px 28px rgb(0 0 0 / 0.18); animation: sb-in 200ms var(--ease-out); }
.sb-ordago p { margin: 0; text-align: center; }
.sb-ordago-win { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sb-ordago-win .button { min-height: 52px; }
.sb-mid { display: grid; grid-template-columns: 76px minmax(0, 1fr) 76px; align-items: center; height: 68px; padding: 0 6px; background: var(--surface); border-block: 1px solid var(--line); }
.sb-mid-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 60px; border: 0; border-radius: 14px; background: none; color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.sb-mid-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.sb-mid-btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.sb-mid-info { display: flex; flex-direction: column; align-items: center; min-width: 0; text-align: center; }
.sb-mid-info b { font-size: 20px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sb-mid-info b small { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.sb-mid-info > small { max-width: 100%; font-size: 13px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; }
.sb-mid-info [data-offline]:not([hidden]) + .sb-last { display: none; }
.sb-mid-info .sb-warn { color: var(--warn); font-weight: 600; }
.sb-flash { max-width: 100%; font-size: 17px !important; white-space: normal !important; line-height: 1.2; color: var(--ink); animation: sb-in 220ms var(--ease-out); }
@keyframes sb-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

.sb-done .vs { margin-top: 8px; }

@media (prefers-reduced-motion: reduce) {
  .seat, .face-cell, .pick, .sb-lance, .sb-add { transition: none; }
  .sb-ordago, .sb-flash, .live-dot { animation: none; }
}
