/* ─── Nightfall dark theme ─── */

:root {
  --bg:        #0d0e14;
  --bg-card:   #161823;
  --bg-card-2: #1f2231;
  --border:    #262a3d;
  --text:      #e8eaf2;
  --muted:     #8a8fa8;
  --accent:    #c4a76d;     /* золотой */
  --accent-2:  #6b4dff;     /* фиолет */
  --danger:    #ff5470;
  --success:   #4ade80;
  --warning:   #f59e0b;

  /* Rarity */
  --r-common:    #9ca3af;
  --r-rare:      #3b82f6;
  --r-epic:      #a855f7;
  --r-legendary: #f59e0b;
  --r-mythic:    #ef4444;
}

* { box-sizing: border-box; }

/* Отключаем зум по двойному тапу везде, включая интерактивные элементы —
   некоторые WebView не наследуют touch-action от html/body на кнопках. */
button, a, .item, .quick-btn, .action-btn, .raid-target, .card {
  touch-action: manipulation;
}

/* HTML hidden атрибут — без !important его перебивают любые display: rules */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text",
               "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Убирает зум по двойному тапу — сохраняет обычный скролл и жесты */
  touch-action: manipulation;
}
html { height: 100%; }
body { min-height: 100vh; }

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 80px;
  position: relative;
}

main {
  padding: calc(var(--tg-safe-top, 8px) + 8px) 14px 24px;
}

.muted { color: var(--muted); }

/* ─── Loader ─── */
.loader {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--bg);
  z-index: 100;
}
.loader-pulse {
  font-size: 64px;
  animation: pulse 1.6s ease-in-out infinite;
}
.loader-text {
  margin-top: 12px;
  letter-spacing: 0.4em;
  color: var(--accent);
  font-weight: 600;
}
@keyframes pulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.05); }
}

/* ─── Cards / sections ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

.card-title {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ─── Profile header ─── */
.profile-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.avatar {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar canvas {
  width: 100%; height: 100%;
  display: block;
  image-rendering: pixelated;
}
.profile-meta { flex: 1; min-width: 0; }
.profile-meta .name {
  font-size: 17px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.profile-meta .username {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}
.badges {
  display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap;
}
.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge.faction { background: rgba(196,167,109,0.12); border-color: var(--accent); color: var(--accent); }
.badge.vip     { background: rgba(245,158,11,0.15); border-color: #f59e0b; color: #f59e0b; }
.badge.protected { background: rgba(74,222,128,0.12); border-color: var(--success); color: var(--success); }
.badge.title { background: rgba(107,77,255,0.12); border-color: var(--accent-2); color: #a89dff; }

/* ─── Stat / metric ─── */
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 15px; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.metric {
  margin-bottom: 0;
  padding: 12px;
}
.metric-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.metric-value {
  font-size: 20px;
  font-weight: 600;
  /* Длинные числа (3.5M кредитов = 9 символов) сжимаются на узких экранах */
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 380px) {
  .metric-value { font-size: 17px; }
}
.energy-timer {
  font-size: 10px;
  margin-top: 4px;
  line-height: 1.3;
  white-space: normal;
}
.tap-hint {
  font-size: 10px;
  opacity: 0.6;
}

/* ─── Progress ─── */
.progress {
  height: 8px;
  background: var(--bg-card-2);
  border-radius: 99px;
  overflow: hidden;
  margin: 6px 0 4px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #e8c98a);
  border-radius: 99px;
  transition: width 0.4s ease;
  width: 0%;
}
.progress-fill.influence {
  background: linear-gradient(90deg, var(--accent-2), #8a78ff);
}
.progress-text {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

/* ─── Character grid ─── */
.char-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}
.char-grid > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.char-grid .muted {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ─── Inventory ─── */
.inv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 0 4px;
}
.inv-header .card-title { margin: 0; }
.inv-equipped { font-size: 13px; color: var(--muted); }
.inv-equipped b { color: var(--accent); }

.filters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 12px;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.filter {
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.filter.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d0e14;
  font-weight: 600;
}

.inventory-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.empty {
  text-align: center;
  padding: 32px 16px;
}

.item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--r-common);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
}
.item:active { transform: scale(0.98); }
.item.equipped { background: linear-gradient(90deg, rgba(196,167,109,0.10), var(--bg-card) 40%); }
.item.rarity-rare      { border-left-color: var(--r-rare); }
.item.rarity-epic      { border-left-color: var(--r-epic); }
.item.rarity-legendary { border-left-color: var(--r-legendary); }
.item.rarity-mythic    { border-left-color: var(--r-mythic); }

.item-emoji {
  font-size: 28px;
  width: 40px;
  text-align: center;
  flex-shrink: 0;
}
.item-body { flex: 1; min-width: 0; }
.item-name {
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-meta {
  display: flex;
  gap: 8px;
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}
.item-meta .rarity-rare      { color: var(--r-rare); }
.item-meta .rarity-epic      { color: var(--r-epic); }
.item-meta .rarity-legendary { color: var(--r-legendary); }
.item-meta .rarity-mythic    { color: var(--r-mythic); }
.item-effect {
  color: var(--accent);
  font-weight: 500;
}
.item-equip-mark {
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  flex-shrink: 0;
}

/* ─── Bottom tabs ─── */
#tabs {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(13, 14, 20, 0.92);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 10;
  padding: 6px 4px;
  padding-bottom: calc(env(safe-area-inset-bottom) + 6px);
  gap: 2px;
}
.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 6px 0 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  font-family: inherit;
  border-radius: 10px;
  min-width: 0;
  transition: background 0.18s, color 0.18s, transform 0.1s;
}
/* Эмодзи — голый текстовый узел, наследует font-size кнопки */
.tab-btn {
  font-size: 24px;
  line-height: 1;
  transition: background 0.18s, color 0.18s, transform 0.1s;
}
/* Подписи под иконками (span) — прячем */
.tab-btn > span { display: none; }
.tab-btn:active { transform: scale(0.94); }
.tab-btn.active {
  color: var(--accent);
  background: rgba(196, 167, 109, 0.10);
}
/* Активная иконка чуть крупнее */
.tab-btn.active { font-size: 27px; }

/* ─── Streak badge ─── */
.badge.streak {
  background: rgba(239,68,68,0.12);
  border-color: var(--r-mythic);
  color: var(--r-mythic);
}

/* ─── Daily button ─── */
.daily-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #1d2540 0%, #2a1838 100%);
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.1s;
}
.daily-btn:active { transform: scale(0.98); }
.daily-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  border-color: var(--border);
  background: var(--bg-card);
}
.daily-icon { font-size: 28px; flex-shrink: 0; }
.daily-text { flex: 1; font-weight: 600; }
.daily-sub { color: var(--muted); font-size: 12px; }

/* ─── Tutorial banner ─── */
.tutorial-banner {
  width: 100%;
  display: block;
  background: linear-gradient(135deg, #1d2540 0%, #2a1838 100%);
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: transform 0.1s;
}
.tutorial-banner:active { transform: scale(0.98); }
.tutorial-banner-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.tutorial-icon { font-size: 20px; }
.tutorial-text { flex: 1; font-weight: 600; font-size: 14px; }
.tutorial-count { color: var(--accent); font-size: 13px; font-weight: 600; }
.tutorial-banner .progress { margin: 0; }

.tutorial-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
}
.tutorial-step:last-child { border-bottom: none; }
.tutorial-step-mark {
  font-size: 18px;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}
.tutorial-step.done .tutorial-step-label { color: var(--muted); text-decoration: line-through; }
.tutorial-step-body { flex: 1; }
.tutorial-step-label { font-size: 13px; font-weight: 600; }
.tutorial-step-hint { font-size: 11px; color: var(--muted); margin-top: 2px; }
.tutorial-step-reward { font-size: 11px; color: var(--accent); white-space: nowrap; }
.tutorial-final-card {
  margin-top: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--accent);
  background: linear-gradient(90deg, rgba(196,167,109,0.12), var(--bg-card-2) 60%);
  text-align: center;
  font-size: 13px;
}

/* ─── Stats grid ─── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  font-size: 13px;
}
.stats-row { display: flex; justify-content: space-between; }
.stats-row .muted { font-size: 11px; }
.stats-row b { color: var(--accent); }

/* ─── Energy ─── */
.energy-card { margin-bottom: 14px; }
.progress-fill.energy-fill {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

/* ─── Actions grid ─── */
.actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.action-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 10px;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: transform 0.1s, border-color 0.15s;
}
.action-btn:active { transform: scale(0.97); border-color: var(--accent); }
.action-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.action-icon { font-size: 28px; }
.action-name { font-weight: 600; font-size: 14px; }
.action-cost { font-size: 11px; color: var(--muted); }

/* ─── Raid target card ─── */
.raid-target {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.raid-target-info { flex: 1; min-width: 0; }
.raid-target-name {
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.raid-target-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}
.raid-attack-btn {
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
.raid-attack-btn:active { transform: scale(0.95); }
.raid-attack-btn:disabled {
  background: var(--bg-card-2);
  color: var(--muted);
  cursor: not-allowed;
}

/* ─── Market ─── */
.market-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 0 4px;
}
.market-balance {
  font-weight: 600;
  color: var(--accent);
}
.deal-card {
  background: linear-gradient(135deg, rgba(245,158,11,0.18), rgba(196,167,109,0.06));
  border: 1px solid var(--r-legendary);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
  position: relative;
}
.deal-card::before {
  content: "🔥 ТОВАР ДНЯ";
  position: absolute;
  top: -10px; left: 14px;
  background: var(--r-legendary);
  color: #0d0e14;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}
.market-list { display: flex; flex-direction: column; gap: 8px; }
.shop-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--r-common);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.shop-item.rarity-rare      { border-left-color: var(--r-rare); }
.shop-item.rarity-epic      { border-left-color: var(--r-epic); }
.shop-item.rarity-legendary { border-left-color: var(--r-legendary); }
.shop-item.rarity-mythic    { border-left-color: var(--r-mythic); }
.shop-item-body { flex: 1; min-width: 0; }
.shop-item-name { font-weight: 600; font-size: 14px; }
.shop-item-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.shop-price {
  background: var(--accent);
  color: #0d0e14;
  border: none;
  border-radius: 8px;
  padding: 7px 12px;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
.shop-price:disabled {
  background: var(--bg-card-2);
  color: var(--muted);
  cursor: not-allowed;
}
.deal-old {
  text-decoration: line-through;
  color: var(--muted);
  font-size: 12px;
  margin-right: 4px;
}

/* ─── Slots ─── */
.slots-card { text-align: center; padding: 20px 14px; }
.reels {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}
.reel {
  width: 64px; height: 80px;
  background: var(--bg-card-2);
  border: 2px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  transition: transform 0.1s;
}
.reel.spinning {
  animation: reel-spin 0.6s linear infinite;
  border-color: var(--accent);
}
@keyframes reel-spin {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
.slot-result {
  font-size: 14px;
  margin-bottom: 16px;
  min-height: 22px;
}
.slot-result.win { color: var(--success); font-weight: 600; }
.slot-result.lose { color: var(--danger); }

.bet-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.bet-row label { font-size: 13px; }
#bet-input {
  flex: 1;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  text-align: center;
}
.bet-presets {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.bet-preset {
  flex: 1;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 7px 0;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.bet-preset:active { transform: scale(0.95); }

.spin-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), #e8c98a);
  color: #0d0e14;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  margin-bottom: 12px;
  transition: transform 0.1s;
}
.spin-btn:active { transform: scale(0.98); }
.spin-btn:disabled {
  background: var(--bg-card-2);
  color: var(--muted);
  cursor: not-allowed;
}
.slot-info { font-size: 11px; line-height: 1.5; }

/* ─── Action result ─── */
.result-line {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.result-line:last-child { border-bottom: none; }
.result-line .v { font-weight: 600; }
.result-line .v.good { color: var(--success); }
.result-line .v.bad  { color: var(--danger); }
.result-drop {
  margin-top: 10px;
  padding: 10px;
  background: var(--bg-card-2);
  border-radius: 8px;
  border: 1px solid var(--accent);
  text-align: center;
}

/* ─── Animations for darts/basket ─── */
@keyframes shake {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  20% { transform: translateX(-6px) rotate(-8deg); }
  40% { transform: translateX(6px) rotate(8deg); }
  60% { transform: translateX(-4px) rotate(-5deg); }
  80% { transform: translateX(4px) rotate(5deg); }
}
@keyframes bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  25% { transform: translateY(-12px) scale(1.05); }
  50% { transform: translateY(0) scale(0.95); }
  75% { transform: translateY(-6px) scale(1.02); }
}
@keyframes coin-flip {
  0%, 100% { transform: rotateY(0); }
  50% { transform: rotateY(180deg); }
}
.anim-shake { animation: shake 0.5s linear infinite; }
.anim-bounce { animation: bounce 0.5s linear infinite; }
.anim-flip { animation: coin-flip 0.3s linear infinite; }

/* ─── Quick action buttons ─── */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.quick-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  color: var(--text);
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  position: relative;
  font-weight: 500;
  transition: transform 0.1s, border-color 0.15s;
}
.quick-btn:active { transform: scale(0.97); }
.quick-btn > :first-child { font-size: 22px; }
.quick-badge {
  position: absolute;
  top: 6px; right: 8px;
  background: var(--accent);
  color: var(--bg);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
}

/* ─── Inventory tools row ─── */
.inv-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

/* ─── Modal ─── */
.modal[hidden] { display: none !important; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-sheet {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-card);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  animation: sheet-up 0.25s ease;
  border: 1px solid var(--border);
  border-bottom: none;
}
@keyframes sheet-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.modal-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.modal-title {
  font-weight: 600;
  font-size: 16px;
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
}
.modal-body {
  padding: 14px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ─── Mission card ─── */
.mission-card {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}
.mission-card.completed { border-color: var(--success); }
.mission-card.claimed   { opacity: 0.55; }
.mission-title { font-weight: 600; margin-bottom: 4px; }
.mission-desc  { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.mission-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.mission-progress-row .progress { flex: 1; margin: 0; }
.mission-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}
.mission-reward {
  font-size: 13px;
}
.mission-claim {
  background: var(--success);
  color: #0d0e14;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.mission-claim:disabled {
  background: var(--bg-card);
  color: var(--muted);
  border: 1px solid var(--border);
  cursor: not-allowed;
}

/* ─── Achievement ─── */
.ach-category {
  margin-bottom: 14px;
}
.ach-category h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 8px 4px;
}
.ach-card {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.ach-card.unlocked { border-color: var(--accent); background: linear-gradient(90deg, rgba(196,167,109,0.10), var(--bg-card-2) 50%); }
.ach-card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.ach-name { font-weight: 600; font-size: 14px; }
.ach-mark { color: var(--accent); font-size: 13px; }
.ach-desc { font-size: 12px; color: var(--muted); margin: 4px 0 6px; }
.ach-progress { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.ach-progress .progress { flex: 1; margin: 0; height: 6px; }
.ach-reward { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ─── Craft result banner (успех/провал прямо в модалке) ─── */
.craft-result-banner {
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
  text-align: center;
  animation: fade-in-up 0.3s ease both;
}
.craft-result-banner.success {
  background: linear-gradient(135deg, rgba(74,222,128,0.16), var(--bg-card-2));
  border: 1px solid var(--success);
}
.craft-result-banner.fail {
  background: linear-gradient(135deg, rgba(255,84,112,0.14), var(--bg-card-2));
  border: 1px solid var(--danger);
}
.craft-result-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.craft-result-banner.success .craft-result-title { color: var(--success); }
.craft-result-banner.fail .craft-result-title { color: var(--danger); }
.craft-result-item {
  font-size: 17px;
  font-weight: 700;
  margin-top: 8px;
}
.craft-result-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* ─── Craft / Scrap modal content ─── */
.craft-option, .scrap-option {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}
.craft-option-top, .scrap-option-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.craft-option-name { font-weight: 600; }
.craft-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 10px;
  color: var(--muted);
}
.craft-do {
  background: var(--accent);
  color: #0d0e14;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
}
.craft-do:disabled {
  background: var(--bg-card);
  color: var(--muted);
  cursor: not-allowed;
}
.scrap-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.scrap-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  flex: 1;
  min-width: 60px;
}
.scrap-btn.all { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 600; }

/* ─── Casino game switcher ─── */
.casino-balance {
  text-align: center;
  font-size: 18px;
  color: var(--accent);
  margin-bottom: 10px;
  padding: 6px;
}
.game-switcher {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.game-tab, .fac-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 8px 4px;
  border-radius: 8px;
  font-size: 20px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.game-tab.active, .fac-tab.active {
  background: var(--accent);
  color: var(--bg);
}

.game-panel {
  margin-bottom: 12px;
}
.game-card {
  padding: 18px 14px;
}
.dice-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-bottom: 14px;
}
.dice-face {
  width: 70px; height: 70px;
  background: var(--bg-card-2);
  border: 2px solid var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  font-weight: 700;
}
.dice-vs {
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
}

.game-side-btn {
  flex: 1;
  background: var(--accent-2);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.game-side-btn:active { transform: scale(0.97); }
.game-side-btn.selected { background: var(--accent); color: var(--bg); }

/* ─── Blackjack ─── */
.bj-area {
  font-size: 14px;
  line-height: 1.6;
}
.bj-row {
  margin: 10px 0;
}
.bj-label { color: var(--muted); font-size: 12px; }
.bj-cards {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.bj-card {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 16px;
  min-width: 36px;
  text-align: center;
}
.bj-card.hidden-card {
  background: var(--accent-2);
  color: white;
}
.bj-value {
  margin-top: 6px;
  font-weight: 600;
  color: var(--accent);
}
.bj-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.bj-actions button {
  flex: 1;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
}
.bj-hit { background: var(--success); color: #0d0e14; }
.bj-stand { background: var(--danger); color: white; }

/* ─── Faction subtabs ─── */
.fac-panel { padding: 0; }

.faction-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.faction-header {
  text-align: center;
  margin-bottom: 16px;
  padding: 14px;
  background: linear-gradient(135deg, rgba(196,167,109,0.10), var(--bg-card));
  border: 1px solid var(--accent);
  border-radius: 14px;
}
.faction-emoji { font-size: 42px; }
.faction-name { font-size: 18px; font-weight: 600; margin-top: 4px; }
.faction-king { font-size: 13px; color: var(--accent); margin-top: 4px; }

.fac-leaderboard {
  margin-bottom: 14px;
}
.fac-lb-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.fac-lb-row.mine { color: var(--accent); font-weight: 600; }
.fac-lb-row:last-child { border-bottom: none; }

.members-list {
  display: flex;
  flex-direction: column;
}
.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.member-row:last-child { border-bottom: none; }
.member-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}
.member-dot.online { background: var(--success); }
.member-name { flex: 1; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-meta { font-size: 11px; color: var(--muted); }

/* ─── Districts ─── */
.district-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
}
.district-top {
  display: flex;
  align-items: center;
  gap: 12px;
}
.district-card.mine { border-left: 3px solid var(--success); }
.district-card.enemy { border-left: 3px solid var(--danger); }
.district-card.free { border-left: 3px solid var(--muted); }
.district-info { flex: 1; min-width: 0; }
.district-name { font-weight: 600; font-size: 14px; }
.district-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.district-attack {
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-family: inherit;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
}
.district-attack:disabled {
  background: var(--bg-card-2);
  color: var(--muted);
  cursor: not-allowed;
}
.district-attack.mine-bonus { background: var(--success); color: var(--bg); }

/* ─── Очки фракций в районе ─── */
.dist-bars {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.dist-bar-row {
  display: grid;
  grid-template-columns: 22px 1fr 44px;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.dist-bar-row.mine .dist-bar-num { color: var(--accent); font-weight: 600; }
.dist-bar-label { font-size: 14px; text-align: center; }
.dist-bar {
  height: 8px;
  background: var(--bg-card-2);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}
.dist-bar-fill {
  height: 100%;
  background: var(--muted);
  border-radius: 99px;
  transition: width 0.4s ease;
}
/* Маркер порога захвата (1000 на шкале 3000) */
.dist-threshold-mark {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: var(--warning);
  border-radius: 1px;
  opacity: 0.7;
}
.dist-bar-fill.mine {
  background: linear-gradient(90deg, var(--accent), #e8c98a);
}
.dist-bar-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--muted);
}
.dist-threshold {
  margin-top: 6px;
  font-size: 10px;
  text-align: center;
}
.dist-need {
  margin-top: 6px;
  font-size: 12px;
  padding: 6px 8px;
  background: var(--bg-card-2);
  border-radius: 6px;
  text-align: center;
}

/* ─── Chat / Announcements ─── */
.chat-area {
  display: flex;
  flex-direction: column;
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: var(--bg-card);
  margin-bottom: 12px;
}
.chat-msg {
  margin-bottom: 8px;
  font-size: 13px;
}
.chat-msg .sender { color: var(--accent); font-weight: 600; }
.chat-msg .text { color: var(--text); }
.chat-msg .ts { color: var(--muted); font-size: 10px; margin-left: 6px; }

.chat-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.chat-input-row input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.chat-input-row button {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 10px;
  padding: 0 16px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* ─── Друзья ─── */
.friend-request-card, .friend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.friend-request-info, .friend-row-info { min-width: 0; }
.friend-request-actions, .friend-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.friend-row-actions button, .friend-request-actions button {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 15px;
  cursor: pointer;
}
.fr-accept { color: var(--success); border-color: var(--success) !important; }
.fr-decline { color: var(--danger); border-color: var(--danger) !important; }

.chat-msg.friend-msg {
  display: flex;
  flex-direction: column;
  max-width: 78%;
  background: var(--bg-card-2);
  border-radius: 10px;
  padding: 6px 10px;
  align-self: flex-start;
}
.chat-msg.friend-msg.mine {
  align-self: flex-end;
  background: linear-gradient(135deg, #1d2540 0%, #2a1838 100%);
}
.chat-msg.friend-msg .ts { align-self: flex-end; }

.friend-search-inline {
  margin-bottom: 4px;
}

.announce-card {
  background: linear-gradient(135deg, rgba(245,158,11,0.10), rgba(245,158,11,0.02));
  border: 1px solid var(--warning);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
}
.announce-author { color: var(--warning); font-size: 12px; font-weight: 600; }
.announce-text { font-size: 14px; margin-top: 4px; }

/* ─── King / Voting ─── */
.king-card {
  background: linear-gradient(135deg, rgba(245,158,11,0.16), rgba(196,167,109,0.06));
  border: 1px solid var(--warning);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  text-align: center;
}
.king-icon { font-size: 38px; }
.king-name { font-weight: 700; font-size: 17px; margin-top: 4px; }
.king-since { color: var(--muted); font-size: 12px; margin-top: 4px; }

.candidate-card {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}
.candidate-card.voted { border-color: var(--accent); }
.candidate-name { font-weight: 600; }
.candidate-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.vote-btn {
  width: 100%;
  margin-top: 8px;
  background: var(--accent-2);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px;
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.vote-btn:disabled { background: var(--bg-card); color: var(--accent); cursor: default; }

/* ─── P2P tabs in modal ─── */
.p2p-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  background: var(--bg-card-2);
  border-radius: 10px;
}
.p2p-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 8px 4px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.p2p-tab.active { background: var(--accent); color: var(--bg); }

/* ─── Shards grid ─── */
.shards-balance {
  text-align: center;
  font-size: 16px;
  color: var(--text);
  padding: 12px;
  background: linear-gradient(135deg, rgba(196,167,109,0.10), var(--bg-card-2));
  border-radius: 12px;
  margin-bottom: 10px;
}
.shards-balance b { color: var(--accent); font-size: 20px; }

.shard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 4px;
}
.shard-action {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 8px;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: transform 0.1s, border-color 0.15s;
}
.shard-action:active { transform: scale(0.97); border-color: var(--accent); }
.shard-icon { font-size: 24px; }
.shard-name { font-size: 12px; font-weight: 500; text-align: center; }
.shard-price { font-size: 11px; color: var(--accent); font-weight: 600; }

/* Safe ─── */
.safe-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-bottom: 4px;
}
.safe-row input {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  text-align: center;
}
.safe-row .craft-do { margin: 0; padding: 10px; }

/* Shard packs ─── */
.pack-card {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ─── VIP modal ─── */
.vip-header {
  text-align: center;
  padding: 18px;
  background: linear-gradient(135deg, rgba(245,158,11,0.16), rgba(196,167,109,0.06));
  border: 1px solid var(--warning);
  border-radius: 14px;
  margin-bottom: 14px;
}
.vip-perks {
  margin-bottom: 14px;
}
.vip-perk {
  padding: 10px 12px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
  line-height: 1.4;
}
.vip-buy-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--warning), #fbbf24);
  color: #0d0e14;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 0.1s;
}
.vip-buy-btn:active { transform: scale(0.98); }
.vip-buy-btn:disabled {
  background: var(--bg-card-2);
  color: var(--muted);
  cursor: not-allowed;
}

/* ─── Tournament ─── */
.tourn-header {
  text-align: center;
  padding: 14px;
  background: linear-gradient(135deg, rgba(196,167,109,0.12), var(--bg-card-2));
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
}
.tourn-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.tourn-entry.me { color: var(--accent); font-weight: 600; }
.tourn-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tourn-power { font-size: 12px; color: var(--muted); }

.prize-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 4px;
  font-size: 13px;
}
.prize-place { color: var(--accent); font-weight: 600; }
.prize-detail { color: var(--text); }

.history-row {
  display: flex;
  gap: 10px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

/* ─── Referrals ─── */
.ref-header {
  text-align: center;
  padding: 14px;
  background: linear-gradient(135deg, rgba(74,222,128,0.10), var(--bg-card-2));
  border: 1px solid var(--success);
  border-radius: 12px;
  margin-bottom: 12px;
}
.ref-link-box {
  display: flex;
  gap: 8px;
  align-items: center;
}
.ref-link-box input {
  flex: 1;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  font-family: monospace;
  font-size: 12px;
  min-width: 0;
}
.ref-rewards > div { padding: 4px 0; font-size: 13px; }

.ref-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.ref-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-meta { font-size: 12px; color: var(--muted); }

/* ─── Catalog ─── */
.catalog-header {
  text-align: center;
  padding: 16px;
  background: linear-gradient(135deg, rgba(107,77,255,0.10), var(--bg-card-2));
  border: 1px solid var(--accent-2);
  border-radius: 14px;
  margin-bottom: 14px;
}
.catalog-section { margin-bottom: 16px; }
.catalog-section-head {
  display: flex;
  justify-content: space-between;
  padding: 8px 4px;
  font-weight: 600;
  font-size: 14px;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.catalog-item {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 4px;
  text-align: center;
  position: relative;
  border-left: 2px solid var(--r-common);
}
.catalog-item.rarity-rare      { border-left-color: var(--r-rare); }
.catalog-item.rarity-epic      { border-left-color: var(--r-epic); }
.catalog-item.rarity-legendary { border-left-color: var(--r-legendary); }
.catalog-item.rarity-mythic    { border-left-color: var(--r-mythic); }
.catalog-item.locked { opacity: 0.4; }
.catalog-emoji { font-size: 20px; line-height: 1; }
.catalog-name {
  font-size: 10px;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.catalog-rarity {
  position: absolute;
  top: 2px; right: 2px;
  font-size: 8px;
}

/* ─── Battle Pass ─── */
.bp-header {
  text-align: center;
  padding: 14px;
  background: linear-gradient(135deg, rgba(196,167,109,0.16), var(--bg-card-2));
  border: 1px solid var(--accent);
  border-radius: 14px;
  margin-bottom: 12px;
}
.bp-grid-head {
  display: grid;
  grid-template-columns: 36px 1fr 1fr 28px 28px;
  gap: 4px;
  padding: 4px 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-align: center;
}
.bp-row {
  display: grid;
  grid-template-columns: 36px 1fr 1fr 28px 28px;
  gap: 4px;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.bp-row.milestone { background: rgba(196,167,109,0.06); }
.bp-row.locked { opacity: 0.5; }
.bp-level {
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  color: var(--accent);
}
.bp-reward {
  background: var(--bg-card-2);
  border-radius: 6px;
  padding: 6px 4px;
  font-size: 10px;
  text-align: center;
  border: 1px solid var(--border);
  min-height: 28px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bp-reward.claimed { background: rgba(74,222,128,0.10); border-color: var(--success); color: var(--success); }
.bp-reward.locked { opacity: 0.5; }
.bp-claim-btn {
  background: var(--success);
  color: #0d0e14;
  border: none;
  border-radius: 6px;
  padding: 6px 0;
  font-family: inherit;
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
  width: 28px;
}
.bp-claim-btn.premium { background: var(--accent); }

/* ─── Season ─── */
.season-header {
  text-align: center;
  padding: 14px;
  background: linear-gradient(135deg, rgba(107,77,255,0.12), var(--bg-card-2));
  border: 1px solid var(--accent-2);
  border-radius: 14px;
  margin-bottom: 12px;
}
.season-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
}
.season-row.me { background: rgba(196,167,109,0.08); border-radius: 6px; padding-left: 8px; padding-right: 8px; }
.season-place { text-align: center; font-size: 18px; }
.season-name { font-size: 13px; min-width: 0; overflow: hidden; }
.season-meta { font-size: 12px; color: var(--muted); text-align: right; }

.arch-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
}
.arch-row:active { background: var(--bg-card-2); }

/* ─── Events feed ─── */
.event-row {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  background: var(--bg-card-2);
  margin-bottom: 6px;
}
.event-emoji { font-size: 22px; line-height: 1; flex-shrink: 0; }
.event-body { font-size: 13px; min-width: 0; }
.event-body > div:first-child { line-height: 1.3; }

/* ─── Item detail modal ─── */
.item-detail-header {
  text-align: center;
  padding: 16px;
  background: var(--bg-card-2);
  border-radius: 12px;
  margin-bottom: 12px;
  border-left: 4px solid var(--r-common);
}
.item-detail-header.rarity-rare      { border-left-color: var(--r-rare); }
.item-detail-header.rarity-epic      { border-left-color: var(--r-epic); }
.item-detail-header.rarity-legendary { border-left-color: var(--r-legendary); }
.item-detail-header.rarity-mythic    { border-left-color: var(--r-mythic); }
.item-detail-emoji { font-size: 56px; line-height: 1; }
.item-detail-name { font-size: 18px; font-weight: 700; margin-top: 6px; }
.item-detail-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.item-detail-effect {
  font-size: 14px;
  color: var(--accent);
  margin-top: 8px;
  font-weight: 600;
}
.item-detail-desc {
  padding: 10px 12px;
  background: var(--bg-card-2);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 10px;
  color: var(--text);
}
.item-detail-line {
  padding: 8px 12px;
  background: var(--bg-card-2);
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 6px;
}
.item-detail-actions {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.item-act {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s;
}
.item-act:active { transform: scale(0.98); }
.item-act.primary { background: var(--accent); color: var(--bg); }
.item-act.secondary { background: var(--accent-2); color: white; }
.item-act.danger {
  background: var(--bg-card-2);
  color: var(--danger);
  border: 1px solid var(--danger);
}

/* ─── Scrap group with inline items ─── */
.scrap-group {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 12px;
}
.scrap-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  margin-bottom: 8px;
  gap: 8px;
}
.scrap-select-all {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 5px 10px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.scrap-items {
  max-height: 260px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 4px;
}
.scrap-item-row {
  display: grid;
  grid-template-columns: 20px 22px 22px 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  border-left: 2px solid var(--r-common);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.1s;
}
.scrap-item-row:active { background: var(--bg-card-2); }
.scrap-item-row.selected { background: rgba(196,167,109,0.10); }
.scrap-item-row:last-child { border-bottom: none; }
.scrap-item-row.rarity-rare      { border-left-color: var(--r-rare); }
.scrap-item-row.rarity-epic      { border-left-color: var(--r-epic); }
.scrap-item-row.rarity-legendary { border-left-color: var(--r-legendary); }
.scrap-item-row.rarity-mythic    { border-left-color: var(--r-mythic); }
.scrap-checkbox { font-size: 14px; text-align: center; }
.scrap-item-num { font-size: 10px; text-align: right; color: var(--muted); }
.scrap-item-emoji { font-size: 16px; text-align: center; }
.scrap-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scrap-item-tag { color: var(--accent); font-weight: 500; font-size: 11px; }

/* ─── Scrap footer (sticky selection summary) ─── */
.scrap-footer {
  position: sticky;
  bottom: -1px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 10px 0 2px;
  margin-top: 10px;
}
.scrap-footer-info {
  text-align: center;
  font-size: 13px;
  margin-bottom: 8px;
}

/* ─── Power breakdown ─── */
.power-header {
  text-align: center;
  padding: 16px;
  background: linear-gradient(135deg, rgba(196,167,109,0.14), var(--bg-card-2));
  border: 1px solid var(--accent);
  border-radius: 14px;
}
.power-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 4px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.power-row:last-of-type { border-bottom: none; }
.power-row.total {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 2px solid var(--accent);
  font-weight: 700;
  font-size: 15px;
}
.power-value { color: var(--accent); font-weight: 600; }
.power-row.total .power-value { font-size: 17px; }

/* ─── Registration flow ─── */
#registration-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--tg-safe-top, 8px) + 16px) 16px 80px;
}
.reg-screen {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.reg-logo { font-size: 52px; animation: pulse 1.8s ease-in-out infinite; }
.reg-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-top: 8px;
  color: var(--text);
}
.reg-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
  margin-bottom: 18px;
}

.reg-lang-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.reg-lang-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 16px;
  border-radius: 14px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s;
}
.reg-lang-btn:active { transform: scale(0.97); border-color: var(--accent); }

.reg-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.reg-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 16px;
  border-radius: 14px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
}
.reg-card:active { transform: scale(0.97); border-color: var(--accent); background: rgba(196,167,109,0.06); }
.reg-card-emoji { font-size: 30px; margin-bottom: 4px; }
.reg-card-name { font-size: 16px; font-weight: 700; }
.reg-card-desc { font-size: 13px; color: var(--muted); margin-top: 4px; }

.reg-chosen-faction {
  display: inline-block;
  background: var(--bg-card-2);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
}

.reg-card-static {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-top: 12px;
  text-align: left;
}
.reg-done-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.reg-done-row:last-of-type { border-bottom: none; }
.reg-weakness-desc {
  margin-top: 8px;
  font-size: 12px;
  color: var(--danger);
  line-height: 1.4;
}
.reg-story {
  font-style: italic;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  padding: 14px 4px;
}
.reg-rewards {
  width: 100%;
  background: var(--bg-card-2);
  border-radius: 12px;
  padding: 12px;
  text-align: left;
}
.reg-bonus-line {
  font-size: 13px;
  padding: 4px 0;
  color: var(--accent);
}

/* ─── Stake raids ─── */
.stake-pending-card {
  background: linear-gradient(135deg, rgba(255,84,112,0.10), var(--bg-card-2));
  border: 1px solid var(--danger);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}
.stake-pending-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}
.stake-countdown {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--danger);
}
.stake-pending-stakes {
  margin-top: 6px;
  font-size: 13px;
}
.stake-pending-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.stake-pending-actions button {
  flex: 1;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

/* ─── Settings row ─── */
.settings-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.settings-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.settings-btn.danger { color: var(--danger); border-color: rgba(255,84,112,0.3); }
.settings-btn:active { transform: scale(0.97); }

/* ─── Population ─── */
.pop-header {
  text-align: center;
  padding: 16px;
  background: linear-gradient(135deg, rgba(74,222,128,0.10), var(--bg-card-2));
  border: 1px solid var(--success);
  border-radius: 14px;
  margin-bottom: 14px;
}
.pop-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.pop-faction-row { margin-bottom: 12px; }
.pop-faction-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
}
.pop-bar {
  height: 10px;
  background: var(--bg-card-2);
  border-radius: 99px;
  overflow: hidden;
}
.pop-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: 99px;
}

/* ─── Help ─── */
.help-nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 14px;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.help-nav::-webkit-scrollbar { display: none; }
.help-nav-btn {
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 99px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.help-nav-btn.active { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
.help-content {
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-line;
}
.help-content hr { border: none; border-top: 1px solid var(--border); margin: 8px 0; }

/* ─── Restart confirm ─── */
.restart-warning {
  background: rgba(255,84,112,0.08);
  border: 1px solid var(--danger);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}
.restart-warning-title {
  color: var(--danger);
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 10px;
  text-align: center;
}
.restart-stat-line { font-size: 13px; padding: 3px 0; }

/* ─── Skeleton loaders ─── */
.skeleton-row {
  height: 56px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-2) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  margin-bottom: 8px;
}
.skeleton-row.small { height: 32px; }
.skeleton-row.large { height: 90px; }
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Content fade-in ─── */
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fade-in-up 0.25s ease both; }

/* ─── Badge pulse (new item arrived) ─── */
@keyframes badge-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.4); }
  100% { transform: scale(1); }
}
.badge-pulse { animation: badge-pop 0.4s ease; }

/* ─── Pull-to-refresh ─── */
#ptr-indicator {
  position: fixed;
  top: calc(var(--tg-safe-top, 8px) + 4px);
  left: 50%;
  transform: translateX(-50%) translateY(-40px);
  z-index: 40;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 99px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: transform 0.15s ease;
  opacity: 0;
}
#ptr-indicator.visible { opacity: 1; }
#ptr-indicator.spinning { animation: ptr-spin 0.6s linear infinite; }
@keyframes ptr-spin { to { transform: translateX(-50%) rotate(360deg); } }

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 90px; left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 200;
  animation: toast-in 0.25s ease;
  max-width: 90%;
  text-align: center;
}
.toast.error { border-color: var(--danger); }
.toast.success { border-color: var(--success); }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ═══════════ v0.3: hold-milestones, king tenure, season shop ═══════════ */

.dist-hold {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--bg-card-2);
  border-radius: 8px;
  font-size: 12px;
  border-left: 3px solid var(--accent);
}

.king-tenure {
  margin-top: 4px;
  font-size: 12px;
}

.king-history-row {
  padding: 10px 12px;
  background: var(--bg-card);
  border-radius: 10px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
}
.king-history-row .king-history-name {
  font-size: 14px;
}

.season-shop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-card);
  border-radius: 10px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
}
.season-shop-label { font-size: 13px; flex: 1; }
.season-shop-action { flex-shrink: 0; }
.season-shop-badge.done { color: var(--success); font-size: 12px; }
.btn-muted { background: var(--bg-card-2); color: var(--muted); }
.btn-small { padding: 6px 12px; font-size: 12px; }

.progress-bar {
  height: 8px;
  background: var(--bg-card-2);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 0.3s ease;
}

/* ═══════════ v0.4: daily reward calendar ═══════════ */

.daily-claimed-banner {
  text-align: center;
  padding: 14px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.daily-reward-line {
  font-size: 13px;
  padding: 3px 0;
}

.daily-finale-banner {
  text-align: center;
  padding: 12px;
  margin-top: 10px;
  background: linear-gradient(135deg, rgba(255,196,0,.12), rgba(255,120,0,.08));
  border: 1px solid #d4a017;
  border-radius: 12px;
  font-size: 14px;
}

.daily-cal-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.daily-cal-cell {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 2px;
  text-align: center;
}
.daily-cal-cell.today {
  border-color: var(--accent);
  background: var(--bg-card-2);
  box-shadow: 0 0 0 1px var(--accent);
}
.daily-cal-cell.claimed {
  opacity: 0.45;
}
.daily-cal-cell.finale {
  border-color: #d4a017;
  background: linear-gradient(160deg, rgba(255,196,0,.15), var(--bg-card));
}
.daily-cal-cell.lucky {
  border-color: var(--success);
}
.daily-cal-crown {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
}
.daily-cal-day {
  font-size: 10px;
  color: var(--muted);
}
.daily-cal-credits {
  font-size: 11px;
  font-weight: 700;
  margin: 3px 0 1px;
}
.daily-cal-extras {
  font-size: 9px;
  color: var(--muted);
  line-height: 1.3;
}

/* ═══════════ v0.4: покер (Техасский Холдем) ═══════════ */

.poker-lobby-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}
.poker-lobby-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.poker-lobby-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.poker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.poker-board {
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}
.poker-community {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 8px 0;
  min-height: 44px;
  flex-wrap: wrap;
}
.poker-pot { font-size: 14px; }

.poker-card {
  width: 32px;
  height: 44px;
  border-radius: 6px;
  background: #fff;
  color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.poker-card.red { color: #c0392b; }
.poker-card.black { color: #111; }
.poker-card.back {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: transparent;
}

.poker-result {
  background: var(--bg-card-2);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 13px;
}
.poker-reveal-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}
.poker-reveal-row.won { color: var(--success); font-weight: 600; }

.poker-seats { display: flex; flex-direction: column; gap: 8px; }
.poker-seat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
}
.poker-seat.you { border-color: var(--accent-2); }
.poker-seat.turn { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.poker-seat.folded { opacity: 0.45; }
.poker-seat.allin { border-color: var(--danger); }
.poker-seat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.poker-seat-name { font-weight: 600; }
.poker-turn-badge {
  font-size: 10px;
  color: var(--accent);
  font-weight: 700;
}
.poker-seat-cards {
  display: flex;
  gap: 4px;
  margin: 6px 0;
}
.poker-hand-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--bg-card-2);
  border-radius: 6px;
  padding: 2px 8px;
  margin-bottom: 6px;
}
.poker-seat-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
  flex-wrap: wrap;
}
.poker-bet-chip {
  background: var(--bg-card-2);
  border-radius: 6px;
  padding: 1px 6px;
}

#poker-actions { margin-top: 10px; }
.poker-act-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.poker-act-btn {
  flex: 1;
  min-width: 70px;
  padding: 10px 8px;
  border-radius: 10px;
  border: none;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
}
.poker-act-btn.fold { background: var(--bg-card-2); color: var(--muted); }
.poker-act-btn.check { background: var(--accent-2); }
.poker-act-btn.call { background: var(--accent); }
.poker-act-btn.allin { background: var(--danger); }
.poker-act-btn.raise { background: var(--success); flex: 1; }
.poker-raise-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.poker-raise-row input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 10px;
  font-size: 14px;
}
