/* Официальные шрифты Brawl Stars (Lilita One / Nougat / BH EXT) */
@font-face {
  font-family: 'Lilita One';
  src: url('/assets/fonts/lilita-one-400-latin.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+0-FF, U+131, U+152-153, U+2BB-2BC, U+2C6, U+2DA, U+2DC, U+304, U+308, U+329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Lilita One';
  src: url('/assets/fonts/lilita-one-400-latin-ext.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+100-2BA, U+2BD-2C5, U+2C7-2CC, U+2CE-2D7, U+2DD-2FF, U+304, U+308, U+329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'BH EXT';
  src: url('/assets/fonts/bh-ext.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+100-24F, U+259, U+300-36F, U+400-4FF, U+1E00-1EFF, U+20AB;
}
@font-face {
  font-family: 'Nougat';
  src: url('/assets/fonts/nougat-extrablack-webfont.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}

/* ============================================================
   TWEXIS — клуб Brawl Stars
   Палитра: тёмно-серый / серый / белый.
   Все иконки — один светло-серый цвет (--icon).
   ============================================================ */

:root {
  --bg: #0f1215;
  --bg-deep: #0b0e11;
  --sidebar: #15191e;
  --surface: #1b2026;
  --surface-2: #222830;
  --surface-3: #2a313a;
  --line: #323a44;
  --line-soft: #272e36;
  --text: #f4f6f8;
  --muted: #9aa4af;
  --muted-2: #737d88;
  --icon: #d4dae0;
  --steel: #9fb8c9;
  --steel-line: rgba(159, 184, 201, .26);
  --steel-fill: rgba(159, 184, 201, .07);
  --sidebar-width: 268px;
  --radius: 16px;
  --radius-sm: 11px;
  --font: 'Lilita One', 'BH EXT', system-ui, sans-serif;
  --display: 'Nougat', 'Lilita One', 'BH EXT', sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 620px at 18% -8%, rgba(212, 218, 224, .07), transparent 62%),
    radial-gradient(800px 520px at 96% 4%, rgba(212, 218, 224, .04), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

::selection { background: rgba(212, 218, 224, .25); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 20px; border: 3px solid var(--bg-deep); }
::-webkit-scrollbar-thumb:hover { background: #3a434d; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: var(--icon);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--sm { width: 16px; height: 16px; }

/* ---------- Layout ---------- */
.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-width);
  min-height: 100vh;
}

.content { min-width: 0; padding: 0 48px 64px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 78px;
  margin: 0 -48px 34px;
  padding: 0 48px;
  background: rgba(15, 18, 21, .82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line-soft);
}

.topbar__left, .topbar__right { display: flex; align-items: center; gap: 14px; }

.breadcrumb { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted-2); letter-spacing: .02em; }
.breadcrumb strong { color: var(--text); font-weight: 700; }
.breadcrumb__sep { opacity: .4; }

.tag-chip, .online-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  transition: background .2s, border-color .2s, transform .2s;
}
.tag-chip:hover { background: var(--surface-2); border-color: var(--muted-2); transform: translateY(-1px); }
.tag-chip .icon { width: 15px; height: 15px; color: var(--icon); }

.online-chip { color: var(--muted); font-weight: 600; letter-spacing: 0; }
.online-chip__dot, .chat-panel__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--icon); box-shadow: 0 0 0 3px rgba(212, 218, 224, .12);
}

.icon-btn {
  display: none;
  width: 38px; height: 38px;
  align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface);
}

/* ---------- Pages ---------- */
.page { display: none; animation: pageIn .38s ease both; }
.page.is-active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.eyebrow {
  display: flex; align-items: center; gap: 10px;
  color: var(--muted); font-size: 11px; font-weight: 800;
  letter-spacing: .22em; text-transform: uppercase;
}
.eyebrow__line { width: 26px; height: 2px; background: var(--icon); opacity: .8; }

.page-head { margin: 12px 0 32px; }
.page-head h1 { font-family: var(--display); font-size: clamp(32px, 4vw, 48px); line-height: 1.15; margin: 12px 0 10px; letter-spacing: -.03em; }
.page-head p { color: var(--muted); max-width: 620px; margin: 0; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 52px 0 18px; }
.section-head h2 { font-family: var(--display); font-size: 20px; letter-spacing: -.02em; margin: 0; }
.section-head span { color: var(--muted-2); font-size: 12px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
  align-items: center;
  gap: 24px;
  min-height: 470px;
  padding: 42px 46px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(212, 218, 224, .05), transparent 45%),
    linear-gradient(180deg, var(--surface), var(--bg-deep));
  overflow: visible;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(212, 218, 224, .13) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(90deg, transparent, #000 65%);
  opacity: .35;
  pointer-events: none;
}
.hero__content { position: relative; z-index: 2; max-width: 610px; }
.hero__title {
  font-family: var(--display);
  font-size: clamp(52px, 6.4vw, 88px);
  line-height: .98;
  letter-spacing: .02em;
  margin: 22px 0 18px;
  background: linear-gradient(180deg, #fff 12%, #b9c1ca 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__lead { font-size: 19px; font-weight: 700; margin: 0 0 10px; color: var(--text); }
.hero__text { color: var(--muted); max-width: 510px; margin: 0 0 28px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 46px; padding: 0 22px; border-radius: 11px;
  font-weight: 700; font-size: 14px;
  transition: transform .2s, background .2s, border-color .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { color: #10151a; background: var(--icon); border: 1px solid var(--icon); box-shadow: 0 10px 30px rgba(212, 218, 224, .13); }
.btn--primary .icon { stroke: #10151a; }
.btn--primary:hover { background: #eef1f4; box-shadow: 0 14px 34px rgba(212, 218, 224, .2); }
.btn--ghost { color: var(--text); background: rgba(212, 218, 224, .05); border: 1px solid var(--line); }
.btn--ghost:hover { background: rgba(212, 218, 224, .11); border-color: var(--muted-2); }

.hero__stats { display: flex; gap: 34px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line-soft); }
.hero-stat { display: flex; flex-direction: column; }
.hero-stat strong { font-family: var(--display); font-size: 24px; letter-spacing: -.03em; }
.hero-stat strong span { font-size: 13px; color: var(--muted); font-family: var(--font); font-weight: 700; margin-left: 3px; }
.hero-stat small { color: var(--muted-2); font-size: 11px; letter-spacing: .03em; margin-top: 2px; }

.hero__visual { position: relative; display: grid; place-items: center; min-height: 380px; color: var(--icon); }
.hero__orb {
  position: absolute; width: 340px; height: 340px; border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 218, 224, .12), transparent 68%);
  filter: blur(6px);
}
.hero__rings {
  position: absolute; width: 330px; height: 330px; border-radius: 50%;
  border: 1px solid rgba(212, 218, 224, .08);
  box-shadow: 0 0 0 34px rgba(212, 218, 224, .025), 0 0 0 68px rgba(212, 218, 224, .015);
}
.mascot { position: relative; width: min(100%, 360px); height: auto; filter: drop-shadow(0 24px 40px rgba(0, 0, 0, .45)); animation: float 6s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.mascot-rays { position: absolute; width: 320px; height: 320px; max-width: 90%; color: var(--icon); opacity: .3; }
.mascot--avatar {
  width: 250px; height: 250px; border-radius: 50%; object-fit: cover;
  border: 2px solid rgba(212, 218, 224, .45);
  background: var(--surface-2);
  filter: grayscale(1) brightness(1.14) contrast(.88) drop-shadow(0 24px 40px rgba(0, 0, 0, .5));
}
body.is-color .mascot--avatar { filter: drop-shadow(0 24px 40px rgba(0, 0, 0, .5)); }
.color-toggle {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  padding: 4px 12px; border-radius: 6px;
  border: 1px solid var(--line); background: rgba(15, 18, 21, .78); backdrop-filter: blur(8px);
  color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
  transition: background .2s, color .2s, border-color .2s;
}
.color-toggle:hover { color: var(--text); background: rgba(212, 218, 224, .12); border-color: var(--muted-2); }

/* ---------- Info cards ---------- */
.info-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.info-card {
  display: flex; flex-direction: column; gap: 14px;
  padding: 20px; border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(160deg, var(--surface), rgba(27, 32, 38, .55));
  transition: transform .25s, border-color .25s;
}
.info-card:hover { transform: translateY(-4px); border-color: var(--muted-2); }
.info-card__icon {
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--line); border-radius: 11px; background: rgba(212, 218, 224, .05);
}
.info-card small { display: block; color: var(--muted-2); font-size: 11px; }
.info-card strong { display: block; font-family: var(--display); font-size: 21px; letter-spacing: -.02em; margin-top: 2px; }
.info-card__delta { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }

/* ---------- Panels ---------- */
.two-col { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; margin-top: 14px; }
.panel {
  padding: 24px; border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(160deg, var(--surface), rgba(21, 25, 30, .75));
}
.panel__head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.panel__head h3 { font-size: 15px; margin: 0; font-weight: 800; }
.panel__head .icon { width: 18px; height: 18px; }
.about-panel p { color: var(--muted); margin: 0 0 12px; max-width: 720px; }
.link-btn {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 6px; padding: 0; border: 0; background: none;
  color: var(--text); font-weight: 700; font-size: 13px;
}
.link-btn .icon { transition: transform .2s; }
.link-btn:hover .icon { transform: translateX(4px); }

.next-event { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.next-event__icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: rgba(212, 218, 224, .08); border: 1px solid var(--line); }
.next-event strong { display: block; font-size: 15px; }
.next-event span { color: var(--muted); font-size: 12px; }
.progress { height: 6px; border-radius: 10px; background: var(--surface-3); overflow: hidden; }
.progress__fill { height: 100%; border-radius: 10px; background: var(--icon); }
.progress__label { display: flex; justify-content: space-between; color: var(--muted-2); font-size: 11px; margin: 8px 0 16px; }
.progress__label strong { color: var(--text); }

/* ---------- Rules ---------- */
.rules-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.rule-card {
  position: relative; padding: 24px; min-height: 210px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(160deg, var(--surface), rgba(21, 25, 30, .8));
  transition: transform .25s, border-color .25s;
}
.rule-card:hover { transform: translateY(-4px); border-color: var(--muted-2); }
.rule-card__num { position: absolute; top: 18px; right: 20px; font-family: var(--display); font-size: 26px; color: rgba(212, 218, 224, .13); }
.rule-card__icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; background: rgba(212, 218, 224, .07); border: 1px solid var(--line); margin-bottom: 18px; }
.rule-card h3 { margin: 0 0 8px; font-size: 15px; }
.rule-card p { margin: 0; color: var(--muted); font-size: 13px; }
.note-panel { display: flex; gap: 16px; align-items: flex-start; margin-top: 14px; }
.note-panel > .icon { width: 24px; height: 24px; margin-top: 2px; }
.note-panel strong { font-size: 14px; }
.note-panel p { color: var(--muted); margin: 4px 0 0; font-size: 13px; }

/* ---------- Players ---------- */
.live-bar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: rgba(212, 218, 224, .035);
  color: var(--muted); font-size: 12px;
}
.live-bar__dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--icon); box-shadow: 0 0 0 3px rgba(212, 218, 224, .12); }
.live-bar .mini-btn { margin-left: auto; }
.hint a { color: var(--icon); text-decoration: underline; text-underline-offset: 3px; }
.table-panel { padding: 8px 22px; }
.table-head, .player-row {
  display: grid; grid-template-columns: minmax(200px, 2fr) minmax(120px, 1fr) minmax(100px, 1fr) minmax(110px, .8fr);
  align-items: center; gap: 12px;
}
.table-head { padding: 8px 0; color: var(--muted-2); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; border-bottom: 1px solid var(--line); }
.table-sort {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 0; border: 0; background: none;
  color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit;
  transition: color .2s;
}
.table-sort:hover, .table-sort.is-active { color: var(--text); }
.table-sort .icon { width: 13px; height: 13px; opacity: .3; transition: transform .2s, opacity .2s; }
.table-sort:hover .icon, .table-sort.is-active .icon { opacity: 1; }
.table-sort.is-active[data-dir="asc"] .icon { transform: rotate(-90deg); }
.table-sort.is-active[data-dir="desc"] .icon { transform: rotate(90deg); }
.player-row { padding: 13px 0; border-bottom: 1px solid var(--line-soft); transition: background .2s; }
.player-row:last-child { border-bottom: 0; }
.player-row:hover { background: rgba(212, 218, 224, .035); }
.player { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar {
  position: relative; overflow: hidden;
  display: grid; place-items: center; width: 38px; height: 38px; flex: none;
  border-radius: 0; border: 0;
  background: transparent;
  font-family: var(--display); font-size: 13px; font-weight: 700; color: var(--icon);
}
.avatar__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.12); }
.avatar__fallback { display: grid; place-items: center; width: 100%; height: 100%; background: var(--surface-2); }
.player-name { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-tag { color: var(--muted-2); font-size: 10px; }
.player-tag--id { color: var(--muted); font-size: 12px; letter-spacing: .02em; }
.role { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.role .icon { width: 15px; height: 15px; }
.trophies { font-family: var(--display); font-size: 13px; }
.player-status { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); }
.player-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); }
.player-status--online i { background: var(--icon); box-shadow: 0 0 0 3px rgba(212, 218, 224, .12); }
.hint { display: flex; align-items: center; gap: 8px; color: var(--muted-2); font-size: 12px; margin: 16px 2px 0; }

/* ---------- Events ---------- */
.events-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.event-card {
  display: flex; flex-direction: column; min-height: 230px; padding: 24px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(160deg, var(--surface), rgba(21, 25, 30, .8));
  transition: transform .25s, border-color .25s;
}
.event-card:hover { transform: translateY(-4px); border-color: var(--muted-2); }
.event-card__top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.event-card__icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: rgba(212, 218, 224, .07); border: 1px solid var(--line); }
.event-card__icon .icon { width: 23px; height: 23px; }
.badge { padding: 5px 10px; border-radius: 7px; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--line); color: var(--muted); background: rgba(212, 218, 224, .05); }
.badge--active { color: var(--text); background: rgba(212, 218, 224, .14); border-color: rgba(212, 218, 224, .3); }
.event-card h3 { margin: 0 0 8px; font-size: 18px; font-family: var(--display); letter-spacing: -.02em; }
.event-card p { color: var(--muted); font-size: 13px; margin: 0 0 22px; }
.event-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.event-card__foot > span { display: flex; align-items: center; gap: 7px; color: var(--muted-2); font-size: 11px; }
.mini-btn { padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: rgba(212, 218, 224, .06); color: var(--text); font-size: 11px; font-weight: 700; transition: background .2s, border-color .2s; }
.mini-btn:hover { background: rgba(212, 218, 224, .14); border-color: var(--muted-2); }
.mini-btn:disabled { opacity: .55; cursor: not-allowed; }
.mini-btn:disabled:hover { background: rgba(212, 218, 224, .06); border-color: var(--line); }
.mini-btn--primary { background: var(--icon); border-color: var(--icon); color: #10151a; }
.mini-btn--primary:hover { background: #eef1f4; border-color: #eef1f4; color: #10151a; }
.event-card__actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky; top: 0; align-self: start;
  display: flex; flex-direction: column;
  height: 100vh; padding: 30px 20px 22px;
  background: linear-gradient(180deg, var(--sidebar), var(--bg-deep));
  border-left: 1px solid var(--line-soft);
  z-index: 30;
}
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 12px; border: 1px solid var(--line); background: rgba(212, 218, 224, .06); color: var(--icon); }
.brand-mark .icon { width: 27px; height: 27px; stroke-width: 1.4; }
.brand-text strong { display: block; font-family: var(--display); font-size: 15px; letter-spacing: .04em; }
.brand-text span { display: block; color: var(--muted-2); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 5px; }
.nav__item {
  position: relative;
  display: flex; align-items: center; gap: 13px;
  width: 100%; height: 48px; padding: 0 14px;
  border: 1px solid transparent; border-radius: 11px;
  background: transparent; color: var(--muted);
  font-size: 14px; font-weight: 600; text-align: left;
  transition: color .2s, background .2s, border-color .2s, transform .2s;
}
.nav__item:hover { color: var(--text); background: rgba(212, 218, 224, .055); }
.nav__item.is-active { color: var(--text); background: rgba(212, 218, 224, .1); border-color: var(--line); }
.nav__item.is-active::before { content: ''; position: absolute; left: -20px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--icon); }
.nav__icon { display: grid; place-items: center; width: 22px; }
.nav__icon .icon { width: 19px; height: 19px; }
.nav__label { flex: 1; }
.nav__arrow { opacity: 0; transform: translateX(-5px); transition: opacity .2s, transform .2s; }
.nav__item.is-active .nav__arrow, .nav__item:hover .nav__arrow { opacity: 1; transform: none; }

.sidebar__footer { margin-top: auto; padding: 16px 8px 0; color: var(--muted-2); font-size: 10px; line-height: 1.7; }

/* ---------- Модальное окно вступления ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center; padding: 20px;
  background: rgba(6, 8, 10, .78); backdrop-filter: blur(8px);
  opacity: 0; visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
.modal-overlay.is-open { opacity: 1; visibility: visible; }
.modal {
  position: relative; width: min(100%, 460px); padding: 34px;
  border: 1px solid var(--line); border-radius: 20px;
  background:
    radial-gradient(420px 200px at 85% -5%, rgba(212, 218, 224, .08), transparent 70%),
    linear-gradient(160deg, var(--surface), var(--bg-deep));
  box-shadow: 0 28px 80px rgba(0, 0, 0, .6);
  transform: translateY(18px) scale(.98);
  transition: transform .3s ease;
}
.modal-overlay.is-open .modal { transform: none; }
.modal__close {
  position: absolute; top: 14px; right: 14px;
  display: grid; place-items: center; width: 34px; height: 34px;
  border: 1px solid var(--line); border-radius: 9px;
  background: rgba(212, 218, 224, .04); color: var(--muted);
  font-size: 22px; line-height: 1; transition: background .2s, color .2s, border-color .2s;
}
.modal__close:hover { color: var(--text); background: rgba(212, 218, 224, .12); border-color: var(--muted-2); }
.modal h2 { font-family: var(--display); font-size: 25px; letter-spacing: -.03em; margin: 14px 0 8px; }
.modal__lead { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.modal__tg { width: 100%; text-decoration: none; }
.modal__req { margin-top: 22px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 13px; background: rgba(212, 218, 224, .035); }
.modal__req h3 { margin: 0; font-size: 13px; font-weight: 800; }
.modal__req ul { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 11px; }
.modal__req li { display: flex; align-items: center; gap: 11px; font-size: 13px; color: var(--text); }
.modal__req li .icon { width: 16px; height: 16px; }
.modal__hint { color: var(--muted-2); font-size: 11px; text-align: center; margin: 16px 0 0; }

/* ---------- Сетка турнира ---------- */
.modal--bracket { width: min(100%, 700px); }
.bracket-toolbar {
  margin: 16px 0 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 12px;
}
.bracket-scheme__titles {
  display: grid; grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1fr);
  gap: 12px; margin-bottom: 10px;
}
.bracket-scheme__titles span {
  color: var(--steel); font-size: 11px; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase;
}
.bracket-scheme {
  display: grid; grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1fr);
  align-items: stretch; min-height: 230px;
}
.bracket-scheme__stack { display: flex; flex-direction: column; justify-content: space-around; gap: 16px; }
.bracket-scheme__final { display: flex; align-items: center; }
.bracket-scheme__final .scheme-match { width: 100%; }
.bracket-scheme__lines { position: relative; }
.bracket-scheme__lines::before {
  content: ''; position: absolute; left: 50%; top: 25%; bottom: 25%;
  border-left: 2px solid var(--steel-line);
}
.bracket-line { position: absolute; height: 2px; background: var(--steel-line); }
.bracket-line--top { top: 25%; left: 0; width: 50%; }
.bracket-line--bottom { top: 75%; left: 0; width: 50%; }
.bracket-line--out { top: 50%; left: 50%; width: 50%; }
.scheme-match {
  padding: 12px; border: 1px solid var(--steel-line); border-radius: 11px;
  background: var(--steel-fill);
}
.scheme-match__label {
  color: var(--muted-2); font-size: 9px; font-weight: 800;
  letter-spacing: .14em; text-transform: uppercase; margin-bottom: 9px;
}
.scheme-team {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border-radius: 7px; background: rgba(15, 18, 21, .55); font-size: 13px;
}
.scheme-team + .scheme-team { margin-top: 6px; }
.scheme-team__name { font-weight: 700; }
.scheme-team__score { color: var(--steel); font-family: var(--display); font-size: 12px; }
.scheme-team.is-winner { color: #eaf4fa; box-shadow: inset 2px 0 0 var(--steel); }
.scheme-team.is-out { opacity: .45; text-decoration: line-through; }
.bracket-note {
  color: var(--muted-2); font-size: 11px; line-height: 1.7;
  margin: 18px 0 0; padding-top: 12px; border-top: 1px solid var(--line);
}

/* ---------- Статистика игрока (серо-голубой акцент) ---------- */
.player-link { cursor: pointer; }
.player-link .player-name { transition: color .2s; }
.player-link:hover .player-name, .avatar--link:hover + div .player-name { color: var(--steel); }
.player-link:hover .avatar, .avatar--link:hover { border-color: var(--steel); }

.modal--player {
  width: min(100%, 540px);
  border-color: var(--steel-line);
  background:
    radial-gradient(400px 220px at 92% -8%, rgba(159, 184, 201, .16), transparent 70%),
    linear-gradient(160deg, #1d242b, var(--bg-deep));
  box-shadow: 0 28px 80px rgba(0, 0, 0, .6), 0 0 0 1px rgba(159, 184, 201, .05);
}
.player-modal__head {
  display: flex; align-items: center; gap: 16px;
  padding-bottom: 18px; border-bottom: 1px solid var(--steel-line);
}
.player-modal__avatar {
  width: 74px; height: 74px; flex: none; object-fit: cover;
  border-radius: 16px; border: 1px solid var(--steel-line);
  background: var(--surface-2);
}
.player-modal__tag { color: var(--steel); font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.modal--player h2 { margin: 2px 0; font-size: 23px; }
.player-modal__role { color: var(--muted); font-size: 12px; }
.fame-badge { width: 22px; height: 22px; vertical-align: middle; object-fit: contain; margin-left: 5px; }
.player-modal__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin: 18px 0; }
.stat-tile {
  padding: 14px; border: 1px solid var(--steel-line); border-radius: 11px;
  background: var(--steel-fill);
}
.stat-tile__top { display: flex; align-items: center; gap: 6px; }
.stat-tile__icon { width: 20px; height: 20px; flex: none; object-fit: contain; }
.stat-tile small { display: block; color: var(--muted-2); font-size: 11px; }
.stat-tile strong { display: block; margin-top: 4px; font-family: var(--display); font-size: 20px; color: #e8f2f8; }
.player-modal__brawlers h3 { margin: 0 0 10px; font-size: 13px; font-weight: 800; }
.brawler-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.brawler-tile {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 8px; border: 1px solid var(--steel-line); border-radius: 9px;
  background: var(--steel-fill);
}
.brawler-tile img { width: 36px; height: 36px; flex: none; border-radius: 8px; object-fit: cover; }
.brawler-tile div { min-width: 0; }
.brawler-tile strong { display: block; font-size: 11px; color: #e8f2f8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brawler-tile span { display: block; font-size: 11px; color: var(--steel); }
.player-modal__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--steel-line);
  color: var(--muted-2); font-size: 11px;
}
.player-modal__foot .mini-btn { text-decoration: none; color: var(--steel); border-color: var(--steel-line); }
.player-modal__foot .mini-btn:hover { color: var(--text); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 100;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); font-size: 13px; font-weight: 600;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
  opacity: 0; transform: translate(-50%, 16px); pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast .icon { width: 17px; height: 17px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .content { padding: 0 28px 56px; }
  .topbar { margin: 0 -28px 28px; padding: 0 28px; }
  .hero { padding: 34px 32px; }
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rules-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 920px) {
  :root { --sidebar-width: 0px; }
  .app-shell { display: block; }
  .content { padding: 0 22px 96px; }
  .topbar { margin: 0 -22px 24px; padding: 0 22px; height: 66px; }
  .icon-btn { display: inline-flex; }
  .hero { grid-template-columns: 1fr; min-height: 0; padding: 32px 26px; }
  .hero__visual { min-height: 330px; order: -1; }
  .mascot-rays { width: 280px; height: 280px; }
  .mascot--avatar { width: 220px; height: 220px; }
  .hero__title { font-size: clamp(44px, 9vw, 72px); }
  .two-col, .chat-layout { grid-template-columns: 1fr; }
  .events-grid { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0;
    width: 100%; height: 68px; padding: 6px 10px;
    flex-direction: row; align-items: center;
    border-left: 0; border-top: 1px solid var(--line);
    background: rgba(21, 25, 30, .96); backdrop-filter: blur(18px);
  }
  .sidebar__brand { display: none; }
  .nav { flex-direction: row; gap: 4px; width: 100%; }
  .nav__item { flex-direction: column; justify-content: center; gap: 3px; height: 56px; padding: 0 4px; font-size: 10px; }
  .nav__icon { width: auto; }
  .nav__icon .icon { width: 20px; height: 20px; }
  .nav__arrow { display: none; }
  .nav__item.is-active::before { left: 50%; top: auto; bottom: 0; width: 22px; height: 3px; transform: translateX(-50%); border-radius: 3px 3px 0 0; }
  .toast { bottom: 84px; }
}

@media (max-width: 640px) {
  .content { padding: 0 16px 96px; }
  .topbar { margin: 0 -16px 22px; padding: 0 16px; }
  .online-chip { display: none; }
  .breadcrumb { font-size: 12px; }
  .hero { padding: 26px 20px; border-radius: 18px; }
  .hero__stats { gap: 18px; flex-wrap: wrap; }
  .hero-stat strong { font-size: 20px; }
  .info-grid, .rules-grid { grid-template-columns: 1fr; }
  .section-head { margin-top: 40px; }
  .table-panel { padding: 6px 14px; overflow-x: auto; }
  .table-head, .player-row { grid-template-columns: 170px 110px 90px 100px; min-width: 470px; }
  .chat-messages { height: 380px; }
  .message { max-width: 95%; }
  .player-modal__stats, .brawler-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal--player { padding: 26px 20px; }
  .bracket-scheme, .bracket-scheme__titles { grid-template-columns: 1fr; }
  .bracket-scheme__lines { display: none; }
  .bracket-scheme__stack { gap: 10px; }
  .bracket-scheme__final { margin-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Модальные окна должны помещаться и прокручиваться на телефоне */
.modal {
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 640px) {
  .modal { max-height: calc(100vh - 24px); padding: 24px 18px; }
}

/* Правила клуба */
.rules-intro { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.rules-intro .panel p { color: var(--muted); margin: 0; }
.rules-list { display: grid; gap: 12px; }
.rule-block {
  position: relative; padding: 20px 22px 20px 70px;
  border: 1px solid var(--line); border-radius: 14px;
  background: linear-gradient(160deg, var(--surface), rgba(21, 25, 30, .75));
}
.rule-block__num {
  position: absolute; left: 22px; top: 18px;
  font-family: var(--display); font-size: 20px; color: var(--steel);
}
.rule-block h3 { margin: 0 0 10px; font-size: 15px; }
.rule-block ul { margin: 0; padding-left: 18px; display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
@media (max-width: 640px) {
  .rules-intro { grid-template-columns: 1fr; }
}

/* Пасхалка: носок Спайка на краю панели */
.hero__sock {
  position: absolute; top: -14px; right: 18%; z-index: 6;
  width: 58px; color: var(--icon);
  transform-origin: 50% 0;
  animation: sock-swing 4.5s ease-in-out infinite;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .45));
  pointer-events: none;
}
.hero__sock svg { width: 100%; height: auto; display: block; }
@keyframes sock-swing {
  0%, 100% { transform: rotate(-7deg); }
  50% { transform: rotate(7deg); }
}

/* Красивое появление текста в окне вступления */
#joinModal.is-open .modal > *,
#tournamentModal.is-open .modal > * {
  animation: text-wipe .55s cubic-bezier(.2, .8, .2, 1) both;
}
#joinModal.is-open .modal > :nth-child(2),
#tournamentModal.is-open .modal > :nth-child(2) { animation-delay: .06s; }
#joinModal.is-open .modal > :nth-child(3),
#tournamentModal.is-open .modal > :nth-child(3) { animation-delay: .12s; }
#joinModal.is-open .modal > :nth-child(4),
#tournamentModal.is-open .modal > :nth-child(4) { animation-delay: .18s; }
#joinModal.is-open .modal > :nth-child(5),
#tournamentModal.is-open .modal > :nth-child(5) { animation-delay: .24s; }
#joinModal.is-open .modal > :nth-child(6),
#tournamentModal.is-open .modal > :nth-child(6) { animation-delay: .3s; }
@keyframes text-wipe {
  from { opacity: 0; clip-path: inset(0 100% 0 0); transform: translateX(-14px); }
  to { opacity: 1; clip-path: inset(0 0 0 0); transform: none; }
}

/* На телефоне центрируем показатели в герое */
@media (max-width: 640px) {
  .hero__stats { justify-content: center; text-align: center; }
  .hero-stat { align-items: center; }
  .hero__actions { justify-content: center; }
  .hero__title { text-align: center; }
}
