:root {
  --primary: #3c70f9;
  --primary-dark: #2755d6;
  --secondary: #00c087;
  --orange: #ff7d3b;
  --purple: #7a5af8;
  --bg-main: #f5f7fb;
  --bg-card: #ffffff;
  --text-main: #1e2432;
  --text-muted: #8b95a5;
  --border-color: #edf1f7;
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(60, 112, 249, 0.12);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: #121620;
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
}

/* App Viewport Container */
.app-viewport {
  width: 100%;
  max-width: 440px;
  height: 100vh;
  max-height: 920px;
  background-color: var(--bg-main);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

@media (min-width: 480px) {
  .app-viewport {
    border-radius: 36px;
    border: 8px solid #232936;
    height: 90vh;
  }
}

/* Header */
.app-header {
  height: 56px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.app-brand {
  font-weight: 700;
  font-size: 18px;
  color: var(--primary);
  letter-spacing: 0.5px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-icon-btn img {
  width: 24px;
  height: 24px;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.header-icon-btn img:hover {
  opacity: 1;
}

/* Main Content Area */
.app-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 70px;
  -webkit-overflow-scrolling: touch;
}

/* Screen Views */
.screen-view {
  display: none;
  padding: 14px;
}

.screen-view.active {
  display: block;
  animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.screen-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.screen-title-bar h2 {
  font-size: 20px;
  font-weight: 700;
  color: #171d2d;
}

.tag-status {
  background: rgba(60, 112, 249, 0.1);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* Banner */
.banner-carousel {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.banner-img {
  width: 100%;
  display: block;
  object-fit: cover;
  border-radius: var(--radius-lg);
}

/* Notice Ticker */
.notice-ticker {
  background: #ffffff;
  border-radius: 20px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.notice-badge {
  background: var(--primary);
  color: #fff;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}

/* Asset Card */
.asset-card {
  background: linear-gradient(135deg, #2b5fe8 0%, #1e45b6 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-md);
  margin-bottom: 16px;
}

.asset-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.asset-label {
  font-size: 12px;
  opacity: 0.85;
}

.asset-amount {
  font-size: 26px;
  font-weight: 800;
  margin-top: 2px;
}

.recharge-btn {
  background: #ffffff;
  color: var(--primary);
  border: none;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.asset-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: 12px;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-sub {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  opacity: 0.85;
}

.stat-ic {
  width: 14px;
  height: 14px;
}

.stat-val {
  font-size: 13px;
  font-weight: 700;
  margin-top: 3px;
}

.text-green { color: #00e096 !important; }

/* Action Grid */
.action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  background: #ffffff;
  padding: 16px 12px;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  gap: 6px;
}

.action-ic-box {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

.action-item:active .action-ic-box {
  transform: scale(0.92);
}

.action-ic-box img {
  width: 26px;
  height: 26px;
}

.bg-blue { background: rgba(60, 112, 249, 0.12); }
.bg-green { background: rgba(0, 192, 135, 0.12); }
.bg-orange { background: rgba(255, 125, 59, 0.12); }
.bg-purple { background: rgba(122, 90, 248, 0.12); }

.action-item span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-main);
}

/* Promo Sections */
.promo-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.promo-img {
  width: 100%;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* Section Card */
.section-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: #171d2d;
}

.card-link {
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
  cursor: pointer;
}

.reward-banner-box {
  border-radius: var(--radius-md);
  overflow: hidden;
}

.reward-img {
  width: 100%;
  display: block;
}

/* Buy Screen Styles */
.order-matching-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.match-circle {
  width: 80px;
  height: 80px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: rgba(60, 112, 249, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

.match-icon-pulse {
  width: 44px;
  height: 44px;
}

.match-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 16px;
}

.amount-select-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.amt-chip {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  padding: 10px 0;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
}

.amt-chip.active {
  background: rgba(60, 112, 249, 0.1);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

.custom-amt-input {
  display: flex;
  align-items: center;
  background: var(--bg-main);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 14px;
  height: 48px;
}

.curr-sign {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-muted);
  margin-right: 8px;
}

.custom-amt-input input {
  border: none;
  background: transparent;
  width: 100%;
  height: 100%;
  font-size: 16px;
  font-weight: 600;
  outline: none;
}

.primary-btn {
  width: 100%;
  height: 48px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border: none;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(60, 112, 249, 0.3);
}

.btn-green {
  background: linear-gradient(135deg, #00c087 0%, #029468 100%);
  box-shadow: 0 4px 14px rgba(0, 192, 135, 0.3);
}

.order-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.order-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.order-id {
  font-size: 13px;
  font-weight: 600;
}

.order-time {
  font-size: 11px;
  color: var(--text-muted);
}

.order-badge {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 8px;
  font-weight: 600;
}

.badge-success {
  background: rgba(0, 192, 135, 0.12);
  color: #00c087;
}

/* Sell Screen Styles */
.sell-overview-card {
  background: linear-gradient(135deg, #18233c 0%, #293859 100%);
  border-radius: var(--radius-lg);
  padding: 18px;
  color: #fff;
  margin-bottom: 16px;
}

.sell-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.text-white-70 { color: rgba(255, 255, 255, 0.7); }
.text-white { color: #fff; }

.sd-icon {
  width: 48px;
  height: 48px;
}

.sell-limits {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 10px;
}

.sell-action-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.input-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.max-btn {
  background: rgba(60, 112, 249, 0.1);
  color: var(--primary);
  border: none;
  font-weight: 700;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.card-selector {
  display: flex;
  align-items: center;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  gap: 10px;
}

.card-icon {
  width: 28px;
  height: 28px;
}

.card-details {
  flex: 1;
}

.bank-name {
  font-size: 13px;
  font-weight: 700;
}

.bank-acc {
  font-size: 11px;
  color: var(--text-muted);
}

.change-card-btn {
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
}

/* Offline / Team Screen */
.team-banner-card {
  background: linear-gradient(135deg, #7a5af8 0%, #4a2ec4 100%);
  border-radius: var(--radius-lg);
  padding: 20px;
  color: #fff;
  margin-bottom: 14px;
}

.ref-code-box {
  margin-top: 14px;
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 14px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.copy-btn {
  background: #fff;
  color: var(--purple);
  border: none;
  font-weight: 700;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
}

.share-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.social-share-btn {
  height: 44px;
  border-radius: var(--radius-md);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  color: #fff;
  cursor: pointer;
}

.social-share-btn img {
  width: 20px;
  height: 20px;
}

.ws-btn { background: #25d366; }
.tg-btn { background: #229ed9; }

.team-stats-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.team-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
}

.tstat-val {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
}

.tstat-lbl {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.level-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.level-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  font-weight: 600;
}

/* Mine / Profile Screen */
.profile-header-card {
  background: linear-gradient(135deg, #1e2432 0%, #2f374a 100%);
  border-radius: var(--radius-lg);
  padding: 20px;
  color: #fff;
  margin-bottom: 12px;
}

.profile-user-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar-box {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fff;
  padding: 2px;
}

.user-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.user-phone {
  font-size: 16px;
  font-weight: 700;
}

.user-badge {
  font-size: 11px;
  color: #f7ba2a;
  font-weight: 600;
}

.user-id {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
}

.mine-wallet-bar {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}

.border-lr {
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
}

.mw-lbl {
  font-size: 11px;
  color: var(--text-muted);
}

.mw-val {
  font-size: 15px;
  font-weight: 700;
  margin-top: 2px;
}

.menu-group-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 4px 14px;
  box-shadow: var(--shadow-sm);
}

.menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
}

.menu-item:last-child {
  border-bottom: none;
}

.menu-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
}

.menu-ic {
  width: 22px;
  height: 22px;
}

.menu-arrow {
  color: var(--text-muted);
  font-size: 14px;
}

.logout-btn {
  width: 100%;
  height: 44px;
  background: #feecef;
  color: #f53f5f;
  border: none;
  border-radius: 22px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 20;
}

.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  width: 20%;
}

.tab-ic {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.nav-tab .active-ic { display: none; }
.nav-tab .inactive-ic { display: block; opacity: 0.6; }

.nav-tab.active .active-ic { display: block; }
.nav-tab.active .inactive-ic { display: none; }

.nav-tab span {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

.nav-tab.active span {
  color: var(--primary);
  font-weight: 700;
}

/* Modals */
.modal-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
  align-items: flex-end;
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

.modal-sheet {
  width: 100%;
  background: #fff;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  padding: 24px 20px 32px;
  animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  text-align: center;
  margin-bottom: 20px;
}

.login-logo {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  margin-bottom: 8px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.modal-header p {
  font-size: 12px;
  color: var(--text-muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-group {
  display: flex;
  align-items: center;
  background: var(--bg-main);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 14px;
  height: 48px;
  gap: 10px;
}

.input-ic {
  width: 20px;
  height: 20px;
  opacity: 0.6;
}

.input-group input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  font-weight: 500;
}

.toggle-pwd {
  width: 18px;
  height: 18px;
  cursor: pointer;
  opacity: 0.6;
}

.auth-switch-row {
  text-align: center;
  font-size: 12px;
  margin-top: 10px;
  color: var(--text-muted);
}

.auth-switch-row a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  margin-left: 4px;
}

/* Toast */
.toast-box {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(23, 29, 45, 0.95);
  color: #fff;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 200;
}

.toast-box.show {
  opacity: 1;
  transform: translateX(-50%) translateY(10px);
}

.mt-3 { margin-top: 12px !important; }
