/* The big screen for a monitor or projector (UPG-392).
 * SP-91: an official scoreboard, read from the back of a hall. A light page as
 * the public match page has it (the Cricbuzz-like reference), a dark score band,
 * one accent colour, no emoji, no badges in colour, plain sentences. */
:root { --tv-ink: #1B1F24; --tv-muted: #5B6470; --tv-line: #D9DCE1; --tv-soft: #F3F4F6; --tv-paper: #FFFFFF;
        --tv-accent: #0B6E4F; --tv-live: #C62828; --tv-won: #1E6B3F; }
body.tv { margin: 0; min-height: 100vh; background: var(--tv-soft); color: var(--tv-ink); font-family: 'Outfit', 'Mukta', sans-serif;
          overflow-x: hidden; }
.tv-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 24px;
           background: var(--tv-ink); color: #FFFFFF; border-bottom: 3px solid var(--tv-accent); }
.tv-head__title { display: flex; align-items: center; gap: 16px; font-size: clamp(18px, 2vw, 32px); font-weight: 700; flex-wrap: wrap; min-width: 0; }
.tv-head__right { display: flex; align-items: center; gap: 16px; }
.tv-head__time { font-size: clamp(16px, 1.6vw, 26px); font-variant-numeric: tabular-nums; color: #D5D9DF; }
.tv-btn { background: transparent; color: #FFFFFF; border: 1px solid #8A929C; border-radius: 6px; padding: 7px 12px; font-size: 14px; font-weight: 600; cursor: pointer; }
:fullscreen .tv-btn { display: none; }
.tv-main { padding: 16px 24px 24px; }
.tv-empty { font-size: 32px; text-align: center; padding: 20vh 0; color: var(--tv-muted); }
.tv-offline { position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); margin: 0; background: var(--tv-live); color: #fff;
              padding: 6px 14px; border-radius: 6px; font-size: 14px; }
.tv-offline[hidden] { display: none; }

.tv-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 900px) { .tv-grid { grid-template-columns: 1fr; } }
.tv-left, .tv-right { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
/* A live match: the score across the whole screen, the tables side by side under it (UPG-434) */
.tv-grid--live { grid-template-columns: minmax(0, 1fr); }
.tv-grid--live .tv-right { display: flex; flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
.tv-grid--live .tv-right > .tv-panel { flex: 1 1 440px; }          /* never narrower than its names: wraps instead */
.tv-grid--live .tv-table__team { white-space: nowrap; }              /* each name on one line */
.tv-grid--live .tv-left { display: contents; }                   /* the score, the tables, then the bracket */
.tv-grid--live .tv-right { order: 1; }
.tv-grid--live .tv-bracket { order: 2; }
.tv-grid--live .tv-table-key { flex-basis: 100%; order: 9; margin: 0; }

/* The match: a white card; the score in a dark band across it */
.tv-board { background: var(--tv-paper); border: 1px solid var(--tv-line); border-radius: 6px; overflow: hidden; }
.tv-board__meta { display: flex; align-items: center; gap: 12px; padding: 10px 20px; font-size: clamp(14px, 1.3vw, 22px);
                  color: var(--tv-muted); border-bottom: 1px solid var(--tv-line); }
.tv-board__meta .live-dot { background: none; border-radius: 0; padding: 0 10px 0 0; border-right: 1px solid var(--tv-line);
  color: var(--tv-live); font-size: inherit; font-weight: 700; letter-spacing: .06em; }
.tv-board__meta .tv-board__ft { padding-right: 10px; border-right: 1px solid var(--tv-line); font-weight: 700; letter-spacing: .06em; }
.tv-board__row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; text-align: center;
                 background: var(--tv-ink); color: #FFFFFF; padding: 18px 20px; }
.tv-board__logo { width: clamp(56px, 5vw, 100px); height: clamp(56px, 5vw, 100px); object-fit: contain; display: block; margin: 0 auto 6px;
                  background: #FFFFFF; border-radius: 6px; padding: 4px; }
.tv-board__name { overflow-wrap: break-word; hyphens: auto; font-size: clamp(20px, 2.4vw, 44px); font-weight: 700; line-height: 1.1; }
.tv-board__score { font-size: clamp(64px, 9vw, 180px); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: #FFFFFF; }
.tv-board__split { font-size: clamp(13px, 1.1vw, 20px); color: #C3C8CF; }
.tv-board__phase { font-size: clamp(14px, 1.4vw, 24px); text-transform: uppercase; letter-spacing: .08em; color: #C3C8CF; }
.tv-board__clock { font-size: clamp(36px, 4.5vw, 84px); font-weight: 700; font-variant-numeric: tabular-nums; color: #FFFFFF; }
.tv-board__left { font-size: clamp(16px, 1.6vw, 30px); font-weight: 600; font-variant-numeric: tabular-nums; color: #C3C8CF; }
.tv-board__left.is-up { color: #FF8A80; }
.tv-board__raid { display: inline-block; margin-top: 8px; padding: 3px 14px; border: 1px solid #8A929C; border-radius: 6px; color: #FFFFFF;
  font-size: clamp(18px, 2vw, 36px); font-weight: 700; font-variant-numeric: tabular-nums; }
.tv-board__raid.is-over { border-color: #FF8A80; color: #FF8A80; }

/* Under the band: who won, why the clock is stopped, the organisers' note, the mat */
.tv-board__result { text-align: center; font-size: clamp(22px, 2.4vw, 42px); font-weight: 700; color: var(--tv-won);
                    padding: 10px 20px; border-bottom: 1px solid var(--tv-line); }
.tv-board__ft { font-weight: 700; letter-spacing: .06em; color: var(--tv-ink); }
.tv-board__stop, .tv-board__note { margin: 10px 20px 0; padding: 8px 14px; border-left: 4px solid var(--tv-accent); background: var(--tv-soft);
  font-size: clamp(16px, 1.5vw, 26px); font-weight: 600; text-align: left; }
.tv-board__mat, .tv-board__shootout { text-align: center; font-size: clamp(16px, 1.5vw, 26px); font-weight: 600; margin: 10px 20px 0; }
.tv-board__mat--dod { color: #B42318; }
.tv-board .mat-host--tv { margin: 12px 20px 0; }
.mat-host--tv .mat-chip--yellow { background: #fef9c3; border-color: #facc15; }
.mat-host--tv .mat-chip--red { background: #fecaca; border-color: #ef4444; }
.mat-host--tv .mat-chip__left { display: block; font-style: normal; font-size: .7em; font-weight: 700; color: #92400e; }
.mat-host--tv .mat-box__label--card { color: #92400e; }
.match-tiebreak { font-size: .8em; opacity: .85; margin-top: 2px; }

/* The raids, as a commentary page lists them: the raid on the left, the sentence, the score on the right */
.tv-board__recent { list-style: none; padding: 0; margin: 14px 20px 18px; border-top: 1px solid var(--tv-line); }
.tv-board__recent li { display: grid; grid-template-columns: 7.5em minmax(0, 1fr) auto; align-items: baseline; gap: 16px;
  padding: 10px 4px; border-bottom: 1px solid var(--tv-line); font-size: clamp(15px, 1.35vw, 24px); }
.tv-board__recent li:first-child { font-weight: 600; }
.tv-board__recent .tv-c__no { font-weight: 700; color: var(--tv-muted); white-space: nowrap; }
.tv-board__recent li strong { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Between matches: up next, the last result, the champion */
.tv-cards { display: grid; gap: 16px; }
.tv-card { background: var(--tv-paper); border: 1px solid var(--tv-line); border-radius: 6px; padding: 18px 22px; }
.tv-card__label { font-size: clamp(14px, 1.2vw, 22px); text-transform: uppercase; letter-spacing: .06em; color: var(--tv-muted); }
.tv-card__big { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; font-size: clamp(26px, 3.2vw, 60px); font-weight: 700; margin-top: 6px; }
.tv-card__big img { object-fit: contain; }
.tv-card__v { color: var(--tv-muted); font-weight: 400; }
.tv-card__sub { font-size: clamp(14px, 1.2vw, 22px); color: var(--tv-muted); margin-top: 4px; }
[data-screen-last-result] { color: var(--tv-won); font-weight: 700; }
.tv-card--champion { border-top: 4px solid var(--tv-accent); }
.tv-card__result > div { display: flex; justify-content: space-between; font-size: clamp(22px, 2.4vw, 42px); padding: 2px 0; }
.tv-won { font-weight: 800; }

/* The tables */
.tv-panel { background: var(--tv-paper); border: 1px solid var(--tv-line); border-radius: 6px; padding: 12px 16px; }
.tv-panel__title { font-size: clamp(15px, 1.3vw, 22px); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 8px;
                   color: var(--tv-ink); border-left: 4px solid var(--tv-accent); padding-left: 8px; }
.tv-table { width: 100%; border-collapse: collapse; font-size: clamp(14px, 1.25vw, 22px); font-variant-numeric: tabular-nums; }
.tv-table th { text-align: left; font-weight: 600; color: var(--tv-muted); font-size: .8em; text-transform: uppercase; padding: 4px 6px;
               border-bottom: 2px solid var(--tv-line); }
.tv-table td { padding: 6px; border-top: 1px solid var(--tv-line); }
[data-screen-leaders] .tv-table td:first-child { width: 2.2em; color: var(--tv-muted); }
[data-screen-leaders] .tv-table td:last-child { width: 3em; text-align: right; }
.tv-table__team { display: flex; align-items: center; gap: 8px; overflow-wrap: break-word; }   /* whole words (UPG-434) */
.tv-table__team img { object-fit: contain; }
.tv-table__team small, .tv-leader__team { color: var(--tv-muted); }
.tv-leader__team { display: block; font-size: .75em; }
.tv-through td:first-child { box-shadow: inset 4px 0 0 var(--tv-won); }

/* The college logo and the audience's QR code (UPG-402) */
.tv-head__logo { height: clamp(28px, 3.6vw, 40px); width: auto; min-width: 120px; flex-shrink: 0; object-fit: contain; display: block; }
.tv-qr { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-size: clamp(12px, 1.1vw, 18px);
         font-weight: 600; line-height: 1.2; }
.tv-qr[hidden], .tv-head__watch[hidden] { display: none; }
.tv-head__title span { text-wrap: balance; }                   /* the whole event name, evenly over two lines if need be */
.tv-btn { white-space: nowrap; }
.tv-qr img { background: #fff; padding: 4px; border-radius: 4px; width: clamp(64px, 6vw, 110px); height: auto; }
/* How many watch the live match, at the top right, while one is live (UPG-435) */
.tv-watch { display: flex; align-items: center; gap: .45em; white-space: nowrap; font-size: clamp(16px, 1.5vw, 26px); line-height: 1; }
.tv-watch__live { color: #FF8A80; font-weight: 700; font-size: .75em; letter-spacing: .08em; }
.tv-watch .fa-eye { color: #C3C8CF; }
.tv-watch strong { color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }
.tv-watch__label { color: #C3C8CF; font-weight: 500; }

/* The table's letters in one line (UPG-425) */
.tv-table-key { margin: -4px 0 12px; font-size: clamp(11px, .85vw, 15px); color: var(--tv-muted); }

/* On a phone (UPG-457): the header fits, the QR (for other phones) and Full screen go, the cards wrap */
@media (max-width: 640px) {
  .tv-head { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
  .tv-head__title { flex: 1 1 100%; min-width: 0; gap: 8px; font-size: 17px; line-height: 1.2; }
  .tv-head__logo { height: 24px; min-width: 120px; }
  .tv-head__right { flex: 1 1 100%; justify-content: space-between; gap: 8px; }
  .tv-qr, .tv-btn[data-fullscreen] { display: none; }
  .tv-head__time { font-size: 14px; }
  .tv-main { padding: 12px; }
  .tv-card__big { font-size: 21px; gap: 8px; }
  .tv-card__big img { display: none; }                         /* the names wrap cleanly without them */
  .tv-board__row { gap: 8px; padding: 12px; }
  .tv-board__logo { width: 40px; height: 40px; }
  .tv-board__name { font-size: 16px; }
  .tv-board__score { font-size: 56px; }
  .tv-board__split { font-size: 11px; }
  .tv-board__clock { font-size: 30px; }
  .tv-board__recent { margin: 12px; }
  .tv-board__recent li { grid-template-columns: 1fr auto; gap: 4px 10px; }
  .tv-board__recent .tv-c__no { grid-column: 1 / -1; }
}

/* SP-15: on a phone the tables take the width and wrap a long name, never wider than the screen */
@media (max-width: 600px) {
  .tv-grid--live .tv-right > .tv-panel { flex-basis: 100%; min-width: 0; }
  .tv-grid--live .tv-table__team { white-space: normal; }
}

/* SP-57: "Scored on MittiToMat" on a free tournament's big screen */
.scored-on { margin: 0.5rem 0 0; font-size: 0.9rem; color: var(--tv-muted); text-align: center; }
.scored-on a { color: inherit; font-weight: 700; }
