/* CueScore tournaments: website widget, tournament page and TV screens. Colours can be set per widget
   (Elementor's Style tab sets these variables). */
.cst {
  --cst-accent: #1f8f4e;
  --cst-card: #ffffff;
  --cst-bg: #f4f7f5;
  --cst-text: #15241c;
  --cst-muted: #5f7468;
  --cst-line: #dbe5df;
  --cst-live: #d4302f;
  --cst-gold: #c48a12;
  /* Outside the cards, text takes the page's own colour (light or dark themes alike). */
  color: inherit;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  max-width: 100%;
}
.cst-card, .cst-list, .cst-facts div, .cst-champ, .cst-table, .cst-match, .cst-standings, .cst-b-match { color: var(--cst-text); }
.cst-full-head .cst-meta, .cst-tabs button, .cst-round h5, .cst-empty, .cst-loading, .cst-note,
.cst-results small, .cst-queue small, .cst-entries small, .cst-group h4 small, .cst-panel > h4 { color: inherit; opacity: .72; }
.cst-tabs button.on, .cst-panel > h4 { opacity: 1; }
.cst *, .cst *::before, .cst *::after { box-sizing: border-box; }
.cst h2, .cst h3, .cst h4, .cst h5, .cst p { margin: 0; }
.cst h4 { font-size: 1.05em; margin: 1.4em 0 .6em; }
.cst small { color: var(--cst-muted); }
.cst-loading, .cst-empty { color: var(--cst-muted); padding: 1em 0; }
.cst-muted { color: var(--cst-muted); }
.cst-tbc { color: var(--cst-muted); font-style: italic; }

.cst-badge { display: inline-flex; align-items: center; gap: .35em; font-size: .72em; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: .25em .6em; border-radius: 99px; background: var(--cst-line); color: var(--cst-text); white-space: nowrap; }
.cst-badge-live { background: var(--cst-live); color: #fff; }
.cst-badge-live i { width: .5em; height: .5em; border-radius: 50%; background: #fff; animation: cst-pulse 1.4s infinite; }
.cst-badge-upcoming { background: #e4eefa; color: #1d4f8a; }
.cst-badge-completed { background: #ece6d4; color: #6b5413; }
@keyframes cst-pulse { 50% { opacity: .25; } }

.cst-btn { display: inline-block; border: 0; border-radius: 8px; background: var(--cst-accent); color: #fff !important; font: inherit; font-weight: 600; font-size: .9em; padding: .55em 1em; cursor: pointer; text-decoration: none !important; }
.cst-btn:hover { filter: brightness(1.08); }
.cst-back { border: 0; background: none; color: var(--cst-accent); font: inherit; cursor: pointer; padding: 0 0 .6em; }

/* Cards and the compact list */
.cst-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.cst-card { background: var(--cst-card); border: 1px solid var(--cst-line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: .45em; }
.cst-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: .6em; }
.cst-card h3 { font-size: 1.15em; line-height: 1.25; }
.cst-card footer { margin-top: auto; padding-top: .6em; }
.cst-club { font-weight: 600; }
.cst-meta, .cst-stage { color: var(--cst-muted); font-size: .92em; }
.cst-live-n { color: var(--cst-live); font-weight: 700; font-size: .92em; }
.cst-winner { font-weight: 700; color: var(--cst-gold); }
.cst-progress { display: flex; flex-direction: column; gap: .25em; margin: .3em 0; }
.cst-bar { height: 6px; border-radius: 3px; background: var(--cst-line); overflow: hidden; }
.cst-bar span { display: block; height: 100%; background: var(--cst-accent); }
.cst-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--cst-line); border-radius: 12px; background: var(--cst-card); }
.cst-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--cst-line); flex-wrap: wrap; }
.cst-row:first-child { border-top: 0; }
.cst-row-main { display: flex; flex-wrap: wrap; align-items: center; gap: .2em .6em; min-width: 0; }
.cst-row-main small { flex-basis: 100%; }
.cst-row-side { display: flex; align-items: center; gap: .8em; }

/* One tournament */
.cst-full-head { margin-bottom: 12px; }
.cst-title { display: flex; flex-wrap: wrap; align-items: center; gap: .3em .7em; }
.cst-title h2 { font-size: 1.6em; line-height: 1.2; }
.cst-tabs { display: flex; gap: 4px; border-bottom: 1px solid rgba(127, 127, 127, .3); overflow-x: auto; scrollbar-width: none; margin-bottom: 16px; }
.cst-tabs::-webkit-scrollbar { display: none; }
.cst-tabs button { border: 0; background: none; font: inherit; font-weight: 600; color: var(--cst-muted); padding: .7em .9em; border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.cst-tabs button.on { border-bottom-color: var(--cst-accent); }
.cst-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 0 0 12px; }
.cst-facts div { background: var(--cst-card); border: 1px solid var(--cst-line); border-radius: 10px; padding: 10px 12px; }
.cst-facts dt { font-size: .78em; color: var(--cst-muted); text-transform: uppercase; letter-spacing: .06em; }
.cst-facts dd { margin: 0; font-weight: 600; }
.cst-champs { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.cst-champ { display: flex; align-items: center; gap: 10px; background: var(--cst-card); border: 1px solid var(--cst-gold); border-radius: 12px; padding: 8px 14px 8px 8px; }
.cst-champ small { display: block; font-size: .75em; text-transform: uppercase; letter-spacing: .06em; }
.cst-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.cst-table { background: var(--cst-card); border: 1px solid var(--cst-line); border-left: 4px solid var(--cst-line); border-radius: 8px; padding: 8px 12px; display: flex; flex-direction: column; font-size: .92em; }
.cst-table-in_use { border-left-color: var(--cst-live); }
.cst-table-assigned { border-left-color: var(--cst-accent); }
.cst-table em { font-style: normal; font-weight: 700; padding: 0 .3em; }
.cst-queue, .cst-results, .cst-entries { list-style: none; margin: 0; padding: 0; }
.cst-queue li { padding: 6px 0; border-top: 1px solid var(--cst-line); display: flex; flex-wrap: wrap; gap: .2em .6em; }
.cst-entries { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; }
.cst-entries li { display: flex; align-items: center; gap: 8px; }
.cst-entries li small { margin-left: auto; }
.cst-out { opacity: .55; text-decoration: line-through; }
.cst-av { display: inline-block; flex: none; width: 28px; height: 28px; border-radius: 50%; background: #d7e2db center/cover; vertical-align: middle; }
.cst-av-i { display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--cst-muted); }
.cst-hc { margin-left: .35em; font-size: .78em; color: var(--cst-accent) !important; font-weight: 700; }

/* Live matches */
.cst-live { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.cst-match { background: var(--cst-card); border: 1px solid var(--cst-line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.cst-match.is-live { border-color: var(--cst-live); }
.cst-match header { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; font-size: .9em; }
.cst-match footer { color: var(--cst-muted); font-size: .85em; }
.cst-match footer b { color: var(--cst-gold); }
.cst-side { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 8px; }
.cst-side.cst-turn { background: rgba(31, 143, 78, .1); box-shadow: inset 3px 0 0 var(--cst-accent); }
.cst-pn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cst-pts { font-size: 1.4em; min-width: 2ch; text-align: right; }
.cst-frames { display: flex; align-items: baseline; justify-content: center; gap: .5em; }
.cst-frames b { font-size: 1.2em; }
.cst-won { font-weight: 700; }
.cst-free p { color: var(--cst-muted); }

/* Standings */
.cst-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cst-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 0 20px; }
.cst-standings { width: 100%; border-collapse: collapse; background: var(--cst-card); font-size: .92em; min-width: 420px; }
.cst-standings th, .cst-standings td { padding: 7px 8px; text-align: center; border-bottom: 1px solid var(--cst-line); white-space: nowrap; }
.cst-standings th { font-size: .78em; color: var(--cst-muted); text-transform: uppercase; font-weight: 600; }
.cst-standings .cst-l { text-align: left; }
.cst-standings td.cst-l .cst-av { width: 22px; height: 22px; margin-right: 8px; font-size: 9px; }
.cst-standings tr.cst-q td:first-child { box-shadow: inset 4px 0 0 var(--cst-accent); }
.cst-note { font-size: .85em; color: var(--cst-muted); margin-top: 8px; }
.cst-q-key { display: inline-block; width: 10px; height: 10px; background: var(--cst-accent); border-radius: 2px; margin-right: 4px; }

/* Brackets: rounds side by side, scrolling sideways on small screens */
.cst-bracket { display: flex; gap: 28px; padding-bottom: 8px; min-width: max-content; }
.cst-round { display: flex; flex-direction: column; width: 220px; }
.cst-round h5 { font-size: .8em; text-transform: uppercase; letter-spacing: .06em; color: var(--cst-muted); margin: 0 0 8px; text-align: center; }
.cst-round-m { flex: 1; display: flex; flex-direction: column; justify-content: space-around; }
.cst-b-cell { padding: 6px 0; position: relative; }
.cst-round:not(.cst-last) .cst-b-cell::after { content: ""; position: absolute; right: -28px; top: 50%; width: 28px; border-top: 1px solid var(--cst-line); }
.cst-b-match { background: var(--cst-card); border: 1px solid var(--cst-line); border-radius: 8px; overflow: hidden; position: relative; font-size: .9em; }
.cst-b-match.is-live { border-color: var(--cst-live); }
.cst-b-row { display: flex; align-items: center; gap: 6px; padding: 6px 10px; }
.cst-b-row + .cst-b-row { border-top: 1px solid var(--cst-line); }
.cst-b-row b { margin-left: auto; }
.cst-b-row.cst-won { background: rgba(31, 143, 78, .08); }
.cst-b-tag { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-size: .7em; font-weight: 700; text-transform: uppercase; color: var(--cst-muted); background: var(--cst-card); padding: 0 4px; border-radius: 4px; }
.cst-b-live { color: var(--cst-live); }

/* Results */
.cst-results li { padding: 8px 0; border-top: 1px solid var(--cst-line); }
.cst-results li > div { display: flex; flex-wrap: wrap; gap: .3em .6em; align-items: baseline; }
.cst-fr { display: block; }
.cst-more { margin-top: 12px; }

/* The tournament's own page */
.cst-page { padding: 32px 16px 64px; }
.cst-page-inner { max-width: 1200px; margin: 0 auto; }

@media (max-width: 600px) {
  .cst-title h2 { font-size: 1.3em; }
  .cst-live, .cst-cards { grid-template-columns: 1fr; }
  .cst-round { width: 180px; }
}

/* ------------------------------------------------------------------ TV screens */
.cst-tv-body { margin: 0; min-height: 100vh; background: #07130e; overflow: hidden; }
.cst-tv {
  --cst-card: #0f2219; --cst-bg: #07130e; --cst-text: #f2f7f4; --cst-muted: #8fb3a1; --cst-line: #1f3a2c; --cst-accent: #38d27a; --cst-live: #ff5a4f; --cst-gold: #f2c14e;
  color: var(--cst-text); font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 1.25vw; padding: 1.6vw 2.2vw; min-height: 100vh; display: flex; flex-direction: column; gap: 1.2vw;
}
.cst-tv-head { display: flex; justify-content: space-between; align-items: baseline; gap: 2vw; color: var(--cst-muted); font-size: 1.4em; }
.cst-tv-head b { color: var(--cst-accent); letter-spacing: .04em; }
.cst-tv-head span:nth-child(2) { color: var(--cst-text); font-weight: 700; font-size: 1.3em; flex: 1; text-align: center; }
.cst-tv-main { flex: 1; min-height: 0; }
.cst-tv-msg { display: flex; align-items: center; justify-content: center; min-height: 60vh; font-size: 2.4em; color: var(--cst-muted); }
.cst-tv .cst-av { width: 2.4em; height: 2.4em; font-size: .8em; }
.cst-tv-over { display: grid; grid-template-columns: 1fr 26%; gap: 1.6vw; height: 100%; }
.cst-tv-over aside h3 { font-size: 1.1em; color: var(--cst-muted); text-transform: uppercase; letter-spacing: .1em; margin: .6em 0 .4em; }
.cst-tv-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(22vw, 1fr)); gap: 1vw; align-content: start; }
.cst-tv-live_tables .cst-tv-tables { grid-template-columns: repeat(auto-fill, minmax(30vw, 1fr)); }
.cst-tv .cst-match { border-radius: 1vw; padding: 1vw 1.2vw; }
.cst-tv .cst-pts { font-size: 2em; }
.cst-match-big { font-size: 1.35em; }
.cst-match-big .cst-pts { font-size: 2.4em !important; }
.cst-match-big .cst-frames b { font-size: 2em; }
.cst-tv-one { max-width: 70vw; margin: 0 auto; font-size: 2em; }
.cst-tv-frames { display: flex; flex-wrap: wrap; gap: .6em; justify-content: center; margin-top: 1em; font-size: .6em; color: var(--cst-muted); }
.cst-tv-frames span { background: var(--cst-card); border-radius: .6em; padding: .2em .8em; }
.cst-tv-bracket { overflow: hidden; }
.cst-tv-bracket h3 { color: var(--cst-muted); margin: 1em 0 .5em; text-transform: uppercase; letter-spacing: .1em; font-size: 1em; }
.cst-tv .cst-round { width: 15vw; }
.cst-tv .cst-bracket { gap: 2vw; }
.cst-tv .cst-round:not(.cst-last) .cst-b-cell::after { right: -2vw; width: 2vw; }
.cst-tv-groups .cst-groups { grid-template-columns: repeat(auto-fill, minmax(30vw, 1fr)); gap: 0 2vw; }
.cst-tv .cst-standings { min-width: 0; font-size: 1em; }
