/* ===================== GullySport — Tournament UI ===================== */

/* ---------- Hero ---------- */
.t-hero {
  padding: 44px 0 34px;
  background: linear-gradient(160deg, rgba(237, 96, 27,0.07), rgba(224, 54, 44,0.05));
  border-bottom: 1px solid var(--line, rgba(0,0,0,0.08));
}
.t-hero-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 24px; flex-wrap: wrap;
}
.t-hero-meta { font-size: 0.95rem; color: var(--ink-dim); }

/* ---------- Branded hero ----------
   The default hero is dark text on a pale wash. Once a tournament's own colours
   are painted behind it, that text becomes unreadable — so `is-branded` flips the
   whole block to white and adds a scrim for contrast. Applied by applyBranding()
   only when real branding exists, so unbranded tournaments keep the light look. */
.t-hero.is-branded,
.t-hero.is-branded .t-hero-meta,
.t-hero.is-branded h1 { color: #fff; }

.t-hero.is-branded { position: relative; border-bottom: none; }

/* Sits between the banner image and the text. Without it, a busy photo makes
   white text unreadable no matter which colours were chosen. */
.t-hero.is-branded::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.10), rgba(0,0,0,0.42));
  pointer-events: none;
}
.t-hero.is-branded > .container { position: relative; z-index: 1; }

.t-hero.is-branded .badge {
  background: rgba(255,255,255,0.92); color: #1a1a1a; border-color: transparent;
}
/* Fact cards stay solid white with dark text: translucent cards over a banner
   photo left white text unreadable. */
.t-hero.is-branded .t-fact { background: #fff; border-color: transparent; }
.t-hero.is-branded .t-fact .k { color: #4A5B74; }
.t-hero.is-branded .t-fact .v { color: #063163; }
.t-hero.is-branded .t-fact.urgent { background: #FFF6E0; border-color: rgba(246, 178, 30,0.6); }
.t-hero.is-branded .form-note { color: rgba(255,255,255,0.85); }

.t-brand-head { display: flex; align-items: flex-start; gap: 18px; }

.t-logo {
  width: 78px; height: 78px; flex: none; object-fit: contain;
  background: rgba(255,255,255,0.94); border-radius: 16px; padding: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.16);
}

.t-tagline {
  font-size: 1.02rem; font-weight: 600; margin: 0 0 6px;
  color: rgba(255,255,255,0.94); max-width: 60ch;
}
.t-hero:not(.is-branded) .t-tagline { color: var(--ink-soft, #444); }

@media (max-width: 560px) {
  .t-brand-head { gap: 12px; }
  .t-logo { width: 56px; height: 56px; border-radius: 12px; }
}

.t-champion {
  padding: 16px 26px; border-radius: 16px;
  background: linear-gradient(135deg, #F6B21E, #F6B21E);
  color: #241a04; text-align: center; min-width: 190px;
  box-shadow: 0 10px 30px rgba(245,181,68,0.35);
}
.t-champion-label {
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.12em;
  text-transform: uppercase; opacity: 0.75;
}
.t-champion-name { font-size: 1.2rem; font-weight: 900; margin-top: 3px; }

.t-facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin: 22px 0 4px;
}
.t-fact {
  padding: 13px 16px; border-radius: 12px;
  background: rgba(255,255,255,0.7); border: 1px solid var(--line, rgba(0,0,0,0.08));
}
.t-fact .k {
  font-size: 0.66rem; font-weight: 800; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--ink-dim); margin-bottom: 4px;
}
.t-fact .v { font-size: 0.95rem; font-weight: 700; }
.t-fact.urgent { border-color: rgba(246, 178, 30,0.5); background: rgba(246, 178, 30,0.08); }

/* ---------- Tabs ---------- */
.t-tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line, rgba(0,0,0,0.08));
  margin-top: 26px;
}
.t-tab {
  padding: 11px 18px; border: 0; background: none; cursor: pointer;
  font-family: inherit; font-size: 0.9rem; font-weight: 700;
  color: var(--ink-dim); border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.t-tab:hover { color: var(--ink); }
.t-tab.active { color: var(--violet); border-bottom-color: var(--violet); }

/* ---------- Fixtures ---------- */
.t-round { margin-bottom: 30px; }
.t-round-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.t-round-head h3 { margin: 0; font-size: 1.05rem; }
.t-round-head .line { flex: 1; height: 1px; background: var(--line, rgba(0,0,0,0.1)); }

.t-match {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 14px; padding: 16px 20px; margin-bottom: 10px;
  background: var(--bg-panel, #fff); border: 1px solid var(--line, rgba(0,0,0,0.08));
  border-radius: 14px;
}
.t-match.done { border-color: rgba(14, 159, 110,0.35); }
.t-side { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.t-side.right { text-align: right; align-items: flex-end; }
.t-side .name {
  font-weight: 750; font-size: 0.98rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.t-side .name.win { color: var(--teal, #0E9F6E); }
.t-side .name.tbd { color: var(--ink-faint, #9ca3af); font-style: italic; font-weight: 600; }
.t-side .score { font-size: 0.86rem; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.t-vs {
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em;
  color: var(--ink-faint, #9ca3af); text-transform: uppercase;
}
.t-match-foot {
  grid-column: 1 / -1; display: flex; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; padding-top: 10px; margin-top: 4px;
  border-top: 1px dashed var(--line, rgba(0,0,0,0.08));
  font-size: 0.82rem; color: var(--ink-dim);
}
.t-match-foot .summary { font-weight: 700; color: var(--teal, #0E9F6E); }

/* ---------- Bracket ---------- */
.t-bracket { display: flex; gap: 30px; overflow-x: auto; padding-bottom: 14px; }
.t-bracket-col { display: flex; flex-direction: column; justify-content: space-around; gap: 14px; min-width: 210px; }
.t-bracket-col h4 {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-dim); margin-bottom: 4px; text-align: center;
}
.t-bnode {
  border: 1px solid var(--line, rgba(0,0,0,0.08)); border-radius: 10px;
  overflow: hidden; background: var(--bg-panel, #fff); font-size: 0.85rem;
}
.t-bteam {
  padding: 8px 12px; display: flex; justify-content: space-between; gap: 8px;
}
.t-bteam + .t-bteam { border-top: 1px solid var(--line, rgba(0,0,0,0.08)); }
.t-bteam.win { background: rgba(14, 159, 110,0.10); font-weight: 750; }
.t-bteam .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-bteam .s { color: var(--ink-dim); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.t-bteam.tbd { color: var(--ink-faint, #9ca3af); font-style: italic; }

/* ---------- Teams ---------- */
.t-teamcard { break-inside: avoid; }
.t-players { list-style: none; margin-top: 12px; display: grid; gap: 6px; }
.t-players li {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 0.85rem; padding: 6px 0;
  border-bottom: 1px dashed var(--line, rgba(0,0,0,0.07));
}
.t-players li:last-child { border-bottom: 0; }
.t-players .pn { font-weight: 650; }
.t-players .pr { color: var(--ink-dim); font-size: 0.8rem; text-align: right; }
.t-cap {
  display: inline-block; padding: 1px 7px; border-radius: 100px; margin-left: 6px;
  font-size: 0.64rem; font-weight: 800; letter-spacing: 0.04em;
  background: rgba(237, 96, 27,0.14); color: var(--violet, #ED601B);
}
.t-cap.vc { background: rgba(224, 54, 44,0.14); color: var(--pink, #E0362C); }

/* ---------- Registration modal ---------- */
.t-modal {
  display: none; position: fixed; inset: 0; z-index: 300;
  background: rgba(15,10,30,0.7); backdrop-filter: blur(6px);
  padding: 22px; overflow-y: auto;
}
.t-modal.open { display: block; }
.t-modal-box {
  max-width: 860px; margin: 34px auto;
  background: var(--bg-panel, #fff); border: 1px solid var(--line-strong, rgba(0,0,0,0.14));
  border-radius: 20px; padding: 30px;
  box-shadow: 0 26px 70px rgba(0,0,0,0.3);
}
.t-modal-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 22px;
}

.t-player-row {
  display: grid; grid-template-columns: 26px 1.4fr 1fr 1fr 1fr auto auto;
  gap: 8px; align-items: center; margin-bottom: 8px;
}
.t-player-row .idx {
  font-size: 0.78rem; color: var(--ink-dim); font-weight: 700; text-align: center;
}
.t-player-row input, .t-player-row select { padding: 9px 11px; font-size: 0.85rem; }
.t-player-row .capbtn {
  padding: 7px 10px; border-radius: 8px; cursor: pointer; font-family: inherit;
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.03em;
  border: 1px solid var(--line-strong, rgba(0,0,0,0.14));
  background: transparent; color: var(--ink-dim); white-space: nowrap;
}
.t-player-row .capbtn.on { background: rgba(237, 96, 27,0.14); color: var(--violet, #ED601B); border-color: rgba(237, 96, 27,0.4); }
.t-player-row .capbtn.vc.on { background: rgba(224, 54, 44,0.14); color: var(--pink, #E0362C); border-color: rgba(224, 54, 44,0.4); }
.t-player-row .rm {
  background: none; border: 0; cursor: pointer; color: var(--ink-faint, #9ca3af);
  font-size: 1.1rem; padding: 0 4px;
}
.t-player-row .rm:hover { color: var(--crimson, #E0362C); }
.t-player-row .hdr {
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-dim); font-weight: 800;
}

.t-squad-count { margin-top: 10px; font-size: 0.84rem; color: var(--ink-dim); }
.t-squad-count.ok { color: var(--teal, #0E9F6E); font-weight: 700; }
.t-squad-count.bad { color: var(--crimson, #E0362C); font-weight: 700; }

@media (max-width: 860px) {
  .t-player-row {
    grid-template-columns: 1fr 1fr; gap: 6px;
    padding: 12px; margin-bottom: 12px;
    border: 1px solid var(--line, rgba(0,0,0,0.08)); border-radius: 12px;
  }
  .t-player-row .idx { grid-column: 1 / -1; text-align: left; }
  .t-player-row .hdr { display: none; }
  .t-match { grid-template-columns: 1fr; gap: 8px; }
  .t-side.right { text-align: left; align-items: flex-start; }
  .t-vs { display: none; }
}

/* Share result — appears only on completed matches.
   WhatsApp green rather than the GullySport palette: this button is a promise
   about where the tap goes, and borrowing the destination's colour is clearer
   than being on-brand.
   NOT the #25D366 brand green — white on it measures 1.98, and even WhatsApp's
   own darker teal #128C7E only reaches 4.14. #188844 is that green darkened
   until white clears AA at 4.52. Still unmistakably WhatsApp, actually legible. */
.t-share {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 12px; padding: 11px 16px;
  border: 0; border-radius: 999px;
  background: #188844; color: #fff;
  font-weight: 800; font-size: 0.85rem; font-family: inherit;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}
.t-share:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(24, 136, 68, 0.32); }
.t-share:disabled { opacity: 0.6; cursor: default; }

/* ---------- Per-player performance grid ----------
   Built for a phone held at the edge of a ground, not a desk. Columns are as
   narrow as a two-digit number allows, rows are thumb-height, and the running
   points total sits at the end of each row so a mistyped 420 is obvious before
   it is saved rather than after it reaches a public leaderboard. */
.perf-team { margin-bottom: 22px; }
.perf-team-name {
  font-size: 0.95rem; margin-bottom: 8px; color: var(--ink);
  border-bottom: 2px solid var(--border-strong); padding-bottom: 6px;
}
.perf-head, .perf-row {
  display: grid;
  grid-template-columns: minmax(96px, 1.6fr) repeat(auto-fit, minmax(52px, 1fr)) 46px;
  gap: 6px; align-items: center;
}
.perf-head {
  font-size: 0.66rem; font-weight: 800; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-dim);
  padding: 0 2px 6px;
}
.perf-row { padding: 4px 0; border-bottom: 1px solid var(--border); }
.perf-row:last-child { border-bottom: 0; }
.perf-name {
  font-size: 0.86rem; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.perf-input {
  width: 100%; padding: 9px 6px; text-align: center;
  font-variant-numeric: tabular-nums; font-weight: 700;
  border-radius: 8px; font-size: 0.9rem;
}
/* Spinners steal width and nobody taps them on a phone. */
.perf-input::-webkit-outer-spin-button,
.perf-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.perf-input { -moz-appearance: textfield; }
.perf-pts {
  text-align: right; font-variant-numeric: tabular-nums;
  font-weight: 900; font-size: 0.9rem; color: var(--ink-dim);
}
@media (max-width: 560px) {
  .perf-head, .perf-row { grid-template-columns: minmax(78px, 1.3fr) repeat(auto-fit, minmax(44px, 1fr)) 40px; gap: 4px; }
  .perf-name { font-size: 0.8rem; }
  .perf-input { padding: 8px 3px; font-size: 0.85rem; }
}

/* ---------- Player profile ----------
   Pro-sports layout: a large portrait beside a name block and a band of career
   numbers. On a phone it stacks, portrait first, because that is the thing a
   coach scrolling a list is scanning for. */
.pf-hero {
  position: relative; overflow: hidden;
  background: var(--grad-dark); color: var(--bg-page);
  border-radius: 20px; padding: 0;
  box-shadow: var(--shadow-lg);
}
.pf-hero::after {                   /* the sun, matching the share card */
  content: ""; position: absolute; top: -90px; right: -60px;
  width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(246, 178, 30,0.45), transparent 68%);
  pointer-events: none;
}
.pf-hero-grid {
  position: relative; display: grid;
  grid-template-columns: 200px 1fr; gap: 26px; align-items: center;
  padding: 26px;
}
.pf-portrait {
  width: 200px; height: 240px; border-radius: 16px; object-fit: cover;
  background: rgba(255,255,255,0.08); display: block;
}
/* Initials stand in when there is no photo — which is always the case for
   under-18s. It has to look intentional, not like a broken image. */
.pf-initials {
  width: 200px; height: 240px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, rgba(255,255,255,0.14), rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.14);
  font-size: 3.6rem; font-weight: 900; color: var(--marigold);
  letter-spacing: -0.02em;
}
.pf-name { font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 900; letter-spacing: -0.02em; color: #fff; line-height: 1.1; margin: 0; }
.pf-sub  { font-size: 0.95rem; color: #C9D3E8; margin-top: 6px; }
.pf-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pf-chip {
  font-size: 0.74rem; font-weight: 800; letter-spacing: 0.04em;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(255,255,255,0.12); color: var(--marigold);
  border: 1px solid rgba(246, 178, 30,0.3);
}
.pf-bio { margin-top: 16px; font-size: 0.95rem; color: #DCE4F2; line-height: 1.6; max-width: 54ch; }

/* Career numbers band */
.pf-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 1px; background: var(--border); border-radius: 16px; overflow: hidden;
  margin-top: 20px; border: 1px solid var(--border);
}
.pf-stat { background: var(--surface); padding: 16px 12px; text-align: center; }
.pf-stat .n {
  font-variant-numeric: tabular-nums; font-weight: 900;
  font-size: 1.7rem; line-height: 1; color: var(--ink);
}
.pf-stat .l {
  font-size: 0.64rem; font-weight: 800; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-dim); margin-top: 7px;
}
.pf-stat--hero .n { color: var(--violet); font-size: 2rem; }

/* Recent form */
.pf-form-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px;
  align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.pf-form-row:last-child { border-bottom: 0; }
.pf-form-fig { font-variant-numeric: tabular-nums; font-size: 0.85rem; color: var(--ink-soft); }
.pf-form-pts { font-variant-numeric: tabular-nums; font-weight: 900; color: var(--violet); }

@media (max-width: 720px) {
  .pf-hero-grid { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 22px 18px; }
  .pf-portrait, .pf-initials { width: 160px; height: 192px; }
  .pf-chips { justify-content: center; }
  .pf-bio { text-align: left; }
}

/* ---------- Team & organizer pages ----------
   Shares the profile hero so a team, a player and an organizer read as the same
   family of page rather than three different products. */
.ent-hero {
  position: relative; overflow: hidden;
  background: var(--grad-dark); color: var(--bg-page);
  border-radius: 20px; padding: 30px 28px;
  box-shadow: var(--shadow-lg);
}
.ent-hero::after {
  content: ""; position: absolute; top: -90px; right: -60px;
  width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle, rgba(246, 178, 30,0.42), transparent 68%);
  pointer-events: none;
}
.ent-hero > * { position: relative; }
.ent-name { font-size: clamp(1.8rem, 5vw, 2.5rem); font-weight: 900; letter-spacing: -0.02em; color: #fff; line-height: 1.1; }
.ent-sub { font-size: 0.95rem; color: #C9D3E8; margin-top: 8px; }

/* Head-to-head result rows */
.h2h { border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--surface); }
.h2h-row {
  display: grid; grid-template-columns: 1fr auto;
  gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.h2h-row:last-child { border-bottom: 0; }
.h2h-row--won { box-shadow: inset 3px 0 0 var(--win); }
.h2h-row--lost { box-shadow: inset 3px 0 0 var(--sindoor); }
.h2h-opp { font-weight: 700; color: var(--ink); font-size: 0.95rem; }
.h2h-meta { font-size: 0.78rem; color: var(--ink-dim); margin-top: 3px; }
.h2h-score {
  text-align: right; font-variant-numeric: tabular-nums;
  font-weight: 900; font-size: 1rem; color: var(--ink); white-space: nowrap;
}
.h2h-verdict { font-size: 0.74rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; margin-top: 3px; }
.h2h-verdict--won { color: var(--cyan); }
.h2h-verdict--lost { color: var(--pink); }

/* Squad list */
.squad { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.squad-item { background: var(--surface); padding: 13px 15px; }
.squad-item .n { font-weight: 700; color: var(--ink); font-size: 0.92rem; }
.squad-item .m { font-size: 0.76rem; color: var(--ink-dim); margin-top: 2px; }

/* ---------- Modal & toolbar, for PUBLIC pages ----------
   These class names were borrowed from admin/css/admin.css when the rewards and
   leaderboard pages were written — but public pages don't load admin.css.
   .modal-overlay was therefore undefined, which meant the claim dialog was not
   hidden but PERMANENTLY VISIBLE, sitting inline in the page.
   ...
   Defined here, in a stylesheet the public pages actually load. Same names, so
   the markup is unchanged and the admin panel is untouched. */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: none; align-items: flex-start; justify-content: center;
  background: rgba(6, 49, 99, 0.55);
  backdrop-filter: blur(3px);
  padding: 40px 18px; overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--surface); border-radius: 18px;
  padding: 30px 28px; width: 100%; max-width: 560px;
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
}
.modal-box h3 { margin-bottom: 14px; }
.modal-close-row {
  display: flex; gap: 12px; justify-content: flex-end;
  margin-top: 22px; flex-wrap: wrap;
}

.admin-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 18px;
}
.admin-toolbar .filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.admin-toolbar select { width: auto; min-width: 190px; }

@media (max-width: 560px) {
  .modal-overlay { padding: 18px 12px; }
  .modal-box { padding: 22px 18px; }
  .modal-close-row { justify-content: stretch; }
  .modal-close-row .btn { flex: 1; justify-content: center; }
}

/* Prize money call-out in the hero (GS-11). Sits beside the champion box.
   Indigo on marigold-tint: the prize is the headline, so it gets contrast,
   but it mustn't compete with the Champions box once a winner exists. */
.t-prize {
  padding: 14px 22px; border-radius: 16px;
  background: #fff7e0; border: 2px solid var(--marigold, #F6B21E);
  color: var(--ink, #063163); text-align: center; min-width: 190px;
}
.t-prize-label {
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.12em;
  text-transform: uppercase; opacity: 0.7;
}
.t-prize-main { font-size: 1.25rem; font-weight: 900; margin-top: 3px; }
.t-prize-sub { font-size: 0.8rem; font-weight: 600; margin-top: 4px; opacity: 0.85; }
