:root {
  --bg-primary: #0D0D0D;
  --bg-card: #171717;
  --accent: #2D8CFF;
  --text-main: #FFFFFF;
  --text-dim: #9A9A9A;
  --radius: 18px;
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-primary);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
}

/* ---------- Loading Screen ---------- */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 999;
  transition: opacity 0.4s ease;
}
.loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}
.loader {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(45, 140, 255, 0.2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Top Bar (liquid glass, no stroke/shadow on the bar itself) ---------- */
.topbar {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  background: transparent;
  border: none;
  box-shadow: none;
}

/* Coins box: rounded rectangle, glass, no shadow */
.coins-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 8px 16px;
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  box-shadow: none;
}

.coins-icon {
  font-size: 16px;
  line-height: 1;
}

.coins-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

/* User area: no box, no background, no shadow - just avatar + username side by side */
.user-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  padding: 0;
  box-shadow: none;
}

.username {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-main);
  white-space: nowrap;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  border: none;
  background: var(--bg-card);
  display: block;
}

/* ---------- Pages ---------- */
.pages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px 100px;
}
.page {
  display: none;
  animation: fadeIn 0.35s ease;
}
.page.active {
  display: block;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.page-title {
  font-size: 20px;
  font-weight: 700;
  margin: 4px 0 16px;
}
.section-subtitle {
  font-size: 15px;
  font-weight: 600;
  margin: 20px 0 10px;
  color: var(--text-dim);
}

/* ---------- Miner Page ---------- */
.coin-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 30px;
  position: relative;
}
.coin-balance {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 30px;
}
.coin-balance span {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -1px;
}
.coin-balance small {
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
}

.coin-button {
  background: radial-gradient(circle at 35% 30%, #3a3a3a, #171717 70%);
  border: none;
  border-radius: 50%;
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-soft), 0 0 0 1px rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: transform 0.08s ease;
  padding: 0;
}
.coin-button img {
  width: 78%;
  height: 78%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 6px 14px rgba(255, 200, 0, 0.35));
}
.coin-button.pressed {
  transform: scale(0.92);
}
.hint {
  margin-top: 22px;
  color: var(--text-dim);
  font-size: 13px;
}

/* Floating +1 popup */
.float-plus {
  position: absolute;
  font-size: 26px;
  font-weight: 800;
  color: var(--accent);
  pointer-events: none;
  animation: floatUp 0.7s ease forwards;
  text-shadow: 0 2px 10px rgba(45, 140, 255, 0.5);
}
@keyframes floatUp {
  0%   { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -70px) scale(1.3); }
}

/* Particle layer */
#particle-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}
.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: particleFly 0.6s ease-out forwards;
}
@keyframes particleFly {
  to {
    transform: translate(var(--dx), var(--dy)) scale(0);
    opacity: 0;
  }
}

/* ---------- Cards (generic) ---------- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

/* ---------- Tasks Page ---------- */
.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.task-item {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: transform 0.15s ease;
}
.task-item:active {
  transform: scale(0.98);
}
.task-info {
  flex: 1;
  min-width: 0;
}
.task-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}
.task-desc {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.4;
}
.task-reward {
  font-size: 12px;
  color: var(--accent);
  margin-top: 6px;
  font-weight: 600;
}
.task-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.15s ease;
}
.task-btn:active {
  transform: scale(0.95);
}
.task-btn.completed {
  background: #2a2a2a;
  color: var(--text-dim);
  cursor: default;
}

/* ---------- Wallet Page ---------- */
.wallet-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}
.wallet-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card-label {
  font-size: 12px;
  color: var(--text-dim);
}
.card-value {
  font-size: 22px;
  font-weight: 800;
}
.withdraw-button {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  background: #2a2a2a;
  color: var(--text-dim);
  font-weight: 700;
  font-size: 14px;
  cursor: not-allowed;
}
.wallet-history {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-item {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.history-type {
  font-size: 13px;
  font-weight: 600;
  text-transform: capitalize;
}
.history-note {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 2px;
}
.history-amount {
  font-weight: 700;
  color: var(--accent);
  font-size: 14px;
}
.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 30px 0;
  font-size: 13px;
}

/* ---------- Bottom Navigation ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: rgba(23, 23, 23, 0.85);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
  z-index: 100;
}
.nav-item {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.15s ease;
  border-radius: 12px;
}
.nav-item.active {
  color: var(--accent);
}
.nav-item:active {
  transform: scale(0.94);
}
.nav-icon {
  font-size: 20px;
}
.nav-label {
  font-size: 11px;
  font-weight: 600;
}

/* Scrollbar cleanup */
.pages::-webkit-scrollbar {
  width: 0;
}
