/* =============================================================================
   POLPEXA — tokens, reset, ambient scene, mobile application shell.

   Mobile-first. Every rule here is written for a 320px viewport and widened at
   breakpoints in responsive.css. Nothing assumes a desktop canvas.
   ========================================================================== */

:root {
  /* ---- neon apple green: active, earning, positive, confirm ---- */
  --neon-green:        #7CFF3D;
  --neon-green-bright: #A8FF6E;
  --neon-green-dark:   #4FBF1E;
  --neon-glow:         rgba(124, 255, 61, .38);
  --neon-glow-soft:    rgba(124, 255, 61, .14);

  /* ---- metals ---- */
  --metal-light:  #E6EBEF;
  --metal-silver: #AEB8C2;
  --metal-mid:    #6E7A87;
  --metal-dark:   #2A3138;
  --graphite:     #171B20;
  --graphite-2:   #10141A;
  --black:        #07090C;
  --white:        #FFFFFF;

  /* ---- rank accents ---- */
  --bronze:       #CE8B4E;
  --bronze-light: #F0B27F;
  --gold:         #E9C25A;
  --gold-light:   #FFE49A;

  /* ------------------------------------------------------------------
     Drawn from the POLPEXA mark itself — sampled, not guessed.
     The logo is the source of the palette rather than a guest inside it.

       bull  / rising arrow  -> green
       bear  / falling arrow -> red
       cast metal of both    -> graphite

     Semantics: green already carries active/earning/positive. Red is
     reserved for genuine negatives — failed transactions, reverts, wrong
     network, paused. It is deliberately NOT used for "completed", which is
     a good outcome and stays green.
     ------------------------------------------------------------------ */
  --logo-green:       #37923F;
  --logo-green-light: #95ED9F;
  --logo-red:         #992121;
  --logo-red-bright:  #FF5E5F;
  --logo-red-tint:    #FFA8A8;
  --logo-graphite:    #141611;

  /* ---- text ---- */
  --text-primary:   #EEF3F7;
  --text-secondary: #9AA6B2;
  --text-faint:     #66707B;

  /* ---- surfaces: brushed graphite with a cool silver cast ---- */
  --surface:        linear-gradient(157deg, #232B33 0%, #171E25 38%, #10151A 68%, #0A0E12 100%);
  --surface-raised: linear-gradient(157deg, #313B45 0%, #1F2830 40%, #141A20 72%, #0E1216 100%);
  --edge-top:       rgba(233, 240, 246, .20);
  --edge:           rgba(210, 222, 232, .09);

  /* ---- signature gradients: silver -> neon apple green ---- */
  --grad-silver:       linear-gradient(145deg, #F4F8FB 0%, #C6D0DA 30%, #8C97A3 62%, #55606B 100%);
  --grad-silver-neon:  linear-gradient(135deg, #EEF6F1 0%, #C3D3C8 22%, #8FBF72 52%, #7CFF3D 100%);
  --grad-neon:         linear-gradient(150deg, #C8FFA6 0%, #A8FF6E 28%, #7CFF3D 60%, #4FBF1E 100%);
  --grad-metal-sheen:  linear-gradient(105deg, transparent 0%, rgba(255,255,255,.13) 42%, rgba(255,255,255,.03) 55%, transparent 100%);

  /* Fine brushed-metal striation, layered over surfaces at low opacity. */
  --brushed: repeating-linear-gradient(
    98deg,
    rgba(255,255,255,.028) 0px,
    rgba(255,255,255,.028) 1px,
    transparent 1px,
    transparent 3px
  );

  /* ---- depth ---- */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.5);
  --shadow:    0 6px 18px -6px rgba(0,0,0,.72), 0 2px 6px rgba(0,0,0,.4);
  --shadow-lg: 0 18px 40px -12px rgba(0,0,0,.8), 0 6px 14px rgba(0,0,0,.45);

  /* ---- geometry ---- */
  --radius:    16px;
  --radius-sm: 11px;
  --radius-lg: 22px;

  --appbar-h: 64px;   /* tall enough to give the emblem real presence */
  --tabbar-h: 62px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', var(--font);
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
}

/* ------------------------------------------------------------------ reset */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--black);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  /* No horizontal scroll, ever. */
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 600; line-height: 1.2; }
p { margin: 0 0 10px; }
ul { margin: 0; padding-left: 18px; }
a { color: var(--neon-green); text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { font: inherit; color: inherit; }

/* Everything that can hold a long string must be able to break it. */
.mono, .addr, input, .v, .k { overflow-wrap: anywhere; }

.mono { font-family: var(--font-mono); font-size: .92em; letter-spacing: -.01em; }

:focus-visible {
  outline: 2px solid var(--neon-green);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------- ambient scene */

.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% -10%, #14202A 0%, #0A0E12 45%, var(--black) 100%);
}

/* Echoes the mark's composition: the bull's green rising on the left, the
   bear's red falling on the right, silver between them. Kept very low
   opacity — it should register as atmosphere, not decoration. */
.aurora {
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 60%;
  background:
    radial-gradient(50% 60% at 18% 28%, var(--neon-glow-soft), transparent 70%),
    radial-gradient(42% 52% at 50% 18%, rgba(174,184,194,.10), transparent 70%),
    radial-gradient(46% 56% at 84% 32%, rgba(153,33,33,.13), transparent 72%);
  filter: blur(30px);
}

.scene-canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .5; }

.scene-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 40%, transparent 45%, rgba(0,0,0,.72) 100%);
}

/* -------------------------------------------------------- app shell */

.app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
}

/* ---- app bar ---- */

/* Brushed silver bar. The mark was drawn on a light ground, so it sits on
   polished metal rather than glass — and the light band gives the dark app
   below it a clear edge. Opaque on purpose: a translucent light bar over
   scrolling dark content muddies the logo. */
.appbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: calc(var(--appbar-h) + var(--safe-top));
  padding: var(--safe-top) 12px 0;
  display: flex;
  align-items: center;
  gap: 10px;

  background:
    var(--brushed),
    linear-gradient(180deg, #FBFDFE 0%, #E7EDF2 38%, #CFD9E1 72%, #B4C0CA 100%);
  border-bottom: 1px solid rgba(10,14,18,.28);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.95),
    inset 0 -1px 0 rgba(10,14,18,.10),
    0 2px 14px rgba(0,0,0,.55);
}

/* A faint neon seam where the silver meets the dark app. */
.appbar::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--neon-glow), transparent);
  pointer-events: none;
}

/* The mark is a detailed square emblem that already carries the POLPEXA
   wordmark, so it is given real size and NO circular crop — a 32px circle
   sliced the wordmark off and turned the bull/bear into mush. It sits on the
   bar itself with a soft neon lift rather than inside a heavy chrome puck. */
.appbar-logo {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
}

.appbar-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* On silver a soft grounding shadow reads as depth; the neon glow used on
     the old dark bar would just look like haze here. */
  filter: drop-shadow(0 1px 2px rgba(10,14,18,.34));
}

.appbar-logo-fallback {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--logo-green);
}

/* The emblem carries the brand name, so the screen title is a quieter
   companion rather than a competing headline. Engraved dark on the silver. */
.appbar-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #2B343D;
  text-shadow: 0 1px 0 rgba(255,255,255,.7);
}

.appbar-wallet {
  flex: 0 0 auto;
  min-height: 44px;              /* touch target floor */
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 42vw;

  /* A dark control set INTO the silver — the contrast is what makes it read
     as a button rather than as part of the plate. */
  background: linear-gradient(170deg, #2E3740 0%, #1A2027 55%, #11161B 100%);
  border: 1px solid rgba(10,14,18,.45);
  border-radius: 999px;
  color: var(--text-primary);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.16),
    0 1px 0 rgba(255,255,255,.75),
    0 2px 5px rgba(10,14,18,.35);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.wallet-btn-label {
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wallet-dot {
  width: 7px; height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--metal-mid);
}
.wallet-dot.is-live { background: var(--neon-green); box-shadow: 0 0 7px var(--neon-glow); }
.wallet-dot.is-warn { background: var(--gold); box-shadow: 0 0 7px rgba(233,194,90,.5); }

/* ---- screens ---- */

.screens {
  padding:
    calc(var(--appbar-h) + var(--safe-top) + 12px)
    14px
    calc(var(--tabbar-h) + var(--safe-bottom) + 28px);
  max-width: 100%;
}

.screen { display: none; }
.screen.is-active { display: block; animation: screen-in .22s ease-out; }

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

.banners {
  position: relative;
  z-index: 5;
  padding: calc(var(--appbar-h) + var(--safe-top) + 10px) 14px 0;
}
.banners:empty { padding: 0; }
/* When a banner is present the screen below must not double-pad. */
.banners:not(:empty) + .screens { padding-top: 12px; }

/* ---- bottom navigation ---- */

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 6px 6px calc(6px + var(--safe-bottom));

  background: linear-gradient(180deg, rgba(18,22,28,.86), rgba(8,11,14,.97));
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-top: 1px solid var(--edge);
  box-shadow: 0 -1px 0 rgba(255,255,255,.05), 0 -8px 24px rgba(0,0,0,.5);
}

.tab {
  min-height: 50px;
  padding: 6px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;

  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  cursor: pointer;
  transition: color .16s ease, transform .16s ease, background .16s ease;
}

.tab-icon { font-size: 16px; line-height: 1; }
.tab-label { font-size: 10.5px; font-weight: 500; letter-spacing: .01em; }

.tab.is-active {
  color: var(--neon-green);
  background: linear-gradient(180deg, rgba(124,255,61,.13), rgba(124,255,61,.03));
  border-color: rgba(124,255,61,.28);
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.12),
    0 0 14px var(--neon-glow-soft),
    0 4px 10px -4px rgba(0,0,0,.7);
}

.tab:active { transform: translateY(0) scale(.97); }

/* -------------------------------------------------------- typography */

.eyebrow {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}

/* Polished silver, struck with a neon-green edge — the signature treatment
   for the largest financial figures. */
.figure-xl {
  font-family: var(--font-display);
  font-size: clamp(30px, 9vw, 40px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -.02em;
  background: var(--grad-silver-neon);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.55)) drop-shadow(0 0 16px rgba(124,255,61,.13));
}

.figure-lg, .level-vol-amount, .tier-reward, .summary-plan-name {
  background: var(--grad-silver);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.figure-lg {
  font-family: var(--font-display);
  font-size: clamp(22px, 6.5vw, 28px);
  font-weight: 700;
  letter-spacing: -.015em;
}

.figure-md {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.accent { color: var(--neon-green); }
.dim   { color: var(--text-secondary); }
.faint { color: var(--text-faint); }
.small { font-size: 12.5px; line-height: 1.55; }

.block { margin-top: 22px; }

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.block-head h2 { font-size: 15px; font-weight: 600; letter-spacing: .01em; }

.stack    { display: grid; gap: 14px; }
.stack-sm { display: grid; gap: 8px; }

.disclaimer { margin-top: 12px; }
.app-footer { margin-top: 28px; text-align: center; line-height: 1.7; }

/* ------------------------------------------------------ config gate */

.gate {
  position: relative;
  z-index: 1;
  padding: 60px 16px;
  max-width: 560px;
  margin: 0 auto;
}
.gate-title { font-size: 22px; margin-bottom: 10px; }
.gate-list { color: var(--text-secondary); font-size: 13.5px; line-height: 1.8; }
