/* Live tournament composition and state-specific betting controls. */
:root {
  --bet-option-ink: #041118;
  --bet-live-color: #f4cb58;
  --bet-surface: color-mix(in srgb, var(--text) 4%, var(--ink));
  --bet-line: color-mix(in srgb, var(--edge) 45%, transparent);
}
.event-grid > [data-betting-tournament] { display: block; container-type: inline-size; }
.pixel-card.tournament-summary.is-live { padding: 24px; box-shadow: inset 0 0 0 2px var(--bet-live-color); }
.tournament-summary-main { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(180px, .9fr) auto; align-items: center; gap: 24px; }
.tournament-live-layout { display: none; }
.tournament-summary.is-live .tournament-summary-main { grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; }
.tournament-summary.is-live .tournament-winner-slot { display: none; }
.tournament-summary.is-live .event-summary-info { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.tournament-summary.is-live .event-card-title { order: 0; margin: 0; }
.tournament-summary.is-live .event-card-top { order: 1; margin: 0; }
.tournament-summary.is-live .event-card-top .results-eyebrow { display: none; }
.tournament-summary.is-live .event-date { order: 2; flex-basis: 100%; font-size: 12px; }
.tournament-summary.is-live .event-card-footer { justify-self: end; }
.tournament-summary.is-live .event-status { display: inline-flex; align-items: center; gap: 6px; color: var(--bet-live-color); background: var(--bet-option-ink); font-size: 11px; }
.tournament-summary.is-live .event-status::before { content: ''; width: 5px; height: 5px; background: currentColor; }
.tournament-summary.is-live .tournament-live-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px; align-items: stretch; margin-top: 20px; }
.tournament-live-right { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 20px; min-width: 0; }
.live-stream-panel { min-width: 0; margin-bottom: 16px; }
.live-stream-view { display: grid; place-items: center; aspect-ratio: 16 / 9; background: var(--bet-option-ink); min-width: 0; }
.live-stream-view > .event-meta { padding: 24px; text-align: center; }
.live-stream-view iframe { width: 100%; height: 100%; border: 0; }
.live-stream-selectors { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(130px, 100%), 1fr)); gap: 8px; margin-top: 12px; }
.live-stream-selector { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px; border: 1px solid var(--bet-line); background: var(--bet-surface); color: var(--text); font: inherit; font-size: 12px; cursor: pointer; }
.live-stream-selector span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-stream-selector .player-head { flex-shrink: 0; }
.live-stream-selector[aria-pressed='true'], .live-stream-selector:hover { border-color: var(--edge); background: color-mix(in srgb, var(--edge) 18%, var(--ink)); }
.live-stream-selector:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.tournament-live-left { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 20px; min-width: 0; container-type: inline-size; }
.live-games-panel, .live-teams-panel { min-width: 0; }
.live-teams-panel { align-self: stretch; padding: 16px; background: var(--bet-surface); border-left: 1px solid var(--bet-line); }
.live-games-panel { padding: 16px; border: 1px solid var(--bet-line); }
.live-section-title { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0 0 14px; font-size: 15px; color: var(--text); }
.live-roster-caption { font-size: 11px; font-weight: 400; color: var(--muted); }
.live-game-list { display: grid; gap: 14px; margin: 0 0 0 9px; padding: 0 0 0 20px; list-style: none; border-left: 1px solid var(--bet-line); }
.live-game-list:has(> .event-meta:only-child) { margin: 0; padding: 0; border: 0; }
.live-game-list > .event-meta { font-size: 13px; }
.live-game-entry { position: relative; min-width: 0; font-size: 14px; }
.live-game-position { position: absolute; left: -30px; top: 0; display: grid; place-items: center; width: 18px; height: 22px; background: var(--ink); color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.live-game-map { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.live-team-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.live-team-list .event-team { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 12px; min-width: 0; padding: 12px; background: var(--bet-surface); }
.live-team-list .event-winner-team { grid-column: 1; grid-row: 1; gap: 10px; }
.live-team-list .team-emblem { flex-basis: 30px; width: 30px; height: 30px; font-size: 11px; }
.live-team-list .event-team-label strong { font-size: 15px; }
.live-team-list .event-team-meta { display: contents; }
.live-team-list .event-team-heads { grid-column: 1; grid-row: 2; margin-left: 40px; }
.live-team-list .event-team-score { grid-column: 2; grid-row: 1 / 3; display: flex; flex-direction: column-reverse; align-items: flex-end; justify-content: center; gap: 2px; margin: 0; font-size: 10px; color: var(--muted); }
.live-team-list .event-team-score strong { color: var(--text); font-size: 23px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tournament-live-reveal { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows 220ms ease, visibility 0s linear 220ms; }
.tournament-summary.is-live .tournament-live-reveal { grid-template-rows: 1fr; visibility: inherit; transition-delay: 0s; }
.live-game-entry > div { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-height: 24px; }
.live-game-entry .live-game-map { flex-basis: 100%; }
.live-game-placeholder { color: var(--muted); font-size: 12px; }
.live-game-entry.is-placeholder { padding-block: 4px; }
.live-game-voting { display: inline-block; flex: 0 0 20px; width: 20px; height: 20px; background: var(--bet-live-color); mask: url('/static/images/community-vote.svg') center / contain no-repeat; font-size: 0; }
.tournament-summary { isolation: isolate; }
.tournament-live-content { min-height: 0; overflow: hidden; }
.bet-question { min-width: 0; }
.bet-question:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }
.bet-question [hidden] { display: none !important; }
.bet-question-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 16px; margin-bottom: 16px; }
.bet-question-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
.bet-question-heading .bet-section-label { flex-basis: 100%; }
.bet-question-heading .bet-phase, .bet-question-heading .bet-clock { flex-shrink: 0; }
.bet-section-label, .bet-info-label { display: block; font-size: 11px; line-height: 1.4; color: var(--muted); }
.bet-section-label { margin-bottom: 4px; }
.bet-question-title { margin: 0; color: var(--text); font-size: 22px; line-height: 1.3; font-weight: 600; overflow-wrap: anywhere; }
.bet-question-info { display: grid; justify-items: end; gap: 8px; }
.bet-question-info .bet-clock { font-size: 28px; line-height: 1; }
.bet-pool { display: grid; justify-items: end; gap: 2px; text-align: right; }
.bet-money { display: inline-flex; align-items: center; gap: 5px; min-width: 0; font-variant-numeric: tabular-nums; }
.bet-money strong { font-size: 18px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.bet-phase { padding: 5px 8px; border: 1px solid var(--bet-line); font-size: 11px; line-height: 1.4; color: var(--muted); }
.bet-question[data-phase='finished'] .bet-phase { color: var(--bet-live-color); background: var(--bet-option-ink); border-color: transparent; }
.bet-clock { color: var(--text); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bet-clock.is-urgent { padding-bottom: 2px; border-bottom: 2px solid var(--bet-live-color); }
.bet-variants { display: flex; flex-wrap: wrap; gap: 12px; }
.bet-option { position: relative; display: grid; flex: 1 1 200px; align-content: start; gap: 12px; min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--bet-line); border-top: 3px solid var(--bet-option-color); background: var(--bet-surface); }
.bet-option-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.bet-option-name { min-width: 0; margin: 0; font-size: 16px; line-height: 1.4; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.bet-option-totals { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.bet-option-totals .bet-money strong { font-size: 15px; }
.bet-option-percentage { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bet-option-track { height: 3px; overflow: hidden; background: color-mix(in srgb, var(--text) 7%, transparent); }
.bet-option-fill { display: block; width: var(--bet-share, 0%); height: 100%; background: var(--bet-option-color); transition: width 200ms ease-out; }
.bet-option-controls { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.bet-amount-field { display: flex; flex: 1; align-items: center; gap: 6px; min-width: 0; padding-right: 10px; border: 1px solid var(--bet-line); background: var(--ink); }
.bet-amount-field:focus-within { outline: 2px solid var(--text); outline-offset: 2px; }
.bet-amount-field input { min-width: 0; width: 100%; height: 40px; padding: 8px 10px; border: 0; outline: 0; background: transparent; color: var(--text); font: 500 16px/1 var(--font-ui); }
.bet-option .pixel-button { --button-face-color: color-mix(in srgb, var(--bet-option-color) 50%, white); --button-base-color: var(--depth); color: var(--bet-option-ink); min-height: 40px; }
.bet-option .menu-button-content { min-height: 40px; }
.bet-option [disabled] { opacity: .55; cursor: not-allowed; }
.bet-option.is-selected { background: color-mix(in srgb, var(--bet-option-color) 8%, var(--ink)); }
.bet-your-choice { justify-self: start; color: var(--text); font-size: 12px; font-weight: 600; }
.bet-winner-mark { display: inline-flex; align-items: center; gap: 5px; padding: 3px 6px; background: var(--bet-option-ink); color: var(--bet-live-color); font-size: 11px; white-space: nowrap; }
.bet-trophy-icon { display: inline-block; flex: 0 0 24px; width: 24px; height: 24px; background: currentColor; mask: url('/static/images/bet-trophy.svg') center / contain no-repeat; -webkit-mask: url('/static/images/bet-trophy.svg') center / contain no-repeat; transform-origin: center 80%; }
.bet-winner-mark .bet-trophy-icon { flex-basis: 20px; width: 20px; height: 20px; }
.bet-option.is-winning { border-color: var(--bet-live-color); }
.bet-option.is-winning .bet-trophy-icon { animation: bet-trophy-cheer 900ms ease-in-out 3; }
.bet-win-sparks { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.bet-win-spark { position: absolute; left: 50%; top: 65%; width: 4px; height: 4px; background: var(--bet-live-color); opacity: 0; }
.bet-option.is-winning .bet-win-spark { animation: bet-spark-burst 1000ms ease-out var(--spark-delay) both; }
.bet-personal { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 16px 24px; align-items: center; margin-top: 12px; padding: 16px; background: var(--bet-surface); border-left: 3px solid var(--edge); }
.bet-personal-win { border-left-color: var(--bet-live-color); animation: bet-payout-reveal 400ms ease-out; }
.bet-personal-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bet-personal-identity > .bet-trophy-icon { color: var(--bet-live-color); flex-basis: 28px; width: 28px; height: 28px; }
.bet-personal-title { display: block; font-size: 15px; line-height: 1.4; }
.bet-personal-choice { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.bet-breakdown { display: flex; flex-wrap: wrap; gap: 12px 20px; margin: 0; }
.bet-breakdown > div { min-width: 0; }
.bet-breakdown dt { color: var(--muted); font-size: 11px; }
.bet-breakdown dd { margin: 3px 0 0; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.bet-personal-credit { text-align: right; }
.bet-personal-credit .bet-money strong { font-size: 24px; }
.bet-question-footer { display: flex; flex-wrap: wrap; align-items: start; justify-content: space-between; gap: 12px 20px; margin-top: 14px; }
.bet-action-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; min-width: 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
.bet-action-hint .pixel-button { max-width: 100%; }
.bet-action-hint .menu-button-content { white-space: normal; line-height: 1.3; }
.bet-available { display: inline-flex; align-items: center; gap: 8px; }
.bet-available .bet-money strong { font-size: 13px; color: var(--text); }
.bet-hint-copy { font-size: 12px; }
.pixel-card .bet-feedback { margin: 12px 0 0; padding: 10px 12px; border-left: 3px solid var(--bet-live-color); background: var(--bet-surface); color: var(--text); font-size: 13px; line-height: 1.5; }
.bet-question-waiting { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.bet-question-waiting .bet-question-title { font-size: 17px; }
.pixel-card .bet-waiting-copy { margin: 5px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.bet-viewing-reward { padding: 6px 8px; border: 1px solid var(--bet-line); color: var(--muted); font-size: 12px; }
@keyframes bet-trophy-cheer { 0%, 100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-3px) rotate(-10deg); } 65% { transform: translateY(-3px) rotate(10deg); } }
@keyframes bet-spark-burst { 0% { opacity: 0; transform: translate(0, 0); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--spark-x), -60px) rotate(90deg); } }
@keyframes bet-payout-reveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@container (max-width: 720px) {
  .tournament-summary.is-live .tournament-live-layout { grid-template-columns: minmax(0, 1fr); }
  .bet-personal { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
  .bet-personal-credit { grid-column: 2; grid-row: 1 / 3; }
  .bet-breakdown { grid-column: 1; }
}
@container (max-width: 420px) {
  .bet-personal { grid-template-columns: minmax(0, 1fr); }
  .bet-personal-credit { grid-column: 1; grid-row: auto; text-align: left; }
  .bet-option { flex-basis: 100%; }
  .live-roster-caption { display: none; }
}
@media (max-width: 799px) {
  .tournament-summary-main { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .tournament-summary.is-live .tournament-summary-main { grid-template-columns: minmax(0, 1fr) auto; }
}
@media (max-width: 420px) {
  .tournament-summary.is-live .tournament-summary-main { grid-template-columns: minmax(0, 1fr); }
  .tournament-summary.is-live .event-card-footer { justify-self: start; }
  .pixel-card.tournament-summary.is-live { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .tournament-live-reveal, .bet-option-fill { transition: none; }
  .bet-option.is-winning .bet-trophy-icon, .bet-option.is-winning .bet-win-spark, .bet-personal-win { animation: none; }
}
