/* reset */
[hidden] { display: none !important; }
body { margin: 0; }
img { max-width: 100%; }

:root {
  /* Layout: court-blue band with a top-view court drawing; the filter card overlaps the band; each match reads left to right: time, place and level, players, action */
  --bg: #EEF3F6;
  --surface: #FFFFFF;
  --ink: #102331;
  --muted: #52687A;
  --line: #D5DFE6;
  --band: #17407A;
  --band-ink: #F4F8FB;
  --court: #1D4E89;
  --court-text: #1D4E89;
  --on-court: #FFFFFF;
  --ball: #D7EB3C;
  --on-ball: #17220A;
  --good: #1B7A4B;
  --good-bg: #DFF2E7;
  --bad: #B3402F;
  --hard: #3D7FCC;
  --clay: #C4693F;
  --carpet: #4E9B6A;
  --f-display: 'Unbounded', 'Arial Black', system-ui, sans-serif;
  --f-body: 'Golos Text', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --rubber: #8A6FB5;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A1620; --surface: #112231; --ink: #E6EEF4; --muted: #94A9B8; --line: #233A4B;
    --band: #0F2C4C; --band-ink: #EAF1F7; --court: #2E6FB8; --court-text: #7DB4EE;
    --good: #6FD3A0; --good-bg: #12362A; --bad: #F08A78;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A1620; --surface: #112231; --ink: #E6EEF4; --muted: #94A9B8; --line: #233A4B;
  --band: #0F2C4C; --band-ink: #EAF1F7; --court: #2E6FB8; --court-text: #7DB4EE;
  --good: #6FD3A0; --good-bg: #12362A; --bad: #F08A78;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.45; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--court-text); outline-offset: 2px; }
.band :focus-visible { outline-color: var(--ball); }
h1, h2, h3, p { margin: 0; }

.wrap {
  max-width: 1120px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* band */
.band { background: var(--band); color: var(--band-ink); position: relative; overflow: hidden; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding-block: 14px; position: relative; z-index: 1; }
.logo { font-family: var(--f-display); font-weight: 600; font-size: 1.15rem; display: flex; align-items: center; gap: 9px; letter-spacing: .01em; }
.logo i { width: 14px; height: 14px; border-radius: 50%; background: var(--ball); display: inline-block; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav button { background: none; border: 0; color: var(--band-ink); opacity: .72; padding: 8px 12px; border-bottom: 3px solid transparent; font-weight: 500; }
.nav button:hover { opacity: 1; }
.nav button[aria-current="page"] { opacity: 1; border-bottom-color: var(--ball); }
.bar .cta { margin-left: auto; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: end; padding-block: 22px 62px; position: relative; z-index: 1; }
.hero h1 { font-family: var(--f-display); font-weight: 600; font-size: clamp(1.55rem, 4.4vw, 2.5rem); line-height: 1.18; text-wrap: balance; max-width: 20ch; }
.hero p { margin-top: 12px; max-width: 52ch; opacity: .86; }
.pulse { display: flex; flex-wrap: wrap; gap: 6px 26px; margin-top: 20px; font-size: .85rem; opacity: .9; }
.pulse b { font-family: var(--f-mono); font-weight: 500; font-size: 1.15rem; margin-right: 6px; }
.court { color: var(--band-ink); opacity: .38; width: 100%; height: auto; }
@media (max-width: 760px) { .hero { grid-template-columns: minmax(0, 1fr); } .court { display: none; } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 8px; border: 1px solid transparent; font-weight: 600; background: var(--court); color: var(--on-court); white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--muted); filter: none; }
.btn.ball { background: var(--ball); color: var(--on-ball); }
.btn.link { background: none; border: 0; color: var(--court-text); padding: 4px 2px; font-weight: 500; }
.btn[disabled] { opacity: .5; cursor: not-allowed; filter: none; }

/* panels */
.panel { padding-block: 26px 56px; }
.panel.up { padding-top: 0; }

/* filters */
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: -34px; position: relative; z-index: 2; }
.field { display: grid; gap: 5px; min-width: 0; }
.field label, .lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 500; }
.field select, .field input { 
  width: 100%; padding: 9px 10px; 
  border: 1px solid var(--line); 
  border-radius: 8px; 
  background: var(--surface); 
  -webkit-appearance: none;
  appearance: none;
  font: inherit;
}
.results { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: 22px; }
.results h2 { font-family: var(--f-display); font-weight: 500; font-size: 1rem; }

/* match rows */
.list { display: grid; gap: 10px; margin-top: 14px; }
.match { display: grid; grid-template-columns: 138px minmax(0, 1fr) auto; gap: 18px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; }
.when .t { font-family: var(--f-mono); font-weight: 500; font-size: 1.55rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.when .d { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.when .d b { color: var(--ink); font-weight: 600; }
.where h3 { font-size: 1.02rem; font-weight: 600; }
.where .sub { color: var(--muted); font-size: .85rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; padding: 3px 9px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
.chip.good { background: var(--good-bg); color: var(--good); border-color: transparent; font-weight: 600; }
.chip.dim { color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.hard { background: var(--hard); } 
.dot.clay { background: var(--clay); } 
.dot.carpet { background: var(--carpet); }
.dot.rubber { background: var(--rubber); }
.slots { display: flex; align-items: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.av { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 600; background: var(--line); color: var(--ink); }
.av.me { background: var(--court); color: var(--on-court); }
.av.empty { background: transparent; border: 1.5px dashed var(--muted); color: var(--muted); font-weight: 500; font-size: .95rem; }
.slots .free { font-size: .82rem; color: var(--muted); margin-left: 6px; }
.act { display: grid; gap: 8px; justify-items: end; min-width: 160px; }
.price { text-align: right; }
.price b { font-family: var(--f-mono); font-weight: 500; font-size: 1.05rem; }
.price span { display: block; font-size: .75rem; color: var(--muted); }
.empty-state { background: var(--surface); border: 1px dashed var(--line); border-radius: 12px; padding: 32px 20px; text-align: center; display: grid; gap: 12px; justify-items: center; color: var(--muted); }
@media (max-width: 760px) {
  .match { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .when { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
  .when .d { margin-top: 0; }
  .act { grid-auto-flow: column; justify-content: space-between; align-items: center; justify-items: stretch; min-width: 0; }
  .price { text-align: left; }
}

/* clubs */
.sect-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 8px; margin-bottom: 14px; }
.sect-head h2 { font-family: var(--f-display); font-weight: 500; font-size: 1.15rem; }
.sect-head p { color: var(--muted); font-size: .88rem; }
.clubs { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 12px; }
.club { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.club h3 { font-size: 1.05rem; font-weight: 600; }
.club .sub { color: var(--muted); font-size: .85rem; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-family: var(--f-mono); font-weight: 500; font-size: .95rem; font-variant-numeric: tabular-nums; }
.club .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

/* profile */
.pgrid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 860px) { .pgrid { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: grid; gap: 14px; min-width: 0; }
.card h2 { font-family: var(--f-display); font-weight: 500; font-size: .95rem; }
.who { display: flex; align-items: center; gap: 14px; }
.who .av { width: 52px; height: 52px; font-size: 1rem; }
.who b { font-size: 1.1rem; display: block; }
.who span { color: var(--muted); font-size: .85rem; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0; }
@media (max-width: 480px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stats dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.stats dd { margin: 2px 0 0; font-family: var(--f-mono); font-weight: 500; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-family: var(--f-mono); font-size: 10px; }
.hist { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.hist li { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.hist li:first-child { border-top: 0; }
.hist .sc { font-family: var(--f-mono); font-size: .82rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.hist .dl { font-family: var(--f-mono); font-weight: 500; min-width: 44px; text-align: right; }
.hist .dl.up { color: var(--good); } .hist .dl.down { color: var(--bad); }
.hist .res { font-weight: 600; }
@media (max-width: 480px) { .hist li { grid-template-columns: 62px minmax(0, 1fr) auto; } .hist .sc { display: none; } }
.hint { font-size: .85rem; color: var(--muted); }
.mine { display: grid; gap: 8px; }
.mine .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; flex-wrap: wrap; }
.mine .row b { font-weight: 600; }
.mine .row span { color: var(--muted); font-size: .84rem; display: block; }

/* modal + toast */
.scrim { position: fixed; inset: 0; background: rgba(5, 15, 25, .6); z-index: 20; overflow-y: auto; display: flex; justify-content: center; align-items: flex-start;
  padding-top: calc(16px + env(safe-area-inset-top, 0px)); padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.modal { background: var(--surface); border-radius: 14px; width: min(540px, 100%); padding: 20px; display: grid; gap: 14px; margin-block: auto; }
.modal h2 { font-family: var(--f-display); font-weight: 500; font-size: 1.1rem; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.modal .field select { width: 100%; }
.preview { background: var(--bg); border-radius: 10px; padding: 10px 12px; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.preview b { font-family: var(--f-mono); font-weight: 500; font-size: 1.15rem; }
.modal .btns { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 30; font-weight: 500; max-width: calc(100% - 32px); }
.note { margin-top: 28px; font-size: .8rem; color: var(--muted); max-width: 70ch; }
@media (prefers-reduced-motion: no-preference) { .btn, .nav button { transition: filter .15s, opacity .15s; } }

/* auth + forms */
.nav-user { display: flex; align-items: center; gap: 10px; }
.nav-user .who-name { font-weight: 500; font-size: .9rem; }
.btn.band-ghost { background: transparent; color: var(--band-ink); border-color: rgba(255,255,255,.35); }
.tabs2 { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs2 button { background: none; border: 0; padding: 8px 12px; border-bottom: 3px solid transparent; font-weight: 500; color: var(--muted); }
.tabs2 button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--court); }
.form-err { color: var(--bad); font-size: .88rem; min-height: 1.2em; }
.modal .field input { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }

.field .checks input[type="checkbox"],
.checks input[type="checkbox"] {
  -webkit-appearance: checkbox; appearance: auto;
  width: 18px; height: 18px; min-height: 0; padding: 0; margin: 0; flex: none;
  accent-color: var(--court);
}

/* ---- многостраничный сайт ---- */
a.logo { color: inherit; text-decoration: none; }
.nav a { color: var(--band-ink); opacity: .72; text-decoration: none; padding: 8px 12px; border-bottom: 3px solid transparent; font-weight: 500; }
.nav a:hover { opacity: 1; }
.nav a[aria-current="page"] { opacity: 1; border-bottom-color: var(--ball); }

/* компактная шапка внутренних страниц */
.hero.compact { grid-template-columns: minmax(0, 1fr); padding-block: 16px 30px; }
.hero.compact h1 { font-size: clamp(1.4rem, 3.6vw, 2rem); max-width: none; }
.hero.compact.overlap { padding-bottom: 62px; }

/* заголовок в карточке матча ведёт на ленту этой площадки */
.where h3 a { color: inherit; text-decoration: none; }
.where h3 a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* поиск и фильтры списков */
.tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 0 0 14px; }
.tools .field { min-width: 160px; flex: 1 1 160px; }
.tools .grow { flex: 3 1 240px; }
#pl-count { margin-bottom: 12px; }

/* главная: как это работает */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; counter-reset: step; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: grid; gap: 6px; counter-increment: step; }
.steps li::before { content: counter(step); font-family: var(--f-mono); font-size: .9rem; color: var(--court-text); }
.steps b { font-weight: 600; font-size: 1.02rem; }
.steps span { color: var(--muted); font-size: .9rem; }
.home-soon { padding-bottom: 20px; }


/* Фикс вертикального ритма главной:
   .filters наезжает на band (margin-top:-34px),
   поэтому первой секции <main> нужен явный верхний отступ. */
main > .panel.home-matches {
  padding-top: 40px;      /* воздух между фильтром и заголовком */
  padding-bottom: 40px;   /* не слипаться со следующим блоком */
}
@media (max-width: 760px) {
  main > .panel.home-matches { padding-top: 28px; padding-bottom: 32px; }
}

/* Убираем старый «резаный» низ у home-soon, если он ещё где-то используется */
.home-soon { padding-bottom: 40px; }

/* ---------- Футер ---------- */
.site-foot {
  margin-top: 56px;
  background: var(--band);
  color: var(--band-ink);
  border-top: 1px solid rgba(255,255,255,.08);
}
.site-foot .wrap { padding-left: max(16px, env(safe-area-inset-left, 0px));
                   padding-right: max(16px, env(safe-area-inset-right, 0px)); }

.foot-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
  gap: 28px 32px;
  padding-block: 40px 28px;
}
@media (max-width: 860px) {
  .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
}
@media (max-width: 520px) {
  .foot-grid { grid-template-columns: minmax(0, 1fr); gap: 22px; padding-block: 32px 22px; }
}

.foot-brand .logo { color: var(--band-ink); font-size: 1.1rem; }
.foot-brand p {
  margin-top: 12px;
  max-width: 34ch;
  font-size: .9rem;
  opacity: .82;
}
.foot-social { display: flex; gap: 8px; margin-top: 16px; }
.foot-social a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.25);
  color: var(--band-ink); text-decoration: none;
  font-family: var(--f-mono); font-size: .78rem; font-weight: 500;
}
.foot-social a:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.4); }

.foot-col h3 {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: .82rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  opacity: .72;
  margin-bottom: 12px;
}
.foot-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.foot-col a {
  color: var(--band-ink);
  text-decoration: none;
  font-size: .92rem;
  opacity: .86;
}
.foot-col a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }

.foot-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  padding-block: 16px 24px;
  border-top: 1px solid rgba(255,255,255,.12);
  font-size: .82rem;
  opacity: .72;
}
@media (max-width: 520px) { .foot-bottom { flex-direction: column; align-items: flex-start; } }