:root {
  /* Газон и разметка */
  --pitch: #0B3D2C;
  --pitch-stripe: #0E4632;
  --chalk: #FFFFFF;
  --chalk-dim: rgba(255, 255, 255, .62);
  --chalk-line: rgba(255, 255, 255, .14);

  /* Список матчей */
  --bg: #EEF2EE;
  --surface: #FFFFFF;
  --surface-2: #F3F6F3;
  --ink: #0F1A15;
  --muted: #5F6B65;
  --line: #E0E6E1;

  /* Исходы */
  --win: #1F9D57;
  --draw: #9AA49E;
  --loss: #E04536;

  /* Акцент: коэффициент фаворита */
  --accent: #FFD43B;
  --accent-ink: #231C00;
  --focus: #2B6DE0;

  --font-display: "Oswald", "Arial Narrow", sans-serif;
  --font-body: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --pitch: #082D20;
    --pitch-stripe: #0A3426;
    --bg: #0B1310;
    --surface: #121C17;
    --surface-2: #18241E;
    --ink: #E8EEEA;
    --muted: #8E9B94;
    --line: #22302A;
    --win: #2FB46A;
    --draw: #5D6862;
    --loss: #EE5A4A;
    --focus: #7EA6FF;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--font-body);
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
img { display: block; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }

/* ---------- Газон: шапка и поиск ---------- */

.pitch {
  position: relative;
  overflow: hidden;
  color: var(--chalk);
  background:
    repeating-linear-gradient(90deg, var(--pitch) 0 96px, var(--pitch-stripe) 96px 192px);
}
.pitch :focus-visible { outline-color: var(--chalk); }

.pitch-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  stroke: var(--chalk-line);
  stroke-width: 2;
  pointer-events: none;
}
.pitch-lines .spot { fill: var(--chalk-line); }

.top, .hero, .wrap { position: relative; max-width: 1040px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 18px;
  padding-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font: 600 22px/1 var(--font-display);
  letter-spacing: .01em;
}
.brand-mark { width: 30px; height: 30px; stroke-width: 2; }

.top-actions { display: flex; align-items: center; gap: 14px; }

.quota { display: grid; gap: 5px; min-width: 128px; }
.quota-text { font-size: 13px; color: var(--chalk-dim); }
.quota-bar { height: 3px; border-radius: 3px; background: var(--chalk-line); overflow: hidden; }
.quota-bar span { display: block; height: 100%; width: 0; background: var(--chalk); transition: width .4s ease; }
.quota.low .quota-text { color: var(--accent); }
.quota.low .quota-bar span { background: var(--accent); }

.btn-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--chalk-line);
  border-radius: 50%;
  background: rgba(255, 255, 255, .06);
  color: inherit;
}
.btn-icon:hover { background: rgba(255, 255, 255, .14); }

.hero { padding-top: 20px; padding-bottom: 32px; }

.days { display: flex; gap: 24px; margin-bottom: 6px; }
.days button {
  position: relative;
  border: 0;
  background: none;
  padding: 4px 0 8px;
  color: var(--chalk-dim);
  font-weight: 500;
}
.days button:hover { color: var(--chalk); }
.days button[aria-checked="true"] { color: var(--chalk); }
.days button[aria-checked="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  border-radius: 3px;
  background: var(--accent);
}

.day-title {
  margin: 0 0 22px;
  font: 600 clamp(34px, 6vw, 56px)/1.05 var(--font-display);
  letter-spacing: .005em;
}
.day-title::first-letter { text-transform: uppercase; }

.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }

.btn-primary {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 13px 30px;
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  transition: transform .15s ease, filter .15s ease;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:active { transform: scale(.97); }
.btn-primary:disabled { opacity: .6; cursor: progress; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  border: 1px solid var(--chalk-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  padding: 7px 14px;
  font-size: 14px;
  color: var(--chalk);
}
.chip span { color: var(--chalk-dim); }
.chip:hover { background: rgba(255, 255, 255, .14); }

.progress { margin-top: 24px; max-width: 560px; }
.progress-track { height: 4px; border-radius: 4px; background: var(--chalk-line); overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .35s ease; }
.progress p { margin: 10px 0 0; font-size: 14px; color: var(--chalk-dim); }

/* ---------- Список ---------- */

.wrap { padding-top: 28px; padding-bottom: 64px; }

.alert {
  margin: 0 0 20px;
  padding: 14px 18px;
  border-radius: var(--r-md);
  border-left: 4px solid var(--loss);
  background: var(--surface);
}
.alert strong { display: block; margin-bottom: 2px; }
.alert .btn-ghost { margin-top: 10px; }

.btn-ghost {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  padding: 9px 18px;
  font-weight: 500;
}
.btn-ghost:hover { background: var(--surface-2); }

.link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 14px;
}
.link:hover { color: var(--ink); }

.empty { max-width: 60ch; color: var(--muted); }
.empty p { margin: 0 0 8px; }
.empty-title { color: var(--ink); font-weight: 600; font-size: 17px; }

.summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
  margin-bottom: 18px;
}
.summary h2 { margin: 0; font: 600 26px/1.2 var(--font-display); }
.summary p { margin: 0; color: var(--muted); font-size: 14px; }

.league-block {
  margin-bottom: 16px;
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}

.lg-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--surface-2);
  font-size: 14px;
}
.lg-head img { width: 20px; height: 20px; object-fit: contain; }
.lg-head b { font-weight: 600; }
.lg-head span { color: var(--muted); }

.rows { list-style: none; margin: 0; padding: 0; }

.row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 32px;
  padding: 14px 18px;
}
.row + .row { border-top: 1px solid var(--line); }

.r-time { font: 500 17px/1 var(--font-display); }
.r-time small { display: block; margin-top: 4px; font: 400 12px/1 var(--font-body); color: var(--muted); }

.r-teams { min-width: 0; display: grid; gap: 8px; }
.t {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  line-height: 1.3;
}
.t img { width: 20px; height: 20px; object-fit: contain; }
.t-name { min-width: 0; }
.t-name span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-name small { display: block; margin-top: 1px; font-size: 12.5px; color: var(--muted); }
.t.fav .t-name span { font-weight: 700; }
.t.fav .t-name small { color: var(--ink); }
.t.fav .t-name small::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 1px;
}

.strip { display: flex; gap: 3px; }
.strip i {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  font: 600 11px/1 var(--font-body);
  font-style: normal;
  color: #fff;
}
.strip .W { background: var(--win); }
.strip .D { background: var(--draw); }
.strip .L { background: var(--loss); }
.strip .none { background: var(--surface-2); }
.strip i.last { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--ink); }

.r-odds { display: flex; gap: 4px; }
.o {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 56px;
  padding: 7px 6px 6px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.o span { font-size: 11px; color: var(--muted); }
.o b { font: 500 16px/1 var(--font-display); }
.o.fav { background: var(--accent); color: var(--accent-ink); }
.o.fav span { color: inherit; opacity: .7; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 4px 0 24px;
  font-size: 13px;
  color: var(--muted);
}
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .W { background: var(--win); }
.legend .D { background: var(--draw); }
.legend .L { background: var(--loss); }

.others { margin-top: 28px; }
.others > .link { display: block; margin-bottom: 14px; }
.others .league-block { opacity: .72; }
.others .league-block:hover { opacity: 1; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 500;
  z-index: 50;
}

/* ---------- Настройки ---------- */

.sheet {
  width: min(540px, 100%);
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  background: var(--surface);
  color: var(--ink);
}
.sheet::backdrop { background: rgba(4, 20, 13, .55); }
.sheet[open] { animation: slide-in .22s ease-out; }
@keyframes slide-in { from { transform: translateX(32px); opacity: 0; } }

.sheet-inner { display: flex; flex-direction: column; height: 100%; }
.sheet-head, .sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; }
.sheet-head { background: var(--pitch); color: var(--chalk); }
.sheet-head h2 { margin: 0; font: 600 22px/1.2 var(--font-display); }
.sheet-foot { border-top: 1px solid var(--line); justify-content: flex-end; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.sheet-foot .btn-primary { background: var(--pitch); color: var(--chalk); }
.sheet-body { flex: 1; overflow-y: auto; padding: 4px 24px 24px; overscroll-behavior: contain; }

fieldset { margin: 0; padding: 20px 0 8px; border: 0; border-bottom: 1px solid var(--line); }
fieldset:last-child { border-bottom: 0; }
legend { padding: 0; margin-bottom: 14px; font: 600 18px/1.2 var(--font-display); }
legend small { font: 400 14px var(--font-body); color: var(--muted); margin-left: 6px; }

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > span { font-size: 14px; color: var(--muted); }
.field > span small { color: var(--ink); }
.field input[type="number"], .field input[type="text"], .field input[type="password"], .field select {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
}
.field input:focus, .field select:focus { border-color: var(--pitch); outline: none; }
.hint { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.field .hint { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.segmented { display: inline-flex; padding: 3px; margin-bottom: 10px; border-radius: 999px; background: var(--surface-2); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; }
.segmented span { display: block; padding: 8px 16px; border-radius: 999px; font-size: 14px; color: var(--muted); }
.segmented input:checked + span { background: var(--pitch); color: var(--chalk); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

.league-tools { display: flex; gap: 16px; margin-bottom: 12px; }
.leagues { columns: 2; column-gap: 24px; margin-bottom: 16px; }
.league-group { break-inside: avoid; margin-bottom: 14px; }
.league-country { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.check { display: flex; align-items: center; gap: 10px; padding: 4px 0; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--pitch); flex: none; margin: 0; }

@media (prefers-color-scheme: dark) {
  .sheet-foot .btn-primary, .segmented input:checked + span { background: var(--win); }
  .check input { accent-color: var(--win); }
}

/* ---------- Вход ---------- */

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  position: relative;
  width: min(360px, 100%);
  display: grid;
  gap: 18px;
  padding: 28px;
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
}
.login-card .brand { color: var(--pitch); margin-bottom: 4px; }
.login-card .field { margin: 0; }
.login-card .field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
}
.login-card .btn-primary { width: 100%; }
.login-error { margin: 0; font-size: 14px; color: var(--loss); }
@media (prefers-color-scheme: dark) { .login-card .brand { color: var(--ink); } }

/* ---------- Телефон ---------- */

@media (max-width: 760px) {
  .top, .hero, .wrap { padding-left: 16px; padding-right: 16px; }
  .top { padding-top: 12px; padding-bottom: 12px; }
  .brand { font-size: 20px; }
  .quota { min-width: 92px; }
  .hero { padding-top: 12px; padding-bottom: 24px; }
  .day-title { margin-bottom: 18px; }
  .btn-primary { width: 100%; }
  .pitch { background: repeating-linear-gradient(90deg, var(--pitch) 0 64px, var(--pitch-stripe) 64px 128px); }

  .league-block { border-radius: var(--r-md); margin-left: -4px; margin-right: -4px; }
  .lg-head { padding: 10px 14px; }
  .row {
    grid-template-columns: 40px minmax(0, 1fr);
    grid-template-areas:
      "time teams"
      ". odds";
    gap: 12px 10px;
    padding: 14px;
  }
  .r-time { grid-area: time; align-self: start; padding-top: 2px; font-size: 15px; }
  .r-teams { grid-area: teams; }
  .r-odds { grid-area: odds; }
  .t { gap: 8px; }
  .strip { gap: 2px; }
  .strip i { width: 18px; height: 20px; font-size: 10px; }
  .o { flex: 1; min-width: 0; }

  .sheet {
    width: 100%;
    height: auto;
    max-height: 92vh;
    margin: auto 0 0;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
  }
  .sheet[open] { animation-name: slide-up; }
  .sheet-inner { max-height: 92vh; }
  .sheet-head, .sheet-foot { padding-left: 16px; padding-right: 16px; }
  .sheet-body { padding: 4px 16px 20px; }
  .sheet-foot .btn-primary { flex: 1; width: auto; }
  .leagues { columns: 1; }
}
@keyframes slide-up { from { transform: translateY(32px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
