:root {
  --bg: #0b1020;
  --card: #121a33;
  --text: #e9ecf5;
  --muted: #aab2cf;
}

body {
  background: radial-gradient(1200px 800px at 20% -10%, #1b2a5a 0%, var(--bg) 55%);
  color: var(--text);
}

.wrap {
  max-width: 620px;
  margin: 0 auto;
}

.content {
  padding: 10px 12px 18px;
  /* let the browser handle vertical scrolling natively but leave horizontal
     gestures to wireTabSwipe()'s pointer handlers — without this, mobile
     browsers grab the touch sequence for their own scroll before our JS
     ever sees a clean pointerdown/move/up run, so the swipe silently does
     nothing */
  touch-action: pan-y;
}

/* Tab switch transition — plays whenever a section.tab goes from d-none to
   visible (CSS animations auto-restart on that display:none -> block
   transition, no JS re-triggering needed). Swipes get a directional slide
   matching the gesture; tapping a tab in the bar falls back to the plain
   fade since there's no meaningful direction for that. */
section.tab{
  animation: tabFadeIn .18s ease;
}

section.tab.tab-anim-next{
  animation: tabSlideInRight .22s ease;
}

section.tab.tab-anim-prev{
  animation: tabSlideInLeft .22s ease;
}

@keyframes tabFadeIn{
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes tabSlideInRight{
  from { opacity: 0; transform: translateX(28px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes tabSlideInLeft{
  from { opacity: 0; transform: translateX(-28px); }
  to { opacity: 1; transform: translateX(0); }
}

.app-watermark{
  text-align: center;
  margin-top: 28px;
  padding: 10px 0 4px;
  font-size: 11px;
  letter-spacing: .4px;
  color: rgba(255,255,255,.22);
}

.card-soft {
  background: rgba(18, 26, 51, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  overflow: hidden;
}

/* Bootstrap's .card sets its own color: var(--bs-body-color), which our
   theme never touches — any icon/label inside a card that doesn't set its
   own color (chevrons, item carets) silently inherited Bootstrap's dark
   gray default instead of our theme text color. */
.card {
  color: var(--text);
}

.app-title {
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--text);
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.section-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.hr-soft {
  border-color: rgba(255, 255, 255, 0.10);
}

.nav-pills .nav-link {
  color: var(--muted);
  border-radius: 12px;
}

.nav-pills .nav-link.active {
  color: #0b1020;
  background: #ffffff;
}

.form-control,
.form-select,
.input-group-text {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
}

/* native <option> popups ignore .form-select's translucent background and
   default to the OS's white dropdown — without this, dark theme's near-white
   text is invisible against it */
.form-select option,
.form-select optgroup {
  background: var(--card);
  color: var(--text);
}

.form-control:focus,
.form-select:focus {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: none;
}

.form-label {
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--muted);
}

.hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.mini {
  width: 80px;
  display: inline-block;
  border-radius: 10px;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn {
  border-radius: 14px;
}

.btn-primary {
  background: #6ea8fe;
  border-color: #6ea8fe;
  color: #0b1020;
  font-weight: 700;
}

.btn-outline-primary {
  border-color: rgba(110, 168, 254, 0.7);
  color: #cfe1ff;
}

.btn-outline-light {
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

/* Bootstrap sets .form-check-label color via --bs-body-color, which our
   theme never overrides, so checkbox labels stayed dark on dark cards. */
.form-check-label {
  color: var(--text);
}

.modal-header,
.modal-footer {
  border-color: rgba(255, 255, 255, 0.10);
}

@media (max-width: 380px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ===============================
   FIX: labels & modals readability
   =============================== */

/* ===== МОДАЛКИ ===== */
.modal-content {
  background: #0f1423 !important; /* тёмный фон */
  color: rgba(255,255,255,.92) !important;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.12);
}

/* Заголовки модалок */
.modal-title {
  color: #ffffff !important;
  font-weight: 700;
}

/* ЛЕЙБЛЫ (Название, Описание, Дальность и т.д.) */
.modal .form-label {
  color: rgba(255,255,255,.80) !important;
  font-weight: 600;
  margin-bottom: 6px;
}

/* Поля ввода */
.modal .form-control,
.modal textarea,
.modal select {
  background: rgba(255,255,255,.08) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255,255,255,.18) !important;
  border-radius: 12px;
}

/* Плейсхолдер */
.modal .form-control::placeholder,
.modal textarea::placeholder {
  color: rgba(255,255,255,.45) !important;
}

/* Фокус */
.modal .form-control:focus,
.modal textarea:focus,
.modal select:focus {
  border-color: #5b8cff !important;
  box-shadow: 0 0 0 3px rgba(91,140,255,.25) !important;
}

/* Подсказки */
.modal .hint,
.modal .form-text {
  color: rgba(255,255,255,.55) !important;
}

/* Крестик */
.modal-header .btn-close {
  filter: invert(1);
  opacity: .85;
}
.modal-header .btn-close:hover {
  opacity: 1;
}

/* =========================
   FAB (+)
   ========================= */
.fab{
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1000;

  width: 56px;
  height: 56px;
  border-radius: 18px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid rgba(255,255,255,.14);
  background: rgba(80,145,255,.98);
  color: #fff;

  box-shadow: 0 18px 40px rgba(0,0,0,.35);
}

.fab i{ font-size: 20px; }

.fab:active{
  transform: translateY(1px);
}

/* =========================
   FAB menu + animations
   ========================= */

.fab{
  transition: transform .12s ease, box-shadow .2s ease, filter .2s ease;
  will-change: transform;
}
.fab:hover{ filter: brightness(1.05); }
.fab:active{ transform: translateY(1px) scale(.98); }

/* контейнер меню */
.fab-menu{
  position: fixed;
  right: 18px;
  bottom: 86px;
  z-index: 1000;

  display: flex;
  flex-direction: column;
  gap: 10px;

  padding: 10px;
  border-radius: 16px;
  background: rgba(15, 20, 35, .92);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 24px 70px rgba(0,0,0,.45);

  transform-origin: bottom right;
  animation: fabMenuIn .14s ease-out;
}

/* элементы меню */
.fab-item{
  display: flex;
  align-items: center;
  gap: 10px;

  width: 220px;
  padding: 10px 12px;

  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.92);
  text-align: left;
  font-weight: 700;
}

.fab-item i{
  font-size: 18px;
  color: rgba(170,205,255,.95);
}

.fab-item:hover{
  background: rgba(255,255,255,.10);
}

.fab-item:active{
  transform: translateY(1px);
}

/* появление меню */
@keyframes fabMenuIn{
  from { opacity: 0; transform: translateY(6px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* =========================
   Header buttons compact
   ========================= */

header.topbar .btn{
  padding: 6px 10px !important;
  border-radius: 12px !important;
  font-size: 13px !important;
  line-height: 1.1;
}

/* чтобы они не ломали строку — пусть скроллятся по горизонтали */
header.topbar .topbar-character-row{
  flex-wrap: nowrap !important;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

header.topbar .topbar-character-row::-webkit-scrollbar{
  height: 0;
}

#btnNew{
  padding: 8px 12px !important;
  border-radius: 14px !important;
  font-weight: 700;
}

/* =========================
   COLLAPSING HEADER
   ========================= */

.topbar{
  position: sticky;
  top: 0;
  z-index: 120;

  background: rgba(10, 14, 26, .96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,.08);

  transition:
    padding .2s ease,
    background .2s ease;
}

/* состояние "сжат" */
.topbar.is-collapsed{
  padding-top: 6px !important;
  padding-bottom: 6px !important;
}

/* заголовок */
.app-title{
  transition:
    font-size .2s ease,
    opacity .2s ease,
    transform .2s ease;
}

/* подпись под заголовком */
#status.muted{
  transition:
    opacity .2s ease,
    transform .2s ease,
    height .2s ease,
    margin .2s ease;
}

/* при сжатии */
.topbar.is-collapsed .app-title{
  font-size: 15px !important;
}

.topbar.is-collapsed #status.muted{
  opacity: 0;
  height: 0;
  margin: 0;
  transform: translateY(-4px);
  overflow: hidden;
}

/* кнопки в шапке чуть компактнее при сжатии */
.topbar.is-collapsed .btn{
  padding: 4px 10px !important;
  font-size: 12px !important;
}
/* =========================
   TABS (scroll like before)
   ========================= */

#tabs.nav{
  display: flex;
  flex-wrap: nowrap;          /* 🔥 запрещаем перенос строк */
  gap: 8px;
  overflow-x: auto;           /* 🔥 включаем горизонтальный скролл */
  -webkit-overflow-scrolling: touch;

  padding: 6px 0;

  /* чтобы скролл был “плавный” и без прыжков */
  scroll-snap-type: x proximity;
}

#tabs.nav::-webkit-scrollbar{
  height: 0;                  /* прячем полоску на мобилках */
}

#tabs .nav-link{
  flex: 0 0 auto;             /* 🔥 каждый таб не сжимается и не переносится */
  white-space: nowrap;

  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 8px 14px;
  border-radius: 999px;

  font-size: 13px;
  line-height: 1;

  scroll-snap-align: start;

  color: #9bb6ff;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

#tabs .nav-link.active{
  background: #4f8cff;
  color: #fff;
  border-color: transparent;
}

/* =========================
   LIST ITEMS (final)
   ========================= */

.list{
  display: grid;
  gap: 10px;
}

.item{
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;

  transition: transform .12s ease, background .2s ease, border-color .2s ease;
}

.item:hover{
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.18);
}
.item:active{
  transform: translateY(0);
}

.item.is-current-turn{
  border-color: rgba(110,168,254,.55);
  background: rgba(110,168,254,.12);
}

.item-head{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.item-title{
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  font-size: 14px;
  color: rgba(255,255,255,.95);
}

.message-item.is-unread{
  border-color: rgba(110,168,254,.45);
  background: rgba(110,168,254,.08);
}

.message-unread-dot{
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 50%;
  background: #6ea8fe;
  box-shadow: 0 0 6px rgba(110,168,254,.7);
}

.message-delete-btn{
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0 !important;
  border-radius: 999px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.item-sub{
  margin-top: 4px;
  color: rgba(255,255,255,.66);
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
}

.item-caret{
  opacity: .65;
  margin-left: auto;
}

.item-details{
  margin-top: 10px;
  color: rgba(255,255,255,.70);
  font-size: 12px;
  white-space: pre-wrap;
  line-height: 1.35;
}

.item-actions{
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.item-actions button{
  cursor: pointer;
}

/* ===== STEPPER: [-][cur][+]/[max] ===== */
.stepper.stepper-split{
  display: grid;
  grid-template-columns: 36px 1fr 36px 14px 1fr;
  gap: 8px;
  align-items: center;
}

.stepper.stepper-split .step-btn{
  height: 36px;
  width: 36px;
  padding: 0;
  border-radius: 10px;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stepper.stepper-split .num{
  height: 36px;
  min-width: 0;
  width: 100%;
  text-align: center;
  font-weight: 600;
  border-radius: 10px;
  padding: 0;
  font-variant-numeric: tabular-nums;
}

.stepper.stepper-split .step-sep{
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  opacity: .6;
  user-select: none;
}

/* на очень узких экранах */
@media (max-width: 380px){
  .stepper.stepper-split{
    grid-template-columns: 32px 1fr 32px 12px 1fr;
    gap: 6px;
  }
  .stepper.stepper-split .step-btn{
    width: 32px;
    height: 32px;
    font-size: 18px;
  }
  .stepper.stepper-split .num{
    height: 32px;
    font-size: 14px;
  }
}


/* ===== EQUIPMENT CARDS (REAL FIX) ===== */

.equip-card{
  background: rgba(18, 26, 51, 0.72);
  border: 1px solid rgb(252, 252, 252);
  border-radius: 18px;
  padding: 12px;
}

/* нормальный хедер */
.equip-top{
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}

/* слот слева */
.equip-slot{
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* кнопки справа */
.equip-actions{
  justify-self: end;
}

/* иконки-кнопки */
.btn-icon{
  width: 36px;
  height: 36px;
  border-radius: 12px;
}
.equip-card{
  cursor: pointer;
}

.equip-card:active{
  transform: translateY(1px);
}

/* ===== COINS: icon + number line ===== */

.coins-line{
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: nowrap;
}

.coin-item{
  display: flex;
  align-items: center;
  gap: 8px;
}

/* кружок-монета */
.coin-icon{
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-block;
  opacity: .95;
}

.coin-icon.gold{
  background: linear-gradient(180deg, #ffd966, #d4a900);
}

.coin-icon.silver{
  background: linear-gradient(180deg, #e6e6e6, #9fa3a7);
}

.coin-icon.copper{
  background: linear-gradient(180deg, #e0a070, #a45a2a);
}

/* число */
.coin-input{
  width: 70px;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,.25);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  text-align: left;
  padding: 2px 4px;
}

.coin-input:focus{
  outline: none;
  border-bottom-color: rgba(255,255,255,.7);
}

/* ===== EQUIP readability ===== */
.equip-card{
  color: rgba(255,255,255,.92);
}

.equip-slot i{
  opacity: .9;
}

.equip-slot span{
  color: rgba(255,255,255,.88);
  font-weight: 700;
}

.equip-slot span.equip-empty{
  color: rgba(255,255,255,.55);
  font-weight: 600;
}

.equip-sub,
.equip-info{
  color: rgba(255,255,255,.72);
}

/* ===== FORCE DARK COIN INPUTS ===== */
.coin-input{
  background: transparent !important;
  background-color: transparent !important;
  color: rgba(255,255,255,.95) !important;

  border: none !important;
  border-bottom: 1px solid rgba(255,255,255,.35) !important;

  box-shadow: none !important;
  outline: none !important;

  padding: 2px 4px;
  height: auto;
}

/* ===== EQUIP: readable text fix ===== */

.equip-card{
  background: linear-gradient(
    180deg,
    rgba(22, 32, 60, 0.92),
    rgba(18, 26, 51, 0.92)
  );
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 18px;

  /* ВАЖНО */
  opacity: 1 !important;
  color: #fff;
}

.equip-slot span{
  color: rgba(255,255,255,0.95);
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.equip-slot span.equip-empty{
  color: rgba(255,255,255,0.6);
  font-weight: 600;
}

/* ===== Wallet (coin-number row) ===== */
.wallet-input{
  width: 92px;
  text-align:center;
  font-weight: 700;
}

/* красивые монетки (без картинок, чисто CSS) */
.coin-ico{
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display:inline-block;
  box-shadow:
    0 2px 10px rgba(0,0,0,.35),
    inset 0 1px 2px rgba(255,255,255,.35);
  border: 1px solid rgba(255,255,255,.25);
}

.coin-gold{
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.75), rgba(255,255,255,0) 35%),
              radial-gradient(circle at 70% 70%, rgba(255,255,255,.15), rgba(255,255,255,0) 45%),
              linear-gradient(135deg, #ffdf6e, #f0b400, #ffea9a);
}

.coin-silver{
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.80), rgba(255,255,255,0) 35%),
              radial-gradient(circle at 70% 70%, rgba(255,255,255,.18), rgba(255,255,255,0) 45%),
              linear-gradient(135deg, #f2f5ff, #aeb6c7, #ffffff);
}

.coin-copper{
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.70), rgba(255,255,255,0) 35%),
              radial-gradient(circle at 70% 70%, rgba(255,255,255,.12), rgba(255,255,255,0) 45%),
              linear-gradient(135deg, #ffb08a, #b85a2a, #ffd0b5);
}

/* ===== Equipment readability fix ===== */
.equip-slot{
  color: rgba(255,255,255,.92);
}

.equip-sub,
.equip-info{
  opacity: .88; /* было слишком бледно */
}

.equip-empty{
  opacity: .75;
}

/* ===== Equip: long names don't overflow ===== */

.equip-card{
  overflow: hidden;          /* чтобы ничто не вылезало наружу */
}

.equip-slot{
  min-width: 0;              /* 🔥 критично для ужимания */
}

/* общий контейнер строки тоже можно подстраховать */
.equip-top{
  min-width: 0;
}

/* именно название предмета — в одну строку с ... */
.equip-name{
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Статы: − [input] + в одну линию */
.stepper.stepper-stat{
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 10px;
}

.stepper.stepper-stat .step-btn{
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 14px;
  font-weight: 700;
  line-height: 1;
}

/* чтобы инпут был ровный и не "прыгал" */
.stepper.stepper-stat .stat-num{
  height: 42px;
  text-align: center;
  font-weight: 600;
}

/* опционально: чуть компактнее на очень узких экранах */
@media (max-width: 360px){
  .stepper.stepper-stat{
    grid-template-columns: 40px 1fr 40px;
    gap: 8px;
  }
  .stepper.stepper-stat .step-btn,
  .stepper.stepper-stat .stat-num{
    height: 40px;
  }
}

/* ===== modalx (простая модалка) ===== */
.modalx { position: fixed; inset: 0; z-index: 9999; }
.modalx.d-none { display: none; }
.modalx-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.modalx-card {
  position: relative;
  width: min(920px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  margin: 12px auto;
  background: rgba(20, 25, 40, .98);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modalx-head, .modalx-foot { padding: 12px 12px; border-bottom: 1px solid rgba(255,255,255,.06); }
.modalx-foot { border-bottom: none; border-top: 1px solid rgba(255,255,255,.06); }
.modalx-title { font-weight: 700; }
.modalx-body { padding: 12px 12px; overflow: auto; }

.builder-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
@media (max-width: 720px) {
  .builder-grid { grid-template-columns: 1fr; }
}
.builder-col-title { font-weight: 700; margin-bottom: 6px; }
.builder-list {
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  padding: 8px;
  min-height: 92px;
}
.builder-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid transparent;
}
.builder-item:hover { background: rgba(255,255,255,.04); }
.builder-item.active { border-color: rgba(110,168,254,.65); background: rgba(110,168,254,.10); }

.codebox {
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  padding: 10px;
}

/* ===== Фикс: текст в инпутах/textarea на тёмной теме ===== */
.form-control,
.form-select,
textarea.form-control,
input.form-control {
  color: rgba(255, 255, 255, 0.92) !important;
  background-color: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
}

/* placeholder */
.form-control::placeholder {
  color: rgba(255, 255, 255, 0.45) !important;
}

/* когда фокус — чуть ярче */
.form-control:focus,
.form-select:focus {
  color: rgba(255, 255, 255, 0.95) !important;
  background-color: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(110, 168, 254, 0.7) !important;
  box-shadow: 0 0 0 0.2rem rgba(110, 168, 254, 0.15) !important;
}

/* чтобы выделение текста тоже было видно */
.form-control::selection {
  background: rgba(110, 168, 254, 0.35);
}

/* Fixed donate button */
.donate-btn{
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 100;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 10px 14px;
  border-radius: 18px;

  text-decoration: none;
  font-weight: 700;

  background: rgba(110,168,254,.16);
  border: 1px solid rgba(110,168,254,.38);
  color: rgba(255,255,255,.88);
  backdrop-filter: blur(8px);
}

body.modal-open .donate-btn,
body.builder-open .donate-btn{
  opacity: 0;
  pointer-events: none;
}

/* чтобы контент не прятался под кнопкой */
body{
  padding-bottom: 120px;
}

/* ===== FIX: XP input-group alignment ===== */
#tab-main .input-group {
  align-items: stretch;
}

#tab-main .input-group > .form-control,
#tab-main .input-group > .btn {
  height: 44px;
}

#tab-main .input-group > .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  white-space: nowrap;
}

/* ===== FIX: Wallet ровными колонками ===== */
.wallet-row{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: center;
}

.wallet-pair{
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.wallet-input{
  width: 100%;
  height: 44px;
  text-align: center;
  font-weight: 700;
}

@media (max-width: 360px){
  .wallet-row{
    grid-template-columns: 1fr;
  }
}

/* =========================
   COMBAT HUD (sticky)
   ========================= */
.combat-hud{
  position: static;
  margin: 0;
  background: transparent;
  backdrop-filter: none;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.combat-hud--inside{
  margin-top: 0;
  margin-bottom: 0;
}

.combat-mode-card{
  overflow: hidden;
}

.combat-hud-row{
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 576px){
  .combat-hud-row{
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 992px){
  .combat-hud-row{
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.combat-chip{
  min-width: 0;
  width: 100%;
  padding: 10px;
  min-height: 0;
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
}

.combat-chip-title{
  font-size: 11px;
  color: rgba(255,255,255,.70);
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.combat-chip-body{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.combat-chip-val{
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.combat-mode-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  cursor:pointer;
  user-select:none;
}

.combat-mode-head:active{
  opacity:.9;
}

.combat-mode-head .section-title{
  margin-bottom: 0;
}

.combat-mode-body{
  margin-top: 14px;
}

#combatModeChevron{
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(165deg, rgba(255,255,255,.10), rgba(255,255,255,.02));
  box-shadow: 0 1px 2px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.07);
  font-size: 14px;
  opacity: .8;
  transition: transform .2s ease, opacity .2s ease, color .2s ease, background .2s ease, border-color .2s ease;
}

.combat-mode-card.is-open #combatModeChevron{
  opacity: 1;
  color: #6ea8fe;
  background: linear-gradient(165deg, rgba(110,168,254,.22), rgba(110,168,254,.05));
  border-color: rgba(110,168,254,.42);
  transform: rotate(180deg);
}

#combatModeSummary{
  font-size: 13px;
  opacity: .85;
}

/* ===== Цвета ресурсов ===== */

.combat-chip.hp {
  border: 1px solid rgba(255, 80, 80, 0.25);
  background: linear-gradient(160deg, rgba(255, 80, 80, .14), rgba(255, 80, 80, .04));
}

.combat-chip.hp .combat-chip-title {
  color: #ff6b6b;
}

.combat-chip.hp .combat-chip-val {
  color: #ff8787;
}


.combat-chip.mana {
  border: 1px solid rgba(80, 160, 255, 0.25);
  background: linear-gradient(160deg, rgba(80, 160, 255, .14), rgba(80, 160, 255, .04));
}

.combat-chip.mana .combat-chip-title {
  color: #6bb4ff;
}

.combat-chip.mana .combat-chip-val {
  color: #9ccfff;
}


.combat-chip.energy {
  border: 1px solid rgba(255, 200, 80, 0.25);
  background: linear-gradient(160deg, rgba(255, 200, 80, .14), rgba(255, 200, 80, .04));
}

.combat-chip.energy .combat-chip-title {
  color: #ffd36b;
}

.combat-chip.energy .combat-chip-val {
  color: #ffe08a;
}

.combat-chip.ap {
  border: 1px solid rgba(110, 168, 254, 0.25);
  background: linear-gradient(160deg, rgba(110, 168, 254, .14), rgba(110, 168, 254, .04));
}

.combat-chip.ap .combat-chip-title {
  color: #6ea8fe;
}

.combat-chip.ap .combat-chip-val {
  color: #9cc2ff;
}

.combat-chip.ap .step-btn{
  border-color: rgba(110, 168, 254, .35);
}

/* ===== XP блок ===== */

.xp-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.xp-add{
  grid-column: 1 / -1; /* растянуть на всю ширину */
}

@media (min-width: 768px){
  .xp-grid{
    grid-template-columns: 1fr 1fr 1fr;
  }

  .xp-add{
    grid-column: auto;
  }
}

/* ===== Боевой режим: финальный вид ===== */

.combat-actions-row{
  display:grid;
  grid-template-columns: 1fr;
  gap:10px;
}

@media (min-width: 576px){
  .combat-actions-row{
    grid-template-columns: auto 1fr;
    align-items:center;
  }
}

.combat-search{
  min-width: 0;
}

.combat-switch .btn{
  white-space: nowrap;
}

/* ===== Кошелёк: карточки ===== */

.wallet-grid{
  display:grid;
  grid-template-columns: 1fr;
  gap:10px;
}

@media (min-width: 576px){
  .wallet-grid{
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.wallet-card{
  border-radius: 16px;
  padding: 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
}

.wallet-head{
  display:flex;
  align-items:center;
  gap:8px;
  margin-bottom: 8px;
  font-size: 13px;
  color: rgba(255,255,255,.78);
  font-weight: 600;
}

.wallet-input{
  width: 100%;
  height: 44px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.money-preview{
  font-size: 14px;
  line-height: 1.45;
}

/* ===== FIX: боевой режим кликается нормально ===== */

.combat-mode-head{
  position: relative;
  z-index: 2;
}

#combatModeChevron{
  pointer-events: none;
}

#combatModeSummary{
  pointer-events: none;
}

.combat-mode-body{
  margin-top: 14px;
  animation: fadeIn .2s ease;
}

@keyframes fadeIn{
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== combat mode polish ===== */

.combat-mode-card{
  margin-bottom: 16px;
}

.combat-mode-head{
  padding-bottom: 6px;
}

.combat-mode-body{
  margin-top: 16px;
}

#combatModeSummary{
  line-height: 1.45;
}

.combat-chip:not(.hp):not(.mana):not(.energy) .combat-chip-val{
  color: rgba(255,255,255,.92);
}

#hud_attack,
#hud_armor{
  color: rgba(255,255,255,.92) !important;
}

@media (max-width: 575px){
  .combat-hud-row{
    grid-template-columns: 1fr 1fr;
  }

  .combat-chip{
    min-height: 108px;
  }

  /* DMG и Armor пусть выглядят не "обрубками" */
  .combat-chip:nth-child(4),
  .combat-chip:nth-child(5){
    min-height: 124px;
  }
}

/* ===== Combat states ===== */

.combat-states-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}

.combat-turn-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.combat-states-list{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.combat-state-chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  color: rgba(255,255,255,.92);
  font-size: 13px;
}

.combat-state-name{
  font-weight: 700;
}

.combat-state-meta{
  color: rgba(255,255,255,.68);
  font-size: 12px;
}

.combat-state-actions{
  display:flex;
  align-items:center;
  gap:6px;
}

.combat-state-btn{
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.9);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0;
  line-height:1;
}

.combat-state-btn:active{
  transform: translateY(1px);
}

.combat-state-empty{
  color: rgba(255,255,255,.58);
  font-size: 13px;
}

/* ===== Quick combat buttons ===== */

.combat-quick-row{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.combat-quick-btn{
  min-width: 42px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.92);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.combat-quick-btn:active{
  transform: translateY(1px);
}

.combat-chip.hp .combat-quick-btn{
  border-color: rgba(255, 110, 110, .22);
  background: rgba(255, 90, 90, .08);
}

.combat-chip.mana .combat-quick-btn{
  border-color: rgba(90, 170, 255, .22);
  background: rgba(80, 160, 255, .08);
}

.combat-chip.energy .combat-quick-btn{
  border-color: rgba(255, 210, 90, .22);
  background: rgba(255, 210, 90, .08);
}

.combat-quick-btn.is-heal{
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}

@media (max-width: 575px){
  .combat-quick-row{
    gap: 5px;
  }

  .combat-quick-btn{
    min-width: 38px;
    height: 26px;
    font-size: 11px;
    padding: 0 6px;
  }
}

#btnRest,
#btnMove{
  white-space: nowrap;
}

#btnBattle,
#btnRest,
#btnMove{
  white-space: nowrap;
}

.combat-meta-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}

.combat-meta-actions{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}

.combat-round-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.92);
  font-weight: 700;
  font-size: 13px;
}

.combat-log{
  display:grid;
  gap:8px;
}

.combat-log-item{
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.88);
  font-size: 13px;
  line-height: 1.35;
}

.combat-log-time{
  color: rgba(255,255,255,.5);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  margin-right: 6px;
}

.combat-log-empty{
  color: rgba(255,255,255,.55);
  font-size: 13px;
}

.combat-chip.is-low{
  box-shadow: inset 0 0 0 1px rgba(255,120,120,.22);
}

.combat-chip.is-empty{
  opacity: .78;
}

#hud_armor{
  cursor: pointer;
}

.combat-chip.armor-clickable{
  cursor: pointer;
}

.combat-log-wrap{
  border-top: 1px solid rgba(255,255,255,.08);
  padding-top: 10px;
}

.combat-log-summary{
  cursor: pointer;
  color: #ffffff !important;
  font-size: 15px;
  font-weight: 800;
  list-style: none;
  opacity: 1 !important;
}

.combat-log-summary,
.combat-log-summary *{
  color: #ffffff !important;
}

.combat-log-summary::-webkit-details-marker{
  display: none;
}

.combat-log-summary::before{
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  margin-right: 8px;
  transition: transform .18s ease;
  opacity: .8;
}

.combat-log-wrap[open] .combat-log-summary::before{
  transform: rotate(90deg);
}

.combat-bar{
  width: 100%;
  height: 10px;
  margin-top: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
}

.combat-bar-fill{
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width .2s ease;
}

.combat-bar-fill.hp{
  background: linear-gradient(90deg, #ff6b6b, #ff9a9a);
}

.combat-bar-fill.mana{
  background: linear-gradient(90deg, #5aa8ff, #9ccfff);
}

.combat-bar-fill.energy{
  background: linear-gradient(90deg, #ffd36b, #ffe08a);
}

.combat-bar-fill.ap{
  background: linear-gradient(90deg, #6ea8fe, #9cc2ff);
}

#btnClearCombatLog{
  white-space: nowrap;
}

.combat-log-wrap{
  margin-top: 10px;
}

.combat-log-wrap .d-flex{
  margin-bottom: 10px;
}

.combat-chip .combat-chip-body:has(#hud_attack),
.combat-chip .combat-chip-body:has(#hud_armor){
  min-height: 42px;
  align-items: flex-end;
}

#hud_attack,
#hud_armor{
  font-size: 20px;
  font-weight: 900;
}

.combat-chip.is-critical{
  animation: pulseRed 1s infinite;
  box-shadow: 0 0 12px rgba(255,80,80,.5);
}

@keyframes pulseRed{
  0%{ box-shadow: 0 0 6px rgba(255,80,80,.3); }
  50%{ box-shadow: 0 0 16px rgba(255,80,80,.7); }
  100%{ box-shadow: 0 0 6px rgba(255,80,80,.3); }
}

.combat-chip-val{
  transition: transform .15s ease;
}

.combat-chip-val.updated{
  transform: scale(1.1);
}

.combat-log-item{
  border-left: 3px solid rgba(255,255,255,.2);
}

.combat-log-item.damage{
  border-color: #ff6b6b;
}

.combat-log-item.heal{
  border-color: #6bff9a;
}

.battle-toast{
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  z-index: 3000;

  min-width: 220px;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  border-radius: 14px;

  background: rgba(20, 28, 48, .96);
  border: 1px solid rgba(255,255,255,.14);
  color: #fff;
  font-weight: 700;
  text-align: center;

  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.battle-toast.show{
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.battle-toast.error{
  border-color: rgba(255, 110, 110, .45);
  box-shadow: 0 10px 30px rgba(255, 80, 80, .18);
}

.battle-toast.success{
  border-color: rgba(110, 255, 170, .35);
  box-shadow: 0 10px 30px rgba(80, 255, 140, .14);
}

.combat-action-btn{
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.96);
  font-weight: 800;
  white-space: nowrap;
}

.combat-action-btn--hit{
  background: rgba(255, 90, 90, .12);
  border-color: rgba(255, 110, 110, .28);
  color: #ffd0d0;
}

.combat-action-btn--hit:active{
  transform: translateY(1px) scale(.98);
}

/* =========================
   COMBAT MINI MODE
   ========================= */

.combat-mode-head-actions{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.combat-compact-toggle{
  white-space: nowrap;
}

.combat-mini-actions{
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.combat-mini-btn{
  min-height: 42px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.94);
  font-weight: 800;
  white-space: nowrap;
}

.combat-mini-btn:active{
  transform: translateY(1px) scale(.98);
}

.combat-mini-btn--hit{
  background: rgba(255, 90, 90, .12);
  border-color: rgba(255, 110, 110, .28);
  color: #ffd0d0;
}

/* сам компактный режим */
.combat-mode-body.is-compact .combat-states-block,
.combat-mode-body.is-compact .combat-meta-block,
.combat-mode-body.is-compact .combat-actions-row,
.combat-mode-body.is-compact #combatQuickSpells,
.combat-mode-body.is-compact #combatQuickAbilities{
  display: none !important;
}

.combat-mode-body.is-compact .combat-mini-actions{
  display: grid;
}

.combat-mode-body.is-compact .combat-hud-row{
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.combat-mode-body.is-compact .combat-chip{
  min-height: 96px;
  padding: 10px;
}

.combat-mode-body.is-compact .combat-chip-title{
  font-size: 10px;
  margin-bottom: 4px;
}

.combat-mode-body.is-compact .combat-chip-val{
  font-size: 15px;
}

.combat-mode-body.is-compact .combat-bar{
  margin-top: 10px;
  height: 8px;
}

.combat-mode-body.is-compact .combat-quick-row{
  display: none;
}

.combat-mode-body.is-compact .combat-chip .step-btn{
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  border-radius: 10px;
}

.combat-mode-body.is-compact .combat-chip-body{
  gap: 8px;
}

.combat-mode-card.is-compact .combat-compact-toggle{
  background: rgba(110,168,254,.18);
  border-color: rgba(110,168,254,.42);
  color: #ffffff;
}

@media (max-width: 575px){
  .combat-mode-body.is-compact .combat-hud-row{
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .combat-mode-body.is-compact .combat-chip{
    min-height: 92px;
  }

  .combat-mini-btn{
    min-height: 40px;
    font-size: 13px;
  }
}

/* =========================
   COMBAT SWIPE
   ========================= */

.combat-chip.swipe-enabled{
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  transition:
    transform .14s ease,
    box-shadow .18s ease,
    border-color .18s ease,
    background .18s ease;
}

.combat-chip.is-swiping{
  z-index: 2;
}

.combat-chip.swipe-left{
  transform: translateX(-14px) scale(.985);
}

.combat-chip.swipe-right{
  transform: translateX(14px) scale(.985);
}

.combat-chip.swipe-left.hp{
  box-shadow: 0 10px 26px rgba(255, 90, 90, .18);
}

.combat-chip.swipe-right.hp{
  box-shadow: 0 10px 26px rgba(120, 255, 170, .18);
}

.combat-chip.swipe-left.mana{
  box-shadow: 0 10px 26px rgba(90, 170, 255, .18);
}

.combat-chip.swipe-right.mana{
  box-shadow: 0 10px 26px rgba(120, 210, 255, .18);
}

.combat-chip.swipe-left.energy{
  box-shadow: 0 10px 26px rgba(255, 210, 90, .18);
}

.combat-chip.swipe-right.energy{
  box-shadow: 0 10px 26px rgba(255, 235, 140, .18);
}

/* =========================
   LONG PRESS FEEDBACK
   ========================= */

.step-btn.is-holding,
.combat-quick-btn.is-holding,
.combat-action-btn.is-holding{
  transform: scale(.97);
  filter: brightness(1.08);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}

/* =========================
   COMBAT LOG TYPES
   ========================= */

.combat-log-item.mana{
  border-color: #6bb4ff;
  background: rgba(80, 160, 255, .08);
}

.combat-log-item.energy{
  border-color: #ffd36b;
  background: rgba(255, 210, 90, .08);
}

.combat-log-item.magic{
  border-color: #c084ff;
  background: rgba(168, 85, 247, .10);
}

.combat-log-item.system{
  border-color: rgba(255,255,255,.35);
  background: rgba(255,255,255,.05);
}

.combat-log-item.error{
  border-color: #ff6b6b;
  background: rgba(255, 90, 90, .10);
}

.combat-log-item.damage{
  background: rgba(255, 90, 90, .08);
}

.combat-log-item.heal{
  background: rgba(90, 255, 140, .08);
}

/* =========================
   COMBAT CHIP FX
   ========================= */

.combat-chip{
  transition:
    transform .16s ease,
    box-shadow .18s ease,
    border-color .18s ease,
    background .18s ease,
    opacity .18s ease;
}

.combat-chip.is-hit{
  animation: combatHitShake .28s ease;
}

.combat-chip.is-heal-flash{
  animation: combatHealFlash .42s ease;
}

.combat-chip.is-mana-flash{
  animation: combatManaFlash .42s ease;
}

.combat-chip.is-energy-flash{
  animation: combatEnergyFlash .42s ease;
}

@keyframes combatHitShake{
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-4px); }
  40%  { transform: translateX(4px); }
  60%  { transform: translateX(-3px); }
  80%  { transform: translateX(2px); }
  100% { transform: translateX(0); }
}

@keyframes combatHealFlash{
  0%{
    box-shadow: 0 0 0 rgba(110,255,170,0);
    background: rgba(90, 255, 140, .08);
  }
  50%{
    box-shadow: 0 0 0 10px rgba(110,255,170,.10);
    background: rgba(90, 255, 140, .16);
  }
  100%{
    box-shadow: 0 0 0 rgba(110,255,170,0);
    background: rgba(90, 255, 140, .08);
  }
}

@keyframes combatManaFlash{
  0%{
    box-shadow: 0 0 0 rgba(100,180,255,0);
  }
  50%{
    box-shadow: 0 0 0 10px rgba(100,180,255,.10);
    background: rgba(80, 160, 255, .16);
  }
  100%{
    box-shadow: 0 0 0 rgba(100,180,255,0);
  }
}

@keyframes combatEnergyFlash{
  0%{
    box-shadow: 0 0 0 rgba(255,215,100,0);
  }
  50%{
    box-shadow: 0 0 0 10px rgba(255,215,100,.10);
    background: rgba(255, 210, 90, .16);
  }
  100%{
    box-shadow: 0 0 0 rgba(255,215,100,0);
  }
}

/* =========================
   COMBAT FLOATING VALUES
   ========================= */

.combat-chip{
  position: relative;
  overflow: visible;
}

.combat-float{
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%) translateY(0) scale(.96);
  pointer-events: none;
  z-index: 6;

  padding: 4px 10px;
  border-radius: 999px;

  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;

  opacity: 0;
  animation: combatFloatUp .75s ease forwards;
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
}

.combat-float.damage{
  color: #ffd7d7;
  background: rgba(255, 90, 90, .18);
  border: 1px solid rgba(255, 110, 110, .30);
}

.combat-float.heal{
  color: #dcffe9;
  background: rgba(90, 255, 140, .18);
  border: 1px solid rgba(110, 255, 170, .30);
}

.combat-float.mana{
  color: #d9eeff;
  background: rgba(80, 160, 255, .18);
  border: 1px solid rgba(100, 180, 255, .30);
}

.combat-float.energy{
  color: #fff1c9;
  background: rgba(255, 210, 90, .18);
  border: 1px solid rgba(255, 220, 120, .30);
}

@keyframes combatFloatUp{
  0%{
    opacity: 0;
    transform: translateX(-50%) translateY(6px) scale(.92);
  }
  15%{
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
  100%{
    opacity: 0;
    transform: translateX(-50%) translateY(-26px) scale(1.02);
  }
}

/* =========================
   COMBAT CHIP EXPANDABLE QUICK ROW
   ========================= */

.combat-chip{
  cursor: pointer;
}

.combat-chip button{
  cursor: pointer;
}

.combat-chip .combat-quick-row{
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin-top: 0;
  pointer-events: none;
  transition:
    max-height .22s ease,
    opacity .18s ease,
    margin-top .18s ease;
}

.combat-chip.is-expanded .combat-quick-row{
  max-height: 64px;
  opacity: 1;
  margin-top: 10px;
  pointer-events: auto;
}

.combat-chip.is-expanded{
  box-shadow: 0 10px 28px rgba(0,0,0,.18);
}

.combat-chip.hp.is-expanded{
  border-color: rgba(255, 110, 110, .34);
}

.combat-chip.mana.is-expanded{
  border-color: rgba(90, 170, 255, .34);
}

.combat-chip.energy.is-expanded{
  border-color: rgba(255, 210, 90, .34);
}

/* в компактном режиме оставляем скрытыми */
.combat-mode-body.is-compact .combat-chip .combat-quick-row{
  display: none !important;
}

/* =========================
   COMBAT CHIP TOGGLE
   ========================= */

.combat-chip-top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.combat-chip-top-actions{
  display: flex;
  align-items: center;
  gap: 6px;
}

.combat-chip-toggle,
.combat-chip-overheal{
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: linear-gradient(165deg, rgba(255,255,255,.12), rgba(255,255,255,.02));
  box-shadow: 0 1px 2px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.08);
  color: rgba(255,255,255,.88);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .12s ease, filter .15s ease;
}

.combat-chip-toggle:active,
.combat-chip-overheal:active{
  transform: scale(.90);
  filter: brightness(1.15);
}

.combat-chip-toggle i,
.combat-chip-overheal i{
  font-size: 12px;
  transition: transform .18s ease;
}

.combat-chip.is-expanded .combat-chip-toggle i{
  transform: rotate(180deg);
}

.combat-chip.hp .combat-chip-toggle,
.combat-chip.hp .combat-chip-overheal{
  border-color: rgba(255, 110, 110, .24);
}

.combat-chip.mana .combat-chip-toggle,
.combat-chip.mana .combat-chip-overheal{
  border-color: rgba(90, 170, 255, .24);
}

.combat-chip.energy .combat-chip-toggle,
.combat-chip.energy .combat-chip-overheal{
  border-color: rgba(255, 210, 90, .24);
}

.topbar{
  position: sticky;
  top: 0;
  z-index: 120;
  padding: 10px 12px 8px;
  background: rgba(10, 14, 26, .96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,.08);
  transition: padding .2s ease, background .2s ease;
}

.app-title{
  font-weight: 700;
  letter-spacing: 0.2px;
  font-size: 15px;
  line-height: 1.15;
}

#status.muted{
  font-size: 11px;
  line-height: 1.2;
  margin-top: 2px;
  transition: opacity .2s ease, transform .2s ease, height .2s ease, margin .2s ease;
}

.account-badge{
  font-size: 11px;
  line-height: 1.2;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.account-badge-icon{
  color: #6bff9a;
  font-size: 10px;
}

.topbar.is-collapsed .account-badge{
  opacity: 0;
  height: 0;
  margin: 0;
  overflow: hidden;
}

header.topbar .btn{
  padding: 5px 9px !important;
  border-radius: 999px !important;
  font-size: 12px !important;
}

.character-select-wrap{
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.character-select-icon{
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: rgba(255,255,255,.5);
  pointer-events: none;
}

#characterSelect{
  width: 100%;
  min-height: 42px;
  padding-left: 34px !important;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
  border-color: rgba(255,255,255,.16);
  font-weight: 700;
}

#characterSelect:focus{
  border-color: rgba(110,168,254,.55);
  box-shadow: 0 0 0 3px rgba(110,168,254,.18);
}

#btnDeleteCharacter{
  min-height: 42px;
  min-width: 42px;
  padding: 0 !important;
  border-radius: 14px !important;
  flex: 0 0 auto;
}

/* ===== Connection status lamp ===== */

.account-status-row{
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.account-status-row .account-badge{
  margin-top: 0;
}

.status-dot{
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot--connecting{
  background: #f5c542;
  box-shadow: 0 0 6px rgba(245,197,66,.7);
  animation: statusDotPulse 1.2s ease-in-out infinite;
}

.status-dot--ok{
  background: #34d372;
  box-shadow: 0 0 6px rgba(52,211,114,.6);
}

.status-dot--error{
  background: #ff5c5c;
  box-shadow: 0 0 6px rgba(255,92,92,.6);
}

@keyframes statusDotPulse{
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

#btnNew{
  min-height: 42px;
  min-width: 98px;
  padding: 0 14px !important;
  border-radius: 18px !important;
  font-size: 13px !important;
}

/* ===== Tabs ===== */

#tabs.nav{
  gap: 6px;
  padding: 4px 0 2px;
}

#tabs .nav-link{
  padding: 8px 12px;
  font-size: 12px;
}

/* ===== Combat card ===== */

.combat-mode-card{
  margin-top: 12px !important;
  margin-bottom: 18px;
}

.combat-mode-head{
  align-items: flex-start;
  gap: 10px;
}

#combatModeSummary{
  font-size: 12px;
  line-height: 1.35;
  max-width: 100%;
}

.combat-mode-head-actions{
  gap: 8px;
}

.combat-compact-toggle{
  height: 34px;
  padding: 0 12px;
  border-radius: 999px !important;
  font-size: 12px !important;
}

/* HUD плотнее */
.combat-hud-row{
  gap: 8px;
}

.combat-chip{
  border-radius: 18px;
  padding: 10px;
}

.combat-chip-title{
  font-size: 10px;
  letter-spacing: .55px;
}

.combat-chip-val{
  font-size: 15px;
}

.combat-bar{
  height: 9px;
  margin-top: 10px;
}

.combat-chip .step-btn{
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(165deg, rgba(255,255,255,.12), rgba(255,255,255,.02));
  box-shadow: 0 1px 2px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.08);
  transition: transform .12s ease, filter .15s ease, box-shadow .15s ease;
}

.combat-chip .step-btn:active{
  transform: scale(.90);
  filter: brightness(1.15);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.35);
}

.combat-chip.hp .step-btn{
  border-color: rgba(255, 110, 110, .35);
}

.combat-chip.mana .step-btn{
  border-color: rgba(90, 170, 255, .35);
}

.combat-chip.energy .step-btn{
  border-color: rgba(255, 210, 90, .35);
}

/* DMG/Armor компактнее */
.combat-chip:not(.hp):not(.mana):not(.energy){
  min-height: 96px;
}

#hud_attack,
#hud_armor{
  font-size: 18px;
}

/* ===== Lower base resources ===== */

.base-resources-toggle{
  height: 28px;
  padding: 0 10px !important;
  border-radius: 999px !important;
  font-size: 11px !important;
}

#baseResourcesBlock{
  overflow: hidden;
  transition: max-height .22s ease, opacity .18s ease, margin-top .18s ease;
}

#baseResourcesBlock.is-collapsed{
  max-height: 0;
  opacity: 0;
  margin-top: 0 !important;
  pointer-events: none;
}

.resources-grid{
  margin-top: 2px;
}

/* Обычные ресурсы менее громкие, чем боевой HUD */
#tab-main .resources-grid .stepper.stepper-split .step-btn{
  border-radius: 14px;
}

#tab-main .resources-grid .num{
  border-radius: 14px;
}

/* ===== Wallet tighter ===== */

.wallet-grid{
  gap: 8px;
}

.wallet-card{
  padding: 10px;
  border-radius: 18px;
}

.wallet-head{
  margin-bottom: 6px;
}

/* ===== Donate: small floating pill on mobile ===== */

.donate-btn{
  left: auto;
  right: 12px;
  bottom: 14px;
  width: auto;
  min-width: 52px;
  max-width: 180px;
  height: 46px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: 0 14px 34px rgba(0,0,0,.30);
  background: rgba(110,168,254,.14);
  backdrop-filter: blur(10px);
}

body{
  padding-bottom: 86px;
}

@media (max-width: 575px){
  .donate-btn{
    right: 12px;
    bottom: 14px;
    min-width: 0;
    width: auto;
    max-width: none;
    height: 46px;
    padding: 0 14px;
    border-radius: 999px;
    text-indent: 0;
    overflow: visible;
    white-space: nowrap;
    font-size: 13px;
  }

  .donate-btn::after{
    content: none;
  }
}

/* ===== Main form spacing ===== */

#tab-main > .card.card-soft:not(.combat-mode-card){
  margin-top: 18px;
}

#tab-main .form-label{
  font-size: 11px;
}

#tab-main .form-control,
#tab-main .form-select{
  min-height: 44px;
  border-radius: 14px;
}

/* ===== Hide noisy status text when not needed ===== */

.topbar.is-collapsed #status{
  display: none;
}

/* =========================
   COMBAT INNER TABS
   ========================= */

.combat-inner-tabs{
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 14px;
  padding-bottom: 2px;
}

.combat-inner-tabs::-webkit-scrollbar{
  height: 0;
}

.combat-inner-tab{
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.82);
  font-size: 12px;
  font-weight: 700;
}

.combat-inner-tab.active{
  background: rgba(110,168,254,.18);
  border-color: rgba(110,168,254,.38);
  color: #ffffff;
}

.combat-panel{
  animation: fadeIn .18s ease;
}

.combat-panel .combat-meta-block,
.combat-panel .combat-states-block{
  margin-top: 0 !important;
}

.combat-panel-actions .combat-meta-block{
  padding-top: 2px;
}

.combat-panel-log .combat-meta-block,
.combat-panel-magic,
.combat-panel-states{
  border-top: 1px solid rgba(255,255,255,.06);
  padding-top: 14px;
}

@media (max-width: 575px){
  .combat-inner-tab{
    min-height: 32px;
    padding: 0 10px;
    font-size: 11px;
  }
}

.combat-mini-actions{
  display: none;
}

.combat-panel-actions .combat-mini-actions{
  margin-top: 12px;
}

/* =========================
   TOPBAR ACTION MENU
   ========================= */

.topbar-menu-wrap{
  position: relative;
  flex-shrink: 0;
}

.topbar-menu-btn{
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0 !important;
  border-radius: 999px !important;

  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.topbar-menu-btn i{
  font-size: 18px;
  line-height: 1;
}

.msg-badge{
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 999px;
  background: #ff5a5a;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
}

.topbar-menu{
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 300;

  width: min(220px, calc(100vw - 24px));
  padding: 8px;
  border-radius: 16px;

  background: rgba(15, 20, 35, .96);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 20px 50px rgba(0,0,0,.32);
  backdrop-filter: blur(12px);

  display: grid;
  gap: 6px;

  animation: topbarMenuIn .14s ease-out;
}

.topbar-menu-item{
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.92);

  display: flex;
  align-items: center;
  gap: 10px;

  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

.topbar-menu-item i{
  font-size: 15px;
  color: rgba(170,205,255,.95);
}

.topbar-menu-item:active{
  transform: translateY(1px);
}

@keyframes topbarMenuIn{
  from{
    opacity: 0;
    transform: translateY(6px) scale(.98);
  }
  to{
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* старый горизонтальный контейнер кнопок больше не нужен */
header.topbar .topbar-menu-wrap + .d-flex.gap-2{
  overflow: visible !important;
}

@media (max-width: 575px){
  .topbar-menu{
    right: 0;
    width: min(210px, calc(100vw - 20px));
  }
}

.topbar .app-title{
  max-width: 100%;
}

.topbar .min-w-0{
  min-width: 0;
}

.topbar .app-title,
.topbar #status{
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================
   CHARACTER HERO + MAIN POLISH
   ========================= */

.character-hero-card{
  overflow: hidden;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(110,168,254,.16), rgba(110,168,254,0) 42%),
    linear-gradient(180deg, rgba(20, 28, 52, .96), rgba(14, 22, 42, .96));
  border: 1px solid rgba(255,255,255,.10);
}

.character-hero-head{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.character-hero-kicker{
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: rgba(255,255,255,.56);
  font-weight: 700;
  margin-bottom: 6px;
}

.character-hero-name{
  font-size: 28px;
  line-height: 1.05;
  font-weight: 900;
  color: #ffffff;
  word-break: break-word;
}

.character-hero-badge{
  min-width: 68px;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.character-hero-badge-label{
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: rgba(255,255,255,.56);
  font-weight: 700;
}

.character-hero-badge-value{
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  margin-top: 4px;
}

.character-hero-meta{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.character-meta-pill{
  min-width: 0;
  padding: 12px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
}

.character-meta-label{
  display: block;
  font-size: 11px;
  color: rgba(255,255,255,.56);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 700;
}

.character-meta-value{
  display: block;
  min-width: 0;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 800;
  color: rgba(255,255,255,.95);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main-subsection-title{
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: rgba(255,255,255,.64);
  margin-top: 4px;
  margin-bottom: 2px;
}

#tab-main .card.card-soft:not(.combat-mode-card):not(.character-hero-card) .card-body{
  padding-top: 14px;
}

#tab-main .col-6 > .form-control,
#tab-main .col-6 > .form-select,
#tab-main .col-3 > .form-control{
  font-weight: 700;
}

.xp-grid{
  margin-top: 2px;
}

.xp-grid > div{
  padding: 12px;
  border-radius: 16px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
}

.xp-grid .input-group{
  margin-top: 2px;
}

.xp-grid .input-group .form-control,
.xp-grid .input-group .btn{
  height: 44px;
}

@media (max-width: 575px){
  .character-hero-name{
    font-size: 24px;
  }

  .character-hero-meta{
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .character-meta-pill{
    padding: 10px 10px;
    border-radius: 14px;
  }

  .character-meta-value{
    font-size: 14px;
  }
}

/* =========================
   VIEW FIRST, EDIT SECOND
   ========================= */

.main-edit-kicker{
  font-size: 12px;
  color: rgba(255,255,255,.48);
  margin-top: -2px;
  margin-bottom: 12px;
}

.main-identity-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.main-identity-card{
  padding: 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
}

.main-identity-card .form-label{
  margin-bottom: 6px;
  font-size: 11px;
  color: rgba(255,255,255,.58);
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 700;
}

.main-identity-card .form-control,
.main-identity-card .form-select{
  min-height: 46px;
  border-radius: 14px;
  font-weight: 700;
  background: rgba(255,255,255,.05) !important;
}

.main-identity-card--xp{
  grid-column: span 2;
}

#tab-main .card.card-soft:not(.combat-mode-card):not(.character-hero-card){
  background: rgba(15, 21, 39, .78);
}

#tab-main .card.card-soft:not(.combat-mode-card):not(.character-hero-card) .section-title{
  color: rgba(255,255,255,.66);
}

#tab-main .hint{
  color: rgba(255,255,255,.46);
}

#tab-main .money-wrap .section-title{
  display: none;
}

/* XP блок тише, но аккуратнее */
.xp-grid > div{
  background: rgba(255,255,255,.035);
  border-color: rgba(255,255,255,.07);
}

.xp-grid .form-label{
  color: rgba(255,255,255,.56);
}

.money-preview{
  color: rgba(255,255,255,.72);
}

/* имя — главное, форма — вторична */
.character-hero-card + .card.card-soft{
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
}

@media (max-width: 575px){
  .main-identity-grid{
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .main-identity-card{
    padding: 10px;
    border-radius: 16px;
  }

  .main-identity-card .form-control,
  .main-identity-card .form-select{
    min-height: 44px;
  }

  .main-edit-kicker{
    font-size: 11px;
    margin-bottom: 10px;
  }
}

.character-hero-card{
  box-shadow: 0 18px 48px rgba(0,0,0,.20);
}

#tab-main .card.card-soft:not(.combat-mode-card):not(.character-hero-card){
  box-shadow: none;
}

#tab-main .card.card-soft:not(.combat-mode-card):not(.character-hero-card) .form-control:focus,
#tab-main .card.card-soft:not(.combat-mode-card):not(.character-hero-card) .form-select:focus{
  box-shadow: 0 0 0 0.18rem rgba(110,168,254,.12) !important;
}

.character-hero-card{
  margin-top: 18px;
  margin-bottom: 0;
}

.combat-mode-card + .character-hero-card{
  margin-top: 18px;
}

/* =========================
   TAB-MAIN EDIT CARD POLISH
   ========================= */

#tab-main .character-hero-card + .card.card-soft{
  margin-top: 14px;
}

#tab-main .card.card-soft:not(.combat-mode-card):not(.character-hero-card){
  background: rgba(15, 21, 39, .78);
  box-shadow: none;
}

#tab-main .card.card-soft:not(.combat-mode-card):not(.character-hero-card) .card-body{
  padding: 14px 14px 16px;
}

#tab-main .section-title{
  margin-bottom: 6px;
}

.main-edit-kicker{
  font-size: 11px;
  color: rgba(255,255,255,.46);
  margin-top: -2px;
  margin-bottom: 12px;
}

.main-subsection-title{
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .55px;
  color: rgba(255,255,255,.58);
  margin-top: 6px;
  margin-bottom: 2px;
}

/* имя отдельно и чуть воздушнее */
#tab-main #f_name{
  min-height: 46px;
  font-weight: 700;
}

/* identity-grid компактнее */
.main-identity-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.main-identity-card{
  padding: 10px;
  border-radius: 16px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
}

.main-identity-card .form-control,
.main-identity-card .form-select{
  min-height: 44px;
  border-radius: 14px;
  font-weight: 700;
}

/* прогресс и кошелёк не должны сливаться */
.xp-grid{
  margin-top: 4px;
  gap: 8px;
}

.xp-grid > div{
  padding: 10px;
  border-radius: 14px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.07);
}

.money-wrap{
  margin-top: 2px;
}

.wallet-card{
  padding: 10px;
  border-radius: 16px;
}

/* блок ресурсов чуть отделяем */
#baseResourcesBlock{
  margin-top: 2px;
}

/* нижняя кнопка сохранения пусть не орёт */
#btnSaveMain{
  min-height: 44px;
  border-radius: 16px;
  font-size: 14px;
}

/* hr между секциями мягче */
.hr-soft{
  margin: 16px 0 14px;
  opacity: .65;
}

@media (max-width: 575px){
  #tab-main .card.card-soft:not(.combat-mode-card):not(.character-hero-card) .card-body{
    padding: 12px 12px 14px;
  }

  .main-identity-grid{
    gap: 8px;
  }

  .main-identity-card{
    padding: 10px;
  }

  .xp-grid{
    grid-template-columns: 1fr;
  }
}

.combat-panel-actions .combat-mini-actions{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.combat-panel-actions .combat-mini-btn{
  min-height: 54px;
  padding: 0 16px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.combat-panel-actions .combat-mini-btn--hit{
  background: rgba(255, 90, 90, .14);
  border-color: rgba(255, 110, 110, .30);
  color: #ffd8d8;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}

.combat-panel-actions .combat-mini-btn:not(.combat-mini-btn--hit){
  background: rgba(255,255,255,.045);
  border-color: rgba(255,255,255,.12);
  color: rgba(255,255,255,.94);
}

@media (max-width: 575px){
  .combat-panel-actions .combat-mini-actions{
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .combat-panel-actions .combat-mini-btn{
    min-height: 50px;
    padding: 0 12px;
    border-radius: 16px;
    font-size: 13px;
  }
}

/* ===== TAB VISIBILITY FIX ===== */
.tab {
  display: none;
}

.tab:not(.d-none) {
  display: block;
}

/* ===== MINI MODE CLEANUP ===== */
.combat-mode-body.is-compact .combat-inner-tabs,
.combat-mode-body.is-compact #combatModeSummary,
.combat-mode-body.is-compact .combat-panel-actions .combat-meta-block {
  display: none !important;
}

.combat-mode-body.is-compact {
  padding-top: 4px;
}

.combat-mode-body.is-compact .combat-mini-actions {
  margin-top: 12px;
}

.combat-mode-body.is-compact .combat-chip {
  min-height: 88px;
}

.combat-mode-body.is-compact .combat-chip:not(.hp):not(.mana):not(.energy) {
  min-height: 88px;
}

.combat-battle-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}

.combat-battle-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.combat-battle-actions #btnBattle{
  min-width:160px;
}

/* ===== SPELL PREVIEW READABILITY ===== */

#spellsList .item-sub,
#abilitiesList .item-sub,
#passiveAbilitiesList .item-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  color: rgba(255,255,255,.78);
  font-size: 12px;
  line-height: 1.4;
}

#spellsList .item-sub .spell-meta,
#abilitiesList .item-sub .spell-meta,
#passiveAbilitiesList .item-sub .spell-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  white-space: nowrap;
}

#spellsList .item-sub .spell-meta--cost,
#abilitiesList .item-sub .spell-meta--cost,
#passiveAbilitiesList .item-sub .spell-meta--cost {
  background: rgba(110,168,254,.08);
  border-color: rgba(110,168,254,.20);
}

@media (max-width: 575px) {
  #spellsList .item-sub,
  #abilitiesList .item-sub,
  #passiveAbilitiesList .item-sub {
    gap: 6px;
    font-size: 11px;
  }

  #spellsList .item-sub .spell-meta,
  #abilitiesList .item-sub .spell-meta,
  #passiveAbilitiesList .item-sub .spell-meta {
    padding: 4px 8px;
  }
}

.item-actions .is-favorite {
  border-color: rgba(255, 215, 90, .45);
  background: rgba(255, 215, 90, .10);
  color: #ffe38a;
}

.item-actions .is-favorite i {
  color: #ffd86b;
}

.item-actions button[data-act="favorite"]:hover {
  border-color: rgba(255, 215, 90, .35);
  color: #ffe38a;
}

#spellsList .item,
#abilitiesList .item,
#passiveAbilitiesList .item {
  padding: 10px;
}

#spellsList .item-title,
#abilitiesList .item-title,
#passiveAbilitiesList .item-title {
  font-size: 13px;
  line-height: 1.2;
}

#spellsList .item-sub,
#abilitiesList .item-sub,
#passiveAbilitiesList .item-sub {
  gap: 6px;
  margin-top: 6px;
}

#spellsList .item-sub .spell-meta,
#abilitiesList .item-sub .spell-meta,
#passiveAbilitiesList .item-sub .spell-meta {
  min-height: 24px;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 999px;
}

.item-actions {
  gap: 6px;
  margin-top: 6px;
}

.item-actions .btn.btn-sm {
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.item-actions .btn.btn-sm i {
  font-size: 14px;
}

@media (max-width: 575px) {
  .fab {
    width: 52px;
    height: 52px;
    right: 12px;
    bottom: 12px;
    border-radius: 16px;
  }

  .fab-menu {
    right: 12px;
    bottom: 72px;
    width: min(190px, calc(100vw - 24px));
    padding: 8px;
    gap: 8px;
  }

  .fab-item {
    width: 100%;
    padding: 9px 10px;
    font-size: 13px;
    border-radius: 12px;
  }

  .fab-item i {
    font-size: 16px;
  }
}

.equip-top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.equip-slot{
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.equip-label{
  white-space: nowrap;
}

.equip-name{
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.equip-ac-badge{
  flex: 0 0 auto;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(110,168,254,.12);
  border: 1px solid rgba(110,168,254,.28);
  color: rgba(255,255,255,.92);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 575px){
  .fab{
    right: 12px;
    bottom: 12px;
  }

  .fab-menu{
    right: 12px;
    bottom: 72px;
  }

  .donate-btn{
    left: 12px !important;
    right: auto !important;
    bottom: 12px !important;
    max-width: 190px;
    z-index: 999;
  }
}

#equipGrid{
  align-items: start;
}

.equip-card{
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.equip-top{
  align-items: flex-start;
}

.equip-sub,
.equip-info{
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.35;
  word-break: break-word;
}

.equip-info{
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.equip-ac-badge{
  margin-left: 8px;
}

@media (max-width: 575px){
  .equip-card{
    min-height: 96px;
    padding: 10px;
  }

  .equip-slot{
    gap: 6px;
  }

  .equip-label,
  .equip-name{
    font-size: 13px;
  }

  .equip-ac-badge{
    font-size: 11px;
    padding: 3px 8px;
  }
}

@media (max-width: 575px){
  #spellsList .spell-meta,
  #abilitiesList .spell-meta,
  #passiveAbilitiesList .spell-meta {
    min-height: 24px;
    padding: 3px 8px;
    font-size: 11px;
  }
}

@media (max-width: 575px){
  .fab-menu{
    width: min(190px, calc(100vw - 24px));
    padding: 8px;
    gap: 8px;
  }
}

/* ===== COMPACT SPELL CARDS ===== */
@media (max-width: 575px){
  #spellsList .item,
  #abilitiesList .item,
  #passiveAbilitiesList .item,
  #combatQuickSpells .item,
  #combatQuickAbilities .item{
    padding: 10px;
    border-radius: 16px;
  }

  #spellsList .item-head,
  #abilitiesList .item-head,
  #passiveAbilitiesList .item-head,
  #combatQuickSpells .item-head,
  #combatQuickAbilities .item-head{
    gap: 8px;
  }

  #spellsList .item-title,
  #abilitiesList .item-title,
  #passiveAbilitiesList .item-title,
  #combatQuickSpells .item-title,
  #combatQuickAbilities .item-title{
    font-size: 13px;
    line-height: 1.2;
    gap: 6px;
  }

  #spellsList .item-sub,
  #abilitiesList .item-sub,
  #passiveAbilitiesList .item-sub,
  #combatQuickSpells .item-sub,
  #combatQuickAbilities .item-sub{
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
  }

  #spellsList .spell-meta,
  #abilitiesList .spell-meta,
  #passiveAbilitiesList .spell-meta,
  #combatQuickSpells .spell-meta,
  #combatQuickAbilities .spell-meta{
    min-height: 22px;
    padding: 2px 7px;
    font-size: 11px;
    border-radius: 999px;
  }

  .item-actions{
    gap: 5px;
    margin-top: 4px;
  }

  .item-actions .btn.btn-sm{
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .item-actions .btn.btn-sm i{
    font-size: 13px;
  }

  .item-caret{
    display: none;
  }
}

/* =========================
   LOGIN PAGE
   ========================= */

.login-wrap{
  padding: 24px 16px;
}

.login-card{
  max-width: 420px;
  width: 100%;
  border-radius: 26px;
  box-shadow: 0 30px 80px rgba(0,0,0,.40);
  position: relative;
  overflow: visible;
  /* soft glow behind the icon, layered over card-soft's base fill color */
  background:
    radial-gradient(60% 45% at 50% 0%, rgba(110,168,254,.18), rgba(110,168,254,0) 72%),
    rgba(18, 26, 51, 0.72);
}

.login-card::before{
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(110,168,254,.55), rgba(110,168,254,0) 40%, rgba(110,168,254,.25));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.login-card .card-body{
  padding: 40px 32px 34px;
}

.login-card-icon{
  font-size: 44px;
  line-height: 1;
  margin-bottom: 10px;
}

.login-card-title{
  font-size: 22px;
  font-weight: 800;
}

/* Shared fixed-width column so the Telegram widget and the VK button line
   up as a matched pair instead of each sizing itself independently. */
.login-auth-buttons{
  max-width: 260px;
  margin: 0 auto;
}

.login-card #widgetHolder{
  margin-top: 6px;
  width: 100%;
}

/* The Telegram widget renders its own iframe with square corners and a
   fixed (often dark) background — clip it to the rounded button shape so
   no dark corner peeks out against a light card. Its width is NOT forced:
   the button graphic inside is drawn by Telegram at a fixed size, so
   stretching the iframe just leaves blank dark iframe background showing
   through. Matching width is instead applied to the VK button via JS once
   the widget has actually rendered (see the script at the bottom of the page). */
.login-card #widgetHolder iframe{
  border-radius: 8px;
  overflow: hidden;
}

.login-divider{
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: rgba(255,255,255,.42);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .6px;
}

.login-divider::before,
.login-divider::after{
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: rgba(255,255,255,.12);
}

.login-vk-btn{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin: 0 auto;
  min-height: 40px;
  border-radius: 14px;
  background: #0077ff;
  border: 1px solid #0077ff;
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
}

.login-vk-btn:hover{
  background: #0066dd;
  border-color: #0066dd;
  color: #ffffff;
}

.login-vk-btn i{
  font-size: 18px;
}

.login-trust-note{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  color: rgba(255,255,255,.42);
  font-size: 12px;
  line-height: 1.4;
}

.login-trust-note i{
  font-size: 13px;
  flex-shrink: 0;
}

@media (max-width: 575px){
  #tab-inv #btnAddItem,
  #tab-spells #btnAddSpell,
  #tab-abilities #btnAddAbility,
  #tab-passive-abilities #btnAddPassiveAbility,
  #tab-states #btnAddState,
  #tab-summons #btnAddSummon {
    display: none !important;
  }
}