/* ============================================================
   Captcha Earn — design system
   Palette lifted from the brand mark: royal blue body, gold
   accent, deep navy ink. Surfaces are moulded clay: soft
   double shadow, no borders, generous radius.
   ============================================================ */

:root {
  /* --- brand: locked lime ramp ------------------------------ */
  --lime-glow: #F7FF67;
  --lime-100:  #E0F952;
  --lime-200:  #D6F63C;
  --lime-300:  #C1E81C;
  --lime-400:  #AAD90D;   /* base */
  --lime-500:  #9BCB0A;
  --lime-600:  #84BE0A;
  --lime-700:  #6FAF0B;
  --lime-800:  #4E9206;
  --lime-900:  #1F6100;
  --ink-green: #0A4A00;

  /* Component tokens keep their names so every other stylesheet
     works unchanged; only the values move to the lime ramp. */
  --brand-700: #84BE0A;
  --brand-600: #AAD90D;
  --brand-500: #C1E81C;
  --brand-300: #6FAF0B;
  --brand-100: #1E2A12;

  /* Lime is too bright for white text — fills carry dark ink. */
  --on-brand: #0C1305;

  --gold-600: #C1E81C;
  --gold-500: #E0F952;
  --gold-200: #2A3A12;

  /* --- neutrals --------------------------------------------- */
  --ink:       #FFFFFF;
  --ink-soft:  #FFFFFFB0;
  --ink-faint: #FFFFFF70;
  --placeholder: #FFFFFF55;

  --bg:        #0E1409;
  --bg-deep:   #060A04;
  --card:      #171E11;
  --card-sunk: #282F23;

  --line-card:  #E3EDF330;
  --line-field: #E3EDF361;

  /* --- semantic --------------------------------------------- */
  --success:    #9BCB0A;
  --success-bg: #1E2A12;
  --danger:     #FF6B6B;
  --danger-bg:  #2C1414;
  --warn:       #F7C948;
  --warn-bg:    #2C2412;

  /* --- clay elevation, dark ---------------------------------- */
  --clay-1: 6px 6px 14px rgba(0, 0, 0, .55),
           -4px -4px 10px rgba(255, 255, 255, .03);
  --clay-2: 10px 10px 24px rgba(0, 0, 0, .60),
           -6px -6px 14px rgba(255, 255, 255, .04);
  --clay-3: 14px 16px 34px rgba(0, 0, 0, .70),
           -8px -8px 18px rgba(255, 255, 255, .05);
  --clay-in: inset 4px 4px 10px rgba(0, 0, 0, .50),
             inset -3px -3px 8px rgba(255, 255, 255, .04);
  --clay-brand: 8px 10px 22px rgba(170, 217, 13, .26),
                inset 0 2px 0 rgba(255, 255, 255, .35),
                inset 0 -4px 10px rgba(78, 146, 6, .50);
  --clay-gold: 8px 10px 22px rgba(224, 249, 82, .24),
               inset 0 2px 0 rgba(255, 255, 255, .40),
               inset 0 -4px 10px rgba(111, 175, 11, .45);

  /* --- shape ------------------------------------------------ */
  --r-sm: 14px;
  --r-md: 20px;
  --r-lg: 28px;
  --r-xl: 34px;
  --r-pill: 999px;

  /* --- spacing (4pt scale) ---------------------------------- */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;

  /* --- type ------------------------------------------------- */
  --font-display: 'Baloo 2', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Manrope', -apple-system, 'Segoe UI', Roboto, sans-serif;

  --shell: 480px;
  --nav-h: 74px;
  --ease: cubic-bezier(.34, .8, .34, 1);
}

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

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

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(110% 55% at 50% -8%, #1C2612 0%, rgba(28, 38, 18, 0) 62%),
    radial-gradient(90% 50% at 100% 100%, #060A04 0%, rgba(6, 10, 4, 0) 72%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

img, svg { display: block; max-width: 100%; }

/* Without this, buttons fall back to UA ButtonFace/ButtonText and inputs to
   Field/FieldText — white boxes on white text all over a dark theme. */
button, input, textarea, select {
  font: inherit;
  color: inherit;
  background-color: transparent;
  appearance: none;
  -webkit-appearance: none;
}
a { color: var(--brand-600); text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -.01em;
  margin: 0;
  line-height: 1.15;
}

/* Numbers stay aligned in balances and tables. */
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }

:focus-visible {
  outline: 3px solid var(--brand-500);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

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

/* ============================================================
   Layout shell — phone width, centred on tablet/desktop
   ============================================================ */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 var(--s-4);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + var(--s-8));
}

.shell--plain { padding-bottom: var(--s-8); }

.stack   { display: flex; flex-direction: column; gap: var(--s-4); }
.stack-2 { display: flex; flex-direction: column; gap: var(--s-2); }
.row     { display: flex; align-items: center; gap: var(--s-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.grow    { flex: 1 1 auto; min-width: 0; }

/* Two cards per line — the task grid. */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: var(--s-6) 0 var(--s-3);
}
.section-head h2 { font-size: 19px; }
.section-head a  { font-size: 13px; font-weight: 700; color: var(--brand-600); }

/* ============================================================
   Surfaces
   ============================================================ */
.clay {
  background: var(--card, #171E11);
  border: 1px solid var(--line-card, #E3EDF330);
  border-radius: var(--r-lg);
  box-shadow: var(--clay-2);
}
.clay-sm { border-radius: var(--r-md); box-shadow: var(--clay-1); background: var(--card, #171E11);
           border: 1px solid var(--line-card, #E3EDF330); }
.clay-sunk {
  background: var(--card-sunk);
  border-radius: var(--r-md);
  box-shadow: var(--clay-in);
}
.pad   { padding: var(--s-5); }
.pad-4 { padding: var(--s-4); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 52px;
  padding: 0 var(--s-6);
  border: 0;
  border-radius: var(--r-pill);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .01em;
  cursor: pointer;
  transition: transform .16s var(--ease), box-shadow .16s var(--ease), filter .16s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(2px) scale(.99); }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }

.btn--primary {
  color: var(--on-brand, #0C1305);
  background: linear-gradient(180deg, var(--brand-500) 0%, var(--brand-600) 55%, var(--brand-700) 100%);
  box-shadow: var(--clay-brand);
}
.btn--primary:active { box-shadow: 4px 5px 12px rgba(170, 217, 13, .22), inset 0 3px 10px rgba(78, 146, 6, .55); }

.btn--gold {
  color: var(--on-brand, #0C1305);
  background: linear-gradient(180deg, var(--gold-500) 0%, var(--gold-600) 100%);
  box-shadow: var(--clay-gold);
}

.btn--ghost {
  color: var(--brand-600);
  background: var(--card);
  box-shadow: var(--clay-1);
}

.btn--block { display: flex; width: 100%; }
.btn--sm { min-height: 40px; padding: 0 var(--s-4); font-size: 14px; }

.btn .spinner { display: none; }
.btn.is-loading .spinner { display: block; }
.btn.is-loading .btn-label { opacity: .7; }

.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Form fields
   ============================================================ */
.field { display: flex; flex-direction: column; gap: var(--s-2); }

.field label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  padding-left: var(--s-2);
}

.input-wrap {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 0 var(--s-4);
  min-height: 52px;
  background: var(--card-sunk, #282F23);
  border: 1px solid var(--line-field, #E3EDF361);
  border-radius: var(--r-md);
  box-shadow: var(--clay-in);
  transition: border-color .18s var(--ease);
}
/* Focus is a border change only — no glow ring. */
.input-wrap:focus-within { border-color: var(--brand-600, #AAD90D); }
.input-wrap svg { flex: 0 0 20px; color: var(--brand-500); }

.input-wrap input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 16px;      /* 16px stops iOS zoom on focus */
  font-weight: 800;
  color: var(--ink);
}
.input-wrap input::placeholder { color: var(--placeholder, #FFFFFF55); font-weight: 600; }

.input-prefix {
  font-weight: 700;
  color: var(--ink-soft);
  padding-right: var(--s-1);
  border-right: 1px solid rgba(90, 107, 148, .2);
}

.toggle-eye {
  background: none;
  border: 0;
  padding: var(--s-1);
  color: var(--ink-faint);
  cursor: pointer;
}

.field-error {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--danger);
  padding-left: var(--s-2);
}

/* ============================================================
   Alerts
   ============================================================ */
.alert {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
.alert svg { flex: 0 0 20px; margin-top: 1px; }
.alert--error   { background: var(--danger-bg,  #2C1414); color: #FF9B9B; }
.alert--success { background: var(--success-bg, #1E2A12); color: var(--lime-200, #D6F63C); }
.alert--info    { background: var(--brand-100,  #1E2A12); color: var(--lime-300, #C1E81C); }
.alert--warn    { background: var(--warn-bg,    #2C2412); color: #F7C948; }

/* ============================================================
   Chips & badges
   ============================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
  background: var(--brand-100, #1E2A12);
  color: var(--lime-300, #C1E81C);
}
.chip--gold { background: var(--gold-200, #2A3A12); color: var(--lime-100, #E0F952); }
.chip--live { background: var(--success-bg, #1E2A12); color: var(--lime-200, #D6F63C); }

/* ============================================================
   Bottom navigation — Home · Withdraw · History · News
   ============================================================ */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--shell);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding: 0 var(--s-3) env(safe-area-inset-bottom, 0px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  background: rgba(20, 27, 15, .94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line-card, #E3EDF330);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: 0 -8px 28px rgba(0, 0, 0, .55);
  z-index: 40;
}

.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 58px;
  border-radius: var(--r-md);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-faint);
  transition: color .18s var(--ease);
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.is-active { color: var(--brand-600); }
.tabbar a.is-active .tab-icon {
  background: var(--brand-100, #1E2A12);
  box-shadow: var(--clay-in);
}
.tab-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 30px;
  border-radius: var(--r-pill);
  transition: background .18s var(--ease);
}

/* ============================================================
   App header
   ============================================================ */
.appbar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) 0 var(--s-2);
}
.appbar__logo {
  width: 46px; height: 46px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--clay-1);
  padding: 4px;
  object-fit: contain;
}
.appbar__title { font-size: 18px; line-height: 1.1; }
.appbar__sub { font-size: 12px; font-weight: 700; color: var(--ink-soft); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--card);
  color: var(--brand-600);
  box-shadow: var(--clay-1);
  cursor: pointer;
  transition: transform .16s var(--ease);
}
.icon-btn:active { transform: scale(.94); }
.icon-btn__dot {
  position: absolute;
  transform: translate(14px, -12px);
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--gold-500, #E0F952);
  box-shadow: 0 0 0 2.5px var(--card, #171E11);
}

/* ============================================================
   Sheet / modal
   ============================================================ */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .68);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s var(--ease);
  z-index: 60;
}
.sheet-backdrop.is-open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 100%);
  width: 100%;
  max-width: var(--shell);
  padding: var(--s-5) var(--s-5) calc(var(--s-6) + env(safe-area-inset-bottom, 0px));
  background: var(--card, #171E11);
  border: 1px solid var(--line-card, #E3EDF330);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: 0 -14px 40px rgba(0, 0, 0, .6);
  transition: transform .3s var(--ease);
  z-index: 61;
}
.sheet.is-open { transform: translate(-50%, 0); }
.sheet__grab {
  width: 44px; height: 5px;
  margin: 0 auto var(--s-4);
  border-radius: var(--r-pill);
  background: var(--bg-deep);
}

/* ============================================================
   Utilities
   ============================================================ */
.t-center { text-align: center; }
.t-muted  { color: var(--ink-soft); }
.t-faint  { color: var(--ink-faint); }
.t-sm     { font-size: 13px; }
.t-xs     { font-size: 12px; }
.t-bold   { font-weight: 700; }
.t-brand  { color: var(--brand-600); }
.t-gold   { color: var(--gold-600); }
.t-success{ color: var(--success); }
.t-danger { color: var(--danger); }
.mt-4 { margin-top: var(--s-4); }
.mt-6 { margin-top: var(--s-6); }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ============================================================
   Status-bar inset
   The APK wrapper draws the page under the system status bar, so
   every screen's first element needs to clear it. env() covers
   devices that report an inset; the max() floor covers wrappers
   that report 0. Prefixed with body so it wins over the per-page
   padding set in auth.css and app.css, whatever the load order.
   ============================================================ */
body .shell,
body .auth,
body .splash,
body .admin-shell {
  padding-top: max(44px, calc(env(safe-area-inset-top, 0px) + 14px));
}
