/* =========================================================
   Padel Murah Meriah — Dashboard Turnamen
   Mobile-first. Warna mengikuti logo (navy + biru).
   ========================================================= */
:root {
  --navy: #0a2a6b;
  --navy-2: #0d3a8f;
  --blue: #1565d8;
  --sky: #2196f3;
  --sky-soft: #e3effe;
  --bg: #eef3fb;
  --card: #ffffff;
  --text: #0f1b33;
  --muted: #5d6b85;
  --line: #dbe4f3;
  --live: #e53935;
  --live-soft: #fdecec;
  --ok: #138a4c;
  --ok-soft: #e6f6ed;
  --warn: #c98200;
  --warn-soft: #fff5de;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(10, 42, 107, .06), 0 4px 14px rgba(10, 42, 107, .06);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --nav-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
}
body.public { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
a { color: var(--blue); text-decoration: none; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pad { padding: 12px 16px; margin: 0; }
.ico { width: 20px; height: 20px; flex: none; }

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 16px; }
section { margin-bottom: 22px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px;
  background: linear-gradient(100deg, var(--navy) 0%, var(--navy-2) 60%, var(--blue) 100%);
  color: #fff;
  box-shadow: 0 2px 10px rgba(10, 42, 107, .25);
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; min-width: 0; }
.brand img { width: 44px; height: 44px; border-radius: 50%; background: #fff; object-fit: contain; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-site { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 20px; letter-spacing: .3px; text-transform: uppercase; line-height: 1; }
.brand-tour { font-size: 12.5px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.refresh-dot { width: 9px; height: 9px; border-radius: 50%; background: #7fd1a4; box-shadow: 0 0 0 3px rgba(127, 209, 164, .25); flex: none; transition: background .2s; }
.refresh-dot.busy { background: #ffd54f; box-shadow: 0 0 0 3px rgba(255, 213, 79, .3); }
.refresh-dot.err { background: #ff8a80; }

/* ---------- Bottom nav ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff; border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(10, 42, 107, .08);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11.5px; font-weight: 600;
}
.bottomnav a .ico { width: 23px; height: 23px; }
.bottomnav a.active { color: var(--blue); }
.bottomnav a.active .ico { stroke-width: 2.4; }

/* ---------- Typography blocks ---------- */
.page-title { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 30px; text-transform: uppercase; color: var(--navy); margin: 2px 0 14px; letter-spacing: .3px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-title { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 700; font-size: 21px; text-transform: uppercase; color: var(--navy); letter-spacing: .3px; }
.link { font-size: 13px; font-weight: 600; white-space: nowrap; }
.day-head { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 14px 2px 2px; grid-column: 1 / -1; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: radial-gradient(circle at 100% 0%, rgba(33, 150, 243, .55), transparent 55%), linear-gradient(135deg, var(--navy), var(--navy-2));
  color: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.hero h1 { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 32px; text-transform: uppercase; margin-top: 8px; letter-spacing: .3px; }
.hero-sub { margin: 4px 0 0; opacity: .85; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: rgba(255, 255, 255, .16); letter-spacing: .3px; }
.chip-live { background: var(--live); }
.progress-wrap { margin-top: 16px; }
.progress-label { display: flex; justify-content: space-between; font-size: 12.5px; opacity: .9; margin-bottom: 6px; }
.progress { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .18); overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, #64b5f6, #fff); border-radius: 99px; }

.announce { display: flex; gap: 10px; align-items: flex-start; background: var(--warn-soft); border: 1px solid #f3dca2; border-radius: var(--radius); padding: 12px 14px; font-size: 14px; }
.announce-ico { font-size: 18px; line-height: 1.2; }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-family: var(--display); font-weight: 700; font-size: 20px; text-transform: uppercase; color: var(--navy); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .4px; background: #eef1f6; color: var(--muted); white-space: nowrap; }
.badge-live { background: var(--live); color: #fff; }
.badge-live i { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.2s infinite; }
.badge-done { background: var(--ok-soft); color: var(--ok); }
.badge-up { background: var(--sky-soft); color: var(--blue); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* ---------- Court grid (beranda) ---------- */
.court-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.court-card { display: flex; flex-direction: column; background: var(--card); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); color: var(--text); border: 2px solid transparent; min-height: 118px; }
.court-card.is-live { border-color: var(--live); }
.cc-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 6px; }
.cc-name { white-space: nowrap; font-family: var(--display); font-weight: 700; font-size: 18px; text-transform: uppercase; color: var(--navy); }
.cc-next { white-space: nowrap; font-size: 11px; color: var(--muted); font-weight: 600; }
.cc-teams { flex: 1; }
.cc-row { display: flex; justify-content: space-between; gap: 6px; font-size: 13.5px; font-weight: 600; padding: 2px 0; }
.cc-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-row b { font-family: var(--display); font-size: 18px; line-height: 1; color: var(--navy); white-space: nowrap; }
.cc-foot { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.cc-empty { color: var(--muted); font-size: 13px; margin: auto 0; }
.tbd { color: var(--muted); font-style: italic; font-weight: 500; }

/* ---------- Match card ---------- */
.match-list { display: grid; gap: 10px; }
.match-card { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px; border-left: 4px solid var(--line); }
.match-card.status-live { border-left-color: var(--live); background: linear-gradient(90deg, var(--live-soft), #fff 40%); }
.match-card.status-finished { border-left-color: var(--ok); }
.match-card.status-scheduled { border-left-color: var(--sky); }
.mc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.mc-meta { font-size: 12px; color: var(--muted); }
.mc-meta b { color: var(--navy); font-size: 13px; }
.mc-team { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; }
.mc-team + .mc-team { border-top: 1px dashed var(--line); }
.mc-name { display: flex; flex-direction: column; min-width: 0; }
.tn { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-team.win .tn { color: var(--navy); font-weight: 700; }
.mc-team.win .tn::after { content: ' ✓'; color: var(--ok); }
.mc-team.lose { opacity: .65; }
.mc-score { display: flex; gap: 4px; flex: none; }
.mc-score .set { min-width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; background: #f1f4f9; font-family: var(--display); font-weight: 700; font-size: 19px; color: var(--muted); }
.mc-score .set.w { background: var(--navy); color: #fff; }
.match-list.compact { padding: 10px; background: #f6f8fc; gap: 8px; }

/* ---------- Tabs / chips / filters ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin: 0 -16px 10px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 10px; background: #fff; color: var(--navy); font-weight: 700; font-size: 14px; box-shadow: var(--shadow); }
.tabs a small { font-size: 11px; font-weight: 700; background: var(--sky-soft); color: var(--blue); border-radius: 6px; padding: 0 6px; }
.tabs a.active { background: var(--navy); color: #fff; }
.tabs a.active small { background: rgba(255, 255, 255, .2); color: #fff; }
.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-f { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 13px; font-weight: 600; }
.chip-f.active { border-color: var(--blue); background: var(--sky-soft); color: var(--blue); }
.myteam { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #fff; border-radius: 12px; padding: 8px 12px; box-shadow: var(--shadow); font-size: 13.5px; }
.myteam label { font-weight: 600; color: var(--navy); }
.myteam select { flex: 1; min-width: 160px; }
.myteam .chk { font-weight: 500; color: var(--muted); display: flex; align-items: center; gap: 5px; }
select, input, textarea, button { font: inherit; }
select { padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--text); }

/* sorotan tim saya */
.mine { outline: 2px solid #ffb300; outline-offset: -2px; }
.match-card.mine, .court-card .mine { box-shadow: 0 0 0 2px #ffb300, var(--shadow); outline: none; }
tr.mine td { background: #fff8e1 !important; }
.bm-team.mine { background: #fff3c4; }
.only-mine .match-card:not(.mine) { display: none; }
.only-mine .day-head { display: none; }

/* ---------- Standings ---------- */
.group-grid { display: grid; gap: 4px; }
.table-scroll { overflow-x: auto; }
table.standings { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.standings th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; padding: 8px 6px; text-align: center; background: #f6f8fc; }
.standings td { padding: 9px 6px; text-align: center; border-top: 1px solid var(--line); white-space: nowrap; }
.standings .c-team { text-align: left; white-space: normal; min-width: 120px; max-width: 220px; }
.standings .c-team .tn, .standings .c-team .tp { display: block; }
.standings .c-pos { width: 34px; padding-left: 10px; }
.standings .c-pts { font-size: 15px; color: var(--navy); padding-right: 12px; }
.pos { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; border-radius: 6px; background: #eef1f6; font-weight: 700; font-size: 12px; }
tr.zone-q td:first-child { box-shadow: inset 4px 0 0 var(--ok); }
tr.zone-q .pos { background: var(--ok); color: #fff; }
tr.zone-maybe td:first-child { box-shadow: inset 4px 0 0 var(--warn); }
tr.zone-maybe .pos { background: var(--warn); color: #fff; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.lg-q { background: var(--ok); }
.lg-maybe { background: var(--warn); }
.group-matches { margin: -8px 0 16px; background: #fff; border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.group-matches summary { cursor: pointer; padding: 10px 16px; font-size: 13px; font-weight: 600; color: var(--blue); list-style: none; }
.group-matches summary::-webkit-details-marker { display: none; }
.group-matches summary::before { content: '▸ '; }
.group-matches[open] summary::before { content: '▾ '; }
.tb-info { padding: 14px 16px; }
.tb-info h3 { font-family: var(--display); font-size: 19px; text-transform: uppercase; color: var(--navy); margin-bottom: 6px; }
.tb-info ol { margin: 6px 0; padding-left: 22px; font-size: 14px; }

/* ---------- Bracket ---------- */
.hint-scroll { margin: -4px 0 8px; }
.bracket-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px 12px; -webkit-overflow-scrolling: touch; }
.bracket { display: flex; min-width: max-content; }
.round { display: flex; flex-direction: column; width: 186px; flex: none; }
.round-title { font-family: var(--display); font-weight: 700; font-size: 16px; text-transform: uppercase; color: #fff; background: var(--navy); border-radius: 8px; text-align: center; padding: 5px 8px; margin-bottom: 10px; letter-spacing: .4px; }
.round-matches { display: flex; flex-direction: column; flex: 1; }
.bm-wrap { flex: 1; display: flex; align-items: center; position: relative; padding: 6px 0; }
.bm { width: 100%; background: #fff; border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; border: 1px solid var(--line); }
.bm.status-live { border-color: var(--live); box-shadow: 0 0 0 1px var(--live), var(--shadow); }
.bm.status-bye { opacity: .55; }
.bm-meta { display: flex; justify-content: space-between; align-items: center; font-size: 10.5px; color: var(--muted); padding: 3px 8px; background: #f6f8fc; min-height: 20px; }
.bm-team { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 6px 8px; font-size: 13px; font-weight: 600; }
.bm-team + .bm-team { border-top: 1px solid var(--line); }
.bm-team .bn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-team .bs { display: flex; gap: 6px; font-family: var(--display); font-size: 16px; font-weight: 700; color: var(--muted); }
.bm-team.win { background: var(--sky-soft); }
.bm-team.win .bn, .bm-team.win .bs { color: var(--navy); }
.bm-team.tbd .bn { color: var(--muted); font-style: italic; font-weight: 500; font-size: 12px; }
/* garis penghubung: keluar dari kanan kotak, vertikal di tengah celah, masuk ke kotak babak berikutnya */
.bracket { gap: 14px; }
.round + .round { width: 200px; }
.round + .round .round-title { margin-left: 14px; }
.round + .round .bm-wrap { padding-left: 14px; background: linear-gradient(#b8c6e0, #b8c6e0) no-repeat 0 50% / 14px 2px; }
.round:not(:last-child) .bm-wrap::after { content: ''; position: absolute; right: -14px; top: 50%; width: 14px; border-top: 2px solid #b8c6e0; }
.round:not(:last-child) .bm-wrap:nth-child(odd)::before { content: ''; position: absolute; right: -14px; top: 50%; height: calc(50% + 1px); border-right: 2px solid #b8c6e0; }
.round:not(:last-child) .bm-wrap:nth-child(even)::before { content: ''; position: absolute; right: -14px; top: 0; height: calc(50% + 1px); border-right: 2px solid #b8c6e0; }
.third-place { max-width: 220px; margin-top: 16px; }

/* ---------- Ads ---------- */
.ad-slot { position: relative; margin-bottom: 22px; border-radius: var(--radius); overflow: hidden; background: #fff; box-shadow: var(--shadow); }
.ad-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.ad-track::-webkit-scrollbar { display: none; }
.ad-item { flex: 0 0 100%; scroll-snap-align: start; aspect-ratio: 3 / 1; display: flex; align-items: center; justify-content: center; background: #fff; }
.ad-item a, .ad-item img { display: block; width: 100%; height: 100%; }
.ad-item img { object-fit: contain; }
.ad-dots { position: absolute; bottom: 6px; left: 0; right: 0; display: flex; justify-content: center; gap: 5px; }
.ad-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(10, 42, 107, .25); transition: all .2s; }
.ad-dots i.on { background: var(--blue); width: 16px; border-radius: 3px; }
.ad-tag { position: absolute; top: 6px; right: 6px; font-size: 10px; background: rgba(0, 0, 0, .45); color: #fff; padding: 1px 6px; border-radius: 4px; }
.ad-empty { aspect-ratio: 3 / 1; display: flex; align-items: center; justify-content: center; text-align: center; border: 2px dashed #b8c6e0; background: repeating-linear-gradient(-45deg, #f7faff, #f7faff 10px, #eef4ff 10px, #eef4ff 20px); box-shadow: none; }
.ad-empty b { display: block; font-family: var(--display); font-style: italic; font-size: 22px; color: var(--navy); letter-spacing: 1px; }
.ad-empty span { font-size: 13px; color: var(--muted); padding: 0 12px; display: block; }

/* ---------- Podium ---------- */
.podium { padding: 14px 16px; background: linear-gradient(135deg, #fffbea, #fff); }
.podium-grid { display: grid; gap: 8px; margin-top: 10px; }
.pod { display: grid; grid-template-columns: 34px 1fr; column-gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.pod small { grid-column: 2; color: var(--muted); font-size: 12px; }
.pod b { font-size: 15px; }
.medal { grid-row: span 2; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; font-size: 20px; color: #fff; }
.pod-1 .medal { background: linear-gradient(135deg, #f6c343, #d99a00); }
.pod-2 .medal { background: linear-gradient(135deg, #c9d1dc, #8e9aab); }
.pod-3 .medal { background: linear-gradient(135deg, #e0a070, #b06a35); }
.pod-1 { border-color: #f6c343; }

/* ---------- Misc ---------- */
.empty-state { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-state.small { padding: 28px 16px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.empty-state h2 { color: var(--navy); margin: 10px 0 6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 0; background: var(--blue); color: #fff; font-weight: 600; cursor: pointer; font-size: 14px; }
.site-footer { text-align: center; padding: 18px 16px 24px; color: var(--muted); font-size: 13px; }
.site-footer p { margin: 4px 0; }
.tour-switch { display: flex; gap: 8px; align-items: center; justify-content: center; margin-bottom: 10px; flex-wrap: wrap; }

@media (max-width: 380px) {
  .hide-xs { display: none; }
  .standings td, .standings th { padding-left: 4px; padding-right: 4px; }
}

@media (min-width: 640px) {
  .court-grid { grid-template-columns: repeat(3, 1fr); }
  .match-list { grid-template-columns: repeat(2, 1fr); }
  .match-list.compact { grid-template-columns: repeat(2, 1fr); }
  .podium-grid { grid-template-columns: repeat(3, 1fr); }
  .filters { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
  .hero h1 { font-size: 40px; }
}

@media (min-width: 960px) {
  .container { padding: 24px; }
  .group-grid { grid-template-columns: repeat(2, 1fr); column-gap: 16px; align-items: start; }
  .group-grid > .group-card, .group-grid > .group-matches, .group-grid > .ad-slot { grid-column: auto; }
  .match-list { grid-template-columns: repeat(3, 1fr); }
  .ad-item, .ad-empty { aspect-ratio: 5 / 1; }
}
