/* Telegram Mini App Cyberpunk Dark Theme Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --bg-dark: #0a0e17;
  --bg-card: #131b2e;
  --bg-card-hover: #1c263f;
  --primary: #00d2ff;
  --primary-glow: rgba(0, 210, 255, 0.4);
  --secondary: #ff0055;
  --secondary-glow: rgba(255, 0, 85, 0.4);
  --accent-gold: #ffd700;
  --accent-green: #00ff88;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  overflow-x: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Telegram Header */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(19, 27, 46, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 40;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--primary);
}

.user-meta h4 {
  font-size: 14px;
  font-weight: 700;
}

.user-meta span {
  font-size: 11px;
  color: var(--text-muted);
}

.resource-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
}

.stat-pill.energy {
  color: var(--accent-green);
  border-color: rgba(0, 255, 136, 0.3);
}

.stat-pill.coin {
  color: var(--accent-gold);
  border-color: rgba(255, 215, 0, 0.3);
}

/* Main Content Views */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: 90px;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease-out forwards;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Cards & Badges */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.badge-pool {
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.15), rgba(255, 0, 85, 0.15));
  border: 1px solid var(--primary);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
  margin-bottom: 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, #00d2ff, #0077ff);
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-success {
  background: linear-gradient(135deg, #00ff88, #00bb66);
  color: #052e16;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 72px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  z-index: 50;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  padding: 8px 0;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  margin-bottom: 4px;
  transition: all 0.2s;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active svg {
  transform: scale(1.15);
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

/* Central Glowing Play Button */
.nav-item.play-nav {
  position: relative;
  top: -12px;
}

.play-circle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff0055, #ff5500);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px var(--secondary-glow);
  color: #fff;
  border: 3px solid var(--bg-dark);
  transition: transform 0.2s ease;
}

.play-circle svg {
  width: 28px;
  height: 28px;
  margin-bottom: 0;
  fill: currentColor;
}

.nav-item.play-nav.active .play-circle {
  transform: scale(1.1);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 20px;
  width: 100%;
  max-width: 380px;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.modal-overlay.active .modal-box {
  transform: scale(1);
}

/* Game Canvas & HUD */
#gameCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 60;
  background: #0d1322;
  display: none;
}

.game-hud {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 70;
  pointer-events: none;
}

.hud-pill {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

/* Virtual Joystick */
.joystick-zone {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  z-index: 70;
  display: none;
  touch-action: none;
}

.joystick-knob {
  position: absolute;
  top: 40px;
  left: 40px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 15px var(--primary-glow);
  pointer-events: none;
}

/* Task Pills */
.task-cat-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.task-cat-pill {
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
}

.task-cat-pill.active {
  background: var(--primary);
  color: #000;
  font-weight: 700;
}

/* Touch and Click Optimizations */
.nav-item, .btn, .task-cat-pill, .lang-btn, select, input, button {
  touch-action: manipulation;
  cursor: pointer;
}

.nav-item * {
  pointer-events: none;
}