/* PLAY Table Tennis — site styles
   Palette taken from the table itself: table blue, the white lines,
   the dark court around it, and red rubber for actions. */
:root {
  --court: #0F2747;
  --court-2: #16325A;
  --table: #1F5BA8;
  --table-deep: #184C8F;
  --line: #FFFFFF;
  --chalk: #F3F5F8;
  --paper: #FFFFFF;
  --ink: #13202F;
  --muted: #586A80;
  --rule: #D8DFE8;
  --rubber: #D7262E;
  --rubber-deep: #B51D24;
  --focus: #FFB020;

  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;

  --wrap: 1140px;
  --gutter: clamp(16px, 4vw, 40px);
  --r-sm: 4px;
  --r-md: 10px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--chalk);
  color: var(--ink);
  font: 400 17px/1.6 var(--body);
}
img, iframe { max-width: 100%; display: block; }
a { color: var(--table); text-underline-offset: 3px; }
a:hover { color: var(--table-deep); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.005em;
  margin: 0 0 .5em;
  color: var(--court);
}
h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); }
h2 { font-size: clamp(2rem, 3.6vw, 2.8rem); }
h3 { font-size: 1.6rem; }
h4 { font-size: 1.25rem; }
p { margin: 0 0 1em; max-width: 68ch; }

.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- Header ---------- */
.site-header { background: var(--paper); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 50; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--court); }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand span { font: 700 1.55rem/1 var(--display); }
.brand span b { color: var(--rubber); font-weight: 800; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { font: 600 1.08rem/1 var(--display); color: var(--court); text-decoration: none; padding: 10px 12px; border-radius: var(--r-sm); }
.nav a:hover { background: var(--chalk); }
.nav a[aria-current="page"] { color: var(--table); box-shadow: inset 0 -3px 0 var(--table); border-radius: 0; }
.nav .btn { margin-left: 8px; }
.nav-toggle { display: none; background: none; border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 8px 12px; font: 600 1rem/1 var(--display); color: var(--court); cursor: pointer; }

@media (max-width: 880px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 68px; background: var(--paper); flex-direction: column; align-items: stretch; padding: 8px var(--gutter) 16px; border-bottom: 1px solid var(--rule); }
  .nav.open { display: flex; }
  .nav a { padding: 14px 4px; border-bottom: 1px solid var(--chalk); }
  .nav a[aria-current="page"] { box-shadow: inset 4px 0 0 var(--table); padding-left: 12px; }
  .nav .btn { margin: 12px 0 0; text-align: center; }
}

/* ---------- Logo ---------- */
.brand img { height: 54px; width: auto; display: block; }
.site-footer .brand { display: inline-block; background: #fff; padding: 8px 14px; border-radius: var(--r-md); }
.site-footer .brand img { height: 64px; }
@media (max-width: 880px) { .brand img { height: 48px; } }

/* ---------- Buttons ---------- */
.btn { display: inline-block; font: 700 1.1rem/1 var(--display); letter-spacing: .01em; text-decoration: none; padding: 13px 20px; border-radius: var(--r-sm); border: 2px solid transparent; cursor: pointer; }
.btn-primary { background: var(--rubber); color: #fff; }
.btn-primary:hover { background: var(--rubber-deep); color: #fff; }
.btn-line { border-color: currentColor; color: inherit; background: transparent; }
.btn-line:hover { background: rgba(255,255,255,.12); color: inherit; }
.btn-small { padding: 9px 14px; font-size: 1rem; }
.nav .btn-primary { color: #fff; padding: 11px 16px; }
.nav .btn-primary:hover { background: var(--rubber-deep); }

/* ---------- Hero: the table, seen from above ---------- */
.hero { background: var(--court); padding: clamp(20px, 4vw, 48px) 0; }
.table-top {
  position: relative;
  background: var(--table);
  border: 5px solid var(--line);
  border-radius: 3px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 460px;
  box-shadow: 0 30px 60px -30px rgba(0,0,0,.6);
  overflow: hidden;
}
/* centre line (doubles) */
.table-top::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 3px; background: rgba(255,255,255,.55); transform: translateY(-50%); }
/* net */
.table-top::after {
  content: ""; position: absolute; top: -5px; bottom: -5px; left: 50%; width: 10px; transform: translateX(-50%);
  background: repeating-linear-gradient(0deg, #e9eef5 0 2px, #2a3b52 2px 5px);
  border-left: 2px solid #fff; border-right: 2px solid #fff;
}
.half { position: relative; z-index: 1; padding: clamp(24px, 4vw, 52px); color: #fff; }
.half:first-child { padding-right: clamp(32px, 5vw, 64px); }
.half:last-child { padding-left: clamp(32px, 5vw, 64px); }
.hero h1 { color: #fff; max-width: 11ch; }
.hero .lede { font-size: 1.2rem; color: #E3ECF8; max-width: 36ch; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero h2 { color: #fff; font-size: 1.7rem; margin-bottom: 14px; }

.ball { position: absolute; z-index: 2; width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0 40%, #e4e7ec 75%, #c9ced6); box-shadow: 4px 8px 10px rgba(0,0,0,.28); left: 90%; bottom: 7%; }
@media (prefers-reduced-motion: no-preference) {
  .ball { animation: rally 1.6s cubic-bezier(.45,.05,.4,1) .4s both; }
  @keyframes rally {
    0%   { left: 8%; bottom: 7%; transform: scale(1); }
    50%  { transform: scale(1.35); }
    100% { left: 90%; bottom: 7%; transform: scale(1); }
  }
}

@media (max-width: 820px) {
  .table-top { grid-template-columns: 1fr; min-height: 0; }
  .table-top::before, .table-top::after { display: none; }
  .half:last-child { border-top: 10px solid transparent; border-image: repeating-linear-gradient(90deg, #e9eef5 0 2px, #2a3b52 2px 5px) 10; }
  .half:first-child, .half:last-child { padding: 28px 22px 40px; }
  .half:last-child { padding-top: 40px; }
  .ball { display: none; }
}

/* ---------- Page header (inner pages) ---------- */
.page-head { background: var(--table); color: #fff; border-bottom: 5px solid var(--line); position: relative; overflow: hidden; }
.page-head::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 10px; background: repeating-linear-gradient(0deg, #e9eef5 0 2px, #2a3b52 2px 5px); border-left: 2px solid #fff; }
.page-head .wrap { padding: clamp(36px, 6vw, 64px) 0 clamp(28px, 4vw, 44px); }
.page-head h1 { color: #fff; margin-bottom: .2em; }
.page-head p { color: #E3ECF8; font-size: 1.15rem; margin: 0; }

/* ---------- Sections ---------- */
.section { padding: clamp(48px, 7vw, 88px) 0; }
.section.alt { background: var(--paper); border-block: 1px solid var(--rule); }
.section.dark { background: var(--court); color: #DDE6F2; }
.section.dark h2, .section.dark h3 { color: #fff; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.section-head h2 { margin: 0; }
.section-head p { margin: 6px 0 0; color: var(--muted); }
.dark .section-head p { color: #A9BBD3; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(28px, 4vw, 56px); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
@media (max-width: 820px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- Fixtures (upcoming events) ---------- */
.fixtures { list-style: none; margin: 0; padding: 0; }
.fixture { display: grid; grid-template-columns: 62px 1fr auto; gap: 14px; align-items: center; padding: 14px 0; border-top: 1px solid rgba(255,255,255,.28); }
.fixture:first-child { border-top: 0; padding-top: 0; }
.fixture .day { text-align: center; font-family: var(--display); line-height: 1; background: var(--line); color: var(--court); border-radius: var(--r-sm); padding: 7px 0 6px; }
.fixture .day b { display: block; font-size: 1.8rem; }
.fixture .day small { font-size: .9rem; font-weight: 600; }
.fixture h3 { font-size: 1.22rem; margin: 0 0 2px; color: inherit; }
.fixture h3 a { color: inherit; text-decoration: none; }
.fixture h3 a:hover { text-decoration: underline; }
.fixture p { margin: 0; font-size: .95rem; opacity: .85; }
.fixture .fee { font: 700 1.25rem/1 var(--display); white-space: nowrap; }
.light .fixture { border-top-color: var(--rule); }
.light .fixture .day { background: var(--table); color: #fff; }
.light .fixture p { color: var(--muted); opacity: 1; }
.light .fixture .fee { color: var(--court); }

/* ---------- Scoreboard ---------- */
.scoreboard { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; background: #07162B; border: 2px solid #07162B; border-radius: var(--r-md); overflow: hidden; }
.score { background: var(--court-2); padding: 22px 22px 18px; }
.score h3 { font-size: 1.15rem; color: #A9BBD3; font-weight: 600; margin: 0 0 10px; }
.digits { display: flex; gap: 4px; }
.digits span { font: 700 clamp(2.4rem, 5vw, 3.6rem)/1 var(--display); color: #fff; background: #0A1C36; border-radius: 4px; padding: 6px 7px 4px; min-width: .9em; text-align: center; position: relative; font-variant-numeric: tabular-nums; }
.digits span::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(0,0,0,.55); }
.score .prev { margin: 12px 0 0; font-size: .98rem; }
.score .prev b { color: #fff; }
.score .up { color: #7FD6A4; font-weight: 600; }
@media (max-width: 560px) { .fixture { grid-template-columns: 54px 1fr auto; align-items: start; } }
@media (max-width: 720px) { .scoreboard { grid-template-columns: 1fr; } }

/* ---------- Level ladder ---------- */
.ladder { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rung { display: grid; grid-template-columns: 170px 1fr 70px; gap: 16px; align-items: center; }
.rung .name { font: 700 1.2rem/1.1 var(--display); color: inherit; }
.rung .name small { display: block; font: 500 .9rem/1.3 var(--body); opacity: .75; }
.rung .bar { height: 18px; background: rgba(255,255,255,.08); border-radius: 2px; overflow: hidden; }
.rung .bar i { display: block; height: 100%; background: var(--line); border-radius: 2px; }
.rung:last-child .bar i { background: var(--rubber); }
.rung .count { font: 700 1.5rem/1 var(--display); text-align: right; font-variant-numeric: tabular-nums; color: #fff; }
@media (max-width: 560px) { .rung { grid-template-columns: 1fr 60px; } .rung .bar { grid-column: 1 / -1; order: 3; } }

/* ---------- Steps ---------- */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.steps li { counter-increment: s; border-top: 3px solid var(--court); padding-top: 18px; }
.steps li::before { content: counter(s); font: 800 3rem/1 var(--display); color: var(--table); display: block; margin-bottom: 8px; }
.steps h3 { margin-bottom: 6px; }
.steps p { color: var(--muted); }
@media (max-width: 820px) { .steps { grid-template-columns: 1fr; } }

/* ---------- Venue ---------- */
.venue { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; display: grid; grid-template-columns: 1.1fr 1fr; }
.venue-body { padding: clamp(22px, 3vw, 36px); }
.venue dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0 0 22px; }
.venue dt { font: 700 1.05rem/1.5 var(--display); color: var(--muted); }
.venue dd { margin: 0; }
.venue iframe { width: 100%; height: 100%; min-height: 320px; border: 0; }
.schedule { align-self: start; list-style: none; padding: 0; margin: 0 0 22px; border: 1px solid var(--rule); border-radius: var(--r-sm); }
.schedule li { display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--rule); align-items: baseline; }
.schedule li:first-child { border-top: 0; }
.schedule b { font: 700 1.15rem/1 var(--display); color: var(--court); }
.schedule span { color: var(--muted); font-size: .95rem; }
.schedule em { font-style: normal; font: 700 1.1rem/1 var(--display); }
@media (max-width: 820px) { .venue { grid-template-columns: 1fr; } .schedule li { grid-template-columns: 1fr auto; } .schedule li span { grid-column: 1 / -1; } }

.notice { border-left: 4px solid var(--rubber); background: var(--paper); padding: 14px 18px; border-radius: 0 var(--r-sm) var(--r-sm) 0; }

/* ---------- Tiers (about page) ---------- */
.tiers { display: grid; gap: 0; }
.tier { display: grid; grid-template-columns: 260px 1fr; gap: clamp(20px, 4vw, 56px); padding: 40px 0; border-top: 1px solid var(--rule); }
.tier:first-child { border-top: 0; padding-top: 0; }
.tier aside h2 { margin-bottom: 8px; }
.tier .levels { font: 700 1.1rem/1 var(--display); color: var(--table); }
.tier .checklist { list-style: none; padding: 0; margin: 0 0 1em; }
.tier .checklist li { padding-left: 26px; position: relative; margin-bottom: 6px; }
.tier .checklist li::before { content: ""; position: absolute; left: 4px; top: .6em; width: 10px; height: 10px; border-radius: 50%; background: var(--table); }
@media (max-width: 820px) { .tier { grid-template-columns: 1fr; } }

.pull { font: 600 clamp(1.4rem, 2.6vw, 1.9rem)/1.25 var(--display); color: var(--court); max-width: 30ch; }

/* ---------- Data tables ---------- */
.tools { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.tools input, .tools select { font: 500 1rem/1 var(--body); padding: 11px 12px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--paper); color: var(--ink); min-width: 0; }
.tools input { flex: 1 1 240px; }
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-md); }
table.data { width: 100%; border-collapse: collapse; font-size: .98rem; }
table.data th { text-align: left; font: 700 1.02rem/1.2 var(--display); color: var(--muted); padding: 12px 14px; border-bottom: 2px solid var(--rule); white-space: nowrap; }
table.data td { padding: 12px 14px; border-top: 1px solid var(--rule); vertical-align: top; }
table.data tr:first-child td { border-top: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .date { white-space: nowrap; color: var(--muted); }
table.data .venue-cell { color: var(--muted); font-size: .92rem; }
table.data a { font-weight: 600; text-decoration: none; }
table.data a:hover { text-decoration: underline; }
.lvl { display: inline-block; font: 700 .85rem/1 var(--display); background: var(--chalk); color: var(--table); border: 1px solid var(--rule); padding: 3px 6px 2px; border-radius: 3px; margin-left: 6px; vertical-align: 1px; }
table.data tr.podium-1 td:first-child { color: var(--rubber); }
table.data td.pos { font: 700 1.2rem/1 var(--display); width: 48px; }

/* ---------- Level-up feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.feed li { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 10px 12px; }
.feed .to { font: 800 1.9rem/1 var(--display); color: var(--table); text-align: center; }
.feed .to small { display: block; font: 600 .7rem/1 var(--body); color: var(--muted); margin-bottom: 2px; }
.feed b { display: block; font-weight: 600; line-height: 1.25; }
.feed time { font-size: .88rem; color: var(--muted); }
.dark .feed li { background: var(--court-2); border-color: #23426E; }
.dark .feed .to { color: #fff; }
.dark .feed time, .dark .feed .to small { color: #A9BBD3; }

.video { aspect-ratio: 16 / 9; width: 100%; border: 0; border-radius: var(--r-md); background: #000; }

/* ---------- Rankings ---------- */
.rank-feature { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 40px; }
.rank-feature a { display: block; text-decoration: none; background: var(--paper); border: 1px solid var(--rule); border-top: 5px solid var(--table); border-radius: var(--r-sm); padding: 20px; color: var(--ink); }
.rank-feature a:hover { border-top-color: var(--rubber); }
.rank-feature h3 { margin-bottom: 4px; }
.rank-feature p { color: var(--muted); margin: 0; font-size: .96rem; }
.series-list { columns: 3 240px; column-gap: 32px; list-style: none; padding: 0; margin: 0; }
.series-list li { break-inside: avoid; padding: 7px 0; border-bottom: 1px solid var(--rule); }
.series-list a { text-decoration: none; font-weight: 500; }
.series-list a:hover { text-decoration: underline; }
@media (max-width: 820px) { .rank-feature { grid-template-columns: 1fr; } }

/* ---------- Tournament detail ---------- */
.meta-line { color: #E3ECF8; font-size: 1.1rem; }
.stat-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; margin: 0; }
.stat-list div { background: var(--paper); padding: 14px 16px; }
.stat-list dt { font-size: .9rem; color: var(--muted); }
.stat-list dd { margin: 2px 0 0; font: 700 1.8rem/1 var(--display); color: var(--court); }
.division { margin-top: 28px; }
.division h3 { border-bottom: 3px solid var(--court); padding-bottom: 6px; }
.round { margin: 16px 0 6px; font: 700 1rem/1 var(--display); color: var(--muted); }
.matches { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px; }
.matches li { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 8px 12px; font-size: .95rem; }
.matches li .a { text-align: right; }
.matches li .s { font: 700 1.05rem/1 var(--display); background: var(--court); color: #fff; padding: 4px 7px 3px; border-radius: 3px; font-variant-numeric: tabular-nums; }
.matches .won { font-weight: 700; }
.matches li .s.lu { background: #1E8E4E; }
.extra-html { margin-top: 28px; }
.extra-html img { height: auto; }

/* ---------- States ---------- */
.state { color: var(--muted); padding: 18px 0; }
.dark .state, .hero .state { color: #C9D7EA; }
.state a { font-weight: 600; }
.sample-badge { display: inline-block; font: 600 .82rem/1 var(--body); background: #FFF3D6; color: #6B4A00; border: 1px solid #F0D58C; padding: 5px 8px; border-radius: 3px; margin-top: 10px; }
.skeleton { display: block; height: 14px; border-radius: 3px; background: linear-gradient(90deg, rgba(127,140,160,.18), rgba(127,140,160,.32), rgba(127,140,160,.18)); margin: 10px 0; }

/* ---------- Footer ---------- */
.site-footer { background: var(--court); color: #A9BBD3; padding: 56px 0 28px; font-size: .97rem; }
.site-footer .cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.site-footer h4 { color: #fff; margin-bottom: 10px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: #DDE6F2; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer .brand span { color: #fff; }
.site-footer .legal { border-top: 1px solid #23426E; margin-top: 40px; padding-top: 18px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; font-size: .9rem; }
@media (max-width: 820px) { .site-footer .cols { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
