:root {
  /* бильярдная вечером: сукно, слоновая кость шаров, синий мел, латунь */
  --bg: #0f1814;          /* ночное сукно */
  --bg2: #121d18;
  --card: #16221d;
  --card2: #1c2b25;
  --hover: #23352d;
  --line: #283b33;
  --line2: #355047;
  --text: #ece6d6;        /* слоновая кость */
  --muted: #93a399;
  --accent: #6aa6e8;      /* мел: кнопки и выбор */
  --accent-2: #8fbdf0;
  --accent-ink: #0b1d30;
  --brass: #e3b04b;       /* латунь: «сегодня», биток, отметки */
  --blue: #6aa6e8;
  --sky: #6aa6e8;
  --green: #48c78e;       /* забил */
  --amber: #f0b84a;
  --red: #e0715c;         /* промах */
  --heat-0: #18241f;
  --heat-1: #1b4434;
  --heat-2: #22684c;
  --heat-3: #2f9468;
  --heat-4: #48c78e;
  --radius: 16px;
  --shadow: 0 14px 36px rgba(0, 0, 0, .38);
  --font: 'Golos Text', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --display: 'Unbounded', 'Golos Text', 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  /* тёплый свет лампы над столом */
  background:
    radial-gradient(ellipse 1100px 520px at 50% -140px, rgba(255, 214, 140, .085), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.5 var(--font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-family: var(--display); font-size: 26px; font-weight: 600; letter-spacing: -.015em; line-height: 1.2; }
kbd {
  display: inline-block; padding: 0 5px; border: 1px solid var(--line2); border-bottom-width: 2px;
  border-radius: 5px; font: 600 11px/16px var(--font); color: var(--text); background: var(--card2);
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.amber { color: var(--amber); }
.grow { flex: 1; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { display: inline-flex; align-items: center; justify-content: center; flex: none; }

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

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 28px;
  padding: 12px 28px;
  background: rgba(13, 17, 23, .78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, .05);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 600; font-size: 15.5px; letter-spacing: -.01em; }
.brand-logo { width: 54px; height: 40px; flex: none; }
.nav { display: flex; gap: 4px; }
.brand-name, .nav a { white-space: nowrap; }
.nav a {
  padding: 8px 14px; border-radius: 10px; color: var(--muted); font-weight: 600; transition: .15s;
}
.nav a:hover { color: var(--text); background: var(--card); }
.nav a.on { color: var(--text); background: var(--card2); box-shadow: inset 0 -2px 0 var(--brass); }
.account { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.guest-note { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 600; margin-right: 4px; }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(251, 191, 36, .15); }
.user-wrap { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 9px; padding: 5px 12px 5px 5px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); font-weight: 600;
}
.user-chip:hover { border-color: var(--line2); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brass), #c98a22); color: #2a1d05; font-weight: 800; font-size: 13px;
}
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; padding: 6px;
  background: var(--card2); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.menu-head { padding: 8px 10px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px;
  background: none; text-align: left; font-weight: 600;
}
.menu-item:hover { background: var(--hover); }

.view { max-width: 1480px; margin: 0 auto; padding: 26px 28px 60px; }
.page { animation: fade .2s ease; }
.page.loading { min-height: 50vh; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- кнопки, поля */

.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: 10px; border: 1px solid transparent; font-weight: 700; font-size: 14px; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: var(--card2); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--line2); background: var(--hover); }
.btn.danger { background: var(--red); color: #2b0606; }
.btn.danger-ghost { background: transparent; border-color: rgba(248, 113, 113, .35); color: var(--red); }
.btn.danger-ghost:hover { background: rgba(248, 113, 113, .1); }
.btn.link { background: none; color: var(--muted); padding: 0; }
.btn.link:hover { color: var(--text); }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px;
  background: transparent; border: 1px solid var(--line); color: var(--muted); flex: none;
}
.icon-btn:hover { color: var(--text); background: var(--card2); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field textarea, .field select, .search input, .num-input, .chip-input, .comment, .title-input {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus, .search:focus-within, .num-input:focus, .comment:focus, .chip-input:focus, .title-input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(106, 166, 232, .18);
}
.field textarea { resize: vertical; min-height: 90px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row .field { margin-bottom: 10px; }
.search {
  display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 38px; border-radius: 10px;
  background: var(--bg2); border: 1px solid var(--line); color: var(--muted);
}
.search input { border: 0; padding: 0; background: none; box-shadow: none !important; flex: 1; min-width: 0; height: 100%; color: var(--text); }

.seg { display: inline-flex; padding: 3px; background: var(--bg2); border: 1px solid var(--line); border-radius: 11px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--card2); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, .05), 0 2px 6px rgba(0, 0, 0, .3); }
.seg-full { display: flex; width: 100%; margin-bottom: 12px; }
.seg-full button { flex: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--bg2); color: var(--muted);
  padding: 4px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; transition: .12s;
}
.chip:hover { color: var(--text); border-color: var(--line2); }
.chip.on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.chip-input { padding: 4px 11px; border-radius: 999px; font-size: 13px; width: 140px; }

.badge {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
  background: rgba(59, 155, 234, .14); color: #8cc8ff;
}
.badge.pot_zone { background: rgba(52, 211, 153, .14); color: #6ee7b7; }
.badge.soft { background: var(--card2); color: var(--muted); }
.badge.mine { background: rgba(243, 178, 60, .14); color: var(--accent-2); }
.badge.xs { font-size: 10px; padding: 1px 6px; margin-left: 8px; }

.switch { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch-track { width: 34px; height: 20px; border-radius: 999px; background: var(--line2); position: relative; transition: .15s; }
.switch-track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; transition: .15s;
}
.switch input:checked + .switch-track { background: var(--sky); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }

/* ---------------------------------------------------------------- карточки */

.card {
  background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 14px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.page-head p { margin: 4px 0 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.tile-v { font-family: var(--display); font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
.tile-l { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.small-tiles { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.small-tiles .tile { background: var(--bg2); padding: 10px 12px; }
.small-tiles .tile-v { font-size: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.card + .card, .tiles + .card, .card + .grid-2 { margin-top: 16px; }
.grid-2 > .card.card { margin: 0; }

/* ---------------------------------------------------------------- стол */

.table-svg { display: block; width: 100%; height: auto; user-select: none; }
.table-svg .t-fine { display: none; }
.table-svg.show-fine .t-fine { display: inline; }
.thumb { pointer-events: none; }

/* ---------------------------------------------------------------- дневник */

.journal { display: grid; grid-template-columns: 370px 1fr; gap: 22px; align-items: start; }
.j-side { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 16px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-title { font-family: var(--display); font-weight: 600; font-size: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-wd { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); padding-bottom: 4px; }
.cal-wd.we { color: #b08a5c; }
.cal-day {
  position: relative; aspect-ratio: 1; border: 1px solid transparent; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: var(--heat-0); transition: transform .08s, border-color .12s;
}
.cal-day:hover { border-color: var(--line2); transform: translateY(-1px); }
.cal-num { font-weight: 700; font-size: 14px; line-height: 1; }
.cal-pct { font-size: 10px; font-weight: 700; opacity: .85; line-height: 1; }
.cal-day.out { opacity: .38; }
.cal-day.future { opacity: .55; }
.cal-day.today .cal-num { color: var(--brass); }
.cal-day.today::after { content: ''; position: absolute; top: 5px; right: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--brass); }
.cal-day.sel { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(106, 166, 232, .28); }
.heat-0 { background: var(--heat-0); }
.heat-1 { background: var(--heat-1); }
.heat-2 { background: var(--heat-2); }
.heat-3 { background: var(--heat-3); }
.heat-4 { background: var(--heat-4); color: #04261a; }
.cal-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.heat-legend { display: flex; align-items: center; gap: 4px; }
.heat-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.month-card p { margin: 6px 0 0; }

.day-panel { min-width: 0; transition: opacity .15s; }
.day-panel.loading { opacity: .6; }
.day-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.day-nav { display: flex; gap: 6px; }
.day-title { flex: 1; min-width: 0; }
.day-title h1 { display: flex; align-items: center; gap: 12px; }
.badge.rel { font-size: 12px; background: rgba(227, 176, 75, .15); color: #f1cd7d; font-family: var(--font); letter-spacing: 0; }
.rec-list { display: flex; flex-direction: column; gap: 16px; }

/* ---------------------------------------------------------------- карточка подхода */

.rec-card { padding: 18px 20px; animation: fade .2s ease; transition: opacity .18s, transform .18s; }
.rec-card.removing { opacity: 0; transform: scale(.98); }
.rec-head { display: grid; grid-template-columns: 210px 1fr auto; gap: 18px; align-items: center; margin-bottom: 16px; }
.rec-thumb { padding: 0; border: 0; background: none; border-radius: 10px; overflow: hidden; transition: transform .12s; }
.rec-thumb:hover { transform: scale(1.02); }
.rec-title { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.rec-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rec-name { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.rec-name:hover { color: var(--accent-2); }
.rec-summary { display: flex; align-items: center; gap: 14px; }
.sum-text { line-height: 1.3; min-width: 110px; }
.sum-big { font-family: var(--display); font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.sum-big small { font-size: 16px; color: var(--muted); font-weight: 700; }
.ring { position: relative; flex: none; }
.ring svg { display: block; }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 14px; }

.strip { display: grid; grid-template-columns: repeat(var(--cols, 20), minmax(0, 1fr)); gap: 0; border: 1.5px solid var(--line2); border-radius: 10px; overflow: hidden; }
.cell {
  position: relative; height: 42px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--bg2); display: grid; place-items: center; transition: background .1s;
}
.cell:hover { background: var(--hover); }
.cell-n { position: absolute; top: 2px; left: 4px; font-size: 9px; font-weight: 700; color: var(--muted); opacity: .7; }
.cell.hit { background: rgba(52, 211, 153, .2); color: var(--green); }
.cell.hit.zone { background: rgba(52, 211, 153, .28); color: #86efac; }
.cell.pot-only { background: rgba(251, 191, 36, .16); color: var(--amber); }
.cell.miss { background: rgba(248, 113, 113, .14); color: var(--red); }
.cell .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.cell.pop { animation: pop .22s ease; }
@keyframes pop { 0% { transform: scale(.8); } 60% { transform: scale(1.08); } 100% { transform: none; } }

.quick { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.qbtn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card2); font-weight: 700; font-size: 13.5px; transition: .12s;
}
.qbtn:hover { border-color: var(--line2); }
.q-hit { color: var(--green); }
.q-hit:hover { background: rgba(52, 211, 153, .1); }
.strip-pot_zone ~ .quick .q-hit { color: var(--amber); }
.q-zone { color: #86efac; background: rgba(52, 211, 153, .12); border-color: rgba(52, 211, 153, .35); }
.q-miss { color: var(--red); }
.q-miss:hover { background: rgba(248, 113, 113, .1); }
.q-undo { color: var(--muted); padding: 0 11px; }
.stepper { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--bg2); }
.quick .stepper { margin-left: auto; }
.step-btn {
  min-width: 34px; height: 28px; padding: 0 6px; border: 0; background: none; border-radius: 7px;
  color: var(--muted); font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums;
}
.step-btn:hover { background: var(--hover); color: var(--text); }
.count-label { min-width: 34px; text-align: center; font-weight: 800; font-size: 14px; }
.rec-legend { margin-top: 8px; }

.rec-notes { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 12px; }
.notes-row { display: flex; align-items: center; gap: 14px; }
.notes-row.top { align-items: flex-start; }
.notes-row .label { width: 96px; flex: none; font-size: 13px; font-weight: 600; color: var(--muted); padding-top: 6px; }
.moods { display: flex; gap: 6px; }
.mood {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2);
  font-size: 20px; line-height: 1; filter: grayscale(.85); opacity: .65; transition: .12s;
}
.mood:hover { opacity: 1; filter: none; }
.mood.on { filter: none; opacity: 1; border-color: var(--brass); background: rgba(227, 176, 75, .14); transform: scale(1.06); }
.comment { width: 100%; resize: none; min-height: 44px; line-height: 1.5; }
.rec-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.save-status { font-size: 12.5px; }
.save-status.warn { color: var(--amber); }

/* ---------------------------------------------------------------- пустые состояния */

.empty { text-align: center; padding: 48px 20px; border: 1px dashed var(--line2); border-radius: var(--radius); background: rgba(22, 29, 41, .5); }
.empty h3 { font-size: 18px; margin: 12px 0 6px; }
.empty p { max-width: 460px; margin: 0 auto 16px; }
.empty-art { opacity: .9; }

/* ---------------------------------------------------------------- библиотека */

.filters { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.filters .search { width: 280px; }
.library > .chips { margin-bottom: 18px; }
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 14px; }
.ex-grid > .empty { grid-column: 1 / -1; }
.group-title { grid-column: 1 / -1; font-family: var(--display); font-size: 15px; font-weight: 600; margin: 12px 0 -2px; }
.ex-card {
  text-align: left; padding: 0; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: transform .12s, border-color .12s, box-shadow .12s;
}
.ex-card:hover { transform: translateY(-2px); border-color: var(--line2); box-shadow: var(--shadow); }
.ex-thumb { padding: 12px 12px 0; }
.ex-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 5px; }
.ex-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.ex-title { font-weight: 700; font-size: 16px; line-height: 1.3; }
.ex-stat { display: flex; gap: 12px; align-items: center; font-size: 12.5px; font-weight: 600; margin-top: 4px; }
.ex-stat span { display: inline-flex; align-items: center; gap: 5px; }
.ex-card.compact .ex-title { font-size: 14px; }

.picker-top { display: flex; gap: 10px; margin-bottom: 12px; }
.picker-top .search { flex: 1; }
.picker > .chips { margin-bottom: 14px; }
.picker-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); max-height: 62vh; overflow: auto; padding: 2px 4px 4px 2px; }

/* ---------------------------------------------------------------- упражнение */

.crumbs { margin-bottom: 14px; }
.crumbs a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; }
.crumbs a:hover { color: var(--text); }
.ex-hero { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: 16px; margin-bottom: 16px; }
.ex-scheme { padding: 14px; display: flex; align-items: center; }
.ex-info { display: flex; flex-direction: column; gap: 10px; }
.ex-info h1 { font-size: 22px; }
.desc { white-space: pre-line; margin: 0; color: #c6d0de; }
.ex-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.lg-cue { background: #f5c75a; }
.lg-object { background: #f1f1ee; }
.lg-cue-pool { background: #f6f3ea; }
.lg-object-pool { background: conic-gradient(#f2c230 0 25%, #2457c5 0 50%, #d8392b 0 75%, #1d8a50 0); }
.lg-ghost { border: 1.5px dashed #fff; }
.lg-zone { border-radius: 3px !important; border: 1.5px dashed #fff; background: rgba(255, 255, 255, .15); }
.lg-pocket { background: #000; box-shadow: 0 0 0 2px var(--brass); }

.history { display: flex; flex-direction: column; }
.hist-row {
  display: grid; grid-template-columns: 130px 120px 160px 50px 34px 1fr; gap: 14px; align-items: center;
  padding: 10px 8px; border-bottom: 1px solid var(--line); border-radius: 8px;
}
.hist-row:last-child { border-bottom: 0; }
.hist-row:hover { background: var(--card2); }
.hist-day { font-weight: 700; }
.hist-score { font-weight: 800; }
.hist-bar { height: 8px; border-radius: 99px; background: var(--bg2); overflow: hidden; display: block; flex: 1; }
.hist-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #1f9466, var(--green)); }
.hist-pct { font-weight: 700; font-size: 13px; text-align: right; }
.hist-mood { font-size: 18px; text-align: center; }
.hist-note { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- графики */

.chart { width: 100%; min-width: 0; }
.chart-svg { width: 100%; overflow: hidden; }
.chart .ch-grid { stroke: var(--line); stroke-width: 1; }
.chart .ch-axis { fill: var(--muted); font-size: 11px; font-family: var(--font); font-weight: 600; }
.chart-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

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

.year-heat { overflow-x: auto; padding-bottom: 4px; }
.yh-months { display: grid; grid-template-columns: repeat(53, 15px); gap: 3px; font-size: 11px; color: var(--muted); font-weight: 600; height: 18px; }
.yh-months span { white-space: nowrap; }
.yh-cols { display: flex; gap: 3px; }
.yh-col { display: flex; flex-direction: column; gap: 3px; }
.yh-cell, .yh-empty { width: 15px; height: 15px; border-radius: 4px; display: block; }
.yh-cell:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
.effect-list { display: flex; flex-direction: column; gap: 8px; }
.effect-row { display: grid; grid-template-columns: 170px 1fr 48px 40px 70px; gap: 12px; align-items: center; font-weight: 600; font-size: 14px; }
.effect-row.dim { opacity: .4; }
.effect-emoji { display: inline-flex; align-items: center; gap: 8px; font-size: 18px; }
.effect-pct { text-align: right; font-weight: 800; }
.effect-diff { font-size: 12.5px; font-weight: 800; color: var(--muted); }
.effect-diff.up { color: var(--green); }
.effect-diff.down { color: var(--red); }
.ex-table { display: flex; flex-direction: column; }
.ex-row { display: grid; grid-template-columns: 2fr 90px 90px 1.2fr 80px 130px; gap: 14px; align-items: center; padding: 10px 8px; border-bottom: 1px solid var(--line); border-radius: 8px; }
.ex-row:not(.head):hover { background: var(--card2); }
.ex-row.head { padding-top: 0; }
.ex-row-title { font-weight: 700; }
.hist-bar-wrap { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 13px; }

/* ---------------------------------------------------------------- редактор */

.editor { display: flex; flex-direction: column; gap: 14px; }
.editor-top { display: flex; align-items: center; gap: 14px; padding: 12px 14px; }
.title-input { flex: 1; min-width: 200px; font-size: 18px; font-weight: 800; border-color: transparent; background: transparent; }
.title-input:hover { border-color: var(--line); }
.editor-top-group { display: flex; align-items: center; gap: 12px; }
.inline-field { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.num-input { width: 70px; padding: 6px 8px; }
.editor-main { display: grid; grid-template-columns: 58px minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.tools-card { padding: 7px; position: sticky; top: 84px; }
.tools { display: flex; flex-direction: column; gap: 4px; }
.tool {
  width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px;
  border: 1px solid transparent; background: none; color: var(--muted); transition: .12s;
}
.tool:hover { background: var(--hover); color: var(--text); }
.tool.on { background: rgba(56, 189, 248, .14); border-color: rgba(56, 189, 248, .5); color: var(--text); }
.tool.danger:hover { color: var(--red); }
.tool-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.canvas-card { padding: 12px; }
.canvas-bar { display: flex; align-items: center; gap: 18px; margin-bottom: 10px; padding: 0 4px; flex-wrap: wrap; }
.canvas-hint { font-size: 12.5px; flex: 1; min-width: 160px; }
.coords { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: #fde68a; min-width: 120px; text-align: right; }
.canvas-wrap { border-radius: 12px; overflow: hidden; }
.editor-table { touch-action: none; }
.editor-table[data-tool="cue"], .editor-table[data-tool="object"], .editor-table[data-tool="ghost_cue"],
.editor-table[data-tool="ghost_object"], .editor-table[data-tool="rect"], .editor-table[data-tool="circle"],
.editor-table[data-tool="arrow"], .editor-table[data-tool="arrow_cue"] { cursor: crosshair; }
.editor-table[data-tool="pocket"] { cursor: pointer; }
.side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 84px; }
.side .card { padding: 16px; }
.hint-list { margin: 0 0 12px; padding-left: 18px; color: #c6d0de; font-size: 13px; display: flex; flex-direction: column; gap: 8px; }
.mini-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); font-weight: 600; border-top: 1px solid var(--line); padding-top: 12px; }
.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 14px; }
.type-btn {
  display: flex; align-items: center; gap: 7px; padding: 7px 9px; border-radius: 9px; font-size: 12.5px; font-weight: 600;
  background: var(--bg2); border: 1px solid var(--line); color: var(--muted); text-align: left; line-height: 1.2;
}
.type-btn:hover { color: var(--text); }
.type-btn.on { color: var(--text); border-color: var(--sky); background: rgba(56, 189, 248, .1); }
.swatches { display: flex; gap: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 8px; border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .3); }
.swatch.on { border-color: var(--text); }
.prop-actions { display: flex; gap: 8px; margin-top: 6px; }

/* ---------------------------------------------------------------- модальные окна */

.modal-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(5, 8, 12, .62); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 24px; animation: fade .15s ease;
}
.modal-overlay.closing { opacity: 0; transition: opacity .14s; }
.modal {
  width: min(460px, 100%); max-height: calc(100vh - 48px); overflow: auto;
  background: var(--card); border: 1px solid var(--line2); border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
}
.modal-wide { width: min(1100px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; gap: 12px; }
.modal-head h2 { font-size: 19px; }
.modal-body { padding: 10px 20px 20px; }
.modal-body > div > p:first-child { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 18px; }
.modal-actions .btn.link { margin-right: auto; }
.form-error { color: var(--red); font-size: 13.5px; font-weight: 600; background: rgba(248, 113, 113, .1); padding: 8px 12px; border-radius: 8px; }
.scheme-modal .desc { margin-top: 14px; }

/* ---------------------------------------------------------------- toast, tooltip */

.toast-root { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--card2); border: 1px solid var(--line2); padding: 10px 18px; border-radius: 12px;
  box-shadow: var(--shadow); font-weight: 600; font-size: 14px; animation: fade .2s ease; transition: opacity .3s, transform .3s;
}
.toast.hide { opacity: 0; transform: translateY(6px); }
.toast-error { border-color: rgba(248, 113, 113, .5); color: #fecaca; }
.toast-success { border-color: rgba(52, 211, 153, .45); }
.tooltip {
  position: fixed; left: 0; top: 0; z-index: 300; pointer-events: none; max-width: 300px;
  background: #0a0e14; border: 1px solid var(--line2); color: var(--text); padding: 7px 10px; border-radius: 9px;
  font-size: 12.5px; line-height: 1.45; box-shadow: var(--shadow);
}

/* ---------------------------------------------------------------- узкие экраны ПК */

@media (max-width: 1180px) {
  .journal { grid-template-columns: 320px 1fr; }
  .rec-head { grid-template-columns: 170px 1fr; }
  .rec-summary { grid-column: 1 / -1; }
  .editor-main { grid-template-columns: 58px minmax(0, 1fr); }
  .side { grid-column: 1 / -1; position: static; display: grid; grid-template-columns: 1fr 1fr; }
  .ex-hero, .grid-2 { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- карточка дня */

.day-card { margin-bottom: 16px; display: flex; flex-direction: column; gap: 12px; padding: 16px 20px; }
.day-card-head { display: flex; align-items: center; justify-content: space-between; }
.day-card-head .card-title { margin: 0; }
.rec-notes { gap: 0; }

/* ---------------------------------------------------------------- категории */

.chip.mine:not(.on) { border-color: rgba(243, 178, 60, .35); }
.chip-add { border-style: dashed; color: var(--accent-2); }
.chip-add:hover { border-color: var(--accent); color: var(--accent); }
.cat-actions { display: flex; align-items: center; gap: 8px; margin: -6px 0 16px; flex-wrap: wrap; }
.cat-actions:empty { display: none; }
.ex-card-new {
  align-items: center; justify-content: center; gap: 6px; min-height: 220px;
  border-style: dashed; background: transparent; color: var(--muted); font-weight: 700;
}
.ex-card-new:hover { color: var(--accent-2); border-color: var(--accent); }
.field select { appearance: auto; cursor: pointer; }

/* ================================================================ адаптивность */

/* Элементы, которые появляются только на телефоне или только при определённом вводе */
.tabbar, .rotate-hint, .lbl-short, .only-touch { display: none; }
button, a, .cell { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* Сенсорные экраны: нет наведения — не оставляем «залипшие» эффекты hover */
@media (hover: none) {
  .only-mouse { display: none; }
  .only-touch { display: inline; }
  .cal-day:hover, .ex-card:hover, .rec-thumb:hover { transform: none; box-shadow: none; }
  .cell:hover { background: var(--bg2); }
  .cell.hit:hover { background: rgba(52, 211, 153, .2); }
  .cell.hit.zone:hover { background: rgba(52, 211, 153, .28); }
  .cell.pot-only:hover { background: rgba(251, 191, 36, .16); }
  .cell.miss:hover { background: rgba(248, 113, 113, .14); }
  .cell:active { filter: brightness(1.25); }
}

/* ---------------------------------------------------------------- планшет */

@media (max-width: 1024px) {
  .topbar { gap: 18px; padding: 12px 20px; }
  .view { padding: 22px 20px 56px; }
  .journal { grid-template-columns: 1fr; }
  .j-side { position: static; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; }
  .editor-top { flex-wrap: wrap; }
  .editor-top-group { flex-wrap: wrap; }
  .hist-row { grid-template-columns: 120px 110px 1fr 46px 30px; }
  .hist-note { grid-column: 1 / -1; white-space: normal; }
  .ex-row { grid-template-columns: 2fr 70px 70px 1.2fr 64px 110px; gap: 10px; }
}

/* ---------------------------------------------------------------- телефон */

@media (max-width: 720px) {
  body { font-size: 14.5px; background-attachment: scroll; }
  h1 { font-size: 21px; }

  /* поля ввода 16px — иначе iOS увеличивает страницу при фокусе */
  input, textarea, select, .field input, .field textarea, .search input, .comment, .chip-input, .title-input { font-size: 16px; }

  /* шапка: логотип + аккаунт, разделы — внизу экрана */
  .topbar { padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); gap: 10px; }
  .topbar .nav { display: none; }
  .brand { font-size: 15.5px; gap: 8px; }
  .brand-logo { width: 45px; height: 33px; }
  .account { gap: 6px; }
  .guest-note .lbl, .user-chip .lbl { display: none; }
  .guest-note { margin: 0; }
  .btn-save .lbl { display: none; }
  .btn-save .lbl-short { display: inline; }
  .user-chip { padding: 4px; }
  .menu { position: fixed; left: 12px; right: 12px; top: 58px; min-width: 0; }

  .tabbar {
    display: grid; grid-template-columns: repeat(3, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: rgba(13, 17, 23, .92); backdrop-filter: blur(14px);
    border-top: 1px solid rgba(255, 255, 255, .07);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px;
    border-radius: 12px; color: var(--muted); font-size: 11px; font-weight: 700;
  }
  .tabbar a.on { color: var(--accent); background: rgba(106, 166, 232, .1); }
  .view { padding: 16px 16px calc(92px + env(safe-area-inset-bottom)); }

  .toast-root { bottom: calc(84px + env(safe-area-inset-bottom)); width: calc(100% - 32px); }
  .toast { text-align: center; }

  /* общие блоки */
  .card { padding: 14px; border-radius: 12px; }
  .card-title { margin-bottom: 10px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 14px; }
  .page-head .btn { justify-content: center; height: 42px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile { padding: 11px 12px; }
  .tile-v { font-size: 21px; }
  .tile-l { font-size: 12px; }
  .grid-2 { grid-template-columns: 1fr; gap: 12px; margin-bottom: 12px; }
  .card + .card, .tiles + .card, .card + .grid-2 { margin-top: 12px; }
  .btn { height: 40px; }
  .btn.sm { height: 34px; }
  .icon-btn { width: 40px; height: 40px; }
  .empty { padding: 32px 16px; }

  /* горизонтальная лента чипов вместо переноса */
  .library > .chips, .picker > .chips {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin-left: -16px; margin-right: -16px; padding: 2px 16px 4px;
  }
  .library > .chips::-webkit-scrollbar, .picker > .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; padding: 6px 13px; }

  /* ---------- дневник: календарь, затем день, затем итоги месяца */
  .journal { display: flex; flex-direction: column; gap: 14px; }
  .j-side { display: contents; }
  .cal-card { order: 1; }
  .day-panel { order: 2; }
  .month-card { order: 3; }
  .cal-grid { gap: 4px; }
  .cal-day { border-radius: 9px; }
  .cal-num { font-size: 13px; }
  .cal-pct { font-size: 9px; }
  .cal-head { margin-bottom: 8px; }
  .cal-foot { margin-top: 10px; }

  .day-head { flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
  .day-title { order: 1; flex: 1 1 100%; }
  .day-title h1 { gap: 8px; flex-wrap: wrap; }
  .day-nav { order: 2; }
  .day-head > .btn { order: 3; flex: 1; justify-content: center; height: 40px; }

  /* заметки дня: подпись над содержимым */
  .day-card { padding: 14px; gap: 10px; margin-bottom: 14px; }
  .notes-row, .notes-row.top { flex-direction: column; align-items: stretch; gap: 6px; }
  .notes-row .label { width: auto; padding-top: 0; }
  .moods { justify-content: space-between; max-width: 300px; }
  .mood { width: 48px; height: 48px; font-size: 22px; }
  .chip-input { width: 150px; }

  /* карточка подхода */
  .rec-list { gap: 12px; }
  .rec-card { padding: 14px; }
  .rec-head { grid-template-columns: 112px minmax(0, 1fr); gap: 12px; margin-bottom: 12px; }
  .rec-name { font-size: 16.5px; line-height: 1.25; }
  .rec-summary { grid-column: 1 / -1; gap: 12px; }
  .sum-big { font-size: 24px; }
  .strip { grid-template-columns: repeat(var(--cols-m, 10), minmax(0, 1fr)); }
  .cell { height: 44px; }
  .cell-n { font-size: 8px; top: 1px; left: 3px; }
  .quick { gap: 6px; }
  .qbtn { flex: 1 1 auto; justify-content: center; height: 44px; padding: 0 10px; }
  .q-undo { flex: 0 0 44px; padding: 0; }
  .quick .stepper { margin-left: 0; flex: 1 1 100%; justify-content: space-between; }
  .step-btn { flex: 1; height: 36px; min-width: 0; }
  .rec-foot { flex-wrap: wrap; }
  .rec-foot .save-status { flex: 1 1 100%; }
  .rec-foot .btn { flex: 1; justify-content: center; }
  .rec-foot .grow { display: none; }

  /* ---------- библиотека */
  .filters { flex-direction: column; align-items: stretch; gap: 10px; }
  .filters .search { width: 100%; height: 42px; }
  .filters .seg { overflow-x: auto; }
  .filters .seg button { flex: 1; padding: 8px 10px; }
  .library > .chips { margin-bottom: 12px; }
  .cat-actions { margin: -4px 0 12px; }
  .ex-grid { gap: 12px; }
  .group-title { margin-top: 6px; }
  .ex-card-new { min-height: 140px; }

  /* выбор упражнения и другие окна — снизу экрана */
  .modal-overlay { align-items: end; padding: 0; }
  .modal, .modal-wide {
    width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom); animation: sheet .22s ease;
  }
  .modal-head { padding: 16px 16px 4px; }
  .modal-body { padding: 8px 16px 18px; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn:not(.link) { flex: 1; justify-content: center; height: 44px; }
  .picker-top { flex-direction: column; }
  .picker-top .search { height: 42px; }
  .picker-grid { grid-template-columns: 1fr 1fr; max-height: none; gap: 10px; }
  .picker-grid .ex-thumb { padding: 8px 8px 0; }
  .picker-grid .ex-body { padding: 8px 10px 10px; }
  .picker-grid .ex-stat { display: none; }

  /* ---------- упражнение */
  .ex-hero { gap: 12px; margin-bottom: 12px; }
  .ex-scheme { padding: 10px; }
  .ex-info h1 { font-size: 20px; }
  .ex-actions .btn { flex: 1 1 auto; justify-content: center; }
  .hist-row {
    grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 4px 10px; padding: 10px 4px;
    grid-template-areas: "day score pct mood" "bar bar bar bar" "note note note note";
  }
  .hist-day { grid-area: day; }
  .hist-score { grid-area: score; }
  .hist-row > .hist-bar { grid-area: bar; }
  .hist-pct { grid-area: pct; }
  .hist-mood { grid-area: mood; }
  .hist-note { grid-area: note; white-space: normal; }
  .hist-note:empty { display: none; }

  /* ---------- статистика */
  .yh-months { grid-template-columns: repeat(53, 13px); }
  .yh-cell, .yh-empty { width: 13px; height: 13px; border-radius: 3px; }
  .effect-row {
    grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 10px;
    grid-template-areas: "label pct diff" "bar bar bar";
  }
  .effect-label { grid-area: label; }
  .effect-row > .hist-bar { grid-area: bar; }
  .effect-pct { grid-area: pct; }
  .effect-diff { grid-area: diff; min-width: 28px; text-align: right; }
  .effect-row > .muted.small { display: none; }
  .ex-row.head { display: none; }
  .ex-row {
    grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 10px 4px;
    grid-template-areas: "title last" "avg avg";
  }
  .ex-row > :nth-child(1) { grid-area: title; }
  .ex-row > :nth-child(2), .ex-row > :nth-child(3), .ex-row > :nth-child(5) { display: none; }
  .ex-row > :nth-child(4) { grid-area: avg; }
  .ex-row > :nth-child(6) { grid-area: last; font-size: 12.5px; }

  /* ---------- редактор */
  .editor { gap: 10px; }
  .editor-top { padding: 10px; gap: 10px; }
  .title-input { min-width: 0; flex: 1 1 calc(100% - 60px); font-size: 17px; }
  .editor-top-group { flex: 1 1 100%; gap: 8px; }
  .editor-top-group .seg { flex: 1 1 100%; }
  .editor-top-group .seg button { flex: 1; }
  .editor-top-group .inline-field { flex: 1 1 100%; justify-content: space-between; }
  .editor-top-group .stepper { flex: 1; justify-content: space-between; }
  .editor-top-group .btn.primary { flex: 1; justify-content: center; height: 44px; }
  .editor-top-group .save-status { flex: 1 1 100%; order: 5; }
  .editor-main { grid-template-columns: 1fr; gap: 10px; }
  .tools-card { padding: 6px; position: sticky; top: 56px; z-index: 20; }
  .tools { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .tools::-webkit-scrollbar { display: none; }
  .tool { flex: none; width: 44px; height: 44px; }
  .tool-sep { width: 1px; height: auto; margin: 6px 3px; }
  .canvas-card { padding: 8px; }
  .canvas-bar { gap: 10px 14px; margin-bottom: 8px; }
  .canvas-hint { flex: 1 1 100%; order: 3; }
  .coords { flex: 1 1 100%; text-align: left; min-width: 0; order: 4; min-height: 18px; }
  .canvas-wrap { border-radius: 8px; }
  .side { grid-template-columns: 1fr; position: static; }
  .type-btn { padding: 10px; }
}

/* Портретная ориентация телефона: стол узкий — подсказываем повернуть экран */
@media (max-width: 720px) and (orientation: portrait) {
  .rotate-hint {
    display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 8px 10px;
    border-radius: 10px; background: rgba(56, 189, 248, .1); color: #bae6fd; font-size: 12.5px; font-weight: 600;
  }
}

/* Телефон, повёрнутый горизонтально: низкий экран — шапка не закрывает стол */
@media (max-height: 500px) and (orientation: landscape) {
  .topbar { position: static; }
  .tools-card { top: 0; }
}

/* ---------------------------------------------------------------- маленькие телефоны */

@media (max-width: 380px) {
  .view { padding-left: 12px; padding-right: 12px; }
  .library > .chips, .picker > .chips { margin-left: -12px; margin-right: -12px; padding-left: 12px; padding-right: 12px; }
  .rec-head { grid-template-columns: 92px minmax(0, 1fr); }
  .tiles { gap: 6px; }
  .tile-v { font-size: 19px; }
  .picker-grid { grid-template-columns: 1fr; }
  .mood { width: 44px; height: 44px; }
  .cal-pct { display: none; }
}

@keyframes sheet { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }

/* Элементы сетки не должны растягиваться по содержимому (графики, ряд инструментов) */
.grid-2 > *, .journal > *, .ex-hero > *, .editor-main > *, .tools-card, .canvas-card { min-width: 0; }
@media (max-width: 720px) {
  .editor-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .journal { align-items: stretch; }
  .brand-name { white-space: nowrap; }
}
/* Планшет и телефон горизонтально: шапка с разделами, но компактный аккаунт */
@media (max-width: 1024px) {
  .guest-note .lbl, .btn-save .lbl { display: none; }
  .btn-save .lbl-short { display: inline; }
  .nav a { padding: 8px 11px; }
}
@media (max-width: 720px) {
  .picker-grid .badge.soft, .picker-grid .badge.mine { display: none; }
}

/* Нижняя кнопка «Сохранить» в редакторе */
.editor-bottom { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 12px 14px; }
@media (max-width: 720px) {
  .editor-bottom { flex-direction: column; align-items: stretch; gap: 8px; }
  .editor-bottom .btn { justify-content: center; height: 46px; }
  .editor-bottom .save-status { text-align: center; }
  .editor-bottom .save-status:empty { display: none; }
}

/* ================================================================ два стола: русский бильярд и пул */

.game-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; max-width: 560px; }
.game-tab {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: left;
  border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--muted);
  transition: border-color .15s, background .15s, color .15s;
}
.game-tab:hover { border-color: var(--line2); color: var(--text); }
.game-tab .felt {
  flex: none; width: 46px; height: 28px; border-radius: 6px;
  box-shadow: inset 0 0 0 3px #5b351c, inset 0 0 0 4px rgba(0, 0, 0, .25);
}
.game-russian .felt { background: radial-gradient(circle, #6cc28f, #47996a); }
.game-pool .felt { background: radial-gradient(circle, #4a9ae0, #2a6fb0); }
.game-name { flex: 1; font-family: var(--display); font-weight: 600; font-size: 14.5px; }
.game-count { font-weight: 600; font-size: 13px; color: var(--muted); }
.game-tab.on { border-color: var(--accent); background: var(--card2); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }
.picker .game-tabs { margin-bottom: 12px; }

.seg-game button[data-game="russian"].on { box-shadow: inset 0 -2px 0 #47996a; }
.seg-game button[data-game="pool"].on { box-shadow: inset 0 -2px 0 #3586cf; }
.badge.game-pool { background: rgba(53, 134, 207, .18); color: #9cc8f2; }

/* выбор номера шара пула */
.pool-picker { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.pool-num {
  aspect-ratio: 1; padding: 0; border-radius: 50%; border: 2px solid transparent;
  background: var(--c); display: grid; place-items: center; overflow: hidden;
}
.pool-num.stripe { background: linear-gradient(#f6f3ea 0 22%, var(--c) 22% 78%, #f6f3ea 78%); }
.pool-num span {
  width: 54%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: #fbf8f0; color: #1b1b1b; font-size: 10px; font-weight: 700;
}
.pool-num.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--card) inset; }
.pool-picker .btn { grid-column: 1 / -1; justify-content: center; }

/* ================================================================ доступность */

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cell:focus-visible { outline-offset: -2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ================================================================ Telegram Mini App */
/* У Telegram своя шапка и кнопка «Назад»: наша шапка скрыта, разделы — внизу на любой ширине. */

html.tg body { min-height: var(--tg-vh, 100vh); background-attachment: scroll; }
html.tg .topbar { display: none; }
html.tg .view { padding-top: 12px; padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
html.tg .tabbar {
  display: grid; grid-template-columns: repeat(3, 1fr);
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: rgba(15, 24, 20, .94); backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255, 255, 255, .07);
}
html.tg .tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px;
  border-radius: 12px; color: var(--muted); font-size: 11px; font-weight: 700;
}
html.tg .tabbar a.on { color: var(--accent); background: rgba(106, 166, 232, .1); }
html.tg .toast-root { bottom: calc(84px + env(safe-area-inset-bottom)); }
html.tg .tools-card { top: 0; }
html.tg .rotate-hint { display: none; }

/* Длинное название прячем там, где не помещается рядом с кнопками */
@media (max-width: 430px) {
  .brand-name { display: none; }
}
@media (min-width: 721px) and (max-width: 980px) {
  .brand-name { display: none; }  /* здесь рядом ещё разделы сайта */
}
