:root {
  --bg: #f3fbf5;
  --surface: rgba(255, 255, 255, 0.64);
  --card: rgba(255, 255, 255, 0.82);
  --primary: #24e075;
  --primary-dark: #0f7a37;
  --text: #092018;
  --muted: #234a39;
  --danger: #c62828;
  --shadow: 0 18px 34px rgba(6, 30, 22, 0.18);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
  color: var(--text);
  background: #e8f8ed url("../../images/background.png") center center / cover no-repeat fixed;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  animation: bgPan 18s ease-in-out infinite alternate;
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 45vw;
  height: 45vw;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  filter: blur(2px);
}

body::before {
  top: -12vw;
  left: -10vw;
  background: radial-gradient(circle at 30% 30%, rgba(23, 163, 74, 0.26), rgba(23, 163, 74, 0.02) 68%);
  animation: floatBlobA 13s ease-in-out infinite;
}

body::after {
  right: -12vw;
  bottom: -12vw;
  background: radial-gradient(circle at 60% 60%, rgba(15, 122, 55, 0.24), rgba(15, 122, 55, 0.02) 70%);
  animation: floatBlobB 15s ease-in-out infinite;
}

.container {
  width: min(100%, 430px);
  margin: 0 auto;
  padding: 18px 16px 86px;
}

.glass {
  background: var(--surface);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  padding: 14px;
  width: 100%;
  margin: 0 auto;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 38px rgba(16, 49, 27, 0.24);
}

h1, h2, h3, p {
  margin: 0;
}

.page-title {
  margin-bottom: 14px;
  font-size: 1.3rem;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:focus-visible,
.input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(23, 163, 74, 0.35);
  outline-offset: 2px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, #15bd5f, #24e075);
  color: #042314;
  box-shadow: 0 8px 20px rgba(36, 224, 117, 0.35);
}

.btn-outline {
  background: #fff;
  color: var(--primary-dark);
  border: 1px solid #cdeed9;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.input,
select {
  width: 100%;
  border: 1px solid #cae8d5;
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 0.98rem;
  outline: none;
  background: #fff;
}

.input:focus,
select:focus {
  border-color: var(--primary);
}

.grid {
  display: grid;
  gap: 12px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: 1fr;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.balance {
  font-size: 1.45rem;
  font-weight: 700;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  bottom: 0;
  background: linear-gradient(180deg, rgba(248, 255, 252, 0.95), rgba(232, 255, 242, 0.92));
  border-top: 1px solid rgba(20, 160, 86, 0.24);
  box-shadow: 0 -8px 22px rgba(8, 56, 33, 0.14);
  display: flex;
  justify-content: space-around;
  padding: 8px 6px calc(10px + env(safe-area-inset-bottom));
  z-index: 12;
}

.bottom-nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
  transition: transform 0.18s ease, color 0.18s ease;
}

.nav-item {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-width: 64px;
  padding: 3px 0;
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 10px;
  background: linear-gradient(155deg, #ffffff 5%, #d7ffe8 55%, #bff7d8 100%);
  border: 1px solid rgba(14, 116, 54, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    inset 0 -2px 4px rgba(10, 113, 56, 0.15),
    0 5px 10px rgba(10, 46, 28, 0.18);
  transform: perspective(100px) rotateX(11deg);
  font-size: 15px;
  transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease;
}

.nav-item span:last-child {
  position: relative;
  font-size: 0.72rem;
  letter-spacing: 0.26px;
}

.nav-item span:last-child::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -3px;
  width: 0;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(36, 224, 117, 0), rgba(36, 224, 117, 0.95), rgba(36, 224, 117, 0));
  transform: translateX(-50%);
  transition: width 0.22s ease;
}

.bottom-nav a.active {
  color: var(--primary-dark);
  font-weight: 700;
}

.bottom-nav a.active .nav-icon {
  background: linear-gradient(155deg, #f0fff6 0%, #bff7d8 62%, #8cefb9 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -2px 5px rgba(10, 113, 56, 0.2),
    0 0 0 1px rgba(36, 224, 117, 0.35),
    0 8px 14px rgba(10, 89, 45, 0.28),
    0 0 12px rgba(36, 224, 117, 0.4);
  animation: navGlow 1.9s ease-in-out infinite;
}

.bottom-nav a.active .nav-item span:last-child::after {
  width: 30px;
  animation: navBeam 1.6s ease-in-out infinite;
}

.bottom-nav a:active {
  transform: translateY(1px);
}

.bottom-nav a:hover .nav-icon {
  transform: perspective(100px) rotateX(11deg) translateY(-1px);
  filter: saturate(1.08);
}

.support-btn {
  position: fixed;
  right: max(12px, calc((100vw - 430px) / 2 + 12px));
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2aabee, #4dd2ff);
  color: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  z-index: 14;
  animation: tgFloat 2.6s ease-in-out infinite;
}

.support-btn svg {
  width: 18px;
  height: 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.75rem;
  background: linear-gradient(120deg, rgba(20, 201, 102, 0.2), rgba(102, 243, 170, 0.24));
  color: #0f5f35;
}

.table {
  width: 100%;
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
}

.table th, .table td {
  text-align: left;
  font-size: 0.9rem;
  padding: 10px;
  border-bottom: 1px solid #e7f3eb;
}

.ads-banner {
  animation: blink 1.2s linear infinite;
  border: 1px solid rgba(36, 224, 117, 0.55);
  box-shadow: 0 0 0 1px rgba(36, 224, 117, 0.2), 0 14px 26px rgba(15, 122, 55, 0.2);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.intro-wrap {
  display: grid;
  place-items: center;
  min-height: 100vh;
  text-align: center;
  gap: 12px;
}

.logo {
  width: 92px;
  height: 92px;
  border-radius: 24px;
  background: linear-gradient(160deg, #0f7a37, #17a34a);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.25rem;
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px auto 6px;
  width: min(100%, 430px);
  padding: 0 16px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  box-shadow: var(--shadow);
  animation: logoPulse 2.8s ease-in-out infinite;
}

.brand-name {
  font-weight: 800;
  letter-spacing: 0.2px;
  text-shadow: 0 0 12px rgba(36, 224, 117, 0.35);
}

.brand-tagline {
  font-size: 0.8rem;
  color: var(--muted);
}

@keyframes floatBlobA {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(3vw, 4vw) scale(1.08); }
}

@keyframes floatBlobB {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-4vw, -3vw) scale(1.12); }
}

@keyframes logoPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(23,163,74,0)); }
  50% { transform: scale(1.05); filter: drop-shadow(0 0 8px rgba(23,163,74,0.35)); }
}

@media (min-width: 431px) {
  body {
    background-color: #dbece1;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

.dashboard-card {
  display: grid;
  gap: 8px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.92), rgba(233, 255, 244, 0.82));
  position: relative;
  overflow: hidden;
}

.dashboard-card::before {
  content: "";
  position: absolute;
  inset: -120% auto auto -35%;
  width: 65%;
  height: 320%;
  transform: rotate(25deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  animation: cardShine 4.5s linear infinite;
}

.dashboard-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.team-level-card {
  display: grid;
  gap: 8px;
  cursor: pointer;
}

.team-level-head {
  width: 100%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  padding: 0;
  cursor: pointer;
  color: var(--text);
}

.team-downlines {
  border-top: 1px dashed rgba(15, 122, 55, 0.25);
  padding-top: 8px;
  display: grid;
  gap: 6px;
}

.team-level-card.open {
  box-shadow: 0 18px 40px rgba(9, 68, 36, 0.25);
}

.quick-links {
  justify-items: center;
}

.quick-link-card {
  display: grid;
  place-items: center;
  text-align: center;
  text-transform: uppercase;
  font-weight: 700;
  min-height: 72px;
  width: 100%;
}

.balance-grid {
  align-items: stretch;
  justify-items: center;
}

.balance-tile {
  width: 100%;
  min-height: 84px;
  display: grid;
  gap: 6px;
  align-content: center;
  text-align: center;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.95), rgba(232, 255, 242, 0.84));
  box-shadow: 0 12px 24px rgba(12, 62, 35, 0.14);
}

.balance-tile-value {
  font-size: 1.02rem;
  font-weight: 800;
  color: #0c3d27;
  letter-spacing: 0.2px;
}

.balance-tile-wide {
  grid-column: 1 / -1;
}

.admin-page .container {
  width: 100%;
  max-width: 430px;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 12px;
  padding-right: 12px;
  justify-self: center;
}

.admin-page {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.admin-page .page-title,
.admin-page .card h3 {
  text-align: center;
}

.admin-page .card {
  width: 100%;
  overflow-x: hidden;
}

.admin-page .brand-header {
  width: 100%;
  max-width: 430px;
  margin-left: auto;
  margin-right: auto;
}

.admin-page .table {
  font-size: 0.82rem;
}

.admin-page .support-btn {
  display: none;
}

.dashboard-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  background: radial-gradient(circle at 30% 30%, rgba(36, 224, 117, 0.25), rgba(15, 122, 55, 0.14));
}

.card-enter {
  opacity: 0;
  transform: translateY(14px) scale(0.985);
  animation: cardIn 420ms cubic-bezier(.2,.7,.2,1) forwards;
  animation-delay: var(--d, 0ms);
}

@keyframes cardIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes tgFloat {
  0%, 100% { transform: translateY(-50%) translateX(0); box-shadow: 0 8px 24px rgba(42,171,238,0.35); }
  50% { transform: translateY(calc(-50% - 6px)) translateX(-1px); box-shadow: 0 12px 28px rgba(42,171,238,0.55); }
}

@keyframes cardShine {
  0% { left: -70%; opacity: 0; }
  10% { opacity: .7; }
  45% { left: 120%; opacity: 0; }
  100% { left: 120%; opacity: 0; }
}

@keyframes bgPan {
  0% { background-position: center top; }
  100% { background-position: center 8%; }
}

@keyframes navGlow {
  0%, 100% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.95),
      inset 0 -2px 5px rgba(10, 113, 56, 0.2),
      0 0 0 1px rgba(36, 224, 117, 0.28),
      0 8px 14px rgba(10, 89, 45, 0.26),
      0 0 10px rgba(36, 224, 117, 0.32);
  }
  50% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.98),
      inset 0 -2px 6px rgba(10, 113, 56, 0.24),
      0 0 0 1px rgba(36, 224, 117, 0.42),
      0 10px 16px rgba(10, 89, 45, 0.32),
      0 0 16px rgba(36, 224, 117, 0.52);
  }
}

@keyframes navBeam {
  0%, 100% {
    opacity: 0.55;
    filter: drop-shadow(0 0 3px rgba(36, 224, 117, 0.35));
  }
  50% {
    opacity: 1;
    filter: drop-shadow(0 0 7px rgba(36, 224, 117, 0.72));
  }
}
