/* Бирпонг-турнир — тема «подвальный чемпионат»:
   тёмный стол, красный стакан, пивной янтарь и золото победителя. */

:root {
  --ink: #0a090c;
  --ink-2: #100e14;
  --card: #17151d;
  --card-2: #1d1a25;
  --card-3: #24202e;
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .05);
  --txt: #f6f3f8;
  --muted: #9b93a8;
  --muted-2: #6e6779;

  --red: #ff4438;
  --red-2: #d61f18;
  --amber: #ffb52e;
  --foam: #ffe6b8;
  --gold: #ffce54;
  --bronze: #cd8c52;
  --green: #35d29a;
  --violet: #7b6cff;

  --gA: #ff4438;
  --gB: #ffb52e;
  --gC: #35d29a;
  --gD: #7b6cff;

  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --shadow: 0 18px 40px -22px rgba(0, 0, 0, .9);
  --head-h: 62px;

  --font-d: 'Oswald', 'Arial Narrow', system-ui, sans-serif;
  --font-b: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100%;
  background: var(--ink);
  color: var(--txt);
  font-family: var(--font-b);
  font-size: 15px;
  line-height: 1.45;
  overflow-x: hidden;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}

/* фон: тёплое свечение сверху, красное снизу и лёгкое зерно */
.bg-fx {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1100px 620px at 50% -12%, rgba(255, 181, 46, .16), transparent 62%),
    radial-gradient(880px 520px at 12% 108%, rgba(255, 68, 56, .14), transparent 60%),
    radial-gradient(700px 480px at 96% 72%, rgba(123, 108, 255, .10), transparent 62%),
    linear-gradient(180deg, #100e14 0%, #0a090c 55%, #08070a 100%);
}
.bg-fx::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.055'/%3E%3C/svg%3E");
}

h1, h2, h3, h4 { margin: 0; font-family: var(--font-d); font-weight: 700; letter-spacing: .02em; }

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--amber); }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 14px; }

/* ---------- шапка ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10, 9, 12, .82);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--line-2);
}
.topbar-in {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--head-h);
  padding: 9px 14px;
  max-width: 1180px;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; flex: 1; }
.brand-logo {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #ff5a4a, #b81810);
  box-shadow: 0 6px 18px -6px rgba(255, 68, 56, .75), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.brand-logo svg { width: 21px; height: 21px; }
.brand-txt { min-width: 0; }
.brand-txt h1 {
  font-size: 20px;
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wide-only { display: none; }
@media (min-width: 560px) { .wide-only { display: inline; } }

.top-actions { display: flex; gap: 6px; flex: none; align-items: center; }
.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--card-2);
  border: 1px solid var(--line);
  font-size: 16px;
  transition: .16s;
}
.icon-btn:active { transform: scale(.94); }
.icon-btn:hover { background: var(--card-3); }
.icon-btn.on { color: var(--amber); }

.progress-line { height: 3px; background: rgba(255, 255, 255, .06); position: relative; overflow: hidden; }
.progress-line i {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--red), var(--amber) 70%, var(--gold));
  border-radius: 0 3px 3px 0;
  transition: width .5s cubic-bezier(.22, 1, .36, 1);
  box-shadow: 0 0 12px rgba(255, 181, 46, .55);
}

/* ---------- навигация ---------- */

.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 45;
  display: flex;
  gap: 2px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: rgba(13, 11, 16, .92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 2px 5px;
  border-radius: 13px;
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .02em;
  transition: .18s;
}
.tab i { font-size: 18px; font-style: normal; line-height: 1; }
.tab.active { color: var(--txt); background: linear-gradient(180deg, rgba(255, 68, 56, .18), rgba(255, 68, 56, .06)); }
.tab.active i { filter: drop-shadow(0 0 8px rgba(255, 120, 60, .6)); }

/* ---------- секции и карточки ---------- */

main { padding-top: 16px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 22px 2px 11px;
}
.section-head:first-child { margin-top: 4px; }
.section-head h2 {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: .13em;
  color: var(--muted);
  font-weight: 600;
}
.section-head .hint { font-size: 12px; color: var(--muted-2); }

.card {
  background: linear-gradient(180deg, var(--card), var(--ink-2));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .05);
  overflow: hidden;
}

.grid-groups {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

/* ---------- карточка группы ---------- */

.group-card { --g: var(--gA); position: relative; }
.group-card[data-g="A"] { --g: var(--gA); }
.group-card[data-g="B"] { --g: var(--gB); }
.group-card[data-g="C"] { --g: var(--gC); }
.group-card[data-g="D"] { --g: var(--gD); }
.group-card[data-g="E"] { --g: #ff7ab8; }
.group-card[data-g="F"] { --g: #3ad0e6; }

.group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 15px 11px;
  background: var(--card-2);
  background: linear-gradient(120deg, color-mix(in srgb, var(--g) 17%, transparent), transparent 62%);
  border-bottom: 1px solid var(--line-2);
}
.group-letter {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 10px;
  font-family: var(--font-d);
  font-size: 18px;
  font-weight: 700;
  color: #12101a;
  background: var(--g);
  box-shadow: 0 6px 16px -8px var(--g);
}
.group-title { flex: 1; min-width: 0; }
.group-title b {
  display: block;
  font-family: var(--font-d);
  font-size: 15px;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 600;
}
.group-title span { font-size: 11.5px; color: var(--muted); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  background: var(--card-3);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.chip.live { color: var(--amber); border-color: rgba(255, 181, 46, .35); background: rgba(255, 181, 46, .12); }
.chip.done { color: var(--green); border-color: rgba(53, 210, 154, .3); background: rgba(53, 210, 154, .1); }
.chip.gold { color: #201803; background: linear-gradient(135deg, var(--gold), #ffab2e); border-color: transparent; }

/* таблица группы */
.table { padding: 6px 8px 4px; }
.trow {
  display: grid;
  grid-template-columns: 22px 1fr auto auto;
  align-items: center;
  gap: 9px;
  padding: 7px 7px;
  border-radius: 12px;
  position: relative;
}
.trow + .trow { box-shadow: inset 0 1px 0 var(--line-2); }
.trow.head {
  padding: 3px 7px 1px;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--muted-2);
  box-shadow: none;
}
.trow.head + .trow { box-shadow: none; }
.trow.head .tw, .trow.head .tdiff { font-family: var(--font-b); font-size: 10px; }
.trow.qualify {
  background: rgba(255, 255, 255, .05);
  background: linear-gradient(90deg, color-mix(in srgb, var(--g) 15%, transparent), transparent 70%);
}
.trow.qualify::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: var(--g);
}
.tplace {
  font-family: var(--font-d);
  font-size: 14px;
  color: var(--muted-2);
  text-align: center;
}
.trow.qualify .tplace { color: var(--g); }
.tname { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tname b {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tw {
  font-family: var(--font-d);
  font-size: 15px;
  letter-spacing: .04em;
  min-width: 34px;
  text-align: right;
}
.tw small { color: var(--muted-2); font-size: 12px; }
.tdiff {
  font-family: var(--font-d);
  font-size: 13px;
  color: var(--muted);
  min-width: 46px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.tdiff.plus { color: var(--green); }
.tdiff.minus { color: #ff6f6f; }
.tie-flag {
  font-size: 11px;
  color: var(--amber);
  cursor: pointer;
}

.avatar {
  width: 26px; height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  font-size: 13px;
  background: var(--card-3);
  background: color-mix(in srgb, currentColor 16%, var(--card-3));
  box-shadow: inset 0 0 0 1.5px currentColor;
}
.avatar.lg { width: 42px; height: 42px; border-radius: 13px; font-size: 20px; }
.avatar.xl { width: 62px; height: 62px; border-radius: 18px; font-size: 30px; }

/* матчи в группе */
.matches { padding: 4px 8px 10px; }
.mrow {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 8px;
  border-radius: 13px;
  text-align: left;
  transition: .16s;
  border: 1px solid transparent;
}
.mrow:hover { background: var(--card-2); }
.mrow:active { transform: scale(.985); }
.mrow + .mrow { box-shadow: inset 0 1px 0 var(--line-2); }
.mside { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 13.5px; }
.mside.right { flex-direction: row-reverse; text-align: right; }
.mside span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-weight: 600;
}
.mside.win span { color: var(--txt); font-weight: 800; }
.mscore {
  font-family: var(--font-d);
  font-size: 17px;
  letter-spacing: .03em;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 9px;
  background: var(--card-3);
  border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  min-width: 70px;
  justify-content: center;
}
.mscore em { font-style: normal; color: var(--muted-2); font-size: 13px; }
.mscore .w { color: var(--amber); }
.mrow.empty .mscore {
  border-style: dashed;
  color: var(--muted-2);
  background: transparent;
}
.mrow.next {
  background: linear-gradient(100deg, rgba(255, 68, 56, .14), transparent 75%);
  border-color: rgba(255, 68, 56, .3);
}

/* ---------- «сейчас играют» ---------- */

.hero {
  position: relative;
  padding: 16px 15px 15px;
  background:
    radial-gradient(120% 130% at 8% 0%, rgba(255, 68, 56, .22), transparent 55%),
    radial-gradient(120% 130% at 100% 100%, rgba(255, 181, 46, .16), transparent 55%),
    linear-gradient(180deg, var(--card-2), var(--ink-2));
}
.hero-label {
  font-family: var(--font-d);
  font-size: 11.5px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--amber);
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
}
.hero-label .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 0 rgba(255, 68, 56, .7);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 9px rgba(255, 68, 56, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 68, 56, 0); }
}
.hero-duel {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}
.hero-p { display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center; min-width: 0; }
.hero-p b {
  font-size: 14px;
  font-weight: 800;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hero-vs {
  font-family: var(--font-d);
  font-size: 22px;
  color: var(--muted-2);
  letter-spacing: .05em;
}
.hero-actions { margin-top: 14px; display: flex; gap: 8px; }

/* ---------- кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 13px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .01em;
  background: var(--card-3);
  border: 1px solid var(--line);
  transition: .16s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:hover { border-color: rgba(255, 255, 255, .18); }
.btn.primary {
  background: linear-gradient(135deg, #ff5a4a, var(--red-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 12px 26px -14px rgba(255, 68, 56, .95), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.btn.gold {
  background: linear-gradient(135deg, var(--gold), #ff9f1c);
  color: #1b1405;
  border-color: transparent;
  box-shadow: 0 12px 26px -14px rgba(255, 181, 46, .9);
}
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 11px; }
.btn.danger { color: #ff7a6e; border-color: rgba(255, 68, 56, .3); }
.btn[disabled] { opacity: .4; pointer-events: none; }

/* ---------- плей-офф ---------- */

.champion {
  position: relative;
  text-align: center;
  padding: 24px 18px 22px;
  background:
    radial-gradient(120% 120% at 50% 0%, rgba(255, 206, 84, .28), transparent 60%),
    linear-gradient(180deg, #241c0c, var(--ink-2));
  border-color: rgba(255, 206, 84, .35);
}
.champion .crown { font-size: 34px; line-height: 1; filter: drop-shadow(0 6px 14px rgba(255, 181, 46, .6)); }
.champion .label {
  font-family: var(--font-d);
  font-size: 12px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 9px 0 5px;
}
.champion .who {
  font-family: var(--font-d);
  font-size: 30px;
  line-height: 1.1;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fff6dd, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.champion .sub { color: var(--muted); font-size: 13px; margin-top: 6px; }

.podium { display: flex; justify-content: center; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.podium .slot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 700;
  min-width: 0;
}
.podium .slot span {
  max-width: 74px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bracket { display: grid; gap: 14px; }
.br-round { display: flex; flex-direction: column; gap: 12px; justify-content: space-around; }
.br-round > .br-title {
  font-family: var(--font-d);
  font-size: 12px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted-2);
  text-align: center;
  padding-bottom: 2px;
}
.br-pair { display: flex; flex-direction: column; gap: 12px; position: relative; }

.po-card {
  position: relative;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--card), var(--ink-2));
  padding: 5px;
  width: 100%;
  text-align: left;
  transition: .16s;
  box-shadow: var(--shadow);
}
.po-card:active { transform: scale(.99); }
.po-card.playable { border-color: rgba(255, 68, 56, .35); }
.po-card.final {
  border-color: rgba(255, 206, 84, .4);
  background: linear-gradient(180deg, #221b0d, var(--ink-2));
  box-shadow: 0 18px 44px -24px rgba(255, 181, 46, .8);
}
.po-card.third { border-color: rgba(205, 140, 82, .35); }
.third-wrap { max-width: 560px; }
.po-side {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 12px;
}
.po-side + .po-side { box-shadow: inset 0 1px 0 var(--line-2); }
.po-side b {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.po-side.tbd b { color: var(--muted-2); font-weight: 600; font-size: 12.5px; font-style: italic; }
.po-side .lead-hint {
  display: block;
  font-size: 10.5px;
  color: var(--muted-2);
  letter-spacing: .04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.po-side > div { min-width: 0; }
.po-side.win { background: rgba(255, 206, 84, .1); }
.po-side.win b { color: var(--gold); }
.po-side .sc {
  font-family: var(--font-d);
  font-size: 19px;
  min-width: 26px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted-2);
}
.po-side.win .sc { color: var(--gold); }
.po-tag {
  position: absolute;
  top: -9px;
  left: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: var(--card-3);
  border: 1px solid var(--line);
  color: var(--muted);
}
.po-card.final .po-tag { background: linear-gradient(135deg, var(--gold), #ff9f1c); color: #1b1405; border-color: transparent; }

/* ---------- игроки ---------- */

.roster { padding: 6px; }
.prow {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 14px;
  width: 100%;
  text-align: left;
  transition: .16s;
}
.prow:hover { background: var(--card-2); }
.prow + .prow { box-shadow: inset 0 1px 0 var(--line-2); }
.prow b { font-size: 14.5px; font-weight: 700; }
.prow .meta { font-size: 11.5px; color: var(--muted-2); }
.gtag {
  font-family: var(--font-d);
  font-size: 13px;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--card-3);
  border: 1px solid var(--line);
}
.gtag[data-g="A"] { color: var(--gA); border-color: color-mix(in srgb, var(--gA) 40%, transparent); }
.gtag[data-g="B"] { color: var(--gB); border-color: color-mix(in srgb, var(--gB) 40%, transparent); }
.gtag[data-g="C"] { color: var(--gC); border-color: color-mix(in srgb, var(--gC) 40%, transparent); }
.gtag[data-g="D"] { color: var(--gD); border-color: color-mix(in srgb, var(--gD) 40%, transparent); }

/* ---------- статистика ---------- */

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi { padding: 13px 12px; text-align: center; }
.kpi .v {
  font-family: var(--font-d);
  font-size: 26px;
  line-height: 1;
  background: linear-gradient(180deg, #fff, #ffc46b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.kpi .k {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted-2);
  margin-top: 6px;
  font-weight: 700;
}

.award {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
}
.award + .award { box-shadow: inset 0 1px 0 var(--line-2); }
.award .ic {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  font-size: 19px;
  background: var(--card-3);
  border: 1px solid var(--line);
}
.award .t { flex: 1; min-width: 0; }
.award .t b { display: block; font-size: 14px; }
.award .t span { font-size: 12px; color: var(--muted); }

.lb-row {
  display: grid;
  grid-template-columns: 24px auto 1fr auto auto;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
}
.lb-row + .lb-row { box-shadow: inset 0 1px 0 var(--line-2); }
.lb-row .n { font-family: var(--font-d); color: var(--muted-2); text-align: center; }
.lb-row b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-row .w { font-family: var(--font-d); font-size: 15px; }
.lb-row .c { font-family: var(--font-d); font-size: 13px; color: var(--muted); min-width: 58px; text-align: right; }
.lb-row.top1 .n { color: var(--gold); }

.bar {
  height: 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .07);
  overflow: hidden;
  margin-top: 5px;
}
.bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--red), var(--amber)); }

/* ---------- модалка / шторка ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(6, 5, 8, .72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade .22s ease;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: linear-gradient(180deg, #1b1822, #0f0d13);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -30px 70px -20px rgba(0, 0, 0, .9);
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  animation: up .3s cubic-bezier(.22, 1, .36, 1);
}
@keyframes up { from { transform: translateY(30px); opacity: .4; } }
.sheet-grip {
  width: 42px; height: 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .18);
  margin: 6px auto 12px;
}
.sheet h3 {
  font-size: 13px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  font-weight: 600;
  margin-bottom: 14px;
}
.sheet-actions { display: flex; gap: 9px; margin-top: 16px; }

/* ввод счёта */
.duel { display: grid; gap: 10px; }
.dside {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--card), var(--ink-2));
  padding: 12px;
  transition: .2s;
}
.dside.lead {
  border-color: rgba(255, 206, 84, .45);
  box-shadow: 0 0 0 1px rgba(255, 206, 84, .18), 0 16px 34px -22px rgba(255, 181, 46, .9);
}
.dtop { display: flex; align-items: center; gap: 10px; }
.dtop .nm { flex: 1; min-width: 0; }
.dtop .nm b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dtop .nm span { font-size: 11px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.dscore {
  font-family: var(--font-d);
  font-size: 34px;
  line-height: 1;
  min-width: 46px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.dside.lead .dscore { color: var(--gold); }

.rack { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 11px; }
.rack-row { display: flex; gap: 5px; }
.cup {
  width: 30px; height: 34px;
  position: relative;
  border-radius: 4px;
  transition: transform .14s;
}
.cup:active { transform: scale(.88); }
.cup i {
  position: absolute;
  inset: 0;
  clip-path: polygon(11% 0, 89% 0, 76% 100%, 24% 100%);
  background: linear-gradient(180deg, #2a2632, #1b1822);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07);
  transition: .18s;
}
.cup::after {
  content: '';
  position: absolute;
  left: 11%; right: 11%;
  top: -2px;
  height: 6px;
  border-radius: 50%;
  background: #35303f;
  transition: .18s;
}
.cup.hit i {
  background: linear-gradient(180deg, #ff6f5f, var(--red-2));
  box-shadow: inset 0 -6px 10px -6px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.cup.hit::after { background: #ff8b7d; box-shadow: 0 0 10px rgba(255, 68, 56, .55); }
.cup.pop { animation: pop .34s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.28) rotate(-6deg); }
  100% { transform: scale(1); }
}

.stepper { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 11px; }
.stepper button {
  width: 40px; height: 34px;
  border-radius: 11px;
  background: var(--card-3);
  border: 1px solid var(--line);
  font-family: var(--font-d);
  font-size: 19px;
  line-height: 1;
}
.stepper button:active { transform: scale(.93); }
.stepper .lbl { font-size: 11px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }

.quick { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.quick button {
  padding: 6px 11px;
  border-radius: 10px;
  background: var(--card-2);
  border: 1px solid var(--line);
  font-family: var(--font-d);
  font-size: 14px;
  color: var(--muted);
}
.quick button:hover { color: var(--txt); border-color: rgba(255, 255, 255, .2); }

.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted-2);
  font-weight: 800;
  margin-bottom: 6px;
}
.field input[type=text], .field input[type=number], .field textarea, .field select {
  width: 100%;
  padding: 11px 13px;
  border-radius: 13px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  outline: none;
  transition: .16s;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: rgba(255, 68, 56, .5); background: #131019; }
.field textarea { min-height: 150px; resize: vertical; line-height: 1.6; }

.picker { display: flex; flex-wrap: wrap; gap: 6px; }
.picker button {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--card-2);
  border: 1px solid var(--line);
  font-size: 17px;
}
.picker button.on { border-color: var(--amber); background: rgba(255, 181, 46, .14); }
.picker.colors button { border-radius: 50%; width: 30px; height: 30px; }
.picker.colors button.on { box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px currentColor; }

.opt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 2px;
}
.opt-row + .opt-row { box-shadow: inset 0 1px 0 var(--line-2); }
.opt-row .t b { display: block; font-size: 14px; }
.opt-row .t span { font-size: 12px; color: var(--muted-2); }
.switch {
  width: 46px; height: 27px;
  border-radius: 999px;
  background: var(--card-3);
  border: 1px solid var(--line);
  position: relative;
  flex: none;
  transition: .2s;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 21px; height: 21px;
  border-radius: 50%;
  background: var(--muted);
  transition: .2s cubic-bezier(.22, 1, .36, 1);
}
.switch.on { background: linear-gradient(135deg, #ff5a4a, var(--red-2)); border-color: transparent; }
.switch.on::after { left: 21px; background: #fff; }

.seg { display: flex; gap: 4px; background: var(--ink-2); padding: 4px; border-radius: 13px; border: 1px solid var(--line); }
.seg button {
  flex: 1;
  padding: 8px 6px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.seg button.on { background: var(--card-3); color: var(--txt); }

/* тосты */
.toasts {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 95;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  pointer-events: none;
  padding: 0 14px;
}
.toast {
  background: rgba(30, 27, 37, .96);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 10px 15px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: up .25s ease;
  max-width: 100%;
}
.toast.good { border-color: rgba(53, 210, 154, .4); }
.toast.warn { border-color: rgba(255, 181, 46, .45); }

#confetti { position: fixed; inset: 0; z-index: 120; pointer-events: none; }

.empty-note {
  text-align: center;
  padding: 30px 20px;
  color: var(--muted-2);
  font-size: 13.5px;
}

.sync-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  flex: none;
  box-shadow: 0 0 8px rgba(53, 210, 154, .7);
}
.sync-dot.off { background: #ff5a4a; box-shadow: 0 0 8px rgba(255, 68, 56, .7); }
.sync-dot.local { background: var(--amber); box-shadow: 0 0 8px rgba(255, 181, 46, .7); }

/* ---------- планшет и десктоп ---------- */

@media (min-width: 700px) {
  body { font-size: 15.5px; padding-bottom: 40px; }
  .grid-groups { grid-template-columns: 1fr 1fr; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .tabs {
    position: sticky;
    top: var(--head-h);
    bottom: auto;
    max-width: 1180px;
    margin: 10px auto 0;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 5px;
    background: rgba(23, 21, 29, .9);
    gap: 4px;
  }
  .tab { flex-direction: row; gap: 8px; font-size: 13px; padding: 9px; border-radius: 12px; }
  .tab i { font-size: 15px; }
  .overlay { align-items: center; padding: 20px; }
  .sheet { border-radius: 26px; border-bottom: 1px solid var(--line); max-height: 88vh; }
  .toasts { bottom: 26px; }
  .duel { grid-template-columns: 1fr 1fr; }
  .hero-duel { gap: 20px; }
}

@media (min-width: 1000px) {
  .grid-groups { grid-template-columns: repeat(4, 1fr); }
  .bracket {
    grid-template-columns: repeat(var(--cols, 2), 1fr);
    align-items: stretch;
    gap: 34px;
  }
  /* Заголовок раунда выносим из потока, а пары растягиваем на всю колонку и
     раскладываем space-around: тогда каждая карточка следующего раунда встаёт
     ровно напротив стыка своих двух предшественников — хоть при полуфиналах,
     хоть при четвертьфиналах. */
  .br-round { position: relative; justify-content: space-around; padding-top: 26px; }
  .br-round > .br-title { position: absolute; top: 0; left: 0; right: 0; }
  .br-round > .po-card { margin: auto 0; }
  .br-pair { flex: 1; justify-content: space-around; }
  .br-pair::after {
    content: '';
    position: absolute;
    right: -17px;
    top: 25%;
    bottom: 25%;
    width: 2px;
    background: var(--line);
  }
  .br-round:not(:last-child) .po-card::after {
    content: '';
    position: absolute;
    right: -17px;
    top: 50%;
    width: 17px;
    height: 2px;
    background: var(--line);
  }
  .br-round:not(:first-child) .po-card::before {
    content: '';
    position: absolute;
    left: -17px;
    top: 50%;
    width: 17px;
    height: 2px;
    background: var(--line);
  }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
