:root {
  --gold:   #ffd166;   /* акцент, счётчик, активное */
  --fire:   #ff6b35;   /* CTA, огонь */
  --green:  #00e676;   /* зачёт, статус */
  --blue:   #4ad8ff;   /* камера */
  --purple: #9c7cff;   /* сброс */
  --panel:  #160d2e;
  --panel2: #1e1340;
  --border: #2a2057;
  --text:   #f3eefe;
  --muted:  #8a7cc0;
  --f-head: "Unbounded", system-ui, -apple-system, sans-serif;
  --f-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-num:  "Barlow Condensed", "Unbounded", system-ui, sans-serif;  /* спортивное табло — счётчик, цифры */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: #05030f;
  color: var(--text);
  font-family: var(--f-body);
  overscroll-behavior: none;
}

.hidden { display: none !important; }

/* ================= Космос-фон ================= */
#cosmos {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at 30% 20%, #1b1b52 0%, #0a0a24 45%, #05030f 100%);
}
#nebula {
  position: absolute;
  inset: -25%;
  background:
    radial-gradient(circle at 25% 30%, rgba(120,80,220,0.35), transparent 45%),
    radial-gradient(circle at 75% 68%, rgba(255,107,53,0.18), transparent 50%);
  filter: blur(30px);
  animation: nebula 14s ease-in-out infinite alternate;
}
@keyframes nebula {
  0%   { transform: translate(0,0) scale(1);      opacity: 0.85; }
  100% { transform: translate(2%, -3%) scale(1.15); opacity: 1; }
}
.star {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  opacity: 0.6;
  animation: twinkle 3s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.12; transform: scale(0.6); }
  50%      { opacity: 0.9;  transform: scale(1); }
}

/* ================= Экран входа ================= */
#login {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: calc(env(safe-area-inset-top) + 24px);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: linear-gradient(180deg, rgba(30,19,64,0.92), rgba(16,9,34,0.96));
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 30px 22px 24px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55), 0 0 60px rgba(120,80,220,0.18);
}
.brand {
  font-family: var(--f-head);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: 0;
  text-align: center;
  background: linear-gradient(90deg, var(--gold), var(--fire));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-sub {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin: 6px 0 24px;
}
.fld { display: block; margin-bottom: 16px; }
.fld span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 7px 4px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.fld input {
  width: 100%;
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #0e0820;
  color: var(--text);
  font-size: 17px;
  font-family: var(--f-body);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.fld input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255,209,102,0.18);
}
#login-group { letter-spacing: 4px; font-weight: 700; text-transform: uppercase; }
.btn-go {
  width: 100%;
  margin-top: 6px;
  background: linear-gradient(100deg, var(--gold), var(--fire));
  color: #2a1400;
}
.login-err {
  min-height: 18px;
  text-align: center;
  color: #ff7a6b;
  font-size: 13px;
  font-weight: 600;
  margin-top: 10px;
}
.login-hint {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 4px;
}
.login-mode-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 22px;
  background: rgba(0,0,0,0.35);
  border-radius: 14px;
  padding: 4px;
}
.login-tab {
  flex: 1;
  padding: 11px 8px;
  border: none;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-family: var(--f-body);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
}
.login-tab.active {
  background: linear-gradient(100deg, var(--gold), var(--fire));
  color: #1a0a00;
}

/* ================= Приветственный экран ================= */
#welcome {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: calc(env(safe-area-inset-top) + 28px) 22px calc(env(safe-area-inset-bottom) + 28px);
}
.welcome-inner {
  width: 100%;
  max-width: 400px;
  margin: auto;
}
.welcome-logo {
  font-family: var(--f-head);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 3px;
  text-align: center;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 18px;
}
.welcome-h {
  font-family: var(--f-num);
  text-align: center;
  text-transform: uppercase;
  margin: 0 0 14px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.welcome-q {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text);
}
.welcome-accent {
  font-size: 50px;
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: 0;
  background: linear-gradient(100deg, var(--gold), var(--fire));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.welcome-lead {
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  margin: 0 auto 26px;
  max-width: 340px;
}
.welcome-lead b { color: var(--text); }
.welcome-feats {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}
.wfeat {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(180deg, rgba(30,19,64,0.55), rgba(16,9,34,0.6));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
}
.wfeat-ic {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
  width: 34px;
  text-align: center;
}
.wfeat-tx { display: flex; flex-direction: column; gap: 2px; }
.wfeat-tx b { font-size: 15px; color: var(--text); font-weight: 700; }
.wfeat-tx span { font-size: 13px; color: var(--muted); line-height: 1.4; }
.welcome-cta {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn-ghost-wide {
  width: 100%;
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.btn-ghost-wide:active { background: rgba(255,255,255,0.07); border-color: var(--gold); }
.welcome-foot {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 18px;
}

/* ================= Каркас приложения ================= */
#app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: env(safe-area-inset-top) 0 0;
}

/* ---- Сцена с видео ---- */
#stage {
  position: relative;
  flex: 1;
  min-height: 0;
  background: transparent;   /* космос просвечивает, пока камера не запущена */
  overflow: hidden;
}
/* пока видео не идёт — за ним космос; когда идёт — оно само кроет фон */
#cam { background: transparent; }
#cam, #overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#cam { transform: scaleX(-1); }
#overlay { transform: scaleX(-1); }

/* ---- Верхняя плашка ---- */
#hud-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 10px 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  z-index: 3;
}
#ex-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  max-width: 440px;
  pointer-events: auto;
}
.ex-tab {
  border: 1.5px solid transparent;
  border-radius: 16px;
  padding: 6px 8px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  cursor: pointer;
  color: var(--muted);
  font-family: var(--f-head);
  font-size: 13px;
  font-weight: 600;
  transition: transform 0.14s, border-color 0.2s, box-shadow 0.2s;
}
.ex-tab svg { height: 30px; width: auto; }
/* Оживляем иконку подтягиваний (Lottie-файла нет — двигаем тело на турнике). */
.ex-char .pull-anim { animation: pull-bob 1.6s ease-in-out infinite; }
@keyframes pull-bob { 0%, 100% { transform: translateY(2.5px); } 50% { transform: translateY(-2.5px); } }
.ex-char { height: 48px; width: auto; display: block; margin: 0 auto 2px; }
.ex-tab[data-ex="pushups"] { background: linear-gradient(165deg, #2e1206, #150a04); border-color: #6b3014; }
.ex-tab[data-ex="squats"]  { background: linear-gradient(165deg, #1f1340, #0c0820); border-color: #3a2870; }
.ex-tab[data-ex="plank"]   { background: linear-gradient(165deg, #06283a, #04141f); border-color: #0e4a66; }
.ex-tab[data-ex="pullups"] { background: linear-gradient(165deg, #06351a, #03190d); border-color: #0e6634; }
.ex-tab:active { transform: scale(0.96); }
.ex-tab.active {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 18px rgba(255,209,102,0.45);
  transform: translateY(-2px);
}

.status {
  background: rgba(8,4,20,0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.07);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  max-width: 92%;
  pointer-events: none;
}
.status.ok    { color: var(--green); }
.status.warn  { color: var(--gold); }
.status.error { color: #ff7a6b; }

/* ---- Счётчик ---- */
#counter-wrap {
  position: absolute;
  left: 0; right: 0;
  bottom: 26px;
  text-align: center;
  z-index: 3;
  pointer-events: none;
}
#counter {
  font-family: var(--f-num);
  font-size: 80px;
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: 0;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  animation: glow 2.4s ease-in-out infinite, float 3s ease-in-out infinite;
}
@keyframes glow {
  0%, 100% { text-shadow: 0 0 18px rgba(255,209,102,0.5),  0 0 40px rgba(255,107,53,0.32); }
  50%      { text-shadow: 0 0 32px rgba(255,209,102,0.95), 0 0 64px rgba(255,107,53,0.6); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
#counter.pop {
  animation: none;
  transform: scale(1.18);
  color: var(--green);
  text-shadow: 0 0 36px rgba(0,230,118,0.85), 0 0 70px rgba(0,230,118,0.45);
  transition: transform 0.12s ease, color 0.12s ease;
}
#counter-label {
  font-family: var(--f-head);
  font-size: 14px;
  color: var(--muted);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 3px;
}

/* ---- Бар глубины ---- */
#depth-wrap {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 45%;
  background: rgba(255,255,255,0.1);
  border-radius: 999px;
  overflow: hidden;
  z-index: 3;
}
#depth-fill {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 0%;
  background: linear-gradient(to top, var(--green), var(--gold));
  transition: height 0.06s linear;
}
#depth-mark-down, #depth-mark-up {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: rgba(255,255,255,0.5);
}

/* ================= Нижняя панель ================= */
#dock {
  background: linear-gradient(180deg, rgba(22,13,46,0.82), rgba(8,5,20,0.96));
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 10px 14px calc(env(safe-area-inset-bottom) + 8px);
}

/* база градиентных кнопок-пилюль */
.btn-grad {
  border: none;
  border-radius: 16px;
  font-family: var(--f-head);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.5px;
  cursor: pointer;
  padding: 14px 12px;
  color: #2a1400;
  transition: transform 0.08s, opacity 0.2s, box-shadow 0.2s;
}
.btn-grad:active { transform: scale(0.97); }
.btn-grad:disabled { opacity: 0.45; }

/* мягкие (стеклянные) вторичные кнопки */
.btn-soft {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-family: var(--f-head);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  padding: 13px 14px;
  transition: transform 0.08s, background 0.2s, opacity 0.2s;
}
.btn-soft:active { transform: scale(0.97); }
.btn-soft:disabled { opacity: 0.45; }

/* круглые кнопки-иконки */
.btn-circle {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.08s, opacity 0.2s;
}
.btn-circle:active { transform: scale(0.92); }
.btn-circle:disabled { opacity: 0.4; }
.btn-circle svg { width: 26px; height: 26px; }

#controls {
  display: flex;
  gap: 12px;
  align-items: center;
}
.btn-start {
  flex: 1;
  background: linear-gradient(100deg, #ffb347, var(--fire));
  color: #2a1400;
}
.btn-start.live {
  background: linear-gradient(135deg, #ff5252, var(--fire));
  color: #fff;
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,82,82,0.55); }
  70%  { box-shadow: 0 0 0 16px rgba(255,82,82,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,82,82,0); }
}
.btn-reset { background: linear-gradient(135deg, var(--purple), #6a2dff); }
.btn-reset svg { animation: spin 3.5s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-calib { width: 100%; margin-top: 8px; padding: 9px 12px; font-size: 13px; color: var(--gold); }
.btn-calib.active { background: var(--gold); color: #2a1400; border-color: var(--gold); }

#best {
  text-align: center;
  padding: 7px 0 6px;
  color: var(--muted);
  font-size: 12px;
}
#best b { color: var(--gold); font-family: var(--f-head); }

/* ---- Зачёт группы ---- */
#group-bar { border-top: 1px solid var(--border); padding-top: 8px; }
#who-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  font-size: 13px;
}
.who-name { font-weight: 700; color: var(--text); }
.who-group {
  font-family: var(--f-head);
  font-size: 12px;
  color: var(--gold);
  background: rgba(255,209,102,0.12);
  border: 1px solid rgba(255,209,102,0.3);
  padding: 2px 9px;
  border-radius: 999px;
  letter-spacing: 1px;
}
.link-out {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  font-family: var(--f-body);
}
/* В ЗАЧЁТ — широкая сверху, три кнопки снизу */
.group-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.btn-save {
  grid-column: 1 / -1;
  background: linear-gradient(100deg, #2bd36e, var(--green));
  color: #04210f;
}
.btn-board { width: 100%; padding: 13px 6px; font-size: 12px; }

/* Фильтр упражнений внутри Зачёта */
.board-ex-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.board-ex-btn {
  flex: 1;
  padding: 8px 4px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-family: var(--f-head);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
}
.board-ex-btn.active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(255,209,102,0.08);
}

/* ================= Экран таблицы ================= */
#board {
  position: fixed;
  inset: 0;
  z-index: 15;
  background: radial-gradient(ellipse at 30% 0%, #1b1b52 0%, #0a0a24 45%, #05030f 100%);
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
#board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
#board-head h2 {
  margin: 0;
  font-family: var(--f-head);
  font-weight: 800;
  font-size: 22px;
}
.board-group {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
  letter-spacing: 0.5px;
}
.board-group { text-transform: none; }
.btn-close {
  width: 44px; height: 44px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 18px;
}

/* вкладки режимов: Зачёт / Лига / Лента */
#mode-tabs {
  display: flex;
  gap: 6px;
  padding: 14px 14px 0;
}
.mode-tab {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-family: var(--f-head);
  font-weight: 600;
  font-size: 13px;
  padding: 12px 4px;
  cursor: pointer;
  transition: all 0.18s;
}
.mode-tab.active {
  background: linear-gradient(100deg, #7b4dff, #b03cff);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 18px rgba(123,77,255,0.4);
}

#period-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 14px 4px;
}
.period-tab {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  font-family: var(--f-head);
  font-weight: 600;
  font-size: 12px;
  padding: 7px 4px;
  cursor: pointer;
  transition: all 0.18s;
}
.period-tab.active {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(255,209,102,0.08);
}

#board-live {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 16px 4px;
  color: var(--muted);
  font-size: 12px;
}
.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: blink 1.6s ease-in-out infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

#board-list { flex: 1; overflow-y: auto; padding: 8px 12px 16px; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  border-radius: 16px;
  margin-bottom: 9px;
  background: linear-gradient(180deg, rgba(30,19,64,0.7), rgba(16,9,34,0.85));
  border: 1px solid var(--border);
}
.row .rank {
  font-family: var(--f-head);
  font-size: 20px;
  font-weight: 800;
  width: 36px;
  text-align: center;
  color: var(--muted);
}
.row .who { flex: 1; min-width: 0; }
.row .who b { font-size: 17px; }
.row .who small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.row .total {
  font-family: var(--f-head);
  font-size: 24px;
  font-weight: 800;
  color: var(--fire);
  text-shadow: 0 0 18px rgba(255,107,53,0.4);
}
.row .total .unit {
  font-family: var(--f-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 5px;
  text-shadow: none;
}
.row.top1 {
  border-color: var(--gold);
  box-shadow: 0 0 26px rgba(255,209,102,0.3);
  background: linear-gradient(180deg, rgba(60,42,12,0.75), rgba(30,19,10,0.9));
}
.row.top1 .rank { color: var(--gold); font-size: 24px; }
.row.me { outline: 2px solid var(--gold); outline-offset: -1px; }
#board-empty { text-align: center; color: var(--muted); padding: 50px 24px; line-height: 1.6; }

/* ================= Лига ================= */
#league-view, #feed-view { flex: 1; overflow-y: auto; padding: 8px 12px 16px; }
.row.loser {
  border-color: rgba(255,82,82,0.55);
  box-shadow: 0 0 18px rgba(255,82,82,0.18);
}
.league-block {
  background: linear-gradient(180deg, rgba(30,19,64,0.7), rgba(16,9,34,0.85));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  margin: 14px 0 0;
}
.league-block-title {
  font-family: var(--f-head);
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
}
.league-block-title b { color: var(--gold); }
.lb-sub { font-family: var(--f-body); font-weight: 500; color: var(--muted); font-size: 11px; }
.strength-head { margin: 18px 0 8px; }

/* ===== «Ещё механики» — сворачиваемый блок ===== */
.league-more { margin-top: 18px; border: 1px solid var(--border); border-radius: 16px; background: rgba(16,9,34,0.5); overflow: hidden; }
.league-more > summary { list-style: none; cursor: pointer; padding: 15px 16px; display: flex; align-items: center; gap: 10px; }
.league-more > summary::-webkit-details-marker { display: none; }
.league-more > summary > span { font-family: var(--f-head); font-weight: 600; font-size: 14px; color: var(--text); }
.league-more > summary > small { font-size: 10.5px; color: var(--muted); margin-left: auto; text-align: right; line-height: 1.25; }
.league-more > summary::after { content: "▾"; color: var(--muted); font-size: 13px; flex-shrink: 0; transition: transform .2s; }
.league-more[open] > summary::after { transform: rotate(180deg); }
.league-more[open] > summary { border-bottom: 1px solid var(--border); }
.league-more-inner { padding: 2px 12px 12px; }

/* ---- Зачёт «Стабильность» — сталь/лёд против огня Силы ---- */
.stability-block {
  border-color: rgba(74,216,255,0.28);
  background: linear-gradient(180deg, rgba(14,38,58,0.72), rgba(9,20,34,0.86));
}
.stability-hint { color: var(--muted); font-size: 12px; margin: -2px 0 10px; line-height: 1.4; }
.stab-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 12px; margin-bottom: 6px;
  background: rgba(255,255,255,0.03); border: 1px solid transparent;
}
.stab-row.champ {
  border-color: rgba(74,216,255,0.45);
  background: linear-gradient(180deg, rgba(20,52,74,0.7), rgba(10,26,40,0.85));
  box-shadow: 0 0 20px rgba(74,216,255,0.18);
}
.stab-row.me { outline: 2px solid var(--gold); outline-offset: -1px; }
.stab-rank {
  font-family: var(--f-head); font-size: 17px; font-weight: 800;
  width: 30px; text-align: center; color: var(--muted); flex: none;
}
.stab-row.champ .stab-rank { color: var(--blue); }
.stab-who { flex: 1; min-width: 0; font-size: 15px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stab-title {
  font-family: var(--f-body); font-size: 11px; font-weight: 600;
  color: var(--blue); background: rgba(74,216,255,0.12);
  border: 1px solid rgba(74,216,255,0.3); border-radius: 8px;
  padding: 1px 7px; margin-left: 4px; white-space: nowrap;
}
.stab-title.clean { color: var(--fire); background: rgba(255,107,53,0.12); border-color: rgba(255,107,53,0.3); }
.stab-days { display: flex; align-items: center; gap: 7px; flex: none; }
.stab-dots { letter-spacing: 1px; color: var(--blue); font-size: 12px; }
.stab-num { font-family: var(--f-num); font-size: 18px; font-weight: 700; color: var(--text); min-width: 34px; text-align: right; }
.league-debt { font-size: 14px; padding: 3px 0; }
.league-debt b { color: #ff7a6b; }
.league-debt.muted, .muted { color: var(--muted); }
.league-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 10px;
}
.league-week { font-size: 13px; padding: 4px 0; color: var(--text); }

/* карточка звания */
.title-card { margin-top: 0; margin-bottom: 14px; border-color: rgba(255,209,102,0.4); }
.title-row { display: flex; align-items: center; gap: 12px; }
.title-emoji { font-size: 38px; line-height: 1; }
.title-name {
  font-family: var(--f-head);
  font-weight: 800;
  font-size: 20px;
  background: linear-gradient(90deg, var(--gold), var(--fire));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.title-pts { color: var(--muted); font-size: 12px; margin-top: 2px; }
.title-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  margin: 12px 0 6px;
}
.title-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--fire));
  border-radius: 999px;
  transition: width 0.4s;
}
.title-next { color: var(--muted); font-size: 12px; }
.title-badges { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.ach-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255,209,102,0.12);
  border: 1px solid rgba(255,209,102,0.3);
  color: var(--gold);
  cursor: pointer;
  user-select: none;
}
.ach-chip.locked {
  background: rgba(255,255,255,0.03);
  border-color: var(--border);
  color: var(--muted);
  opacity: 0.6;
  filter: grayscale(0.5);
}
.ach-hint { width: 100%; font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.ach-locked-box { width: 100%; }
.ach-locked-box > summary { list-style: none; cursor: pointer; font-size: 11.5px; color: var(--muted); padding: 5px 0; user-select: none; }
.ach-locked-box > summary::-webkit-details-marker { display: none; }
.ach-locked-box > summary::before { content: "▸ "; }
.ach-locked-box[open] > summary::before { content: "▾ "; }
.ach-locked-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

/* Всплывашка условия достижения (по тапу — нативный title не работает на тач) */
#ach-pop {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%) translateY(12px);
  z-index: 300; width: min(320px, 86vw); padding: 16px 18px;
  background: linear-gradient(180deg, rgba(40,28,64,0.98), rgba(20,12,34,0.98));
  border: 1px solid var(--gold); border-radius: 16px; text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.55); backdrop-filter: blur(8px);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
#ach-pop.show { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.ach-pop-emoji { font-size: 34px; line-height: 1; margin-bottom: 6px; }
.ach-pop-name { font-family: var(--f-head); font-weight: 700; font-size: 17px; color: var(--gold); margin-bottom: 4px; }
.ach-pop-desc { font-size: 13.5px; color: var(--text); line-height: 1.35; }
.ach-pop-tier { font-size: 11px; color: var(--muted); margin-top: 8px; text-transform: uppercase; letter-spacing: .5px; }

/* Тайный соперник */
.rival-card {
  border-color: rgba(138,43,226,0.45);
  background: linear-gradient(180deg, rgba(50,19,80,0.72), rgba(25,8,45,0.88));
  margin-bottom: 0;
}
.rival-card-title {
  font-family: var(--f-head);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.03em;
  margin-bottom: 10px;
}
.rival-gap { font-size: 18px; font-weight: 700; margin: 4px 0 6px; }
.rival-ahead { color: #3ddc84; }
.rival-behind { color: #ff7a6b; }
.rival-footer { color: var(--muted); font-size: 12px; }

/* Раскрытие прошлой недели */
.rival-reveal { border-color: rgba(255,209,102,0.35); }
.rival-reveal-label { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.rival-reveal-name { font-size: 15px; margin-bottom: 6px; }
.rival-reveal-name b { color: var(--gold); }
.rival-result { font-size: 14px; line-height: 1.5; font-weight: 600; }
.rival-won  { color: #3ddc84; }
.rival-lost { color: #ff7a6b; }

/* Детектор отмазок */
#excuse { position:fixed; inset:0; z-index:200; display:flex; align-items:center; justify-content:center;
  background:rgba(5,3,15,0.88); backdrop-filter:blur(6px); }
#excuse.hidden { display:none; }
.excuse-card { background:linear-gradient(180deg,rgba(30,19,64,0.95),rgba(10,6,24,0.98));
  border:1px solid var(--border); border-radius:20px; padding:28px 22px; max-width:360px; width:90%; text-align:center; }
.excuse-title { font-family:var(--f-head); font-size:20px; font-weight:700; margin-bottom:6px; }
.excuse-sub { font-size:13px; color:var(--muted); margin-bottom:20px; }
.excuse-reasons { display:flex; flex-direction:column; gap:10px; margin-bottom:16px; }
.excuse-btn { background:rgba(255,255,255,0.06); border:1px solid var(--border); border-radius:12px;
  color:var(--text); font-size:15px; padding:13px 16px; cursor:pointer; text-align:left;
  transition:background .15s; }
.excuse-btn:hover, .excuse-btn:active { background:rgba(255,255,255,0.12); }
.excuse-freeze { margin:0 0 16px; }
.excuse-freeze.hidden { display:none; }
.excuse-freeze-btn { width:100%; }
.excuse-freeze-hint { font-size:12px; color:var(--muted); margin-top:8px; line-height:1.4; }
.excuse-freeze-ok { font-family:var(--f-head); font-weight:700; font-size:16px; color:#8fdcff; padding:12px; }

/* Подсказка позиции камеры */
#cam-hint { position:fixed; inset:0; z-index:300; display:flex; align-items:flex-end; justify-content:center;
  background:rgba(5,3,15,0.82); backdrop-filter:blur(6px); animation:fadeIn .2s ease; }
#cam-hint.hidden { display:none; }
.cam-hint-card { background:linear-gradient(180deg,rgba(28,16,58,0.97),rgba(8,5,20,0.99));
  border:1px solid var(--border); border-radius:24px 24px 0 0; padding:28px 22px 40px;
  width:100%; max-width:480px; }
.cam-hint-icon { font-size:40px; text-align:center; margin-bottom:8px; }
.cam-hint-title { font-family:var(--f-head); font-size:18px; font-weight:700; text-align:center;
  margin-bottom:18px; color:var(--gold); }
.cam-hint-list { list-style:none; padding:0; margin:0 0 24px; display:flex; flex-direction:column; gap:12px; }
.cam-hint-list li { display:flex; align-items:flex-start; gap:10px; font-size:15px; line-height:1.45;
  color:var(--text); }
.cam-hint-list li::before { content:attr(data-n); font-family:var(--f-head); font-size:13px; font-weight:700;
  color:var(--gold); background:rgba(255,209,102,0.12); border-radius:6px;
  min-width:24px; height:24px; display:flex; align-items:center; justify-content:center; flex-shrink:0; margin-top:1px; }
.cam-hint-ok { width:100%; font-size:16px; padding:16px;
  background:linear-gradient(100deg,var(--gold),var(--fire)); }

/* Экран отказа/сбоя камеры — тот же каркас, что подсказка */
#cam-error { position:fixed; inset:0; z-index:305; display:flex; align-items:flex-end; justify-content:center;
  background:rgba(5,3,15,0.86); backdrop-filter:blur(6px); animation:fadeIn .2s ease; }
#cam-error.hidden { display:none; }
.cam-error-body { font-size:15px; line-height:1.5; color:var(--text); text-align:center;
  margin-bottom:24px; }
.cam-error-body b { color:var(--gold); }

/* Инструкция / онбординг */
#guide { position:fixed; inset:0; z-index:310; overflow-y:auto;
  background:rgba(5,3,15,0.94); backdrop-filter:blur(8px); animation:fadeIn .2s ease;
  display:flex; align-items:flex-start; justify-content:center; padding:0; }
#guide.hidden { display:none; }
.guide-card { width:100%; max-width:480px; min-height:100%; padding:18px 20px 40px;
  background:linear-gradient(180deg,rgba(20,12,44,0.6),rgba(8,5,20,0.4)); }
.guide-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:18px;
  position:sticky; top:0; padding:10px 0; background:rgba(8,5,20,0.85); backdrop-filter:blur(4px); z-index:2; }
.guide-brand { font-family:var(--f-head); font-size:18px; font-weight:800; letter-spacing:2px;
  background:linear-gradient(90deg,var(--gold),#ff8a3d); -webkit-background-clip:text; background-clip:text;
  -webkit-text-fill-color:transparent; }
.guide-intro { margin-bottom:22px; }
.guide-intro p { font-size:15px; line-height:1.55; color:var(--text); margin:0 0 10px; }
.guide-lead { font-size:19px !important; font-family:var(--f-head); font-weight:700; }
.guide-lead-2 { color:var(--gold) !important; font-weight:600; }
.guide-acc { display:flex; flex-direction:column; gap:10px; }
.guide-item { border:1px solid var(--border); border-radius:14px; overflow:hidden;
  background:rgba(255,255,255,0.03); }
.guide-q { width:100%; text-align:left; background:none; border:none; cursor:pointer;
  color:var(--text); font-family:var(--f-head); font-size:15px; font-weight:600;
  padding:15px 16px; display:flex; align-items:center; justify-content:space-between; }
.guide-q::after { content:"+"; font-size:22px; color:var(--gold); font-weight:400; line-height:1; }
.guide-item.open .guide-q::after { content:"−"; }
.guide-a { max-height:0; overflow:hidden; transition:max-height .3s ease; padding:0 16px; }
.guide-item.open .guide-a { max-height:600px; padding:0 16px 16px; }
.guide-a p { font-size:14px; line-height:1.5; color:var(--text); margin:0 0 9px; }
.guide-note { color:var(--gold) !important; font-size:13px !important; }
.guide-footer { margin:22px 0 18px; padding:16px; border-radius:14px;
  background:rgba(255,209,102,0.08); border:1px solid rgba(255,209,102,0.2); }
.guide-footer p { font-size:14px; line-height:1.5; color:var(--text); margin:0; }
.guide-done { width:100%; font-size:16px; padding:16px; }

/* Серия под угрозой */
.streak-danger { border-color: rgba(255,80,50,0.6); background: linear-gradient(180deg,rgba(60,15,5,0.8),rgba(28,6,2,0.92)); animation: pulse-border 2s ease-in-out infinite; }
@keyframes pulse-border { 0%,100% { border-color: rgba(255,80,50,0.6); } 50% { border-color: rgba(255,80,50,1); } }
.streak-danger-text { font-size: 15px; font-weight: 700; color: #ff7a6b; margin-bottom: 4px; }
.streak-danger-sub { font-size: 12px; color: var(--muted); }

/* Легенды группы */
.legend-row { font-size: 13px; padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,0.05); line-height: 1.5; }
.legend-row:last-child { border-bottom: none; }
.legend-row b { color: var(--gold); }

/* реакции в ленте */
.feed-reactions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.react-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-size: 16px;
  padding: 5px 11px;
  cursor: pointer;
  transition: transform 0.08s, border-color 0.2s, background 0.2s;
}
.react-btn:active { transform: scale(0.9); }
.react-btn.mine {
  border-color: var(--gold);
  background: rgba(255,209,102,0.14);
}
.react-n { font-family: var(--f-head); font-size: 12px; font-weight: 700; color: var(--gold); }
.react-em { font-size: 16px; line-height: 1; }
.react-label { font-size: 11px; font-weight: 600; color: var(--muted); }
.react-btn.mine .react-label { color: var(--gold); }

/* «Ты один в группе» — призыв позвать своих */
.alone-card {
  border-color: rgba(255,107,53,0.4);
  background: linear-gradient(180deg, rgba(60,30,20,0.72), rgba(30,15,12,0.86));
  text-align: center;
}
.alone-title { font-family: var(--f-head); font-weight: 700; font-size: 16px; color: var(--gold); margin-bottom: 6px; }
.alone-sub { font-size: 13px; color: var(--muted); line-height: 1.45; margin-bottom: 12px; }
.alone-invite { width: 100%; }

/* ================= Лента ================= */
.feed-row {
  background: linear-gradient(180deg, rgba(30,19,64,0.7), rgba(16,9,34,0.85));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 9px;
}
.feed-row.cancelled { opacity: 0.55; }
.feed-row.cancelled .feed-main { text-decoration: line-through; }
.feed-main { font-size: 15px; }
.feed-main small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.feed-justice { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.feed-justice:empty { display: none; }
.feed-btn {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-family: var(--f-body);
  font-weight: 600;
  font-size: 12.5px;
  padding: 7px 12px;
  cursor: pointer;
}
.feed-btn:disabled { opacity: 0.4; }
.feed-btn.fair { border-color: rgba(0,230,118,0.5); color: var(--green); }
.feed-btn.cheat { border-color: rgba(255,82,82,0.5); color: #ff7a6b; }
.feed-flag { font-size: 12.5px; font-weight: 600; }
.feed-flag.pending { color: var(--gold); }
.feed-flag.fair { color: var(--green); }
.feed-flag.cheat { color: #ff7a6b; }

/* миниатюры снимков-пруфов в Ленте (до 3 штук в ряд) */
.feed-proof { margin-top: 8px; display: flex; gap: 6px; }
.proof-img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
}

/* ссылка на пруф в строке таблицы */
.proof-link {
  color: var(--green);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}
.proof-link:active { opacity: 0.7; }

/* ================= Экран привычек ================= */
#habits {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  padding-top: calc(env(safe-area-inset-top) + 14px);
  padding-bottom: calc(env(safe-area-inset-bottom) + 14px);
  background: rgba(5,3,15,0.82);
  backdrop-filter: blur(8px);
  overflow-y: auto;
}
.habits-card {
  width: 100%;
  max-width: 400px;
  margin: auto;
  background: linear-gradient(180deg, rgba(30,19,64,0.96), rgba(16,9,34,0.98));
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 16px 18px 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6), 0 0 50px rgba(0,230,118,0.1);
}
.habits-list { display: flex; flex-direction: column; gap: 9px; margin-top: 6px; }
.habit-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 15px;
  font-weight: 600;
  padding: 13px 14px;
  cursor: pointer;
  transition: transform 0.08s, border-color 0.2s, background 0.2s;
  text-align: left;
}
.habit-row:active { transform: scale(0.98); }
.habit-row.done {
  border-color: rgba(0,230,118,0.45);
  background: rgba(0,230,118,0.08);
  opacity: 0.85;
}
.habit-emoji { font-size: 22px; }
.habit-name { flex: 1; }
.habit-mark {
  font-family: var(--f-head);
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 0.5px;
}
.habit-row.done .habit-mark { font-size: 15px; }

/* ================= Экран пруф-клипа ================= */
#proof {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  padding-top: calc(env(safe-area-inset-top) + 14px);
  padding-bottom: calc(env(safe-area-inset-bottom) + 14px);
  background: rgba(5,3,15,0.82);
  backdrop-filter: blur(8px);
  overflow-y: auto;
}
.proof-card {
  width: 100%;
  max-width: 400px;
  margin: auto;
  background: linear-gradient(180deg, rgba(30,19,64,0.96), rgba(16,9,34,0.98));
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 16px 18px 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6), 0 0 50px rgba(255,107,53,0.12);
}
.proof-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.proof-title { font-family: var(--f-head); font-weight: 800; font-size: 19px; }
.proof-head .btn-close { width: 40px; height: 40px; font-size: 16px; }
.proof-word-label {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  margin: 4px 0 2px;
}
.proof-word {
  font-family: var(--f-head);
  font-weight: 800;
  font-size: 34px;
  text-align: center;
  letter-spacing: 1px;
  padding: 4px 0 10px;
  background: linear-gradient(90deg, var(--gold), var(--fire));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.proof-video-wrap {
  position: relative;
  width: 100%;
  height: 40vh;
  max-height: 360px;
  background: #0e0820;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
#proof-cam, #proof-playback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#proof-cam { transform: scaleX(-1); }  /* зеркалим превью как селфи */
.proof-timer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-head);
  font-weight: 800;
  font-size: 96px;
  color: #fff;
  text-shadow: 0 0 30px rgba(255,82,82,0.9);
  background: rgba(255,82,82,0.16);
  pointer-events: none;
}
.proof-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  margin: 12px 4px 12px;
}
.proof-actions { display: flex; flex-direction: column; gap: 10px; }
.proof-rec { background: linear-gradient(135deg, #ff5252, var(--fire)); color: #fff; }
.proof-accept { background: linear-gradient(100deg, #2bd36e, var(--green)); color: #04210f; }
.proof-status {
  min-height: 18px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  margin-top: 10px;
}
.proof-status.ok { color: var(--green); }
.proof-status.warn { color: var(--gold); }
.proof-status.error { color: #ff7a6b; }
.proof-skip {
  display: block;
  margin: 8px auto 0;
  margin-left: auto;
  margin-right: auto;
}

/* ================= Рейтинг характера ================= */
#character-view { flex: 1; overflow-y: auto; padding: 8px 12px 16px; }

.char-row {
  background: linear-gradient(180deg, rgba(30,19,64,0.7), rgba(16,9,34,0.85));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 9px;
}
.char-row.me { outline: 2px solid var(--gold); outline-offset: -1px; }
.char-row.top1 {
  border-color: var(--gold);
  box-shadow: 0 0 26px rgba(255,209,102,0.3);
  background: linear-gradient(180deg, rgba(60,42,12,0.75), rgba(30,19,10,0.9));
}
.char-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.char-rank { font-family: var(--f-head); font-size: 20px; font-weight: 800; width: 32px; color: var(--muted); }
.char-row.top1 .char-rank { color: var(--gold); font-size: 24px; }
.char-name { flex: 1; font-size: 17px; font-weight: 700; }
.char-streak { font-size: 12px; color: var(--fire); font-weight: 700; margin-left: 5px; }
.char-total { font-family: var(--f-head); font-size: 24px; font-weight: 800; color: var(--purple); text-shadow: 0 0 16px rgba(156,124,255,0.4); }
.char-total .unit { font-family: var(--f-body); font-size: 11px; color: var(--muted); margin-left: 4px; font-weight: 600; text-shadow: none; }

.char-axes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.char-axis { display: flex; flex-direction: column; gap: 4px; }
.char-axis-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.3px;
}
.char-axis-label b { color: var(--text); font-family: var(--f-head); font-size: 11px; }
.char-bar-wrap {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
}
.char-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.char-bar-fill.discipline  { background: linear-gradient(90deg, #4ad8ff, #7b4dff); }
.char-bar-fill.tenacity    { background: linear-gradient(90deg, #ff6b35, #ff5252); }
.char-bar-fill.reliability { background: linear-gradient(90deg, #00e676, #00b4d8); }
.char-bar-fill.willpower   { background: linear-gradient(90deg, #ffd166, #ff6b35); }

/* История героя */
.hero-story {
  background: linear-gradient(180deg, rgba(26,14,58,0.85), rgba(14,8,34,0.92));
  border: 1px solid rgba(156,124,255,0.35);
  border-radius: 18px;
  padding: 16px;
  margin-top: 8px;
  box-shadow: 0 0 30px rgba(156,124,255,0.1);
}
.hero-title {
  font-family: var(--f-head);
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 13px;
  background: linear-gradient(90deg, var(--purple), var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-bottom: 12px;
}
.hero-stat {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 10px;
  text-align: center;
}
.hero-stat b {
  display: block;
  font-family: var(--f-head);
  font-size: 16px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: -0.5px;
}
.hero-stat span { font-size: 10px; color: var(--muted); font-weight: 600; letter-spacing: 0.3px; }
.hero-growth {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.hero-from { color: var(--muted); }
.hero-arrow { color: var(--muted); font-size: 16px; }
.hero-to { color: var(--green); font-weight: 700; }
.hero-plus  { color: var(--green);  font-family: var(--f-head); font-size: 14px; font-weight: 800; }
.hero-minus { color: #ff7a6b; font-family: var(--f-head); font-size: 14px; font-weight: 800; }
.hero-line {
  font-size: 13px;
  color: var(--text);
  padding: 7px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  line-height: 1.5;
}
.hero-line:first-of-type { border-top: none; }
.hero-line b { color: var(--gold); }

/* Роли в компании */
.role-badges { display: inline-flex; gap: 4px; margin-left: 4px; vertical-align: middle; }
.role-badge {
  font-size: 14px;
  line-height: 1;
  cursor: default;
}

/* Письмо из будущего */
.hero-future {
  background: linear-gradient(135deg, rgba(74,216,255,0.08), rgba(156,124,255,0.08));
  border: 1px solid rgba(74,216,255,0.2);
  border-radius: 12px;
  padding: 11px 12px;
  margin-top: 10px;
}
.hero-future-title {
  font-family: var(--f-head);
  font-size: 12px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.hero-future-line {
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
}
.hero-future-line b { color: var(--blue); font-family: var(--f-head); }

/* ================= Слово мужика ================= */
#promises {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  padding-top: calc(env(safe-area-inset-top) + 14px);
  padding-bottom: calc(env(safe-area-inset-bottom) + 14px);
  background: rgba(5,3,15,0.82);
  backdrop-filter: blur(8px);
  overflow-y: auto;
}
.promises-card {
  width: 100%;
  max-width: 400px;
  margin: auto;
  background: linear-gradient(180deg, rgba(30,19,64,0.96), rgba(16,9,34,0.98));
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 16px 18px 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6), 0 0 50px rgba(255,209,102,0.08);
}
.promises-sub {
  color: var(--muted);
  font-size: 12px;
  margin: -4px 0 14px;
  line-height: 1.5;
}
.promises-list { display: flex; flex-direction: column; gap: 9px; margin-bottom: 14px; }

.promise-row {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.04);
}
.promise-row.fulfilled { border-color: rgba(0,230,118,0.4); background: rgba(0,230,118,0.05); }
.promise-row.broken    { border-color: rgba(255,82,82,0.4);  background: rgba(255,82,82,0.05); opacity: 0.7; }
.promise-row.expired   { border-color: rgba(255,107,53,0.5); }

.promise-who {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}
.promise-who b { font-size: 15px; }
.promise-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.promise-badge.active    { background: rgba(255,209,102,0.15); color: var(--gold); }
.promise-badge.fulfilled { background: rgba(0,230,118,0.15);   color: var(--green); }
.promise-badge.broken    { background: rgba(255,82,82,0.15);   color: #ff7a6b; }
.promise-badge.expired   { background: rgba(255,107,53,0.15);  color: var(--fire); }

.promise-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 6px;
}
.promise-meta { font-size: 12px; color: var(--muted); }

.promise-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.promise-btn {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-family: var(--f-body);
  font-weight: 600;
  font-size: 12.5px;
  padding: 7px 12px;
  cursor: pointer;
  transition: transform 0.08s;
}
.promise-btn:active { transform: scale(0.95); }
.promise-btn:disabled { opacity: 0.4; }
.promise-btn.fulfill { border-color: rgba(0,230,118,0.5); color: var(--green); }
.promise-btn.break   { border-color: rgba(255,82,82,0.4); color: #ff7a6b; }

.promise-form { margin-bottom: 12px; }
.promise-submit {
  width: 100%;
  background: linear-gradient(100deg, var(--gold), var(--fire));
  color: #2a1400;
  margin-top: 4px;
}
.btn-give-word {
  width: 100%;
  color: var(--gold);
  border-color: rgba(255,209,102,0.3);
}

/* ===== Колесо судьбы ===== */
.wheel-block { text-align: center; }
.btn-spin {
  margin-top: 10px;
  padding: 12px 28px;
  border: 2px solid var(--gold);
  border-radius: 24px;
  background: rgba(255,209,102,0.1);
  color: var(--gold);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s, background .15s;
}
.btn-spin:active { transform: scale(.94); background: rgba(255,209,102,0.2); }
.wheel-result { font-size: 18px; margin: 6px 0 2px; }
.wheel-hint   { font-size: 12px; color: var(--muted); margin-top: 4px; }
.wheel-bonus-active {
  margin-top: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  background: rgba(74,216,255,0.12);
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
}

/* ===== Ставки на себя (3 типа) ===== */
.bet-types-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.bet-card {
  flex: 1 1 28%; min-width: 90px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 8px; box-sizing: border-box;
}
.bet-card.bet-won-card { border-color: #3ddc84; background: rgba(61,220,132,.08); }
.bet-type-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing:.5px; margin-bottom: 4px; }
.bet-hint  { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.bet-goal  { font-size: 13px; margin-bottom: 4px; font-weight: 600; }
.bet-progress-bar  { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.bet-progress-fill { height: 100%; border-radius: 3px; transition: width .4s; }
.bet-progress-text { font-size: 11px; margin-top: 3px; color: var(--muted); }

/* ===== Дуэли 1-на-1 ===== */
.duel-card {
  border: 1.5px solid rgba(255,107,53,0.4);
  background: rgba(255,107,53,0.06);
}
.duel-title  { font-weight: 700; color: var(--fire); margin-bottom: 4px; }
.duel-vs     { font-size: 15px; margin-bottom: 3px; }
.duel-time   { font-size: 12px; color: var(--muted); }
.duel-ahead  { color: #3ddc84; }
.duel-behind { color: #ff7a6b; }
.duel-challenge-btn {
  margin-left: 6px;
  background: none;
  border: 1px solid rgba(255,107,53,0.4);
  border-radius: 6px;
  padding: 1px 5px;
  color: var(--fire);
  font-size: 12px;
  cursor: pointer;
  vertical-align: middle;
  line-height: 1.4;
}
.duel-challenge-btn:active { background: rgba(255,107,53,0.15); }

/* ===== Свидетели ===== */
.witness-btn {
  padding: 6px 12px;
  border-radius: 16px;
  border: 1.5px solid var(--border);
  background: var(--card, var(--panel));
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.witness-btn.selected {
  border-color: rgba(74,216,255,0.6);
  background: rgba(74,216,255,0.12);
  color: var(--blue);
}

/* ===== Миссии ===== */
.mission-card {
  border: 2px solid rgba(255,209,102,0.4);
  background: rgba(255,209,102,0.06);
}
.mission-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.mission-badge  { font-size: 12px; font-weight: 700; letter-spacing: 1px; color: var(--gold); }
.mission-time   { font-size: 12px; color: var(--muted); }
.mission-title  { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.mission-goal   { font-size: 13px; color: var(--muted); }
.mission-progress { font-size: 13px; color: var(--muted); margin-top: 2px; }
.mission-contrib  { font-size: 12px; color: var(--muted); margin-top: 6px; }
.mission-reward   { margin-top: 6px; color: #3ddc84; font-size: 13px; font-weight: 600; }

/* ===== Капсула времени ===== */
.capsule-row {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
}
.capsule-month  { font-weight: 600; font-size: 13px; color: var(--gold); }
.capsule-weight { font-size: 12px; color: var(--muted); background: var(--border); padding: 1px 6px; border-radius: 8px; }
.capsule-note   { width: 100%; font-size: 12px; color: var(--muted); font-style: italic; margin-top: 2px; }

/* ===== Компас жизни ===== */
.compass-grid   { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.compass-axis   {}
.compass-axis-label { font-size: 13px; margin-bottom: 4px; }
.compass-bar-wrap   { height: 7px; border-radius: 4px; background: var(--border); overflow: hidden; }
.compass-bar-fill   { height: 100%; border-radius: 4px; transition: width .4s; }
.compass-axis-val   { font-size: 11px; color: var(--muted); margin-top: 2px; }
.compass-axis-avg   { font-size: 11px; color: var(--muted); }
.compass-btns       { display: flex; gap: 8px; flex-wrap: wrap; }
.compass-score-btn  { font-size: 18px; background: none; border: 1.5px solid transparent; border-radius: 8px; padding: 2px 4px; cursor: pointer; opacity: .5; transition: opacity .15s, border-color .15s; }
.compass-score-btn.active { opacity: 1; border-color: var(--gold); }

/* ===== Мой организм ===== */
.body-today { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.body-stat  { font-size: 14px; background: var(--border); padding: 3px 10px; border-radius: 12px; }
.body-row   { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 13px; }

/* ===== Взаимопомощь ===== */
.enc-row { font-size: 13px; padding: 5px 0; border-bottom: 1px solid var(--border); color: var(--text); }
.enc-player-btn {
  padding: 6px 12px; border-radius: 20px; border: 1.5px solid var(--border);
  background: var(--panel); color: var(--text); font-size: 13px; cursor: pointer; font-family: var(--f-body);
}
.enc-player-btn.enc-selected { border-color: var(--gold); color: var(--gold); }
.enc-player-btn.enc-struggling { border-color: #ff7a6b; color: #ff7a6b; }
.enc-player-btn.enc-struggling.enc-selected { background: rgba(255,122,107,.15); }

/* ===== Профиль игрока ===== */
#profile {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(5,3,15,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
}
#profile.hidden { display: none; }
.profile-card {
  width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
  background: linear-gradient(180deg, #12093a 0%, #07041a 100%);
  border-top: 1px solid rgba(255,255,255,0.12);
  border-radius: 22px 22px 0 0;
  padding: 0 16px calc(env(safe-area-inset-bottom) + 20px);
  animation: slideUp 0.28s cubic-bezier(0.34,1.2,0.64,1);
}
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.profile-head {
  display: flex;
  justify-content: flex-end;
  padding: 12px 0 4px;
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, #12093a 80%, transparent);
  z-index: 1;
}
.profile-hero {
  padding: 4px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.profile-name {
  font-family: var(--f-head);
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}
.profile-me-badge {
  font-size: 12px;
  background: rgba(255,209,102,0.15);
  color: var(--gold);
  border: 1px solid rgba(255,209,102,0.3);
  border-radius: 999px;
  padding: 2px 8px;
  margin-left: 8px;
  vertical-align: middle;
}
.profile-title {
  font-family: var(--f-head);
  font-size: 14px;
  color: var(--gold);
  margin-bottom: 4px;
}
.profile-meta {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.profile-roles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.profile-section {
  margin-bottom: 18px;
}
.profile-section-title {
  font-family: var(--f-head);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
.profile-ach { display: flex; flex-wrap: wrap; gap: 6px; }
.ach-tier-title { width: 100%; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin: 10px 0 5px; }
.profile-promise {
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 10px;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.04);
}
.profile-promise.active { border-left: 3px solid #4ad8ff; }
.profile-promise.done   { border-left: 3px solid var(--green); opacity: .8; }
.profile-promise.broken { border-left: 3px solid #ff7a6b; opacity: .7; }
.profile-promise-dl { color: var(--muted); font-size: 12px; margin-left: 6px; }

/* кликабельные имена везде */
.player-link {
  cursor: pointer;
  text-decoration: underline dotted rgba(255,255,255,0.3);
  text-underline-offset: 3px;
}
.player-link:active { opacity: 0.7; }

/* ===== Голосовой коуч + Push + Инструкция ===== */
.btn-push, .btn-guide {
  width: 100%;
  margin-top: 5px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--muted);
  border-color: transparent;
}
.btn-push:active, .btn-guide:active { color: var(--text); }

/* ===== Peer review overlay ===== */
.pr-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.82);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.pr-box {
  background: var(--panel);
  border-radius: 18px;
  padding: 20px 16px;
  max-width: 360px; width: 100%;
  display: flex; flex-direction: column; gap: 12px;
  border: 1px solid var(--border);
}
.pr-title { font-size: 15px; font-weight: 700; text-align: center; }
.pr-who { font-size: 14px; text-align: center; color: var(--muted); }
.pr-img {
  width: 100%; border-radius: 10px;
  object-fit: cover; max-height: 220px;
  background: #111;
}
.pr-amp { font-size: 13px; color: var(--muted); text-align: center; }
.pr-btns { display: flex; gap: 10px; }
.pr-ok, .pr-flag {
  flex: 1; padding: 12px 8px; border-radius: 12px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  border: none;
}
.pr-ok   { background: var(--green); color: #000; }
.pr-flag { background: #ff4444;       color: #fff; }

/* амплитуда в ленте */
.feed-amp { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ================= Экран-выплата (после «В зачёт») ================= */
.payout-ov {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(120% 90% at 50% 30%, rgba(40,26,12,0.82), rgba(8,6,20,0.94));
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; transition: opacity 0.2s ease;
}
.payout-ov.show { opacity: 1; }
.payout-card {
  width: 100%; max-width: 340px; text-align: center;
  background: linear-gradient(180deg, rgba(40,28,70,0.9), rgba(18,11,36,0.96));
  border: 1px solid rgba(255,209,102,0.35);
  border-radius: 22px; padding: 26px 22px 22px;
  box-shadow: 0 0 50px rgba(255,209,102,0.22);
  transform: scale(0.9) translateY(8px); transition: transform 0.25s cubic-bezier(.2,1.4,.4,1);
}
.payout-ov.show .payout-card { transform: scale(1) translateY(0); }
.payout-emoji { font-size: 46px; line-height: 1; margin-bottom: 6px; animation: payout-pop 0.5s ease; }
.payout-pts {
  font-family: var(--f-num); font-size: 72px; font-weight: 800; line-height: 0.95;
  background: linear-gradient(100deg, var(--gold), var(--fire));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: payout-pop 0.55s ease;
}
.payout-unit { font-size: 13px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; margin-top: 2px; }
.payout-proof { font-size: 12px; margin-top: 10px; padding: 4px 10px; border-radius: 20px; display: inline-block; }
.payout-proof.ok   { color: var(--green); background: rgba(0,230,118,0.1); border: 1px solid rgba(0,230,118,0.3); }
.payout-proof.half { color: var(--gold);  background: rgba(255,209,102,0.1); border: 1px solid rgba(255,209,102,0.3); }
.payout-place { margin-top: 16px; min-height: 24px; }
.payout-rank { font-size: 16px; color: var(--text); }
.payout-rank b { color: var(--gold); font-family: var(--f-head); }
.payout-passed { font-size: 15px; font-weight: 700; color: var(--green); margin-top: 6px; animation: payout-pop 0.6s ease; }
.payout-next { font-size: 13px; color: var(--muted); margin-top: 4px; }
.payout-hook { margin-top: 14px; }
.payout-streak { font-size: 14px; color: var(--fire); font-weight: 600; margin-bottom: 8px; }
.payout-remind { width: 100%; }
.payout-btns { display: flex; flex-direction: column; gap: 9px; margin-top: 20px; }
.payout-btns .btn-grad { width: 100%; }
@keyframes payout-pop {
  0% { transform: scale(0.4); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

