:root {
  --sky: #0a6c8f;
  --sky-2: #00a3c4;
  --sky-soft: #e3f4f9;
  --gold: #f4b400;
  --ink: #142430;
  --muted: #5d7280;
  --line: #dde7ed;
  --bg: #f4f8fb;
  --card: #fff;
  --win: #128a4a;
  --loss: #c2392b;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  padding-bottom: calc(70px + env(safe-area-inset-bottom));
}
a { color: var(--sky); text-decoration: none; }
h1 { font-size: 22px; margin: 6px 0 12px; }
h2 { font-size: 17px; margin: 22px 0 10px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.wrap { max-width: 860px; margin: 0 auto; padding: 12px 14px; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: linear-gradient(120deg, var(--sky), var(--sky-2)); color: #fff;
}
.brand { color: #fff; font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.ball { width: 14px; height: 14px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px rgba(255,255,255,.25); }
.langs a { color: rgba(255,255,255,.75); font-size: 13px; margin-left: 8px; font-weight: 600; }
.langs a.on { color: #fff; border-bottom: 2px solid var(--gold); }

/* bottom nav */
nav.bottom {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.bottom a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 0 8px; font-size: 11px; color: var(--muted);
}
nav.bottom svg { width: 24px; height: 24px; fill: currentColor; }
nav.bottom a.on { color: var(--sky); }

/* cards, lists */
.card { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
        box-shadow: 0 1px 2px rgba(20,36,48,.06); }
.list { background: var(--card); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px;
        box-shadow: 0 1px 2px rgba(20,36,48,.06); }
.row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-top: 1px solid var(--line); color: var(--ink); }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank { width: 28px; text-align: right; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.rank.top { color: var(--gold); }
.rating { font-weight: 700; font-variant-numeric: tabular-nums; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--sky-soft); color: var(--sky);
          display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.avatar.big { width: 64px; height: 64px; font-size: 22px; }

.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px;
         background: var(--sky-soft); color: var(--sky); vertical-align: middle; }
.badge.registration { background: #e6f6ec; color: var(--win); }
.badge.running { background: #fff4d6; color: #9a6a00; }
.badge.finished { background: #eceff1; color: var(--muted); }
.badge.draft { background: #f3e8ff; color: #7b3fb5; }

.win { color: var(--win); font-weight: 700; }
.loss { color: var(--loss); font-weight: 700; }

/* buttons & forms */
.btn { display: inline-block; border: 0; border-radius: 10px; padding: 11px 16px; font: inherit; font-weight: 600;
       background: var(--sky); color: #fff; cursor: pointer; text-align: center; }
.btn.block { display: block; width: 100%; }
.btn.light { background: var(--sky-soft); color: var(--sky); }
.btn.gold { background: var(--gold); color: #3a2a00; }
.btn.danger { background: #fdecea; color: var(--loss); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
form p, .field { margin: 0 0 12px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=tel], input[type=number], input[type=date], input[type=time], input[type=search],
select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit;
  background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--sky-2); border-color: transparent; }
input[type=checkbox] { width: 20px; height: 20px; vertical-align: middle; }
.errorlist { color: var(--loss); font-size: 13px; list-style: none; padding: 0; margin: 4px 0; }
.code-input { font-size: 28px !important; letter-spacing: 10px; text-align: center; }
.filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.filters > * { flex: 1 1 120px; }

.msgs { margin-bottom: 10px; }
.msg { padding: 10px 14px; border-radius: 10px; margin-bottom: 6px; background: var(--sky-soft); }
.msg.error { background: #fdecea; color: var(--loss); }
.msg.success { background: #e6f6ec; color: var(--win); }
.msg.info { background: #fff4d6; color: #6b4a00; font-weight: 600; }

/* tabs */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 0 -14px 12px; padding: 0 14px; }
.tabs a { padding: 8px 14px; border-radius: 99px; white-space: nowrap; color: var(--muted); font-weight: 600; font-size: 14px; }
.tabs a.on { background: var(--sky); color: #fff; }

/* hero */
.hero { background: linear-gradient(135deg, var(--sky), var(--sky-2)); color: #fff; border-radius: var(--radius);
        padding: 18px; margin-bottom: 14px; position: relative; overflow: hidden; }
.hero h1 { margin: 0 0 4px; }
.hero::after { content: ""; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px;
               border-radius: 50%; background: var(--gold); opacity: .9; }
.hero .meta { opacity: .9; font-size: 14px; position: relative; z-index: 1; }
.hero > * { position: relative; z-index: 1; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.stat { background: var(--card); border-radius: 12px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 18px; }
.stat span { font-size: 12px; color: var(--muted); }

/* group table */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { font-size: 12px; color: var(--muted); font-weight: 600; text-align: center; padding: 6px 4px; }
.tbl td { padding: 8px 4px; border-top: 1px solid var(--line); text-align: center; font-variant-numeric: tabular-nums; }
.tbl td.name, .tbl th.name { text-align: left; }
.tbl tr.q td { background: #f2fbf5; }

.match { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-top: 1px solid var(--line); color: var(--ink); }
.match:first-child { border-top: 0; }
.match .side { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match .side.r { text-align: right; }
.match .sc { font-weight: 700; min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; }
.match .w { font-weight: 700; }
.match.pending .sc { color: var(--muted); font-weight: 400; }

/* bracket */
.bracket { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; margin: 0 -14px; padding-left: 14px; padding-right: 14px; }
.bracket .col { display: flex; flex-direction: column; justify-content: space-around; min-width: 190px; gap: 10px; }
.bracket .col h3 { text-align: center; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.bm { background: var(--card); border-radius: 10px; box-shadow: 0 1px 2px rgba(20,36,48,.08); overflow: hidden; display: block; color: var(--ink); }
.bm .ln { display: flex; justify-content: space-between; padding: 7px 10px; font-size: 13px; gap: 6px; }
.bm .ln + .ln { border-top: 1px solid var(--line); }
.bm .ln.w { font-weight: 700; background: #f2fbf5; }
.bm .ln .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bm .ln.tbd .n { color: var(--muted); }
.bm .seed { color: var(--muted); font-size: 11px; margin-right: 4px; }

.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; align-items: end; margin-bottom: 12px; }
.podium div { background: var(--card); border-radius: 12px; text-align: center; padding: 10px 6px; font-size: 13px; }
.podium .p1 { padding-top: 18px; border-top: 4px solid var(--gold); }
.podium .p2 { border-top: 4px solid #aeb8c0; }
.podium .p3 { border-top: 4px solid #c98b54; }
.podium b { display: block; font-size: 20px; }

.chart { width: 100%; height: 90px; }
.chart polyline { fill: none; stroke: var(--sky); stroke-width: 2.5; stroke-linejoin: round; }

.game-chips span { display: inline-block; background: var(--sky-soft); border-radius: 6px; padding: 1px 6px; margin: 1px; font-size: 12px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--line); }
.pick:first-child { border-top: 0; }
details summary { cursor: pointer; font-weight: 600; color: var(--sky); padding: 6px 0; }
.empty { text-align: center; color: var(--muted); padding: 22px 10px; }
