:root {
  /* Aether cosmos accents (mini-app palette) */
  --cosmos-bg: #0b0c10;
  --cosmos-violet: #6c63ff;
  --cosmos-cyan: #00f2fe;
  --cosmos-gold: #ffd700;
  --ether-purple: #1a0a2e;
  --ether-purple-mid: #2d1b4e;
  --ether-purple-soft: #382560;
  --crystal-teal: #2dd4bf;
  --crystal-teal-soft: #5eead4;
  --gold-accent: #d4af37;
  --gold-soft: #f0d875;
  --text: #ece6f5;
  --muted: #a89cc4;
  --danger: #f472b6;
  --ok: #6ee7b7;
  --card: rgba(45, 27, 78, 0.55);
  --card-edge: rgba(45, 212, 191, 0.16);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  background: radial-gradient(120% 80% at 50% 0%, var(--ether-purple-mid), var(--ether-purple));
  color: var(--text);
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: touch;
}

body.tg-webapp {
  touch-action: pan-y;
}

button,
.btn,
.tab,
.btn-locale,
.btn-ghost,
.btn-icon,
.stranger-card {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
}

#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
}

/* Top bar */
.topbar {
  padding: 0.75rem 1rem 0.6rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.18);
  background: rgba(26, 10, 46, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.title {
  font-size: 1.2rem;
  margin: 0;
  color: var(--crystal-teal);
  letter-spacing: 0.04em;
  font-weight: 700;
}

.subtitle {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.nav-hint {
  margin: 0.45rem 0 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted);
  opacity: 0.92;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 0.55rem;
  gap: 0.4rem;
}

.exchange-chip {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.45);
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold-soft);
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
}

.coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.45);
  background: rgba(26, 10, 46, 0.55);
  color: var(--gold-accent);
  font-size: 0.78rem;
  font-weight: 700;
}

.coin-pill .muted {
  color: var(--muted);
  font-weight: 500;
}

.btn-locale {
  min-width: 2.6rem;
  height: 2.4rem;
  padding: 0 0.6rem;
  border-radius: 10px;
  border: 1px solid rgba(45, 212, 191, 0.45);
  background: rgba(45, 27, 78, 0.65);
  color: var(--crystal-teal);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

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

/* View / cards */
.view {
  flex: 1;
  padding: 0.75rem 0.9rem 1rem;
  position: relative;
  z-index: 1;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.7rem;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28);
}

.card.hint {
  background: rgba(45, 27, 78, 0.35);
  font-size: 0.8rem;
  color: var(--muted);
}

.card h2,
.card h3 {
  margin: 0 0 0.55rem;
  font-size: 0.98rem;
  color: var(--crystal-teal);
}

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

.xs {
  font-size: 0.72rem;
}

.big {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gold-accent);
  letter-spacing: 0.02em;
}

.list-item {
  font-size: 0.85rem;
  margin: 0.25rem 0;
  color: var(--text);
}

.row-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}

.row-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

/* Hero card */
.stranger-head {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  margin-bottom: 0.7rem;
}

.stranger-glyph {
  font-size: 2rem;
  width: 3rem;
  height: 3rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.18), rgba(212, 175, 55, 0.18));
  border: 1px solid rgba(212, 175, 55, 0.35);
  flex-shrink: 0;
}

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

.stranger-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.stranger-sub {
  font-size: 0.76rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.stat-block {
  margin-top: 0.35rem;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
}

.stat-row label {
  width: 7.5rem;
  color: var(--muted);
  flex-shrink: 0;
  font-size: 0.74rem;
}

.stat-val {
  width: 1.8rem;
  text-align: right;
  color: var(--text);
  font-weight: 700;
  font-size: 0.78rem;
}

.bar {
  flex: 1;
  height: 8px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 999px;
  overflow: hidden;
}

.bar.bar-thin {
  height: 5px;
}

.bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--crystal-teal), var(--gold-accent));
  border-radius: 999px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  min-height: 2.6rem;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--ether-purple);
  background: linear-gradient(135deg, var(--crystal-teal), var(--crystal-teal-soft));
  box-shadow: 0 6px 14px rgba(45, 212, 191, 0.18);
}

.btn:active {
  transform: scale(0.98);
  filter: brightness(0.95);
}

.btn-ghost {
  background: transparent;
  color: var(--crystal-teal);
  border: 1px solid rgba(45, 212, 191, 0.45);
  box-shadow: none;
}

.btn-ghost:active {
  background: rgba(45, 212, 191, 0.1);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-accent), var(--gold-soft));
  color: #1a0a2e;
  box-shadow: 0 6px 14px rgba(212, 175, 55, 0.22);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  filter: grayscale(0.2);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.4rem;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  cursor: pointer;
}

.btn-icon:active {
  background: rgba(255, 255, 255, 0.08);
}

/* Status pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.status-pill.idle {
  background: rgba(45, 27, 78, 0.6);
  color: var(--muted);
}

.status-pill.ok {
  color: var(--ok);
  border-color: rgba(110, 231, 183, 0.35);
  background: rgba(45, 90, 78, 0.18);
}

.status-pill.running {
  color: var(--gold-accent);
  border-color: rgba(212, 175, 55, 0.45);
  background: rgba(60, 30, 12, 0.25);
}

.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold-accent);
  box-shadow: 0 0 8px var(--gold-accent);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.4;
    transform: scale(0.85);
  }
}

@keyframes pulse-gold {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(255, 193, 7, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 193, 7, 0);
  }
}

/* Islands */
.island-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
}

.island-head h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
}

.progress-wrap {
  margin-top: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.progress-bg {
  height: 8px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--crystal-teal), var(--gold-accent));
  transition: width 0.4s ease;
}

/* Fragments */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.frag-card {
  margin-bottom: 0;
}

.frag-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.4rem;
}

.frag-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 3px;
  margin-top: 0.55rem;
}

.frag-cell {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.frag-cell.owned {
  color: var(--ether-purple);
  border-width: 2px;
}

.frag-cell.owned.frag-rarity-dim {
  background: linear-gradient(135deg, #6b7280, #9ca3af);
  border-color: #4b5563;
}

.frag-cell.owned.frag-rarity-flickering {
  background: linear-gradient(135deg, #38bdf8, #7dd3fc);
  border-color: #0ea5e9;
}

.frag-cell.owned.frag-rarity-shining {
  background: linear-gradient(135deg, var(--crystal-teal), var(--crystal-teal-soft));
  border-color: var(--crystal-teal);
}

.frag-cell.owned.frag-rarity-radiant {
  background: linear-gradient(135deg, #a78bfa, #e879f9);
  border-color: #c084fc;
}

.frag-cell.owned.frag-rarity-primordial {
  background: linear-gradient(135deg, var(--gold-accent), var(--gold-soft));
  border-color: #fbbf24;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.45);
}

.frag-cell.frag-new {
  animation: frag-pulse 1.8s ease-in-out infinite;
}

@keyframes frag-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.55);
  }
  50% {
    box-shadow: 0 0 14px 3px rgba(94, 234, 212, 0.35);
  }
}

.frag-complete {
  border-color: rgba(212, 175, 55, 0.55) !important;
  box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.35),
    0 8px 28px rgba(212, 175, 55, 0.12),
    0 6px 22px rgba(0, 0, 0, 0.28) !important;
}

.frag-bonus-line {
  margin: 0 0 0.35rem;
}

.frag-actions {
  margin-top: 0.55rem;
}

.frag-tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.frag-tile {
  border-radius: 8px;
  padding: 0.5rem 0.55rem;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-height: 92px;
}

.frag-tile header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.4rem;
}

.frag-tile h4 {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.2;
}

.frag-tile .frag-rarity-pill {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  white-space: nowrap;
}

.frag-tile .frag-desc {
  margin: 0;
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.25;
}

.frag-tile.is-locked {
  opacity: 0.65;
}

.frag-tile.is-locked .frag-silhouette {
  color: var(--muted);
  font-style: italic;
}

.frag-tile.frag-rarity-dim {
  border-color: rgba(156, 163, 175, 0.45);
}

.frag-tile.frag-rarity-flickering {
  border-color: rgba(14, 165, 233, 0.55);
}

.frag-tile.frag-rarity-shining {
  border-color: rgba(167, 139, 250, 0.55);
}

.frag-tile.frag-rarity-primordial {
  border-color: rgba(212, 175, 55, 0.7);
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.18);
}

/* Fragment copy management */
.frag-copies {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.5rem;
}
.frag-copy-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem;
  background: rgba(255, 255, 255, 0.04);
  border-left: 2px solid #666;
  border-radius: 3px;
  font-size: 0.78rem;
  min-width: 0;
}
.frag-copy-row.is-equipped {
  background: rgba(255, 200, 80, 0.12);
  border-left-color: #ffaa00;
}
.frag-copy-info {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-word;
}
.frag-copy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  flex: 0 0 auto;
}
.frag-copy-actions .btn {
  white-space: nowrap;
}
.frag-copy-eq-label {
  align-self: center;
  padding: 0 0.25rem;
}

.rift-vitrine {
  position: relative;
  margin: 0 0 0.8rem;
  padding: 1.1rem 1rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(212, 175, 55, 0.5);
  background:
    radial-gradient(120% 120% at 50% 0%, rgba(212, 175, 55, 0.18), transparent 60%),
    radial-gradient(120% 100% at 50% 110%, rgba(91, 33, 182, 0.32), transparent 65%),
    rgba(0, 0, 0, 0.45);
  box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.18),
    0 12px 28px rgba(91, 33, 182, 0.18);
  overflow: hidden;
}

.rift-vitrine .rift-glow {
  position: absolute;
  inset: -40% -10% auto -10%;
  height: 200%;
  background: conic-gradient(from 90deg, transparent, rgba(212, 175, 55, 0.16), transparent 60%);
  animation: rift-shimmer 9s linear infinite;
  pointer-events: none;
}

@keyframes rift-shimmer {
  to { transform: rotate(360deg); }
}

.rift-vitrine.rift-complete {
  border-color: rgba(212, 175, 55, 0.85);
  box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.35),
    0 0 28px rgba(212, 175, 55, 0.25);
}

.rift-vitrine .rift-header h2 {
  margin: 0 0 0.25rem;
  letter-spacing: 0.5px;
}

.rift-vitrine .rift-progress {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.55rem 0 0.6rem;
}

.rift-vitrine .rift-counter {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--gold-accent);
  min-width: 3rem;
}

.rift-vitrine .rift-progress .bar {
  flex: 1;
}

.rift-vitrine .rift-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.35rem;
}

.rift-tile {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(212, 175, 55, 0.25);
  color: rgba(212, 175, 55, 0.5);
}

.rift-tile.is-owned {
  background: linear-gradient(135deg, var(--gold-accent), var(--gold-soft));
  color: #1a1a1a;
  border-color: rgba(255, 215, 130, 0.85);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.45);
}

.rift-vitrine .rift-vitrine-tip,
.rift-vitrine .rift-complete-line {
  margin: 0.6rem 0 0;
  font-size: 0.78rem;
}

.rift-complete-line {
  color: var(--gold-accent);
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .rift-vitrine .rift-glow {
    animation: none;
  }
  .frag-cell.frag-new {
    animation: none;
  }
}

.subtabbar {
  display: flex;
  gap: 0.3rem;
  overflow-x: auto;
  padding: 0.35rem 0.1rem 0.4rem;
  margin-bottom: 0.4rem;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.subtabbar::-webkit-scrollbar {
  height: 4px;
}

.subtabbar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.subtabbar .subtab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}

.subtabbar .subtab .subtab-label {
  font-size: 0.78rem;
}

.subtabbar .subtab.active {
  background: rgba(212, 175, 55, 0.18);
  color: var(--gold-accent);
  border-color: rgba(212, 175, 55, 0.45);
}

.bp-track {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem;
}

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

.bp-tier .bp-rewards {
  margin-top: 0.25rem;
}

.bp-tier .bp-rewards p {
  margin: 0.15rem 0;
  font-size: 0.72rem;
  line-height: 1.25;
}

.chest-merge-block {
  margin-bottom: 0.75rem;
}

.chest-merge-block:last-child {
  margin-bottom: 0;
}

.spiral-battle {
  margin-top: 0.35rem;
}

.spiral-battle-row {
  margin-bottom: 0.25rem;
}

.hp-block {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  margin-top: 0.4rem;
}

.hp-block .hp-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
}

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

.hp-block .hp-val {
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.hp-block .hp-fill {
  background: linear-gradient(90deg, #6ee7b7, #34d399);
  transition: width 0.3s ease;
}

.hp-block.hp-low .hp-fill {
  background: linear-gradient(90deg, #f0d875, #f59e0b);
}

.hp-block.hp-fallen .hp-fill {
  background: linear-gradient(90deg, #f472b6, #ef4444);
}

.hp-fallen-hint {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--danger);
}

.hp-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.defeat-heal-hint {
  margin-top: 0.35rem;
}

.alloc-banner {
  margin: 0.4rem 0 0.3rem;
  padding: 0.35rem 0.55rem;
  background: rgba(212, 175, 55, 0.14);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--gold-soft);
}

.btn-stat-plus {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 55, 0.55);
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-soft);
  font-weight: 700;
  margin-left: 0.4rem;
  cursor: pointer;
  flex: 0 0 auto;
}

.btn-stat-plus:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chest-dialog {
  text-align: center;
}

.chest-dialog .chest-icon {
  font-size: 2.4rem;
  filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.5));
  margin-bottom: 0.4rem;
}

.chest-dialog .chest-icon[data-tier="silver"] {
  filter: drop-shadow(0 0 8px rgba(148, 163, 184, 0.6));
}

.chest-dialog .chest-icon[data-tier="gold"] {
  filter: drop-shadow(0 0 12px rgba(240, 216, 117, 0.8));
}

.chest-dialog .chest-icon[data-tier="mythic"] {
  filter: drop-shadow(0 0 14px rgba(212, 175, 55, 1));
}

.chest-loot {
  list-style: none;
  padding: 0;
  margin: 0.4rem auto 0;
  max-width: 320px;
  text-align: left;
}

.chest-loot li {
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  margin-bottom: 0.3rem;
  font-size: 0.85rem;
}

.currency-help section {
  margin-bottom: 0.6rem;
}

.currency-help h4 {
  margin: 0 0 0.2rem;
  font-size: 0.9rem;
  color: var(--gold-soft);
}

.inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.5rem;
}

.inv-card {
  display: flex;
  gap: 0.5rem;
  padding: 0.55rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.inv-card:active,
.inv-card:hover {
  transform: translateY(-1px);
  border-color: rgba(212, 175, 55, 0.5);
}

/* +N enhancement badges */
.inv-plus-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: linear-gradient(135deg, #ffaa00, #ff6600);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
.inv-plus-inline {
  color: #ffaa00;
  font-weight: 700;
  font-size: 0.85em;
  margin-left: 0.2em;
}

/* Dismantle bar + selection */
.inv-dismantle-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.4rem 0 0.2rem;
  padding: 0.4rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
}
.inv-card.inv-selected {
  outline: 2px solid #ffaa00;
  outline-offset: -2px;
}
.inv-card.inv-card-disabled {
  opacity: 0.5;
  pointer-events: auto;
  cursor: not-allowed;
}
.inv-dismantle-check {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 1.1rem;
  color: #ffaa00;
  pointer-events: none;
}
.inv-card {
  position: relative;
}

.inv-icon {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: rgba(255, 255, 255, 0.06);
  flex: 0 0 auto;
}

.inv-icon[data-rarity="dim"] {
  background: rgba(168, 156, 196, 0.15);
}

.inv-icon[data-rarity="flickering"] {
  background: rgba(45, 212, 191, 0.18);
}

.inv-icon[data-rarity="shining"] {
  background: rgba(96, 165, 250, 0.22);
}

.inv-icon[data-rarity="radiant"] {
  background: rgba(168, 85, 247, 0.22);
}

.inv-icon[data-rarity="primordial"] {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.45), rgba(240, 216, 117, 0.25));
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.4);
}

.inv-card.rarity-primordial {
  border-color: rgba(212, 175, 55, 0.6);
}

.inv-card.rarity-radiant {
  border-color: rgba(168, 85, 247, 0.5);
}

.inv-card.rarity-shining {
  border-color: rgba(96, 165, 250, 0.4);
}

.inv-meta {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  flex: 1;
  min-width: 0;
}

.inv-title {
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inv-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.inv-stat {
  background: rgba(255, 255, 255, 0.05);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.inv-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.2rem 0.45rem;
  font-size: 0.7rem;
  line-height: 1.2;
}

/* Bag cards: stack stats in one column so labels don’t collide */
.inv-stats-list {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  font-size: 0.72rem;
  line-height: 1.25;
  width: 100%;
}

.inv-stats-list .inv-stat-cell {
  width: 100%;
  box-sizing: border-box;
}

.inv-stats-list .inv-stat-key {
  max-width: 58%;
}

.inv-stat-cell {
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.12rem 0.3rem;
  border-radius: 4px;
}

.inv-stat-key {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 65%;
}

.inv-stat-val {
  color: var(--crystal-teal-soft);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.inv-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.4rem 0 0.35rem;
}

.inv-filter-btn {
  font-size: 0.72rem;
  padding: 0.25rem 0.55rem;
}

.inv-filter-btn.active {
  border-color: rgba(212, 175, 55, 0.55);
  color: var(--gold-soft);
  background: rgba(212, 175, 55, 0.12);
}

.inv-group-title {
  font-size: 0.8rem;
  color: var(--crystal-teal-soft);
  margin: 0.6rem 0 0.35rem;
  padding: 0 0.1rem;
}

.inv-equipped-strip {
  margin-bottom: 0.5rem;
}

.inv-strip-title {
  font-size: 0.85rem;
  margin: 0 0 0.4rem;
}

.inv-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.inv-strip-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.3rem 0.45rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.65rem;
}

.inv-strip-ico {
  font-size: 1.15rem;
  line-height: 1;
}

.inv-strip-sl {
  max-width: 4.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.inv-equipped {
  font-size: 0.7rem;
  color: var(--gold-soft);
}

.inv-dialog-head {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 0.6rem;
}

.inv-dialog-stats {
  list-style: none;
  padding: 0;
  margin: 0.3rem 0 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
}

.spiral-battle-host:empty {
  display: none;
}

.spiral-battle {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0.4rem 0;
  padding: 0.45rem 0.5rem;
  background: rgba(0, 0, 0, 0.32);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.spiral-battle-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
}

.spiral-battle-row .bar {
  flex: 1;
}

.spiral-battle-row .hp-fill {
  background: linear-gradient(90deg, #6ee7b7, #34d399);
}

.spiral-battle-row .hp-fill.foe {
  background: linear-gradient(90deg, #f472b6, #ef4444);
}

.bp-tier.claimed .bp-rewards {
  display: none;
}

.bp-tier.claimed > header::after {
  content: '✓';
  color: var(--gold-accent);
  margin-left: 0.4rem;
}

.quest-list,
.weekly-list,
.bp-track {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.quest-card.done {
  opacity: 0.7;
}

.quest-head,
.bp-tier > header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.weekly-step.locked {
  opacity: 0.55;
}

.event-milestones,
.leaderboard,
.world-feed,
.tutorial-list {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.event-milestones li,
.leaderboard li,
.world-feed li,
.tutorial-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  font-size: 0.85rem;
}

.bp-tier {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  background: rgba(0, 0, 0, 0.32);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.bp-tier.locked {
  opacity: 0.55;
}

.bp-tier.claimed {
  border-color: rgba(212, 175, 55, 0.45);
}

.bp-rewards p {
  margin: 0;
  font-size: 0.85rem;
}

.bp-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.ach-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.ach-card.claimed {
  opacity: 0.7;
}

.ach-card.completed {
  border-color: rgba(212, 175, 55, 0.4);
}

.echo-listing {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.frag-bonus-btn {
  font-size: 0.82rem;
  padding: 0.35rem 0.65rem;
}

.bazaar-filters {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0.35rem 0 0.5rem;
}

.select-input {
  width: 100%;
  min-height: 2.6rem;
  padding: 0 0.65rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  background: rgba(15, 5, 30, 0.6);
  border: 1px solid rgba(45, 212, 191, 0.35);
  border-radius: 10px;
}

.select-input:focus {
  outline: none;
  border-color: var(--crystal-teal);
}

.sell-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.45rem 0 0.55rem;
}

.flex-grow {
  flex: 1 1 8rem;
  min-width: 0;
}

.sell-price-input {
  flex: 0 0 auto;
}

.sell-hint:empty {
  display: none;
}

/* Market */
.lot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.lot-main {
  flex: 1;
  min-width: 0;
}

.lot-title {
  font-weight: 700;
  font-size: 0.92rem;
}

.rarity-tag {
  display: inline-block;
  margin-top: 0.2rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.rarity-tag.rarity-dim {
  color: #d1d5db;
  background: rgba(75, 85, 99, 0.35);
}

.rarity-tag.rarity-flickering {
  color: #bae6fd;
  background: rgba(14, 165, 233, 0.22);
}

.rarity-tag.rarity-shining {
  color: var(--crystal-teal-soft);
  background: rgba(45, 212, 191, 0.15);
}

.rarity-tag.rarity-radiant {
  color: #e9d5ff;
  background: rgba(168, 85, 247, 0.22);
}

.rarity-tag.rarity-primordial {
  color: var(--gold-soft);
  background: rgba(212, 175, 55, 0.18);
  border-color: rgba(212, 175, 55, 0.35);
}

.vip-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.vip-line-grow {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.loadout-slot-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.loadout-slot-row:last-of-type {
  border-bottom: none;
}

.loadout-slot-meta {
  flex: 1;
  min-width: 0;
}

.loadout-slot-label {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--crystal-teal-soft);
}

.loadout-slot-item {
  font-size: 0.88rem;
  margin-top: 0.15rem;
  word-break: break-word;
}

.loadout-slot-stats {
  margin-top: 0.2rem;
  line-height: 1.35;
  max-height: 3.2em;
  overflow: hidden;
}

.loadout-slot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.loadout-section-title {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.88rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.loadout-section-title:first-child {
  margin-top: 0;
}

.loadout-sp-line {
  margin: 0 0 0.5rem;
}

.skill-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.skill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.skill-row:last-child {
  border-bottom: none;
}

.skill-name {
  font-weight: 600;
  font-size: 0.88rem;
}

.pick-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.pick-item-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.2rem;
  text-align: left;
  padding: 0.5rem 0.65rem;
}

.pick-item-main {
  display: block;
  width: 100%;
}

.pick-item-stats {
  display: block;
  line-height: 1.3;
  max-height: 3.1em;
  overflow: hidden;
}

/* Spiral */
.spiral-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin: 0.3rem 0 0.65rem;
}

.spiral-meta-hint {
  margin: 0 0 0.25rem;
  line-height: 1.35;
}

.spiral-sum {
  margin: 0 0 0.5rem;
}

.spiral-daily-reset-block {
  margin-top: 0.5rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}

.spiral-daily-reset-actions {
  margin-top: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.spiral-run-toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.spiral-run-toolbar.spiral-run-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  align-items: stretch;
}

.spiral-run-grid .btn {
  min-height: 2.75rem;
  padding: 0.55rem 0.65rem;
  font-size: 0.85rem;
}

.spiral-auto-locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.spiral-last-round:empty {
  display: none;
}

.spiral-last-round:not(:empty) {
  margin-top: 0.35rem;
}

.spiral-session-log:not([hidden]) {
  margin-top: 0.45rem;
  max-height: 8rem;
  overflow: auto;
  white-space: pre-wrap;
}

.spiral-log-details {
  margin-top: 0.55rem;
}

.spiral-log-details summary {
  cursor: pointer;
  color: var(--crystal-teal-soft);
  font-size: 0.82rem;
}

.spiral-log-details .spiral-log {
  margin-top: 0.35rem;
}

.spiral-floor-input {
  flex: 1 1 6rem;
  max-width: 8rem;
  width: auto !important;
  min-width: 5rem;
}

.spiral-log {
  max-height: 11rem;
  overflow: auto;
  margin-top: 0.55rem;
  font-size: 0.72rem;
  line-height: 1.35;
}

.spiral-floor-bar {
  height: 10px;
  margin: 0.55rem 0 0.35rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.spiral-floor-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--crystal-teal), var(--gold-accent));
}

.spiral-floor-fill--run {
  animation: spiral-floor-grow 0.85s linear forwards;
}

@keyframes spiral-floor-grow {
  from {
    width: 0%;
  }

  to {
    width: 100%;
  }
}

.spiral-legacy {
  margin-top: 0.65rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.spiral-legacy summary {
  cursor: pointer;
  color: var(--crystal-teal-soft);
}

.distortion-pick {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.distortion-opt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 0.2rem;
  padding: 0.55rem 0.65rem;
}

.distortion-opt-title {
  font-weight: 700;
  font-size: 0.9rem;
}

.spiral-stats > div {
  background: rgba(26, 10, 46, 0.45);
  border: 1px solid rgba(212, 175, 55, 0.18);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
}

.num {
  width: 5.5rem;
  height: 2.6rem;
  padding: 0 0.7rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  background: rgba(15, 5, 30, 0.6);
  border: 1px solid rgba(45, 212, 191, 0.35);
  border-radius: 10px;
}

.shop-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.shop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.45rem 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.shop-row:last-child {
  border-bottom: none;
}

.shop-text {
  flex: 1;
  min-width: 0;
}

.shop-title {
  font-weight: 700;
  font-size: 0.88rem;
}

.stars-shop {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* Tabs */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 6px 4px calc(8px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(22, 10, 38, 0.96), rgba(11, 12, 16, 0.98));
  border-top: 1px solid rgba(108, 99, 255, 0.25);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
  z-index: 50;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabbar::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 3.35rem;
  min-height: 3.1rem;
  padding: 6px 2px;
  margin: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

@media (max-width: 380px) {
  .tab-label {
    font-size: 0.62rem;
  }
  .tab-icon {
    font-size: 1.2rem;
  }
}

.tab:active {
  background: rgba(45, 212, 191, 0.08);
}

.tab.active {
  color: var(--text);
  background: rgba(45, 212, 191, 0.14);
  box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.4);
}

.tab-icon {
  font-size: 1.45rem;
  line-height: 1;
  filter: grayscale(0.2);
}

.tab.active .tab-icon {
  filter: none;
}

.tab-label {
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.01em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  padding: 0;
}

.modal.hidden {
  display: none;
}

.modal-panel {
  background: linear-gradient(180deg, var(--ether-purple-soft), var(--ether-purple-mid));
  border-top: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 18px 18px 0 0;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.modal-head h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--gold-accent);
}

.modal-body {
  font-size: 0.9rem;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.85rem;
  justify-content: flex-end;
}

.modal-actions .btn {
  flex: 1;
}

.card-title {
  margin: 0 0 0.65rem;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--crystal-teal-soft);
}

.bastion-card {
  border-color: rgba(108, 99, 255, 0.35);
}

.stranger-glyph--lg {
  font-size: 2.35rem;
  width: 3.35rem;
  height: 3.35rem;
}

.btn-compact {
  min-height: 2.35rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
}

/* Hall of Strangers modal */
.stranger-hall {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding-right: 2px;
}

.hall-card {
  padding: 0.65rem 0.75rem;
  background: rgba(26, 10, 46, 0.55);
  border: 1px solid rgba(45, 212, 191, 0.22);
  border-radius: 12px;
}

.hall-card.active {
  border-color: var(--gold-accent);
  box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.35) inset;
}

.hall-card-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.hall-card-info {
  flex: 1;
  min-width: 0;
}

.hall-card-info .stranger-sub {
  margin-bottom: 0.2rem;
  line-height: 1.35;
}

.hall-stat-line {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.hall-card-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* Stranger picker */
.stranger-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stranger-card {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.8rem;
  background: rgba(26, 10, 46, 0.55);
  border: 1px solid rgba(45, 212, 191, 0.2);
  border-radius: 12px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.stranger-card.active {
  border-color: var(--gold-accent);
  box-shadow: 0 0 0 1px var(--gold-accent) inset;
}

.stranger-card:active {
  transform: scale(0.99);
}

.badge-on {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ether-purple);
  background: var(--gold-accent);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}

.reward-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.reward-list li {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  font-size: 0.88rem;
}

.boss-result .log {
  margin-top: 0.7rem;
}

/* Skeleton */
.skel {
  pointer-events: none;
}

.skel-line {
  height: 12px;
  border-radius: 6px;
  margin: 0.45rem 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(255, 255, 255, 0.05) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.skel-line.w50 {
  width: 50%;
}
.skel-line.w70 {
  width: 70%;
}
.skel-line.w90 {
  width: 90%;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* Logs */
.log {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  max-height: 160px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* Toast */
.toast {
  position: fixed;
  top: calc(0.65rem + env(safe-area-inset-top, 0px));
  right: calc(0.55rem + env(safe-area-inset-right, 0px));
  left: auto;
  bottom: auto;
  transform: translateY(-6px);
  max-width: min(92vw, 18rem);
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 12px;
  background: rgba(20, 10, 36, 0.95);
  color: var(--text);
  border: 1px solid rgba(212, 175, 55, 0.4);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 300;
  text-align: right;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast[data-kind="success"] {
  border-color: rgba(110, 231, 183, 0.45);
}

.toast[data-kind="error"] {
  border-color: rgba(244, 114, 182, 0.6);
  color: var(--danger);
}

.vip-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin: 0.5rem 0;
}
.vip-table th,
.vip-table td {
  border: 1px solid rgba(212, 175, 55, 0.22);
  padding: 0.35rem 0.45rem;
  text-align: left;
  vertical-align: top;
}
.vip-table th {
  font-weight: 600;
  background: rgba(20, 10, 36, 0.55);
}
.exchange-ec-input {
  max-width: 8rem;
}

.exchange-card-prominent {
  border: 1px solid rgba(212, 175, 55, 0.42);
  background:
    linear-gradient(145deg, rgba(212, 175, 55, 0.1), transparent 42%),
    rgba(0, 0, 0, 0.28);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}

.exchange-modal .exchange-modal-row {
  margin-top: 0.5rem;
}

/* Fragment gallery: stacked collapsible sets */
.frag-gallery-hint {
  margin: 0.35rem 0 0.5rem;
  padding: 0 0.15rem;
}

.frag-sets-stack {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.frag-set-details {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.frag-set-details[data-frag-complete='1'] {
  border-color: rgba(212, 175, 55, 0.38);
}

.frag-set-summary {
  list-style: none;
  cursor: pointer;
  padding: 0.6rem 0.75rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.25rem 0.5rem;
  align-items: center;
}

.frag-set-summary::-webkit-details-marker {
  display: none;
}

.frag-set-chevron {
  grid-row: 1 / span 2;
  grid-column: 1;
  width: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-soft);
  font-size: 0.65rem;
  transition: transform 0.15s ease;
}

.frag-set-chevron::before {
  content: '▸';
}

.frag-set-details[open] .frag-set-chevron {
  transform: rotate(90deg);
}

.frag-set-summary-title {
  font-weight: 700;
  font-size: 0.9rem;
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.frag-set-summary-count {
  grid-column: 3;
  grid-row: 1;
  text-align: right;
  white-space: nowrap;
}

.frag-set-summary-bar {
  grid-column: 2 / -1;
  grid-row: 2;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.frag-set-summary-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(45, 212, 191, 0.85), rgba(212, 175, 55, 0.85));
}

.frag-set-body {
  padding: 0 0.65rem 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.frag-tiles--set {
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 0.35rem;
}

/* Market redesign */
.market-filters-card,
.market-sell-card,
.market-listings-card {
  margin-bottom: 0.65rem;
}

.market-lots-host {
  margin-top: 0.35rem;
}

.market-empty {
  margin: 0.35rem 0 0;
}

.market-lots {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.lot-card {
  position: relative;
  border-radius: 14px;
  padding: 0.75rem 0.85rem;
  background:
    linear-gradient(165deg, rgba(45, 212, 191, 0.08), transparent 55%),
    rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.lot-card--rarity-dim {
  border-color: rgba(156, 163, 175, 0.35);
}
.lot-card--rarity-flickering {
  border-color: rgba(14, 165, 233, 0.45);
}
.lot-card--rarity-shining {
  border-color: rgba(96, 165, 250, 0.45);
}
.lot-card--rarity-radiant {
  border-color: rgba(168, 85, 247, 0.5);
}
.lot-card--rarity-primordial {
  border-color: rgba(212, 175, 55, 0.55);
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.15), 0 10px 26px rgba(0, 0, 0, 0.28);
}

.lot-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.lot-card-idx {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--crystal-teal-soft);
  font-variant-numeric: tabular-nums;
}

.lot-card-set {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.25;
}

.lot-card-seller {
  font-size: 0.74rem;
}

.lot-card-buy {
  align-self: stretch;
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  font-weight: 700;
}

.lot-card-price-num {
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.lot-card-price-unit {
  font-size: 0.82rem;
  opacity: 0.9;
  font-weight: 600;
}

.spiral-skill-panel {
  margin-top: 0.5rem;
}
.spiral-skill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

/* ——— Aether pets ——— */
.pets-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.pets-echo-badge {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 0.35rem 0.65rem;
  border-radius: 10px;
  background: rgba(0, 242, 254, 0.12);
  border: 1px solid rgba(0, 242, 254, 0.35);
  color: var(--cosmos-cyan);
}

.pets-seg {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.25);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(108, 99, 255, 0.2);
}

.pets-seg button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}

.pets-seg button.active {
  background: rgba(108, 99, 255, 0.35);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 215, 0, 0.25);
}

.pet-card {
  position: relative;
  border-radius: 14px;
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.65rem;
  background: rgba(11, 12, 16, 0.55);
  border: 2px solid rgba(108, 99, 255, 0.22);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.pet-card:active {
  transform: scale(0.99);
}

.pet-card--active {
  box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.45), 0 6px 22px rgba(108, 99, 255, 0.15);
}

.pet-rarity-common {
  border-color: rgba(160, 160, 170, 0.45);
}
.pet-rarity-flickering {
  border-color: rgba(0, 242, 254, 0.5);
}
.pet-rarity-shining {
  border-color: rgba(255, 215, 0, 0.55);
}
.pet-rarity-primordial {
  border-color: rgba(108, 99, 255, 0.75);
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.12), rgba(11, 12, 16, 0.65));
}

.pet-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.pet-card-name {
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.25;
  color: var(--text);
}

.pet-card-sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.pet-badge-active {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: rgba(255, 215, 0, 0.2);
  color: var(--cosmos-gold);
  border: 1px solid rgba(255, 215, 0, 0.35);
  white-space: nowrap;
}

.pet-stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.5rem;
  font-size: 0.74rem;
}

.pet-stat-row span {
  background: rgba(108, 99, 255, 0.12);
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  color: var(--crystal-teal-soft);
  font-variant-numeric: tabular-nums;
}

.pet-happy {
  margin-top: 0.45rem;
  font-size: 0.8rem;
}

.pet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.pet-actions .btn {
  font-size: 0.72rem;
  padding: 0.35rem 0.5rem;
}

.pet-egg-card {
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.5rem;
  border: 1px solid rgba(108, 99, 255, 0.25);
  background: rgba(11, 12, 16, 0.45);
}

.pet-egg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.pet-shop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-top: 0.5rem;
}

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

.pet-shop-cell {
  border-radius: 10px;
  padding: 0.5rem;
  border: 1px solid rgba(212, 175, 55, 0.22);
  background: rgba(0, 0, 0, 0.2);
}

.pet-detail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  margin: 0.5rem 0;
  font-size: 0.78rem;
  text-align: center;
}

.pet-detail-stats div {
  background: rgba(108, 99, 255, 0.1);
  border-radius: 8px;
  padding: 0.35rem;
}

.pet-skill-row {
  border: 1px solid rgba(0, 242, 254, 0.15);
  border-radius: 10px;
  padding: 0.5rem 0.55rem;
  margin-bottom: 0.45rem;
  background: rgba(0, 0, 0, 0.15);
}

.pet-skill-row h4 {
  margin: 0 0 0.25rem;
  font-size: 0.82rem;
}

.pet-skill-meta {
  font-size: 0.72rem;
  color: var(--muted);
}

.pet-bastion-card {
  border: 1px solid rgba(108, 99, 255, 0.28);
  background: linear-gradient(160deg, rgba(108, 99, 255, 0.08), rgba(11, 12, 16, 0.35));
}

.pet-bastion-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.pet-bastion-glyph {
  font-size: 2rem;
  filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.35));
}

.spiral-companion-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.35rem 0 0.25rem;
  min-height: 1.6rem;
}

.spiral-pet-icon {
  font-size: 1.35rem;
  line-height: 1;
  display: inline-flex;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.spiral-pet-pulse {
  animation: pet-pulse 0.65s ease-out;
}

@keyframes pet-pulse {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 transparent);
  }
  40% {
    transform: scale(1.2);
    filter: drop-shadow(0 0 10px rgba(0, 242, 254, 0.9));
  }
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 transparent);
  }
}

@keyframes pet-hatch-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(108, 99, 255, 0);
  }
  50% {
    box-shadow: 0 0 24px 4px rgba(0, 242, 254, 0.35);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(108, 99, 255, 0);
  }
}

.pet-hatch-anim {
  animation: pet-hatch-glow 1.2s ease-out;
}

/* Fragment bonuses display */
.fragment-bonuses-line {
  margin: 0.5rem 0;
  padding: 0.35rem 0.5rem;
  background: rgba(108, 99, 255, 0.12);
  border-radius: 6px;
  border-left: 2px solid var(--cosmos-violet);
}

/* Cave progress bar */
.cave-progress-wrap {
  margin: 0.35rem 0;
}

.cave-progress-bar {
  height: 6px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 3px;
  overflow: hidden;
}

.cave-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cosmos-cyan), var(--crystal-teal));
  transition: width 0.3s ease;
}

.cave-progress-text {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

/* Combat parameter badges */
.combat-param-badge {
  display: inline-block;
  padding: 0.15rem 0.35rem;
  margin: 0.1rem;
  border-radius: 4px;
  font-size: 0.7rem;
  background: rgba(45, 212, 191, 0.15);
  color: var(--crystal-teal-soft);
}

.combat-param-badge.ether-armor {
  background: rgba(108, 99, 255, 0.15);
  color: #a89cc4;
}

.combat-param-badge.crystal-power {
  background: rgba(255, 215, 0, 0.15);
  color: var(--gold-soft);
}

.echo-cave-bar-wrap {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin: 0.35rem 0 0.1rem;
}

.echo-cave-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--crystal-teal), var(--cosmos-violet));
  transition: width 0.35s ease;
}

/* --- Referrals widget (v1.07) --- */
.referrals-card .referrals-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.referrals-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
}
.referrals-link-info {
  flex: 1 1 14rem;
  min-width: 12rem;
}
.referrals-link-info input {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: inherit;
  font-size: 0.85rem;
}
.referrals-link-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.referrals-pitch {
  margin: 0;
  font-weight: 600;
}
.referrals-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
  margin-top: 0.25rem;
  align-items: baseline;
}
.referrals-rewards-details {
  margin-top: 0.35rem;
}
.referrals-rewards-details summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.referrals-rewards-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.referrals-reward-item {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
}

/* Rewarded video ads (v1.07) */
.ads-row {
  margin-top: 0.4rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.ads-row .ad-cta {
  background: rgba(255, 196, 64, 0.08);
  border-color: rgba(255, 196, 64, 0.35);
}
.ads-row .ad-cta:hover:not(:disabled) {
  background: rgba(255, 196, 64, 0.16);
}
.ads-row .ad-meta {
  font-size: 0.72rem;
  opacity: 0.75;
}
