: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: 560px;
  margin: 0 auto;
}

.app-title {
  font-weight: 700;
  letter-spacing: 0.2px;
}

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

.content {
  padding: 12px 14px 20px;
}

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

.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);
}

.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;
}

.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); }
}

/* чтобы контент начинался ниже табов и не прятался под ними */
.tab-content{
  padding-top: 10px;
}
/* =========================
   Header buttons compact
   ========================= */

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

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

header.topbar .d-flex.gap-2::-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-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);
}

.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-row{
  display:flex;
  gap:14px;
  align-items:center;
  flex-wrap:wrap;
  margin-top: 6px;
}

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

.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);
}

.wallet-preview-row{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin-top: 6px;
}

.wallet-num{
  font-weight: 800;
  letter-spacing: .2px;
  color: rgba(255,255,255,.92);
  margin-right: 8px;
}

.coin-total{
  opacity:.8;
  font-size: 12px;
}

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

.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: 9999;

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

  padding: 12px 14px;
  border-radius: 16px;

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

  background: rgba(110,168,254,.22);
  border: 1px solid rgba(110,168,254,.55);
  color: rgba(255,255,255,.95);
  backdrop-filter: blur(8px);
}

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