/* ===== MAIN.CSS — Global Charcoal Black Theme ===== */

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

:root {
  --bg: #0D0D0D;
  --card: #1A1A1A;
  --card2: #222222;
  --border: #2A2A2A;
  --text: #FFFFFF;
  --text-muted: #888888;
  --text-sub: #AAAAAA;
  --primary: #F5C518;
  --primary-dark: #D4A800;
  --green: #4ADE80;
  --blue: #60A5FA;
  --red: #F87171;
  --purple: #A78BFA;
  --orange: #F97316;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.5);
  --transition: 0.15s ease;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== SPLASH SCREEN ===== */
#splash-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.4s ease;
}

.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.splash-logo {
  animation: pulse 1.5s ease-in-out infinite;
}

.splash-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--primary);
}

.splash-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }

/* ===== UTILITIES ===== */
.hidden { display: none !important; }

/* ===== MODAL OVERLAY ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.modal-overlay.center-modal {
  align-items: center;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--card);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

.modal-box-lg {
  max-height: 92vh;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
}
.modal-close:active { transform: scale(0.92); }

.modal-body {
  padding: 16px 20px 24px;
}

/* ===== VERIFY MODAL ===== */
.verify-modal-box {
  border-radius: var(--radius) !important;
  max-width: 340px;
  margin: 0 auto;
}

.verify-icon {
  text-align: center;
  margin-bottom: 12px;
}

.verify-title {
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  margin: 0 0 8px;
}

.verify-desc {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
  margin-bottom: 20px;
}

.verify-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.browser-preview-wrap {
  margin-top: 12px;
  text-align: center;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), opacity var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:active { transform: scale(0.95); }
.btn:disabled { opacity: 0.45; pointer-events: none; }

.btn-primary {
  background: var(--primary);
  color: #0D0D0D;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  background: var(--card2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
  flex: 1;
}

.btn-outline.btn-red { border-color: var(--red); color: var(--red); }
.btn-outline.btn-green { border-color: var(--green); color: var(--green); }

.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: var(--radius-xs); }
.btn-full { width: 100%; }
.mt-3 { margin-top: 12px; }

/* ===== CARD ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
}

/* ===== INPUT ===== */
.input {
  width: 100%;
  background: var(--card2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 16px;
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
  -webkit-appearance: none;
}
.input:focus { border-color: var(--primary); }
.input::placeholder { color: var(--text-muted); }

/* ===== PROGRESS BAR ===== */
.progress-bar-wrap {
  background: var(--card2);
  border-radius: 100px;
  height: 6px;
  width: 100%;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #FFD700);
  border-radius: 100px;
  transition: width 0.4s ease;
}

/* ===== APP CONTAINER ===== */
#app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

/* ===== PAGE ===== */
.page {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 80px;
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.page-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.header-points {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
}

/* ===== AVATAR ===== */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--orange));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #0D0D0D;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 72px; height: 72px; font-size: 28px; }

/* ===== BOTTOM NAV ===== */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 0;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: color var(--transition), transform var(--transition);
}
.nav-btn:active { transform: scale(0.92); }
.nav-btn i { font-size: 22px; }
.nav-btn.active { color: var(--primary); }

/* ===== TOAST ===== */
#toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 360px;
}

.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  animation: slideDown 0.25s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow);
}
.toast.success { border-color: var(--green); }
.toast.error { border-color: var(--red); }
.toast.info { border-color: var(--blue); }

@keyframes slideDown {
  from { transform: translateY(-16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ===== SECTION HEADER ===== */
.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  padding: 16px 16px 8px;
}

.badge {
  background: var(--primary);
  color: #0D0D0D;
  border-radius: 100px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  margin-left: auto;
}
.badge-green { background: var(--green); }
.badge-blue { background: var(--blue); }

/* ===== LOTTIE REWARD OVERLAY ===== */
.lottie-reward-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 8000;
  animation: fadeIn 0.2s ease;
}
.lottie-reward-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.reward-lottie {
  width: 200px;
  height: 200px;
}
.reward-coins-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes zoomIn { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
