:root {
  --bg-deep: #050508;
  --bg-card: rgba(12, 14, 24, 0.92);
  --panel-border: rgba(255, 215, 0, 0.15);
  --text: #f0ece4;
  --muted: #8a8498;
  --gold: #ffd700;
  --gold-dim: #b8860b;
  --soul: #00f5d4;
  --soul-glow: rgba(0, 245, 212, 0.35);
  --credit: #22d3ee;
  --credit-glow: rgba(34, 211, 238, 0.35);
  --blood: #ff2d55;
  --success: #22c55e;
  --common: #9ca3af;
  --rare: #3b82f6;
  --epic: #a855f7;
  --legend: #ffd700;
  --tg-safe-top: env(safe-area-inset-top, 0px);
  --tg-safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 64px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100%;
  min-height: 100dvh;
  background: var(--bg-deep);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  touch-action: manipulation;
  -webkit-overflow-scrolling: touch;
}

body {
  overflow: hidden;
}

html.marketplace-embed #app {
  padding-bottom: var(--tg-safe-bottom);
}

html.marketplace-embed .bottom-nav {
  display: none;
}

#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  padding-top: var(--tg-safe-top);
  padding-bottom: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 40% at 50% 0%, rgba(168, 85, 247, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 30% at 80% 100%, rgba(255, 215, 0, 0.08) 0%, transparent 50%),
    var(--bg-deep);
}

/* Header */
.lang-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  min-width: 40px;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(34, 211, 238, 0.45);
  background: rgba(2, 6, 23, 0.85);
  color: var(--credit, #22d3ee);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.header--bar .lang-toggle {
  position: static;
}

body.tg-app {
  --tg-safe-top: env(safe-area-inset-top, 0px);
  --tg-safe-bottom: env(safe-area-inset-bottom, 0px);
}

body.tg-app #app {
  padding-top: var(--tg-safe-top);
}

body.tg-app .bottom-nav {
  padding-bottom: max(8px, var(--tg-safe-bottom));
}

.header {
  position: relative;
  flex-shrink: 0;
  background: #000;
}

/* Slim static bar: balance + marquee + language */
.header--bar {
  position: relative;
  flex-shrink: 0;
  z-index: 80;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 12px;
  background: rgba(2, 6, 23, 0.96);
  border-bottom: 1px solid rgba(34, 211, 238, 0.22);
  backdrop-filter: blur(10px);
}

.header--bar .lang-toggle {
  position: static;
  flex-shrink: 0;
}

.header-marquee {
  min-width: 0;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.header-marquee-track {
  display: flex;
  width: max-content;
  align-items: center;
  gap: 1.25rem;
  animation: marquee-scroll 28s linear infinite;
  will-change: transform;
}

.header-marquee-text {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: #67e8f9;
  text-shadow: 0 0 10px rgba(34, 211, 238, 0.45);
}

.header-marquee-sep {
  color: rgba(251, 191, 36, 0.85);
  font-size: 0.65rem;
  flex-shrink: 0;
}

@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .header-marquee-track {
    animation: none;
  }
}

/* Economy tournaments */
.tournament-block {
  margin: 0 0 18px;
  display: grid;
  gap: 12px;
}

.tournament-block-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #67e8f9;
  text-shadow: 0 0 12px rgba(34, 211, 238, 0.4);
}

.tournament-block-lead {
  margin: -4px 0 4px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

.tournament-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px 14px;
  align-items: start;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(34, 211, 238, 0.35);
  background:
    linear-gradient(135deg, rgba(8, 24, 40, 0.95) 0%, rgba(5, 10, 20, 0.98) 100%);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.12);
  position: relative;
}

.tournament-card--oct {
  border-color: rgba(251, 191, 36, 0.45);
  box-shadow: 0 0 22px rgba(251, 191, 36, 0.14);
}

.tournament-card-badge {
  grid-column: 1 / -1;
  justify-self: start;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  color: #67e8f9;
  border: 1px solid rgba(34, 211, 238, 0.45);
  background: rgba(34, 211, 238, 0.12);
}

.tournament-card-badge--hot {
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.55);
  background: rgba(251, 191, 36, 0.12);
}

.tournament-card-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 10px 8px;
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.75);
  border: 1px solid rgba(34, 211, 238, 0.3);
}

.tournament-card--oct .tournament-card-date {
  border-color: rgba(251, 191, 36, 0.4);
}

.tournament-date-day {
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
  color: #fff;
}

.tournament-date-month {
  margin-top: 4px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #67e8f9;
}

.tournament-card--oct .tournament-date-month {
  color: #fbbf24;
}

.tournament-card-name {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}

.tournament-card-pool {
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.tournament-card-pool strong {
  color: #fbbf24;
  font-size: 1.05rem;
  font-weight: 900;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.35);
}

.tournament-card-desc {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #94a3b8;
}

@media (max-width: 380px) {
  .header--bar {
    grid-template-columns: auto 1fr auto;
    gap: 6px;
    padding: 6px 8px;
  }
  .header-marquee-text { font-size: 0.62rem; }
  .tournament-card {
    grid-template-columns: 1fr;
  }
  .tournament-card-date {
    flex-direction: row;
    gap: 8px;
    justify-content: flex-start;
    min-width: 0;
  }
}

.balance-panel--static {
  position: static;
  pointer-events: auto;
  z-index: 1;
}

.balance-frame--cr-only {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  min-width: 7rem;
  background: rgba(8, 18, 32, 0.9);
  border: 1px solid rgba(34, 211, 238, 0.4);
  border-radius: 10px;
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.15);
}

.balance-frame--cr-only .balance-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  padding: 0;
  grid-template-columns: none;
}

.balance-frame--cr-only .balance-label {
  font-size: 0.75rem;
  color: var(--credit);
}

.balance-frame--cr-only .balance-amount {
  font-size: 1.05rem;
  font-weight: 900;
  color: #e0f7fa;
  text-align: left;
}

.balance-frame--cr-only .balance-sep {
  opacity: 0.5;
}

.hub-back-btn {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top, 0px));
  left: 8px;
  z-index: 20;
  padding: 6px 12px;
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.65);
  color: #ffd700;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.hub-back-btn.hidden { display: none; }

.header-img {
  display: block;
  width: 100%;
  height: 96px;
  max-height: 22vw;
  min-height: 72px;
  object-fit: cover;
  object-position: center 30%;
}

.empty-hint {
  text-align: center;
  padding: 20px 16px;
  margin-bottom: 12px;
  background: var(--bg-card);
  border: 1px dashed var(--panel-border);
  border-radius: 12px;
}

.empty-hint p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.hint-text {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

/* Balance panel */
.balance-frame {
  position: relative;
  border-radius: 10px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(6, 12, 24, 0.78);
  border: 1px solid rgba(56, 189, 248, 0.45);
  backdrop-filter: blur(8px);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.35),
    0 0 20px rgba(56, 189, 248, 0.12),
    inset 0 1px 0 rgba(125, 211, 252, 0.08);
}

.balance-item {
  display: grid;
  grid-template-columns: 2.6rem 0.5rem 3.25rem;
  align-items: center;
  column-gap: 4px;
  padding: 3px 0;
  min-width: 0;
}

.balance-item + .balance-item {
  border-top: 1px solid rgba(56, 189, 248, 0.14);
}

.balance-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(125, 211, 252, 0.82);
  white-space: nowrap;
}

.balance-sep {
  color: rgba(56, 189, 248, 0.4);
  font-size: 0.62rem;
  font-weight: 400;
  line-height: 1;
  text-align: center;
}

.balance-amount {
  font-size: 0.78rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #e0f7fa;
  text-align: right;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
  line-height: 1.2;
  justify-self: stretch;
}

.balance-panel--hero {
  position: absolute;
  right: 10px;
  bottom: 10px;
  pointer-events: none;
  z-index: 2;
}

.balance-panel--hero .balance-frame {
  padding: 7px 10px;
}

.balance-panel--hero .balance-label {
  font-size: 0.6rem;
}

.balance-panel--hero .balance-amount {
  font-size: 0.82rem;
}

.balance-panel--header {
  position: absolute;
  right: 8px;
  top: 8px;
  transform: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.balance-panel--header .balance-frame {
  padding: 5px 8px;
  border-radius: 8px;
}

.balance-panel--header .balance-item {
  grid-template-columns: 2.4rem 0.45rem 2.85rem;
  padding: 2px 0;
}

.balance-panel--header .balance-label {
  font-size: 0.52rem;
}

.balance-panel--header .balance-amount {
  font-size: 0.7rem;
}

.balance-panel--header .balance-sep {
  font-size: 0.55rem;
}

#app[data-screen="inventory"][data-inventory-scroll="top"] .balance-panel--header {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}

#app[data-screen="inventory"][data-inventory-scroll="scrolled"] .balance-panel--header,
#app:not([data-screen="inventory"]) .balance-panel--header {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Nexus hero plaque */
.nexus-hero {
  position: relative;
  width: 100%;
  margin-bottom: 16px;
  background: #000;
}

.nexus-hero-img {
  display: block;
  width: 100%;
  height: auto;
}

/* Main scroll */
.main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 20px;
}

.screen {
  display: none;
  padding-top: 12px;
}

.screen.active { display: block; }

#screen-inventory {
  padding-top: 0;
}

.screen-title {
  font-family: inherit;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* Inventory grid */
.inventory-content {
  padding-top: 4px;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
  min-height: 120px;
  position: relative;
  z-index: 1;
}

.empty-hint[hidden] {
  display: none !important;
}

.nft-card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3/4;
  min-height: 140px;
  background: var(--bg-card);
  border: 2px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  color: var(--text);
  font: inherit;
  text-align: left;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.nft-card:active { transform: scale(0.96); }

.nft-card.selected {
  border-color: #38bdf8;
  box-shadow:
    0 0 0 2px rgba(56, 189, 248, 0.35),
    0 0 24px rgba(56, 189, 248, 0.45),
    inset 0 0 20px rgba(56, 189, 248, 0.12);
}

.nft-card.grade-common { border-color: rgba(156, 163, 175, 0.35); }
.nft-card.grade-rare { border-color: rgba(59, 130, 246, 0.4); }
.nft-card.grade-epic { border-color: rgba(168, 85, 247, 0.4); }
.nft-card.grade-legend { border-color: rgba(255, 215, 0, 0.45); }

.nft-card.selected.grade-rare,
.nft-card.selected.grade-epic,
.nft-card.selected.grade-legend,
.nft-card.selected.grade-common {
  border-color: #38bdf8;
  box-shadow:
    0 0 0 2px rgba(56, 189, 248, 0.35),
    0 0 24px rgba(56, 189, 248, 0.45),
    inset 0 0 20px rgba(56, 189, 248, 0.12);
}

.nft-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, rgba(2, 6, 23, 0.35) 100%);
  z-index: 0;
}

.nft-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.nft-thumb .nft-fallback {
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.nft-thumb .nft-fallback:not([hidden]) {
  display: flex;
}

[hidden] {
  display: none !important;
}

.exchange-desc,
.economy-desc {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
  margin-bottom: 16px;
}

.nft-stat-line {
  font-size: 0.58rem;
  color: var(--muted);
}

.stat-tag {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.stat-tag.dex {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.stat-tag.str {
  background: rgba(255, 45, 85, 0.2);
  color: #ff8fa3;
}

.nft-stats {
  margin-bottom: 12px;
}

.stat-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 12px 14px;
}

.stat-box .stat-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.stat-box .stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  margin-left: auto;
}

.stat-box .stat-next {
  width: 100%;
  font-size: 0.72rem;
  color: var(--success);
}

.detail-preview {
  overflow: hidden;
}

.detail-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-preview span {
  font-size: 2rem;
}

.shop-hint {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
  margin-bottom: 14px;
}

.shop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.shop-card {
  background: var(--bg-card);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 14px;
  text-align: center;
}

.shop-card .shop-nft-preview {
  width: 100%;
  height: 120px;
  margin: 0 0 10px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.shop-card .shop-nft-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: rgba(2, 6, 23, 0.6);
}

.shop-item-name {
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.2;
}

.shop-item-stat {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.shop-card .shop-price {
  font-size: 1rem;
  color: var(--soul);
  margin-bottom: 10px;
}

.shop-card .btn {
  width: 100%;
}

.nft-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  padding: 8px 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: linear-gradient(transparent, rgba(2, 6, 23, 0.92) 30%, rgba(2, 6, 23, 0.98));
  color: var(--text);
  pointer-events: none;
}

.nft-meta .nft-level,
.nft-meta .nft-cost-line {
  color: #e2e8f0;
}

.nft-cost-line {
  font-size: 0.68rem;
  font-weight: 700;
  color: #fbbf24 !important;
}

.nft-grade {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nft-grade.common { color: var(--common); }
.nft-grade.rare { color: var(--rare); }
.nft-grade.epic { color: var(--epic); }
.nft-grade.legend { color: var(--legend); }

.nft-level {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
}

.nft-cost {
  font-size: 0.6rem;
  color: var(--soul);
  opacity: 0.85;
}

.empty-slot {
  aspect-ratio: 3/4;
  border: 2px dashed rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.75rem;
}

/* Exchange */
.exchange-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.exchange-node {
  background: var(--bg-card);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 12px 16px;
  text-align: center;
  min-width: 90px;
}

.exchange-node .label {
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.exchange-node .value {
  font-family: inherit;
  font-size: 0.8rem;
  margin-top: 4px;
}

.exchange-arrow { color: var(--gold); font-size: 1.2rem; }

/* NFT full-screen focus */
body.nft-focus-open {
  overflow: hidden;
}

.nft-focus-overlay {
  position: fixed;
  inset: 0;
  z-index: 8500;
  display: flex;
  flex-direction: column;
  padding: 0;
  animation: nft-focus-fade-in 0.25s ease;
}

.nft-focus-overlay[hidden] {
  display: none;
}

.nft-focus-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 18, 0.82);
  backdrop-filter: blur(10px);
}

.nft-focus-card {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(56, 189, 248, 0.18) 0%, rgba(12, 14, 24, 0.98) 32%),
    var(--bg-card);
  border: none;
  border-top: 2px solid rgba(56, 189, 248, 0.8);
  border-bottom: 2px solid rgba(56, 189, 248, 0.8);
  border-radius: 0;
  box-shadow:
    inset 0 0 80px rgba(56, 189, 248, 0.12),
    0 0 60px rgba(59, 130, 246, 0.25);
  overflow: hidden;
}

/* ensure card is a positioning context for absolute action-row */
.nft-focus-card .action-row {
  position: absolute;
}

.nft-focus-close {
  position: absolute;
  top: calc(var(--tg-safe-top) + 12px);
  right: 12px;
  z-index: 5;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 50%;
  background: rgba(8, 12, 24, 0.85);
  color: #7dd3fc;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.nft-focus-hero {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  height: min(36vh, 260px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid rgba(56, 189, 248, 0.25);
  background:
    radial-gradient(ellipse 80% 70% at 50% 40%, rgba(56, 189, 248, 0.22) 0%, transparent 70%),
    linear-gradient(180deg, rgba(59, 130, 246, 0.12) 0%, transparent 100%);
}

.nft-focus-hero img {
  width: 100%;
  height: 100%;
  max-height: min(42vh, 320px);
  object-fit: contain;
  object-position: center;
}

.nft-focus-hero span {
  font-size: 4rem;
  position: relative;
  z-index: 2;
}

.nft-focus-hero-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 55%, rgba(12, 14, 24, 0.9) 100%);
  box-shadow: inset 0 0 50px rgba(56, 189, 248, 0.25);
}

.nft-focus-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(var(--tg-safe-bottom) + 88px);
}

.detail-header {
  margin-bottom: 14px;
}

.nft-focus-grade {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
}

.nft-focus-grade.common { color: var(--common); border-color: rgba(156, 163, 175, 0.4); background: rgba(156, 163, 175, 0.12); }
.nft-focus-grade.rare { color: #60a5fa; }
.nft-focus-grade.epic { color: #c084fc; border-color: rgba(168, 85, 247, 0.4); background: rgba(168, 85, 247, 0.12); }
.nft-focus-grade.legend { color: var(--legend); border-color: rgba(255, 215, 0, 0.4); background: rgba(255, 215, 0, 0.1); }

.detail-preview {
  overflow: hidden;
}

.detail-info h3 {
  font-family: inherit;
  font-size: 1.15rem;
  margin-bottom: 4px;
}

.detail-info .enhance {
  font-size: 2rem;
  font-weight: 800;
  color: #7dd3fc;
  text-shadow: 0 0 16px rgba(56, 189, 248, 0.45);
}

.detail-desc {
  font-size: 0.88rem;
  color: #c8d4e8;
  line-height: 1.6;
  white-space: pre-line;
  background: rgba(56, 189, 248, 0.06);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}

@keyframes nft-focus-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sharpen-bar-wrap { margin-bottom: 14px; }

.sharpen-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.sharpen-bar {
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
}

.sharpen-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.chance-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 45, 85, 0.12);
  border: 1px solid rgba(255, 45, 85, 0.3);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.75rem;
  margin-bottom: 12px;
}

.chance-pill.safe {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.3);
}

/* Fixed action bar so reassembly buttons stay visible above toast */
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  margin: 0;
  padding: 12px 16px calc(12px + var(--tg-safe-bottom));
  background: linear-gradient(180deg, rgba(12, 14, 24, 0) 0%, rgba(12, 14, 24, 0.96) 28%, rgba(12, 14, 24, 0.99) 100%);
  border-top: 1px solid rgba(56, 189, 248, 0.2);
}

/* Buttons */
.btn {
  flex: 1;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dim) 100%);
  color: #1a1000;
}

.btn-sharpen {
  background: linear-gradient(135deg, #ff2d55 0%, #dc143c 100%);
  color: #fff;
}

.btn-exchange {
  background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
  color: #fff;
}

.btn-ghost {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
}

/* Economy table */
.economy-table-wrap {
  overflow-x: auto;
  margin-top: 8px;
}

.economy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}

.economy-table th,
.economy-table td {
  padding: 6px 8px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.economy-table th {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.6rem;
}

.economy-table td.soul-val { color: var(--soul); }

.grade-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.grade-tab {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  background: transparent;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}

.grade-tab.active { border-color: var(--gold); color: var(--gold); }

/* History */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.8rem;
  border-left: 3px solid var(--muted);
}

.history-item.sharpen { border-left-color: var(--success); }
.history-item.break { border-left-color: var(--blood); }
.history-item.exchange { border-left-color: var(--epic); }
.history-item.buy { border-left-color: var(--soul); }

.history-time {
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 4px;
}

/* Toast — 2s, top when reassembly modal open so buttons stay free */
.toast {
  position: fixed;
  left: 50%;
  right: auto;
  width: min(420px, calc(100% - 32px));
  bottom: calc(var(--nav-h) + var(--tg-safe-bottom) + 12px);
  z-index: 9500;
  background: rgba(12, 14, 24, 0.96);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.85rem;
  text-align: center;
  transform: translate(-50%, 120%);
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
  pointer-events: none;
}

.toast.visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.toast.hiding {
  transform: translate(-50%, 20%);
  opacity: 0;
}

body.nft-focus-open .toast {
  bottom: auto;
  top: calc(var(--tg-safe-top) + 56px);
  transform: translate(-50%, -120%);
}

body.nft-focus-open .toast.visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

body.nft-focus-open .toast.hiding {
  transform: translate(-50%, -20%);
  opacity: 0;
}

.toast.success { border-color: rgba(34, 197, 94, 0.5); }
.toast.error { border-color: rgba(255, 45, 85, 0.5); }
.toast.break { border-color: rgba(255, 45, 85, 0.6); color: #ff8fa3; }

/* Bottom nav — inside #app flex column */
.bottom-nav {
  position: relative;
  flex-shrink: 0;
  left: auto;
  right: auto;
  bottom: auto;
  width: 100%;
  height: auto;
  min-height: var(--nav-h);
  padding-bottom: max(6px, var(--tg-safe-bottom));
  display: flex;
  background: rgba(8, 10, 18, 0.96);
  border-top: 1px solid var(--panel-border);
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 8px 4px;
  min-height: 48px;
}

.nav-btn .nav-icon { font-size: 1.3rem; }

.nav-btn.active { color: var(--gold); }

.nav-btn-menu {
  color: var(--gold-dim, #b8860b);
}

.nav-btn-menu:active {
  color: var(--gold, #ffd700);
}

/* Modal flash */
.flash-overlay {
  position: fixed;
  inset: 0;
  z-index: 8000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.flash-overlay.success { background: rgba(34, 197, 94, 0.15); }
.flash-overlay.break { background: rgba(255, 45, 85, 0.2); }
.flash-overlay.show { opacity: 1; }

/* ——— Sharpen FX ——— */
.sharpen-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.sharpen-overlay[hidden] { display: none; }

.sharpen-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 3, 8, 0.88);
  backdrop-filter: blur(8px);
  animation: sharpen-fade-in 0.35s ease;
}

.sharpen-stage {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: min(280px, 90vw);
}

.sharpen-stage.phase-active .sharpen-nft-card {
  animation: sharpen-shake 0.12s ease-in-out infinite, sharpen-glow-pulse 0.6s ease-in-out infinite;
}

.sharpen-stage.phase-active .sharpen-hammer {
  animation: sharpen-hammer 0.45s ease-in-out infinite;
}

.sharpen-stage.phase-active .sharpen-ring-outer {
  animation: sharpen-spin 1.2s linear infinite;
}

.sharpen-stage.phase-active .sharpen-ring-inner {
  animation: sharpen-spin-rev 0.9s linear infinite;
}

.sharpen-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid transparent;
  pointer-events: none;
}

.sharpen-ring-outer {
  width: 220px;
  height: 220px;
  top: 50%;
  left: 50%;
  margin: -110px 0 0 -110px;
  border-top-color: var(--gold);
  border-right-color: rgba(255, 215, 0, 0.3);
  opacity: 0.7;
}

.sharpen-ring-inner {
  width: 170px;
  height: 170px;
  top: 50%;
  left: 50%;
  margin: -85px 0 0 -85px;
  border-bottom-color: var(--soul);
  border-left-color: rgba(0, 245, 212, 0.35);
  opacity: 0.8;
}

.sharpen-sparks {
  position: absolute;
  width: 200px;
  height: 200px;
  top: 50%;
  left: 50%;
  margin: -100px 0 0 -100px;
  pointer-events: none;
}

.spark {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  background: var(--color, var(--gold));
  border-radius: 50%;
  box-shadow: 0 0 10px var(--color, var(--gold));
  animation: spark-fly 0.7s ease-out infinite;
  transform: rotate(var(--angle)) translateY(-70px);
  opacity: 0;
}

.spark.gear-spark {
  width: auto;
  height: auto;
  margin: 0;
  background: none;
  border-radius: 0;
  box-shadow: none;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--color, #22d3ee);
  text-shadow: 0 0 10px var(--color, #22d3ee);
  animation: gear-fly 0.85s ease-out infinite;
  transform-origin: center center;
}

@keyframes gear-fly {
  0% {
    opacity: 0;
    transform: rotate(var(--angle)) translateY(0) rotate(0deg) scale(0.4);
  }
  20% { opacity: 1; }
  100% {
    opacity: 0;
    transform: rotate(var(--angle)) translateY(-88px) rotate(280deg) scale(1.15);
  }
}

.sharpen-nft-card {
  --grade-color: var(--gold);
  --grade-glow: rgba(255, 215, 0, 0.4);
  position: relative;
  z-index: 3;
  width: 120px;
  height: 156px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg-card);
  border: 2px solid var(--grade-color);
  border-radius: 16px;
  box-shadow: 0 0 30px var(--grade-glow), inset 0 0 20px rgba(255,255,255,0.04);
}

.sharpen-nft-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
  opacity: 0.35;
}

.sharpen-nft-icon { font-size: 3rem; position: relative; z-index: 1; }

.sharpen-nft-stat {
  position: relative;
  z-index: 1;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}

.result-stat {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.sharpen-nft-level {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--grade-color);
  text-shadow: 0 0 12px var(--grade-glow);
}

.sharpen-hammer {
  position: absolute;
  z-index: 4;
  top: -8px;
  right: calc(50% - 90px);
  font-size: 2.2rem;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
  transform-origin: bottom left;
}

.sharpen-status {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  animation: sharpen-text-pulse 0.8s ease-in-out infinite;
}

.sharpen-timer-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}

.sharpen-timer-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--soul), var(--gold));
  border-radius: 2px;
}

/* Result modal */
.sharpen-result {
  position: relative;
  z-index: 3;
  width: min(300px, 92vw);
  opacity: 0;
  transform: scale(0.85) translateY(20px);
  transition: opacity 0.4s ease, transform 0.45s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.sharpen-result[hidden] { display: none; }

.sharpen-result.result-visible {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.result-burst {
  position: absolute;
  inset: -40px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
}

.result-burst.burst-success {
  background: radial-gradient(circle, rgba(34, 211, 238, 0.4) 0%, transparent 70%);
  animation: result-burst 0.6s ease-out forwards;
}

.result-burst.burst-break {
  background: radial-gradient(circle, rgba(255, 45, 85, 0.45) 0%, transparent 70%);
  animation: result-burst 0.6s ease-out forwards;
}

.result-card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(8, 20, 36, 0.98) 0%, rgba(5, 8, 16, 0.98) 100%);
  border: 2px solid rgba(34, 211, 238, 0.35);
  border-radius: 20px;
  padding: 28px 24px 24px;
  text-align: center;
  box-shadow:
    0 0 30px rgba(34, 211, 238, 0.15),
    0 20px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.result-card.cyber-result::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0%, rgba(34, 211, 238, 0.06) 50%, transparent 100%);
  pointer-events: none;
}

.result-card.is-success {
  border-color: rgba(34, 211, 238, 0.75);
  box-shadow:
    0 0 0 1px rgba(34, 211, 238, 0.25),
    0 0 40px rgba(34, 211, 238, 0.35),
    0 20px 60px rgba(0, 0, 0, 0.55);
}

.result-card.is-break {
  border-color: rgba(255, 45, 85, 0.65);
  box-shadow:
    0 0 0 1px rgba(255, 45, 85, 0.25),
    0 0 40px rgba(255, 45, 85, 0.3),
    0 20px 60px rgba(0, 0, 0, 0.55);
  animation: break-shake 0.5s ease;
}

.result-gears {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
}

.result-gear {
  position: absolute;
  font-size: 2rem;
  color: #22d3ee;
  text-shadow: 0 0 12px rgba(34, 211, 238, 0.7);
  animation: gear-spin 3s linear infinite;
}

.result-gear--a { top: 12px; left: 16px; font-size: 1.6rem; animation-duration: 2.4s; }
.result-gear--b { top: 18px; right: 18px; font-size: 2.2rem; animation-direction: reverse; animation-duration: 3.2s; }
.result-gear--c { bottom: 52px; left: 50%; margin-left: -0.7rem; font-size: 1.4rem; opacity: 0.5; animation-duration: 1.8s; }

.result-gears.is-break .result-gear {
  color: #ff2d55;
  text-shadow: 0 0 12px rgba(255, 45, 85, 0.7);
  animation-duration: 0.55s;
}

.result-gears.is-success .result-gear {
  color: #67e8f9;
}

@keyframes gear-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.result-icon {
  font-size: 3.5rem;
  margin-bottom: 8px;
  animation: result-icon-pop 0.5s cubic-bezier(0.34, 1.5, 0.64, 1) 0.15s both;
  position: relative;
  z-index: 1;
}

.result-icon--success {
  color: #22d3ee;
  filter: drop-shadow(0 0 14px rgba(34, 211, 238, 0.85));
  animation:
    result-icon-pop 0.5s cubic-bezier(0.34, 1.5, 0.64, 1) 0.15s both,
    gear-spin 2.2s linear infinite 0.4s;
}

.result-icon--break {
  color: #ff2d55;
  filter: drop-shadow(0 0 14px rgba(255, 45, 85, 0.85));
  animation:
    result-icon-pop 0.45s cubic-bezier(0.34, 1.5, 0.64, 1) 0.1s both,
    gear-spin 0.6s linear infinite 0.35s;
}

.result-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.result-card.is-success .result-title {
  color: #67e8f9;
  text-shadow: 0 0 16px rgba(34, 211, 238, 0.55);
}
.result-card.is-break .result-title {
  color: #ff6b8a;
  text-shadow: 0 0 16px rgba(255, 45, 85, 0.45);
}

.result-subtitle {
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 8px;
  color: var(--text);
}

.result-card.is-success .result-subtitle {
  color: var(--gold);
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}

.result-detail {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 16px;
}

.result-refund {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(0, 245, 212, 0.1);
  border: 1px solid rgba(0, 245, 212, 0.3);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--soul);
  animation: refund-float 1.2s ease-in-out infinite;
}

.result-refund[hidden] { display: none; }

.result-btn {
  width: 100%;
}

.sharpen-overlay.is-success .sharpen-backdrop {
  background: rgba(2, 20, 10, 0.9);
}

.sharpen-overlay.is-break .sharpen-backdrop {
  background: rgba(20, 2, 8, 0.9);
}

@keyframes sharpen-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sharpen-shake {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(-3px, 2px) rotate(-1deg); }
  75% { transform: translate(3px, -2px) rotate(1deg); }
}

@keyframes sharpen-glow-pulse {
  0%, 100% { box-shadow: 0 0 20px var(--grade-glow), inset 0 0 20px rgba(255,255,255,0.04); }
  50% { box-shadow: 0 0 45px var(--grade-glow), 0 0 60px var(--grade-glow), inset 0 0 24px rgba(255,255,255,0.08); }
}

@keyframes sharpen-hammer {
  0%, 100% { transform: rotate(-25deg) translateY(0); }
  40% { transform: rotate(5deg) translateY(8px); }
  50% { transform: rotate(8deg) translateY(10px); }
}

@keyframes sharpen-spin {
  to { transform: rotate(360deg); }
}

@keyframes sharpen-spin-rev {
  to { transform: rotate(-360deg); }
}

@keyframes spark-fly {
  0% { opacity: 0; transform: rotate(var(--angle)) translateY(-50px) scale(0.3); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--angle)) translateY(-95px) scale(0); }
}

@keyframes sharpen-text-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

@keyframes result-burst {
  0% { opacity: 0; transform: scale(0.5); }
  50% { opacity: 1; }
  100% { opacity: 0.6; transform: scale(1.2); }
}

@keyframes result-icon-pop {
  from { transform: scale(0) rotate(-20deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes break-shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-8px) rotate(-1deg); }
  30% { transform: translateX(8px) rotate(1deg); }
  45% { transform: translateX(-6px); }
  60% { transform: translateX(6px); }
}

@keyframes refund-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ——— Cyber Fight Arena ——— */
body.cyber-market {
  --soul: var(--credit);
  --soul-glow: var(--credit-glow);
  --rare: #22d3ee;
  --epic: #c084fc;
  --legend: #fbbf24;
  --panel-border: rgba(34, 211, 238, 0.18);
  --gold: #22d3ee;
}

body.cyber-market .balance-item--credits .balance-label,
body.cyber-market .balance-item--credits .balance-amount {
  color: var(--credit);
}

body.cyber-market .economy-table td.credit-val,
body.cyber-market .economy-table td.soul-val {
  color: var(--credit);
}

.stat-tag.pwr {
  color: #f97316;
  border-color: rgba(249, 115, 22, 0.45);
  background: rgba(249, 115, 22, 0.12);
}

.stat-tag.nrg {
  color: #22d3ee;
  border-color: rgba(34, 211, 238, 0.45);
  background: rgba(34, 211, 238, 0.12);
}

.stat-tag.cpu {
  color: #c084fc;
  border-color: rgba(192, 132, 252, 0.45);
  background: rgba(192, 132, 252, 0.12);
}

.shop-grid--triple {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.screen-sub {
  color: var(--muted);
  font-size: 0.82rem;
  margin: -6px 0 14px;
  line-height: 1.45;
}

.hub-link-alt {
  position: absolute;
  top: calc(var(--tg-safe-top) + 8px);
  right: 12px;
  z-index: 12;
  font-size: 0.72rem;
  color: var(--credit);
  text-decoration: none;
  padding: 6px 10px;
  border: 1px solid rgba(34, 211, 238, 0.35);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.75);
}

body.cyber-market .btn-sharpen {
  background: linear-gradient(135deg, #0891b2, #6366f1);
}

body.cyber-market .sharpen-timer-fill {
  background: linear-gradient(90deg, var(--credit), #22d3ee, #a855f7);
}

.sharpen-ring-outer {
  border-top-color: #22d3ee !important;
  border-right-color: rgba(34, 211, 238, 0.35) !important;
}

.sharpen-ring-inner {
  border-bottom-color: #67e8f9 !important;
  border-left-color: rgba(103, 232, 249, 0.4) !important;
}

/* ——— Home ——— */
.home-hero {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid rgba(34, 211, 238, 0.2);
}

.home-hero-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(200px, 36vh);
  min-height: 120px;
  object-fit: cover;
  object-position: center 20%;
  opacity: 0.95;
}

.home-hero-text {
  position: absolute;
  inset: auto 0 0 0;
  padding: 16px;
  background: linear-gradient(transparent, rgba(2, 6, 23, 0.92));
}

.home-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--credit);
}

.home-tagline {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
}

.home-mech-card {
  background: var(--bg-card);
  border: 1px solid rgba(34, 211, 238, 0.22);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

.home-mech-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.home-mech-preview {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-rows: auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px 8px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.home-mech-preview.complete {
  border-color: rgba(34, 211, 238, 0.35);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.12);
  display: block;
  padding: 0;
  overflow: hidden;
}

.home-assembled-wrap {
  position: relative;
  width: 100%;
}

.home-assembled-label {
  position: absolute;
  left: 10px;
  bottom: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--credit);
  text-shadow: 0 0 8px rgba(2, 6, 23, 0.9);
  pointer-events: none;
}

.assembled-robot-video {
  display: block;
  width: 100%;
  max-height: min(28vh, 200px);
  object-fit: cover;
  object-position: center top;
  border-radius: 10px;
  background: #020617;
}

.mech-assembled-wrap {
  margin-bottom: 10px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(34, 211, 238, 0.35);
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.15);
  max-height: min(32vh, 220px);
}

.mech-assembled-wrap .assembled-robot-video {
  max-height: min(32vh, 220px);
  border-radius: 0;
}

.home-preview-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  border-radius: 10px;
  border: 1px dashed rgba(148, 163, 184, 0.3);
  background: rgba(2, 6, 23, 0.5);
  color: var(--text);
  cursor: pointer;
  min-width: 0;
}

.home-preview-slot--chassis { grid-column: 2; grid-row: 1; }
.home-preview-slot--reactor { grid-column: 1; grid-row: 2; }
.home-preview-robot {
  grid-column: 2;
  grid-row: 2;
  font-size: 2.6rem;
  line-height: 1;
  opacity: 0.9;
  filter: drop-shadow(0 0 12px rgba(34, 211, 238, 0.35));
}
.home-preview-slot--processor { grid-column: 3; grid-row: 2; }

.home-preview-slot.filled {
  border-style: solid;
  border-color: rgba(34, 211, 238, 0.35);
}

.home-preview-slot img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: #0f172a;
}

.home-preview-empty {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--credit);
  background: rgba(34, 211, 238, 0.08);
  border: 1px dashed rgba(34, 211, 238, 0.25);
}

.home-preview-label,
.home-preview-name {
  font-size: 0.62rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.2;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-preview-lvl {
  font-size: 0.72rem;
  font-weight: 800;
}

.home-mech-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.home-mech-ready {
  font-size: 0.8rem;
  color: var(--credit);
  font-weight: 700;
}

.home-mech-ready.complete {
  color: var(--success);
}

.home-stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.home-stat {
  text-align: center;
  padding: 8px 4px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.home-stat .k {
  display: block;
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.home-stat .v {
  display: block;
  font-size: 1.1rem;
  font-weight: 800;
  margin-top: 2px;
}

.home-stat.pwr .v { color: #f97316; }
.home-stat.nrg .v { color: #22d3ee; }
.home-stat.cpu .v { color: #c084fc; }
.home-stat.total .v { color: #fbbf24; }
.home-stat.cost {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.1);
}
.home-stat.cost .v { color: #fbbf24; font-size: 1.15rem; }
.home-stat.cost .k { color: #fbbf24; }

.home-cost-panel {
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, 0.4);
  background: linear-gradient(160deg, rgba(251, 191, 36, 0.12), rgba(15, 23, 42, 0.92));
}

.home-cost-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fde68a;
}

.home-cost-head strong {
  font-size: 1.15rem;
  font-weight: 900;
  color: #fbbf24;
}

.home-cost-parts {
  display: grid;
  gap: 4px;
  margin-bottom: 6px;
}

.home-cost-part {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.55);
  color: var(--muted);
}

.home-cost-part strong {
  color: #fbbf24;
}

.home-cost-part.empty {
  opacity: 0.55;
}

.home-cost-note {
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.35;
  margin: 0;
}

/* Referral */
.ref-card {
  background: var(--bg-card);
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

.ref-card--sim {
  border-color: rgba(148, 163, 184, 0.2);
  opacity: 0.95;
}

.ref-card-title {
  font-size: 0.88rem;
  font-weight: 800;
  margin: 0 0 10px;
  color: var(--credit);
}

.ref-link-label {
  display: block;
  margin: 10px 0 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(103, 232, 249, 0.75);
}

.ref-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.ref-code {
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fbbf24;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.ref-link-input,
.ref-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(2, 6, 23, 0.7);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  margin-bottom: 8px;
}

.ref-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.ref-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.ref-stat {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.7);
  color: var(--muted);
}

.ref-stat strong {
  color: #fbbf24;
}

.ref-enter-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 6px;
}

.ref-enter-row .ref-input {
  margin-bottom: 0;
}

.ref-hint {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
  margin: 0 0 10px;
}

.ref-social-list {
  display: grid;
  gap: 8px;
}

.ref-social-row {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.65);
}

.ref-social-row.claimed {
  border-color: rgba(52, 211, 153, 0.35);
  opacity: 0.85;
}

.ref-social-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  font-size: 0.78rem;
}

.ref-social-meta strong {
  color: var(--text);
}

.ref-social-meta span {
  color: var(--muted);
}

.ref-social-reward {
  color: #fbbf24 !important;
  font-weight: 800;
}

.ref-social-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ref-social-actions a {
  text-align: center;
  text-decoration: none;
}

.nft-cost-line {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fbbf24;
  margin-top: 2px;
}

.modules-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.detail-cost-panel {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, 0.4);
  background: linear-gradient(160deg, rgba(251, 191, 36, 0.12), rgba(15, 23, 42, 0.9));
}

.detail-cost-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: #e2e8f0;
  padding: 4px 0;
}

.detail-cost-row strong {
  color: #fbbf24;
  font-weight: 800;
  white-space: nowrap;
}

.detail-cost-row--fee strong {
  color: var(--credit);
}

.mech-cost-hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 6px 0 8px;
  line-height: 1.35;
}

.mech-parts-cost {
  display: grid;
  gap: 6px;
}

.mech-part-cost {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.12);
  color: var(--muted);
}

.mech-part-cost strong {
  color: #fbbf24;
}

.mech-part-cost.empty {
  opacity: 0.55;
}

.mech-part-cost.total {
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.1);
  color: var(--text);
  font-weight: 700;
}

.home-rating {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.4;
}

.home-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.home-links {
  display: grid;
  gap: 8px;
}

.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 0.75rem; }

.nft-card.equipped {
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.45);
}

.nft-card-equip {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 3;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(34, 211, 238, 0.4);
  background: rgba(2, 6, 23, 0.85);
  color: var(--credit);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.nft-card-equip.equipped {
  border-color: rgba(52, 211, 153, 0.5);
  color: var(--success);
  background: rgba(6, 78, 59, 0.75);
}

.nft-card-equip:active {
  transform: scale(0.92);
}

.nft-equipped-tag {
  display: inline-block;
  font-size: 0.62rem;
  color: var(--credit);
  border: 1px solid rgba(34, 211, 238, 0.35);
  border-radius: 4px;
  padding: 1px 5px;
  margin-right: 4px;
}

/* ——— Mech assembly ——— */
.mech-assembly {
  margin-bottom: 14px;
}

.mech-core {
  background: var(--bg-card);
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: 16px;
  padding: 16px 12px 12px;
  position: relative;
}

.mech-silhouette {
  text-align: center;
  font-size: 3rem;
  opacity: 0.15;
  line-height: 1;
  margin-bottom: -8px;
}

.mech-slots {
  display: grid;
  gap: 10px;
}

.mech-slot {
  width: 100%;
  text-align: left;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.6);
  color: var(--text);
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  align-items: center;
}

.mech-slot.filled {
  border-style: solid;
  border-color: rgba(34, 211, 238, 0.35);
}

.mech-slot-label {
  grid-column: 1 / -1;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.mech-slot-img {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: contain;
  object-position: center;
  background: #0f172a;
}

.mech-slot-empty {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--credit);
  background: rgba(34, 211, 238, 0.08);
  border: 1px dashed rgba(34, 211, 238, 0.3);
}

.mech-slot-name {
  font-weight: 700;
  font-size: 0.88rem;
}

.mech-slot-meta,
.mech-slot-hint {
  font-size: 0.75rem;
  color: var(--muted);
  grid-column: 2;
}

.mech-slot-action {
  grid-column: 1 / -1;
  font-size: 0.72rem;
  color: var(--credit);
  margin-top: 2px;
}

.mech-stats-panel {
  background: var(--bg-card);
  border: 1px solid rgba(34, 211, 238, 0.18);
  border-radius: 14px;
  padding: 14px;
}

.mech-stats-title {
  font-size: 0.85rem;
  margin-bottom: 10px;
  color: var(--credit);
}

.mech-stat-bars {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.mech-stat-bar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  margin-bottom: 4px;
}

.mech-stat-bar-head strong {
  margin-left: auto;
  font-size: 0.95rem;
}

.mech-stat-track {
  height: 8px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.9);
  overflow: hidden;
}

.mech-stat-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.35s ease;
}

.mech-stat-bar--pwr .mech-stat-fill,
.mech-stat-bar--str .mech-stat-fill { background: linear-gradient(90deg, #ea580c, #f97316); }
.mech-stat-bar--nrg .mech-stat-fill,
.mech-stat-bar--con .mech-stat-fill { background: linear-gradient(90deg, #0891b2, #22d3ee); }
.mech-stat-bar--cpu .mech-stat-fill,
.mech-stat-bar--dex .mech-stat-fill { background: linear-gradient(90deg, #7c3aed, #c084fc); }

/* ——— Fight sheet ——— */
.fight-sheet {
  background: var(--bg-card);
  border: 1px solid rgba(34, 211, 238, 0.22);
  border-radius: 14px;
  padding: 14px;
}

.fight-ready {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.fight-ready.ready {
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.35);
}

.fight-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.fight-stat-cell {
  padding: 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.fight-stat-key {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--credit);
}

.fight-stat-val {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  margin: 2px 0;
}

.fight-stat-cell--str .fight-stat-val { color: #c084fc; }
.fight-stat-cell--dex .fight-stat-val { color: #22d3ee; }
.fight-stat-cell--con .fight-stat-val { color: #f97316; }
.fight-stat-cell--atk .fight-stat-val { color: #fbbf24; }
.fight-stat-cell--cost .fight-stat-val { color: #fbbf24; }
.fight-stat-cell--cost {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.08);
}

.fight-stat-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text);
}

.fight-stat-hint {
  display: block;
  font-size: 0.62rem;
  color: var(--muted);
  margin-top: 2px;
}

.fight-hp-bar-wrap {
  margin-bottom: 12px;
}

.fight-hp-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  margin-bottom: 4px;
}

.fight-hp-track {
  height: 10px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.9);
  overflow: hidden;
}

.fight-hp-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #059669, #34d399);
  transition: width 0.25s ease;
}

.fight-formulas {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.fight-formulas code {
  display: block;
  font-size: 0.72rem;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.7);
  color: #a5f3fc;
  border: 1px solid rgba(34, 211, 238, 0.15);
  word-break: break-all;
}

.fight-note {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.4;
}

.fight-arena {
  margin-top: 12px;
}

/* Раунд — крупно, первым в глаза */
.fight-round-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.12), rgba(251, 191, 36, 0.18), rgba(34, 211, 238, 0.12));
  border: 2px solid rgba(251, 191, 36, 0.55);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.2);
}

.fight-round-banner.pulse {
  animation: round-banner-pulse 0.55s ease;
}

@keyframes round-banner-pulse {
  0% { transform: scale(0.96); box-shadow: 0 0 8px rgba(251, 191, 36, 0.2); }
  50% { transform: scale(1.03); box-shadow: 0 0 28px rgba(251, 191, 36, 0.45); }
  100% { transform: scale(1); box-shadow: 0 0 20px rgba(251, 191, 36, 0.2); }
}

.fight-round-banner-label {
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #fbbf24;
}

.fight-round-banner-num {
  font-size: 1.75rem;
  font-weight: 900;
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.6);
}

.fight-round-banner .fight-countdown {
  font-size: 1.5rem;
  min-width: 2rem;
  color: #fbbf24;
}

/* HP / STA — крупная полоса */
.fight-vitals-strip {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}

.fight-vital-card {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  padding: 8px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.9);
  border: 2px solid transparent;
}

.fight-vital-card--hp {
  border-color: rgba(52, 211, 153, 0.65);
  background: linear-gradient(160deg, rgba(6, 78, 59, 0.55), rgba(15, 23, 42, 0.95));
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.25);
}

.fight-vital-card--sta {
  border-color: rgba(192, 132, 252, 0.65);
  background: linear-gradient(160deg, rgba(88, 28, 135, 0.45), rgba(15, 23, 42, 0.95));
  box-shadow: 0 0 14px rgba(192, 132, 252, 0.25);
}

.fight-vital-card--enemy {
  border-color: rgba(248, 113, 113, 0.55);
  background: linear-gradient(160deg, rgba(127, 29, 29, 0.4), rgba(15, 23, 42, 0.95));
}

.fight-vital-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.fight-vital-meta {
  flex: 1;
  min-width: 0;
}

.fight-vital-label {
  display: block;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #e2e8f0;
  margin-bottom: 2px;
}

.fight-vital-card--hp .fight-vital-label { color: #6ee7b7; }
.fight-vital-card--sta .fight-vital-label { color: #e9d5ff; }
.fight-vital-card--enemy .fight-vital-label { color: #fca5a5; }

.fight-vital-val {
  display: block;
  font-size: 0.95rem;
  font-weight: 900;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 4px;
}

.fight-hp-track--big,
.fight-sta-track--big {
  height: 10px;
  border-radius: 5px;
  background: rgba(2, 6, 23, 0.75);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.fight-hp-track--big .fight-hp-fill,
.fight-sta-track--big .fight-sta-fill {
  height: 100%;
  border-radius: 5px;
}

.fight-report {
  margin-bottom: 10px;
  border-radius: 12px;
  border: 2px solid rgba(34, 211, 238, 0.35);
  background: rgba(2, 6, 23, 0.75);
  overflow: hidden;
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.12);
}

.fight-report-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: var(--credit);
  background: rgba(34, 211, 238, 0.1);
  border-bottom: 1px solid rgba(34, 211, 238, 0.2);
}

.fight-report-round {
  color: #fbbf24;
  font-size: 0.72rem;
}

.fight-report .fight-log {
  max-height: 180px;
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.mech-total-row--cost strong {
  color: #fbbf24;
}

.fight-fighters {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 6px;
  margin-bottom: 10px;
  align-items: center;
  max-height: 120px;
  overflow: hidden;
  transition:
    max-height 0.28s ease,
    opacity 0.22s ease,
    margin 0.28s ease,
    transform 0.28s ease;
}

.fight-fighters.is-hidden {
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.fight-fighter {
  min-width: 0;
  max-width: 100%;
}

.fight-fighter-media {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(34, 211, 238, 0.3);
  background: #020617;
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 96px;
  max-height: 96px;
  margin: 0 auto;
}

.fight-fighter--enemy .fight-fighter-media {
  border-color: rgba(239, 68, 68, 0.45);
}

.fight-fighter-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.fight-fighter-video--enemy {
  filter: hue-rotate(160deg) saturate(1.15) contrast(1.05);
  transform: scaleX(-1);
}

.fight-fighter-overlay {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  padding: 4px 5px 6px;
  display: grid;
  gap: 3px;
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.94) 0%, rgba(2, 6, 23, 0.5) 75%, transparent 100%);
  pointer-events: none;
}

.fight-bar-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 3px;
  align-items: center;
}

.fight-bar-row--name {
  grid-template-columns: 1fr;
}

.fight-bar-tag {
  font-size: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #e2e8f0;
}

.fight-bar-tag.hp { color: #6ee7b7; }
.fight-bar-tag.sta { color: #d8b4fe; }
.fight-bar-tag.enemy { color: #fca5a5; font-size: 0.52rem; }

.fight-bar-val {
  font-size: 0.52rem;
  font-weight: 700;
  color: #f8fafc;
  min-width: 1.8rem;
  text-align: right;
}

.fight-fighter-media .fight-hp-track,
.fight-fighter-media .fight-sta-track {
  height: 5px;
  border-radius: 3px;
  background: rgba(15, 23, 42, 0.85);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin: 0;
}

.fight-fighter-media .fight-hp-fill,
.fight-fighter-media .fight-sta-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.2s ease;
}

.fight-sta-fill {
  background: linear-gradient(90deg, #7c3aed, #c084fc);
}

.fight-sta-fill.low {
  background: linear-gradient(90deg, #b45309, #f59e0b);
}

.fight-hp-fill--enemy {
  background: linear-gradient(90deg, #b91c1c, #ef4444);
}

.fight-fighter-name {
  margin-top: 3px;
  text-align: center;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fight-fighter--player .fight-fighter-name { color: var(--credit); }
.fight-fighter--enemy .fight-fighter-name { color: #fca5a5; }

.fight-round-center {
  text-align: center;
  padding: 0 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-width: 36px;
}

.fight-round-label {
  display: block;
  font-size: 0.5rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.fight-round-center strong {
  display: block;
  font-size: 0.95rem;
  color: var(--credit);
  line-height: 1.1;
}

.fight-countdown {
  display: inline-block;
  min-width: 1.4rem;
  font-size: 1rem;
  font-weight: 800;
  color: #fbbf24;
  line-height: 1.1;
}

.fight-vs {
  margin-top: 2px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.fight-countdown.urgent {
  color: #ef4444;
  animation: fight-pulse 0.4s ease infinite alternate;
}

@media (min-width: 400px) {
  .fight-fighter-media {
    max-width: 110px;
    max-height: 110px;
  }
}

@keyframes fight-pulse {
  from { transform: scale(1); }
  to { transform: scale(1.12); }
}

.fight-zones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.fight-zone-col {
  display: grid;
  gap: 8px;
}

.fight-zone-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
}

.fight-zone-label--def { color: #38bdf8; }
.fight-zone-label--atk { color: #f87171; }

.fight-zone-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 10px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.85);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.fight-zone-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.fight-zone-btn:not(:disabled):active {
  transform: scale(0.97);
}

.fight-zone-btn.def-btn.active {
  border-color: #38bdf8;
  background: rgba(14, 165, 233, 0.2);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

.fight-zone-btn.atk-btn.active {
  border-color: #f87171;
  background: rgba(239, 68, 68, 0.2);
  box-shadow: 0 0 12px rgba(248, 113, 113, 0.25);
}

.zone-icon {
  font-size: 1.1rem;
}

.fight-code-dock {
  background: var(--bg-card);
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  text-align: center;
}

.fight-code {
  font-family: ui-monospace, monospace;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--credit);
  letter-spacing: 0.06em;
}

.fight-cost {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 6px 0 10px;
}

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

.fight-log {
  max-height: 160px;
  overflow-y: auto;
  background: rgba(2, 6, 23, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 8px;
  font-size: 0.72rem;
  line-height: 1.35;
}

.fight-log-line {
  padding: 3px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  color: var(--muted);
}

.fight-log--round { color: var(--credit); font-weight: 700; }
.fight-log--hit { color: #86efac; }
.fight-log--dmg { color: #fca5a5; }
.fight-log--sta { color: #d8b4fe; }
.fight-log--win { color: #34d399; font-weight: 800; }
.fight-log--lose { color: #f87171; font-weight: 800; }

.fight-cost-hint {
  font-size: 0.68rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.35;
}

.hp-hit {
  animation: hp-shake 0.45s ease;
}

@keyframes hp-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.mech-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
  font-size: 0.9rem;
}

.mech-total-row strong {
  font-size: 1.25rem;
  color: #fbbf24;
}

.btn-equip {
  background: linear-gradient(135deg, #0e7490, #4f46e5);
  color: #fff;
  border: none;
}

/* ——— Equip picker ——— */
.equip-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  padding-bottom: calc(12px + var(--tg-safe-bottom));
}

.equip-picker-overlay[hidden] { display: none; }

.equip-picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.75);
  backdrop-filter: blur(4px);
}

.equip-picker-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 70vh;
  overflow: auto;
  background: #0f172a;
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: 16px 16px 12px 12px;
  padding: 14px;
}

.equip-picker-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.equip-picker-head h3 {
  font-size: 1rem;
  color: var(--credit);
}

.equip-picker-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.equip-picker-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.equip-picker-list {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.equip-picker-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.equip-picker-item img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
}

.equip-picker-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.78rem;
}

.equip-picker-meta strong {
  font-size: 0.85rem;
}

.equip-picker-empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 16px 8px;
}

body.equip-picker-open { overflow: hidden; }
/* ============================================================
   RESPONSIVE: site · Mini App · portrait · landscape · desktop
   ============================================================ */

/* Web site brand bar (hidden in Telegram) */
.site-topbar {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(2, 6, 23, 0.95);
  border-bottom: 1px solid rgba(34, 211, 238, 0.2);
  z-index: 50;
}

.site-topbar-brand {
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--credit);
  text-transform: uppercase;
}

.site-topbar-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.site-topbar-links a {
  font-size: 0.7rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

.site-topbar-links a:hover {
  color: var(--credit);
}

body.platform-web .site-topbar {
  display: flex;
}

body.platform-telegram .site-topbar {
  display: none !important;
}

/* Header image scaling (override height:auto) */
.header-img {
  display: block;
  width: 100%;
  height: 96px;
  max-height: 18vh;
  min-height: 72px;
  object-fit: cover;
  object-position: center 28%;
}

/* —— Small phones —— */
@media (max-width: 380px) {
  .main { padding: 0 10px 12px; }
  .home-stat-row { gap: 4px; }
  .home-stat .v { font-size: 0.9rem; }
  .inventory-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .nav-btn { font-size: 0.45rem; padding: 4px 1px; letter-spacing: 0.02em; }
  .nav-btn .nav-icon--glyph { font-size: 1rem; }
  .fight-vitals-strip { grid-template-columns: 1fr; gap: 6px; }
  .shop-grid--triple { grid-template-columns: 1fr; }
  .header-img { height: 72px; max-height: 72px; }
  .home-hero-img { height: 88px; max-height: 88px; }
  .lang-toggle { top: 6px; right: 6px; height: 28px; font-size: 0.68rem; }
  .hub-card, .hub-card-body { min-height: 92px; }
  .hub-card-title { font-size: 0.78rem; }
  .hub-card-desc { font-size: 0.6rem; }
  .fight-zone-btn .zone-img { max-width: 64px; }
  .site-topbar { padding: 6px 10px; }
  .site-topbar-brand { font-size: 0.7rem; }
  .site-topbar-links a { font-size: 0.62rem; }
}

/* —— Phones portrait —— */
@media (max-width: 767px) and (orientation: portrait) {
  .shop-grid--triple { grid-template-columns: 1fr; gap: 10px; }
  .ref-actions { grid-template-columns: 1fr; }
  .header-img { height: 88px; max-height: 88px; }
  .home-hero-img { height: 110px; max-height: 110px; }
}

/* —— Landscape phone / short height —— */
@media (max-height: 520px), ((max-width: 960px) and (orientation: landscape)) {
  :root { --nav-h: 48px; }

  .header-img { height: 48px; max-height: 48px; min-height: 48px; }
  .home-hero { display: none; }
  .home-tagline { display: none; }
  .site-topbar { display: none !important; }
  .lang-toggle { top: 4px; right: 4px; height: 26px; min-width: 36px; font-size: 0.65rem; }

  .main { padding: 0 8px 8px; }
  .screen { padding-top: 4px; }
  .screen-title { margin-bottom: 4px; font-size: 0.55rem; }

  .nav-btn {
    flex-direction: row;
    gap: 3px;
    font-size: 0.5rem;
    min-height: 40px;
    padding: 2px 1px;
  }
  .nav-btn .nav-icon--glyph { font-size: 0.95rem; }

  .home-hub {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .hub-card--wide { grid-column: span 1; }
  .hub-card, .hub-card-body { min-height: 64px; }
  .hub-card-desc { display: none; }
  .hub-card-title { font-size: 0.7rem; }

  .home-cost-panel { padding: 8px; margin-bottom: 8px; }
  .home-stat-row { margin-bottom: 6px; }

  html.fight-live #screen-fight .fight-arena:not([hidden]) {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    align-items: start;
  }
  html.fight-live #screen-fight .fight-round-banner {
    grid-column: 1 / -1;
    padding: 4px 8px;
    margin-bottom: 4px;
  }
  html.fight-live #screen-fight .fight-vitals-strip {
    grid-column: 1;
    grid-template-columns: 1fr;
    margin-bottom: 0;
  }
  html.fight-live #screen-fight .fight-fighters {
    grid-column: 1;
    margin-bottom: 0;
  }
  html.fight-live #screen-fight .fight-zones {
    grid-column: 2;
    grid-row: 2 / span 2;
    margin-bottom: 0;
  }
  html.fight-live #screen-fight .fight-code-dock {
    grid-column: 2;
    margin-bottom: 0;
  }
  html.fight-live #screen-fight .fight-report,
  html.fight-live #screen-fight .fight-cost-hint {
    grid-column: 1 / -1;
  }
  .fight-zone-btn .zone-img { max-width: 48px; }
  .fight-fighter-media { max-width: 64px; max-height: 64px; }
}

/* —— Tablet —— */
@media (min-width: 600px) and (max-width: 1023px) {
  .main { padding: 0 18px 16px; }
  .inventory-grid { grid-template-columns: repeat(3, 1fr); }
  .shop-grid--triple { grid-template-columns: repeat(3, 1fr); }
  .header-img { height: 110px; max-height: 110px; }
  .home-hero-img { height: 140px; max-height: 140px; }
  .hub-card, .hub-card-body { min-height: 120px; }
  .fight-zone-btn .zone-img { max-width: 100px; }
  .fight-fighter-media { max-width: 110px; max-height: 110px; }
  .shop-card .shop-nft-preview { height: 140px; }
}

/* —— Desktop / laptop: phone-frame shell —— */
@media (min-width: 1024px) {
  :root { --nav-h: 64px; }

  html, body {
    overflow: auto;
    min-height: 100%;
  }

  body {
    display: flex;
    justify-content: center;
    align-items: stretch;
    min-height: 100dvh;
    background:
      linear-gradient(180deg, rgba(5, 5, 8, 0.82) 0%, rgba(5, 5, 8, 0.92) 100%),
      url('../assets/background/Background_game.png') center / cover no-repeat fixed;
  }

  #app {
    position: relative;
    inset: auto;
    width: min(480px, 100%);
    height: 100dvh;
    max-height: 100dvh;
    margin: 0 auto;
    border-left: 1px solid rgba(34, 211, 238, 0.18);
    border-right: 1px solid rgba(34, 211, 238, 0.18);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.65);
    border-radius: 0;
  }

  /* Wider readable column on big monitors still phone-like */
  body.layout-desktop.platform-web #app {
    width: min(520px, 100vw);
  }

  .header-img {
    height: 120px;
    max-height: 120px;
    min-height: 100px;
  }

  .home-hero-img {
    height: 150px;
    max-height: 150px;
    min-height: 120px;
  }

  .main {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0 16px 16px;
  }

  .bottom-nav {
    max-width: none;
    left: auto;
    transform: none;
    border-radius: 0;
    position: relative;
  }

  .inventory-grid { grid-template-columns: repeat(3, 1fr); }
  .shop-grid--triple { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .shop-card .shop-nft-preview { height: 130px; }

  .home-hub {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .hub-card, .hub-card-body { min-height: 118px; }
  .hub-card--wide { min-height: 100px; }
  .hub-card--wide .hub-card-body { min-height: 100px; }

  .fight-zone-btn .zone-img {
    max-width: 88px;
  }

  .fight-fighter-media {
    max-width: 100px;
    max-height: 100px;
  }

  .equip-picker-card,
  .nft-focus-card {
    max-width: 440px;
  }

  .home-actions {
    grid-template-columns: 1fr 1fr;
  }

  /* Desktop fight: stacked clean layout, no broken grid */
  body.layout-desktop.fight-live #screen-fight .fight-arena:not([hidden]) {
    display: block;
  }

  body.layout-desktop.fight-live #screen-fight .fight-zones {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  body.layout-desktop.fight-live #screen-fight .fight-vitals-strip {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1280px) {
  body.layout-desktop.platform-web #app {
    width: min(560px, 100vw);
    border-radius: 18px;
    margin: 16px auto;
    height: calc(100dvh - 32px);
    max-height: calc(100dvh - 32px);
    overflow: hidden;
  }

  body {
    padding: 0;
    align-items: center;
  }

  .header-img {
    height: 132px;
    max-height: 132px;
  }
}

/* Telegram: full viewport shell */
body.platform-telegram #app,
body.tg-app #app {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: none;
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

body.platform-telegram .bottom-nav,
body.tg-app .bottom-nav {
  max-width: none;
  left: auto;
  transform: none;
  border-radius: 0;
}

body.platform-telegram .site-topbar {
  display: none !important;
}

/* Orientation helpers */
html.is-landscape .header-img {
  height: 56px;
  max-height: 56px;
  min-height: 48px;
}

html.is-landscape.platform-telegram .home-hero {
  display: none;
}

/* Touch targets */
@media (pointer: coarse) {
  .btn, .nav-btn, .mech-slot {
    min-height: 44px;
  }
  .fight-zone-btn {
    min-height: 0;
  }
  .nft-card-equip {
    min-height: 28px;
    min-width: 28px;
  }
}

.fight-fighter-video {
  background: #020617;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* —— Game background art —— */
body.has-game-bg #app {
  background:
    linear-gradient(180deg, rgba(5, 5, 8, 0.78) 0%, rgba(5, 5, 8, 0.9) 45%, rgba(5, 5, 8, 0.96) 100%),
    url('../assets/background/Background_game.png') center top / cover no-repeat;
  background-size: cover;
  background-position: center top;
}

body.platform-telegram.has-game-bg #app {
  background-attachment: scroll;
}

/* —— Home hub cards —— */
.home-hub {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.hub-card {
  position: relative;
  display: block;
  width: 100%;
  min-height: 108px;
  padding: 0;
  border: 1px solid rgba(34, 211, 238, 0.28);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  color: #fff;
  background: #0a0a12;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.hub-card:active {
  transform: scale(0.98);
}

.hub-card:hover {
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.2);
}

/* Neon cyan frame — primary menu: Assembly · Fight · Reassembly · Shop */
.hub-card--neon {
  border: 2px solid rgba(34, 211, 238, 0.75);
  box-shadow:
    0 0 0 1px rgba(34, 211, 238, 0.25),
    0 0 18px rgba(34, 211, 238, 0.35),
    0 0 36px rgba(56, 189, 248, 0.18),
    inset 0 0 20px rgba(34, 211, 238, 0.08);
  animation: neon-frame-pulse 2.8s ease-in-out infinite;
}

.hub-card--neon:hover {
  border-color: #67e8f9;
  box-shadow:
    0 0 0 1px rgba(103, 232, 249, 0.45),
    0 0 24px rgba(34, 211, 238, 0.55),
    0 0 48px rgba(56, 189, 248, 0.28),
    inset 0 0 24px rgba(34, 211, 238, 0.12);
}

.hub-card--neon .hub-card-title {
  color: #a5f3fc;
  text-shadow:
    0 0 8px rgba(34, 211, 238, 0.7),
    0 0 16px rgba(34, 211, 238, 0.4);
}

@keyframes neon-frame-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(34, 211, 238, 0.25),
      0 0 14px rgba(34, 211, 238, 0.3),
      0 0 28px rgba(56, 189, 248, 0.14),
      inset 0 0 16px rgba(34, 211, 238, 0.06);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(34, 211, 238, 0.4),
      0 0 22px rgba(34, 211, 238, 0.48),
      0 0 42px rgba(56, 189, 248, 0.26),
      inset 0 0 22px rgba(34, 211, 238, 0.1);
  }
}

.hub-card--wide {
  grid-column: 1 / -1;
  min-height: 96px;
}

.hub-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  opacity: 0.9;
  transform: none;
}

.hub-card-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  min-height: 108px;
  padding: 12px;
  background: linear-gradient(transparent 10%, rgba(2, 6, 23, 0.88) 70%, rgba(2, 6, 23, 0.96));
}

.hub-card--wide .hub-card-body {
  min-height: 96px;
}

.hub-card-title {
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #f0f9ff;
  text-shadow: 0 0 12px rgba(34, 211, 238, 0.45);
}

.hub-card-desc {
  font-size: 0.68rem;
  color: #94a3b8;
  line-height: 1.3;
}

/* —— Bottom nav polish —— */
.bottom-nav {
  gap: 2px;
  padding: 4px 4px calc(4px + var(--tg-safe-bottom));
  background: linear-gradient(180deg, rgba(8, 10, 18, 0.92), rgba(2, 6, 23, 0.98));
  border-top: 1px solid rgba(34, 211, 238, 0.22);
  backdrop-filter: blur(12px);
}

.nav-btn {
  border-radius: 10px;
  gap: 2px;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.nav-btn .nav-icon--glyph {
  font-size: 1.15rem;
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(34, 211, 238, 0.25));
}

.nav-btn.active {
  color: #22d3ee;
  background: rgba(34, 211, 238, 0.12);
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.35);
}

.nav-btn--accent.active {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.4);
}

.nav-btn--accent:not(.active) {
  color: #fcd34d;
}

/* —— Fight zone art buttons —— */
.fight-zone-btn {
  flex-direction: column;
  gap: 6px;
  padding: 8px 6px 10px;
  min-height: 0;
}

.fight-zone-btn .zone-img {
  width: min(100%, 88px);
  max-width: 88px;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: #020617;
  display: block;
  margin: 0 auto;
  flex-shrink: 0;
}

.fight-zone-btn.def-btn.active .zone-img {
  border-color: #38bdf8;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.45);
}

.fight-zone-btn.atk-btn.active .zone-img {
  border-color: #f87171;
  box-shadow: 0 0 14px rgba(248, 113, 113, 0.45);
}

.fight-zone-btn span:not(.zone-icon) {
  font-size: 0.72rem;
  font-weight: 700;
}

@media (max-width: 380px) {
  .home-hub { gap: 8px; }
  .hub-card { min-height: 96px; }
  .hub-card-body { min-height: 96px; padding: 10px; }
  .hub-card-title { font-size: 0.82rem; }
  .nav-btn span[data-i18n],
  .nav-btn > span:last-child {
    font-size: 0.48rem;
  }
  .fight-zone-btn .zone-img { max-width: 72px; }
}

@media (min-width: 600px) {
  .home-hub {
    grid-template-columns: 1fr 1fr;
  }
  .hub-card { min-height: 120px; }
  .hub-card-body { min-height: 120px; }
  .fight-zone-btn .zone-img { max-width: 110px; }
}

@media (max-height: 500px), (orientation: landscape) and (max-width: 900px) {
  .home-hub {
    grid-template-columns: repeat(3, 1fr);
  }
  .hub-card--wide { grid-column: span 1; }
  .hub-card { min-height: 72px; }
  .hub-card-body { min-height: 72px; padding: 8px; }
  .hub-card-desc { display: none; }
  .fight-zone-btn .zone-img { max-width: 56px; }
}

/* ── Pre-Sale ── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.presale-header-btn {
  flex-shrink: 0;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(251, 191, 36, 0.55);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.22), rgba(234, 88, 12, 0.18));
  color: #fde68a;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.presale-header-btn:hover {
  border-color: rgba(251, 191, 36, 0.9);
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.35);
}

.presale-header-btn:active {
  transform: scale(0.97);
}

.presale-badge {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: linear-gradient(120deg, rgba(251, 191, 36, 0.12), rgba(34, 211, 238, 0.06));
}

.presale-badge-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(253, 230, 138, 0.75);
}

.presale-badge-date {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fde68a;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.35);
}

.presale-card {
  margin-bottom: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(34, 211, 238, 0.22);
  background: rgba(2, 6, 23, 0.72);
}

.presale-card-title {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 800;
  color: #67e8f9;
  letter-spacing: 0.04em;
}

.presale-hint {
  margin: 0 0 10px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: rgba(148, 163, 184, 0.95);
}

.presale-email-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.presale-input {
  flex: 1 1 180px;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(34, 211, 238, 0.35);
  background: rgba(15, 23, 42, 0.9);
  color: #e2e8f0;
  font-size: 0.9rem;
}

.presale-input:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.75);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.15);
}

.presale-status {
  min-height: 1.2em;
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: #94a3b8;
}

.presale-status--ok { color: #4ade80; }
.presale-status--error { color: #f87171; }

.presale-chains {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 12px;
}

@media (min-width: 720px) {
  .presale-chains {
    grid-template-columns: repeat(4, 1fr);
  }
}

.presale-chain-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(34, 211, 238, 0.28);
  background: rgba(15, 23, 42, 0.85);
  color: #e2e8f0;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.presale-chain-btn:hover {
  border-color: rgba(34, 211, 238, 0.55);
}

.presale-chain-btn.is-active {
  border-color: rgba(251, 191, 36, 0.75);
  background: linear-gradient(145deg, rgba(251, 191, 36, 0.14), rgba(15, 23, 42, 0.95));
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.18);
}

.presale-chain-name {
  font-size: 0.88rem;
  font-weight: 800;
}

.presale-chain-meta {
  font-size: 0.68rem;
  color: #94a3b8;
}

.presale-chain-tag {
  margin-top: 4px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #4ade80;
}

.presale-chain-tag--warn {
  color: #fbbf24;
}

.presale-packs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

@media (min-width: 720px) {
  .presale-packs {
    grid-template-columns: repeat(3, 1fr);
  }
}

.presale-pack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(34, 211, 238, 0.28);
  background:
    linear-gradient(165deg, rgba(15, 23, 42, 0.95), rgba(2, 6, 23, 0.92)),
    radial-gradient(circle at top right, rgba(34, 211, 238, 0.12), transparent 55%);
}

.presale-pack--starter {
  border-color: rgba(148, 163, 184, 0.45);
}

.presale-pack--pro {
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.12);
}

.presale-pack--elite {
  border-color: rgba(251, 191, 36, 0.55);
  box-shadow: 0 0 28px rgba(251, 191, 36, 0.14);
  background:
    linear-gradient(165deg, rgba(30, 20, 8, 0.95), rgba(2, 6, 23, 0.95)),
    radial-gradient(circle at top right, rgba(251, 191, 36, 0.16), transparent 55%);
}

.presale-pack-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.presale-pack-name {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: #e2e8f0;
}

.presale-pack-price {
  font-size: 1.35rem;
  font-weight: 900;
  color: #fbbf24;
  letter-spacing: -0.02em;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.35);
}

.presale-pack-credits {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: #22d3ee;
}

.presale-pack-desc {
  margin: 0 0 4px;
  flex: 1;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #94a3b8;
}

.presale-checklist {
  margin: 0 0 10px;
  padding-left: 1.15rem;
  font-size: 0.78rem;
  line-height: 1.55;
  color: #cbd5e1;
}

.presale-wallet {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.4;
  color: #94a3b8;
}

.presale-wallet.is-ok { color: #4ade80; }
.presale-wallet.is-warn { color: #fbbf24; }

.presale-orders {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.presale-order {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.65);
  font-size: 0.78rem;
}

.presale-order-main {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  color: #e2e8f0;
  margin-bottom: 4px;
}

.presale-order-meta {
  color: #94a3b8;
  word-break: break-all;
  margin-bottom: 4px;
}

.presale-order a {
  color: #22d3ee;
  text-decoration: none;
  font-weight: 700;
}

.presale-order a:hover {
  text-decoration: underline;
}

@media (max-width: 480px) {
  .presale-header-btn {
    padding: 0 8px;
    font-size: 0.62rem;
    height: 28px;
  }
  .header--bar {
    gap: 6px;
    padding: 6px 8px;
  }
}
