/* Главная: шапка сайта и хаб (пока нет активного турнира) + блок быстрых матчей под сеткой идущего турнира.
   Визуальный язык страниц /quick и /player (caser.one: тёмное стекло, курсив Sofia Sans, зелёная кнопка со свечением),
   но свои классы hb-* и переменные --h-*: страница подключает turnir.css, и общие имена (.top, .btn, --panel) там заняты. */
:root {
  --h-panel: rgba(0, 0, 0, .38); --h-panel2: rgba(0, 0, 0, .55); --h-line: rgba(255, 255, 255, .08);
  --h-muted: rgba(255, 255, 255, .55); --h-dim: rgba(255, 255, 255, .32);
  --h-green: #44C987; --h-green-bg: #13432C; --h-green-bg2: #1D5A3A; --h-amber: #ffb84d; --h-red: #ff6b6b;
  --h-ct: #7fa3d9; --h-t: #e2a54a; --h-head: #2D3540; --h-blue: #83D8FF;
  --h-f: "Sofia Sans", system-ui, sans-serif; --h-num: "Oswald", "Sofia Sans", sans-serif;
}

/* ---------- шапка (как на /quick и /player) ---------- */
.hb-top { display: flex; align-items: center; gap: 28px; min-height: 56px; padding: 0 24px; background-color: var(--h-head);
  background-image: repeating-radial-gradient(circle at 20% 140%, transparent 0 22px, rgba(255, 255, 255, .035) 22px 23px);
  font-family: var(--h-f); color: #fff; }
.hb-logo { display: inline-block; font: 800 italic 24px/40px var(--h-f); letter-spacing: .02em;
  color: #fff; text-decoration: none; white-space: nowrap; }
.hb-logo b { color: var(--h-green); }
.hb-nav { display: flex; align-self: stretch; font: 600 15px var(--h-f); text-transform: uppercase; }
.hb-nav a { display: flex; align-items: center; min-height: 40px; padding: 0 18px; color: rgba(255, 255, 255, .75); text-decoration: none;
  border-left: 1px solid rgba(255, 255, 255, .15); }
.hb-nav a:first-child { border-left: 0; }
.hb-nav a:hover { color: #fff; }
.hb-nav a.on { color: var(--h-blue); box-shadow: inset 0 -3px 0 var(--h-blue); }
.hb-logo:focus-visible, .hb-nav a:focus-visible { outline: 2px solid var(--h-blue); outline-offset: -2px; }

/* ---------- хаб ---------- */
.hub { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); grid-template-areas: "quick side" "top side" "err err";
  align-items: start; gap: 14px; font: 500 15px/1.35 var(--h-f); color: #fff; }
.hub[hidden] { display: none; }
.hb-quick { grid-area: quick; }
.hb-side { grid-area: side; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.hb-topp { grid-area: top; }
.hb-error { grid-area: err; margin: 0; color: var(--h-red); }
.hb-error:empty { display: none; }

.hb-panel { min-width: 0; padding: 20px 22px 22px; background: var(--h-panel); backdrop-filter: blur(6px); font-family: var(--h-f); color: #fff; }
.hb-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 16px; }
.hb-head > div:first-child { min-width: 0; }
.hb-head.sm { margin-bottom: 12px; align-items: baseline; }
.hb-kick { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font: 600 12px/1.3 var(--h-f); letter-spacing: .16em;
  text-transform: uppercase; color: var(--h-muted); }
.hb-title { margin: 4px 0 0; font: 800 italic 40px/1 var(--h-f); letter-spacing: .01em; color: #fff; text-transform: none; }
.hb-h2 { margin: 6px 0 0; font: 800 italic 26px/1.1 var(--h-f); letter-spacing: .01em; color: #fff; text-transform: none; overflow-wrap: anywhere; }
.hb-count { margin: 8px 0 0; font-size: 14px; color: var(--h-muted); }
.hb-count:empty { display: none; }
.hb-hint { font: 600 12px var(--h-f); letter-spacing: .12em; text-transform: uppercase; color: var(--h-dim); }
.hb-text { margin: 12px 0 0; color: var(--h-muted); font-size: 14px; }
.hb-muted { margin: 0; color: var(--h-muted); }
.hb-acts { display: flex; flex-wrap: wrap; gap: 10px; }
.hb-acts.end { justify-content: flex-end; margin-top: 14px; }
.hb-side .hb-acts { margin-top: 16px; }

/* кнопки — как .btn на /quick */
.hb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 10px 20px;
  font: 700 15px var(--h-f); letter-spacing: .06em; text-transform: uppercase; text-decoration: none; white-space: nowrap;
  border: 1px solid var(--h-green); background: var(--h-green-bg); color: var(--h-green); box-shadow: inset 0 0 1.4rem rgba(68, 201, 135, .45); }
.hb-btn:hover { background: var(--h-green-bg2); box-shadow: inset 0 0 1.4rem rgba(68, 201, 135, .65); }
.hb-btn:focus-visible { outline: 2px solid var(--h-blue); outline-offset: 2px; }
.hb-btn.ghost { border-color: rgba(255, 255, 255, .2); color: rgba(255, 255, 255, .78); box-shadow: none; background-color: rgba(14, 17, 21, .72);
  background-image: radial-gradient(rgba(255, 255, 255, .11) .8px, transparent 1.1px); background-size: 4px 4px; }
.hb-btn.ghost:hover { background-color: rgba(14, 17, 21, .9); border-color: rgba(255, 255, 255, .45); color: #fff; }
.hb-btn.sm { min-height: 40px; padding: 8px 16px; font-size: 13px; }

.hb-badge { display: inline-block; padding: 4px 10px; font: 700 12px/1.2 var(--h-f); letter-spacing: .12em; text-transform: uppercase;
  background: rgba(68, 201, 135, .15); color: var(--h-green); }
.hb-badge.wait { background: rgba(255, 168, 0, .15); color: var(--h-amber); }
.hb-badge.live { background: rgba(255, 107, 107, .15); color: var(--h-red); }
.hb-badge.off { background: rgba(255, 255, 255, .08); color: var(--h-muted); }

/* ---------- карточки комнат (компактная копия /quick) ---------- */
.hb-rooms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hb-quick.wide .hb-rooms { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.hb-quick.wide { padding: 14px; }
.hb-room { display: flex; flex-direction: column; min-width: 0; background: var(--h-panel2); color: inherit; text-decoration: none;
  transition: background .15s, transform .15s; }
.hb-room:hover { background: rgba(0, 0, 0, .7); transform: translateY(-2px); }
.hb-room:focus-visible { outline: 2px solid var(--h-blue); outline-offset: 2px; }
.hb-room.mine { box-shadow: inset 0 0 0 1px rgba(68, 201, 135, .5); }
.hb-room-map { position: relative; height: 78px; padding: 10px 12px; display: flex; align-items: flex-start; justify-content: space-between;
  background: center / cover no-repeat #222; }
.hb-room-map::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10, 12, 15, .15), rgba(10, 12, 15, .7)); }
.hb-room-map::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--h-green); }
.hb-room-map > * { position: relative; }
.hb-room-map .hb-badge { background: rgba(10, 12, 15, .7); }
.hb-fmt { font: 800 italic 30px/1 var(--h-f); text-shadow: 0 2px 10px rgba(0, 0, 0, .6); }
.hb-room-body { display: flex; flex-direction: column; gap: 8px; flex: 1; padding: 12px 14px 14px; }
.hb-room-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-width: 0; }
.hb-room-top b { min-width: 0; font: 800 italic 21px var(--h-f); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-score { display: flex; align-items: center; gap: 6px; flex: none; font: 500 22px/1 var(--h-num); }
.hb-score i { font-style: normal; color: var(--h-dim); }
.hb-score .c { color: var(--h-ct); } .hb-score .tt { color: var(--h-t); }
.hb-room-st { min-height: 1.35em; font-size: 14px; color: var(--h-muted); }
.hb-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hb-rs { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px 10px; background: rgba(0, 0, 0, .35); }
.hb-rs.ct { box-shadow: inset 0 -2px 0 var(--h-ct); } .hb-rs.t { box-shadow: inset 0 -2px 0 var(--h-t); }
.hb-rs b { font: 800 italic 14px var(--h-f); }
.hb-rs.ct b { color: var(--h-ct); } .hb-rs.t b { color: var(--h-t); }
.hb-rs span { display: flex; flex-wrap: wrap; gap: 3px; min-width: 0; }
.hb-rs i { width: 9px; height: 9px; border: 1px solid rgba(255, 255, 255, .25); }
.hb-rs.ct i.on { background: var(--h-ct); border-color: var(--h-ct); } .hb-rs.t i.on { background: var(--h-t); border-color: var(--h-t); }
.hb-rs em { margin-left: auto; font: 500 15px var(--h-num); font-style: normal; color: var(--h-muted); }
.hb-room-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; font-size: 13px; color: var(--h-muted); }
.hb-room-foot > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-go { flex: none; font: 700 13px var(--h-f); letter-spacing: .08em; text-transform: uppercase; color: var(--h-green); }
.hb-room:hover .hb-go { color: #fff; }
/* плитка «создать» дополняет нечётный ряд */
.hb-new { align-items: center; justify-content: center; gap: 6px; min-height: 200px; padding: 18px; text-align: center;
  background: rgba(19, 67, 44, .28); border: 1px dashed rgba(68, 201, 135, .5); }
.hb-new:hover { background: rgba(19, 67, 44, .5); }
.hb-new b { font: 800 italic 22px var(--h-f); color: var(--h-green); }
.hb-new span:last-child { font-size: 14px; color: var(--h-muted); }
.hb-plus { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid var(--h-green); color: var(--h-green);
  font: 300 34px/1 var(--h-f); box-shadow: inset 0 0 1rem rgba(68, 201, 135, .35); }
.hb-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 34px 16px; text-align: center;
  background: var(--h-panel2); color: var(--h-muted); }
.hb-empty b { font: 800 italic 22px var(--h-f); color: #fff; }
.hb-empty .hb-btn { margin-top: 8px; }
.hb-empty.sm { padding: 24px 16px; }

/* ---------- следующий / прошлый турнир ---------- */
.hb-until { margin: 8px 0 0; font: 800 italic 18px var(--h-f); color: var(--h-green); }
.hb-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin: 16px 0 0; }
.hb-facts > div { min-width: 0; }
.hb-facts .wide { grid-column: 1 / -1; }
.hb-facts dt { font: 600 11px var(--h-f); letter-spacing: .14em; text-transform: uppercase; color: var(--h-muted); }
.hb-facts dd { margin: 2px 0 0; font: 500 20px/1.2 var(--h-num); color: #fff; overflow-wrap: anywhere; }
.hb-facts dd small { font-size: 13px; color: var(--h-muted); }
.hb-next { border-top: 3px solid var(--h-green); }
.hb-champ { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 12px 14px; background: rgba(19, 67, 44, .35);
  box-shadow: inset 4px 0 0 var(--h-green); }
.hb-cup { flex: none; width: 34px; height: 34px; background: var(--h-amber);
  -webkit-mask: center / contain no-repeat var(--ico-cup); mask: center / contain no-repeat var(--ico-cup); }
.hb-champ-b { display: flex; flex-direction: column; min-width: 0; }
.hb-champ-l { font: 600 11px var(--h-f); letter-spacing: .14em; text-transform: uppercase; color: #b8f0d0; }
.hb-champ b { font: 800 italic 26px/1.1 var(--h-f); overflow-wrap: anywhere; }
.hb-roster { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.hb-roster a, .hb-roster span { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 11px; font: 700 13px var(--h-f);
  color: rgba(255, 255, 255, .85); background: rgba(14, 17, 21, .72); border: 1px solid rgba(255, 255, 255, .16); text-decoration: none; }
.hb-roster a:hover { color: #fff; border-color: rgba(255, 255, 255, .45); }
.hb-roster a:focus-visible { outline: 2px solid var(--h-blue); outline-offset: 2px; }

/* ---------- топ игроков ---------- */
.hb-tbl-wrap { overflow-x: auto; }
.hb-tbl { width: 100%; border-collapse: collapse; font: 500 15px var(--h-num); }
.hb-tbl th { padding: 6px 10px; font: 600 11px var(--h-f); letter-spacing: .14em; text-transform: uppercase; color: var(--h-muted);
  text-align: right; border-bottom: 1px solid var(--h-line); white-space: nowrap; }
.hb-tbl th:nth-child(2) { text-align: left; }
.hb-tbl td { padding: 0 10px; height: 48px; text-align: right; border-bottom: 1px solid var(--h-line); white-space: nowrap; }
.hb-tbl tbody tr:hover { background: rgba(255, 255, 255, .03); }
.hb-tbl .rk { width: 42px; text-align: center; color: var(--h-muted); }
.hb-tbl tr.first .rk { color: var(--h-amber); font-weight: 700; }
.hb-tbl td.nm { width: 100%; max-width: 0; text-align: left; padding: 0 6px; }
.hb-tbl td.nm a, .hb-who { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 4px; min-width: 0; color: #fff; text-decoration: none; }
.hb-tbl td.nm a:hover .hb-nick { color: var(--h-blue); }
.hb-tbl td.nm a:focus-visible { outline: 2px solid var(--h-blue); outline-offset: -2px; }
.hb-ava { flex: none; width: 30px; height: 30px; background: #3a3f47 center / cover no-repeat; box-shadow: inset 0 -2px 0 var(--h-green); }
.hb-nick { min-width: 0; overflow: hidden; text-overflow: ellipsis; font: 700 16px var(--h-f); }
.hb-tbl .rt { font-size: 18px; color: #fff; }
.hb-tbl .up { color: var(--h-green); } .hb-tbl .dn { color: var(--h-red); }
.hb-tbl .rt.up { text-shadow: 0 0 14px rgba(68, 201, 135, .35); }

/* ---------- адаптив ---------- */
@media (max-width: 1000px) {
  .hub { grid-template-columns: minmax(0, 1fr); grid-template-areas: "quick" "side" "top" "err"; }
  .hb-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
}
@media (max-width: 800px) {
  .hb-top { flex-wrap: wrap; gap: 0 14px; padding: 6px 16px 0; }
  .hb-logo { font-size: 20px; }
  .hb-nav { align-self: auto; margin: 0 -16px; width: calc(100% + 32px); border-top: 1px solid rgba(255, 255, 255, .08); }
  .hb-nav a { flex: 1; justify-content: center; min-height: 44px; padding: 0 10px; font-size: 14px; }
  .hb-head { align-items: stretch; }
  .hb-head .hb-acts { width: 100%; }
  .hb-head .hb-acts .hb-btn { flex: 1; }
  .hb-title { font-size: 34px; }
}
@media (max-width: 640px) {
  .hub { gap: 10px; }
  .hb-side { gap: 10px; }
  .hb-panel { padding: 16px 14px 18px; }
  .hb-quick.wide { padding: 10px; }
  .hb-rooms, .hb-quick.wide .hb-rooms { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .hb-new { display: none; }   /* на телефоне кнопка «Создать комнату» уже в шапке блока */
  .hb-tbl .c-hs, .hb-tbl .c-r { display: none; }
  .hb-tbl th, .hb-tbl td { padding-left: 6px; padding-right: 6px; }
  .hb-tbl .rk { width: 30px; }
  .hb-acts.end .hb-btn { flex: 1; }
  .hb-roster a, .hb-roster span { min-height: 40px; }
}
@media (max-width: 400px) {
  .hb-tbl .c-adr { display: none; }
  .hb-h2 { font-size: 23px; }
  .hb-facts dd { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) { .hb-room { transition: none; } .hb-room:hover { transform: none; } }
