/* База: сброс, типографика, каркас приложения, safe-area, reduced-motion. */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-m);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
h1,
h2,
h3,
h4,
p {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}
a {
  color: var(--accent-text);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
::selection {
  background: var(--accent-soft);
}

/* Каркас экрана: контент + нижние вкладки, safe-area */
.app {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
.view {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: calc(14px + var(--safe-top) + var(--tg-top)) var(--gutter)
    calc(24px + var(--safe-bottom));
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
}
.view.with-tabs {
  padding-bottom: calc(var(--tabs-h) + 24px + var(--safe-bottom));
}
/* Экран с липкой панелью действий: отступ снизу даёт сама панель (она непрозрачна до края
   или до вкладок) — иначе между кнопкой и вкладками просвечивает прокручиваемый список. */
.view:has(> .sticky) {
  padding-bottom: 0;
}
.view.with-tabs:has(> .sticky) {
  padding-bottom: calc(var(--tabs-h) + var(--safe-bottom));
}
.view.dark {
  background: #000;
  max-width: none;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.spacer {
  flex: 1;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.row.start {
  justify-content: flex-start;
}
.row.wrap {
  flex-wrap: wrap;
}
.grow {
  flex: 1;
  min-width: 0;
}
.center {
  text-align: center;
}
.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Типографика. Масштаб: --fs-xs 12 · --fs-s 13 · --fs-m 15 · --fs-l 17 · --fs-xl 20 · --fs-2xl 26 */
.eyebrow {
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.h1 {
  font-size: var(--fs-2xl);
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.15;
  text-wrap: balance;
}
.h2 {
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.2;
  text-wrap: balance;
}
.title {
  font-size: var(--fs-l);
  font-weight: 700;
}
/* заголовок внутри карточки / строки — один кегль вместо инлайн font-size:15px */
.title-s {
  font-size: var(--fs-m);
  font-weight: 700;
  line-height: 1.3;
}
.sub {
  font-size: var(--fs-s);
  color: var(--muted);
  line-height: 1.5;
}
.sub b,
.sub strong {
  color: var(--text);
  font-weight: 700;
}
.display {
  font-family: var(--display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
/* Unbounded очень широкий (~0.78em на знак, кириллица шире): заголовочный шрифт никогда не рвёт
   слово посередине — переносит только по пробелам, а размер подбирается от контейнера (clamp/cq*). */
.display,
.timer,
.seatb,
.wseat .num,
.wbox .v,
.board-winner,
.rolecard .role,
.code-big,
.seat-big,
.stat .v {
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: none;
  text-wrap: balance;
}
.num {
  font-variant-numeric: tabular-nums;
}
.gold {
  color: var(--accent-text);
}
.red {
  color: var(--danger-text);
}
.ok {
  color: var(--ok);
}
.muted {
  color: var(--muted);
}
.dim {
  color: var(--dim-text);
}

hr.sep {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 4px 0;
}

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