/* Каркас страницы, шапка и страницы вокруг стола (вход, статистика, топ).
   Внутри стола координаты пиксельные (table.css), здесь - обычный поток. */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg-page);
  color: var(--text);
  font: 400 16px/1.5 var(--font-ui);
  -webkit-text-size-adjust: 100%;
}

body { display: flex; flex-direction: column; overflow-x: hidden; }

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

button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.page { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
[hidden] { display: none !important; }

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

.topbar {
  flex: 0 0 auto;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar__left { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.topbar__title { font: 700 14px/1.2 var(--font-display); color: var(--text-strong); }
.topbar__season { font-size: 11px; color: var(--text-muted); }

.topbar__center {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  gap: 14px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.topbar__hand { color: var(--text-muted); }
.topbar__net { font-weight: 700; }
.topbar__net.is-plus { color: var(--brand-lite); }
.topbar__net.is-minus { color: var(--danger); }

.topbar__right { position: relative; display: flex; align-items: center; gap: 6px; }
.topbar__nav { display: flex; align-items: center; gap: 6px; }
.tb--burger { display: none; font-size: 20px; line-height: 1; padding: 0 10px; }

.tb {
  height: 28px;
  padding: 0 10px;
  font-size: 13px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  touch-action: manipulation;
}
.tb:hover { background: var(--surface-2); }
.tb.is-on { background: var(--brand-dark); border-color: var(--brand); color: var(--text-strong); }

.langsw { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.langsw__b {
  height: 26px; padding: 0 8px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); border: 0; color: var(--text-muted);
}
.langsw__b.is-on { background: var(--brand-dark); color: var(--text-strong); }

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

.settings {
  position: absolute;
  right: 12px;
  top: 52px;
  z-index: 200;
  width: 280px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .55);
}
.settings__row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; }
.settings__row--off { opacity: .5; }
.settings__keys {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--text-muted); white-space: pre-line;
}

/* --------------------------------------------- страницы вокруг стола */

.page--sheet { overflow-y: auto; padding: 24px 16px 48px; }

.sheet {
  width: min(420px, 100%);
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
}
.sheet--wide { width: min(880px, 100%); }
.sheet h1 { margin: 0 0 4px; font: 700 22px/1.3 var(--font-display); color: var(--text-strong); }
.sheet h2 { margin: 24px 0 8px; font: 700 16px/1.3 var(--font-display); color: var(--text-strong); }

.season-line { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab {
  flex: 1; height: 36px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 14px; font-weight: 600; color: var(--text-muted);
}
.tab.is-on { background: var(--brand-dark); border-color: var(--brand); color: var(--text-strong); }

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-muted); }
.field input {
  height: 40px; padding: 0 12px;
  background: var(--bg-page); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text-strong); font: 400 16px/1 var(--font-ui);
}
.field__hint { font-size: 11px; color: var(--text-dim); }

.warn {
  margin: 0; padding: 10px 12px;
  background: rgba(207, 146, 54, .10);
  border: 1px solid var(--gold-dim);
  border-radius: 8px;
  font-size: 12px; line-height: 1.5; color: var(--text);
}

.wide-btn {
  height: 44px; border: 0; border-radius: 10px;
  background: var(--gold); color: var(--bg-page);
  font: 700 16px/1 var(--font-display);
  touch-action: manipulation;
}
.wide-btn:hover { filter: brightness(1.1); }

.form__err { min-height: 18px; font-size: 13px; color: var(--danger); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--bg-page); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.stat__k { font-size: 12px; color: var(--text-muted); }
.stat__v {
  font: 700 20px/1.3 var(--font-display);
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}
.stat__v.is-plus { color: var(--brand-lite); }
.stat__v.is-minus { color: var(--danger); }

.note { font-size: 12px; line-height: 1.6; color: var(--text-muted); }

.chips-line { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.pill {
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 12px; color: var(--text);
}

.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid th, .grid td {
  padding: 8px 10px; text-align: left;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.grid th { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); }
.grid td.is-plus { color: var(--brand-lite); }
.grid td.is-minus { color: var(--danger); }
.grid tr.is-me { background: rgba(0, 151, 88, .10); }
.grid__wrap { overflow-x: auto; }

.empty { padding: 16px 0; font-size: 13px; color: var(--text-muted); }

/* ------------------------------------------------ шторка лога (телефон) */

.logsheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 300;
  height: 60vh;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  border-radius: 14px 14px 0 0;
  display: flex; flex-direction: column;
}
.logsheet__head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--text-muted);
}
.logsheet__head button { background: transparent; border: 0; font-size: 22px; line-height: 1; }
.logsheet__body { flex: 1; overflow-y: auto; padding: 10px 14px; font-size: 13px; }
