/* Wealth overview (wallet.html) — content-first, emil-design-eng */

:root {
  --wallet-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --wallet-overview-max: 720px;
}

html[data-app="wallet"] {
  --brand-primary: var(--teal);
  --brand-primary-dim: var(--teal-dim);
}

.wallet-overview {
  max-width: var(--wallet-overview-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Desktop: subnav handles module nav — hide duplicate chips */
@media (min-width: 1024px) {
  body.shell-pro-active .wallet-overview .microapp-mobile-chips {
    display: none !important;
  }

  body.shell-pro-active .wallet-overview .back-header {
    display: none;
  }

  body.shell-pro-active .shell-pro-main {
    padding-top: 16px;
  }
}

@media (max-width: 1023px) {
  body[data-app="wallet"] .wallet-overview .microapp-mobile-chips,
  body[data-app="wallet"] #app-bento-mount .microapp-mobile-chips {
    display: none !important;
  }
}

.wallet-overview-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
}

.wallet-overview-topbar #wallet-journey-nudge:not([hidden]) {
  margin-left: auto;
}

/* Plan + stats — one glance row */
.wallet-overview-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 640px) {
  .wallet-overview-summary {
    grid-template-columns: 1.1fr 1fr;
    align-items: stretch;
  }
}

.wallet-plan-card {
  padding: 16px 18px;
  margin-bottom: 0 !important;
}

.wallet-plan-card .plan-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
}

.wallet-plan-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wallet-plan-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: var(--s2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

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

.wallet-plan-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
}

.wallet-plan-desc {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

.wallet-plan-teaser {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.wallet-plan-teaser-label {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 8px;
}

.wallet-plan-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wallet-plan-tag {
  font-size: 11px;
  background: var(--s2);
  color: var(--text-3);
  padding: 3px 10px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
}

/* Level — compact horizontal strip (not giant ring hero) */
.wallet-level-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  margin-bottom: 0 !important;
}

.wallet-level-ring-sm {
  position: relative;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wallet-level-ring-sm svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.wallet-level-ring-sm-center {
  position: relative;
  z-index: 1;
  font-size: 22px;
  line-height: 1;
}

.wallet-level-body {
  flex: 1;
  min-width: 0;
}

.wallet-level-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 4px;
}

.wallet-level-xp-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 6px;
}

.wallet-xp-bar-wrap {
  height: 6px;
  background: var(--s2);
  border-radius: var(--r-full);
  overflow: hidden;
}

.wallet-xp-bar-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--teal), var(--violet));
  transition: width 800ms var(--wallet-ease-out);
}

/* Today stats — compact */
.wallet-today-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 0 !important;
  border-radius: var(--r-lg);
  background: var(--s1);
  border: 1px solid var(--border);
  overflow: hidden;
}

.wallet-today-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  text-align: center;
}

.wallet-today-cell + .wallet-today-cell {
  border-left: 1px solid var(--border);
}

.wallet-today-emoji { font-size: 20px; }

.wallet-today-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-1);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.wallet-today-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* Neuro-Wallet game — primary stage */
.wallet-game-stage {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-md);
  border-radius: var(--r-lg);
  background: var(--s1);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  min-height: min(560px, calc(100dvh - 280px));
}

.wallet-game-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--s1);
}

.wallet-game-stage-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
}

.wallet-game-stage-sub {
  margin: 2px 0 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.wallet-game-open-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--teal);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--r-pill);
  transition: transform 140ms var(--wallet-ease-out), background 160ms ease;
}

.wallet-game-open-link:active {
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .wallet-game-open-link:hover {
    background: var(--teal-dim);
  }
}

.wallet-game-stage-body {
  flex: 1;
  min-height: 0;
  position: relative;
}

.wallet-game-stage-body iframe {
  width: 100%;
  height: 100%;
  min-height: 480px;
  border: none;
  display: block;
  opacity: 1;
  transition: opacity 200ms var(--wallet-ease-out), filter 200ms var(--wallet-ease-out);
}

.wallet-game-stage.is-loading iframe {
  opacity: 0.35;
  filter: blur(2px);
}

.wallet-game-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--s1);
  z-index: 1;
  transition: opacity 200ms var(--wallet-ease-out);
}

.wallet-game-stage.is-live .wallet-game-loading {
  opacity: 0;
  pointer-events: none;
}

/* Secondary sections */
.wallet-overview-secondary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

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

.wallet-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
  padding: 0 2px;
}

.wallet-vela-card,
.wallet-achievements-card {
  margin-bottom: 0 !important;
}

/* First paint — once, fast */
@keyframes walletOverviewIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

body.wallet-overview-ready .wallet-game-stage {
  animation: walletOverviewIn 240ms var(--wallet-ease-out) forwards;
}

@media (prefers-reduced-motion: reduce) {
  body.wallet-overview-ready .wallet-game-stage {
    animation: none;
  }

  .wallet-game-stage-body iframe,
  .wallet-game-stage.is-loading iframe {
    opacity: 1;
    filter: none;
  }

  .wallet-xp-bar-fill {
    transition: none;
  }
}

/* ── Overview content tiers (function rearrangement IA) ── */
[data-content-tier="secondary"]:not(.is-tier-expanded),
[data-content-tier="tertiary"]:not(.is-tier-expanded) {
  display: none;
}

[data-content-tier="secondary"].is-tier-expanded,
[data-content-tier="tertiary"].is-tier-expanded {
  animation: contentTierReveal 220ms cubic-bezier(0.23, 1, 0.32, 1) both;
}

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

.wallet-tier-toggle,
.content-tier-toggle.wallet-tier-toggle {
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--s2);
  border: 1px solid var(--border);
  cursor: pointer;
}

.wallet-tier-toggle:hover {
  border-color: rgba(26, 184, 148, 0.35);
  color: var(--text-1);
}

.content-tier-toggle-arrow {
  opacity: 0.55;
}

.wallet-tier-toggle[aria-expanded="true"] .content-tier-toggle-arrow {
  transform: rotate(90deg);
  display: inline-block;
}

.wallet-overview-hero .wgs-xp-track,
.wallet-overview-hero .wgs-xp-meta,
.wallet-overview-hero .wgs-hud-player-meta .wgs-hud-top-row {
  display: none;
}

.wallet-overview-hero .wgs-stat-pill:not(#stat-streak-wrap) {
  display: none;
}

.wallet-overview-hero .wgs-hud {
  padding-bottom: 0;
}

.wgs-hero-cta-row {
  margin-bottom: 8px;
}

.wgs-hero-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--violet));
  box-shadow: 0 8px 24px rgba(26, 184, 148, 0.22);
  transition: transform 140ms var(--wallet-ease-out), filter 160ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .wgs-hero-cta:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
  }
}

.wgs-hero-cta:active {
  transform: scale(0.98);
}

.wallet-overview-hero {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wallet-overview-hero .wgs-hud {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 4px 0 0;
  background: var(--s1);
}

@media (prefers-reduced-motion: reduce) {
  [data-content-tier="secondary"].is-tier-expanded,
  [data-content-tier="tertiary"].is-tier-expanded {
    animation: none;
  }

  .wgs-hero-cta {
    transition: none;
  }
}
