:root {
  /* Cyberpunk Palette */
  --bg-deep: #080c16;
  --bg-card: rgba(14, 22, 38, 0.85);
  --bg-card-hover: rgba(20, 32, 54, 0.95);
  --bg-panel: rgba(10, 16, 28, 0.92);
  
  --neon-cyan: #00f3ff;
  --neon-cyan-glow: rgba(0, 243, 255, 0.4);
  --neon-magenta: #ff007f;
  --neon-magenta-glow: rgba(255, 0, 127, 0.4);
  --neon-yellow: #ffe600;
  --neon-yellow-glow: rgba(255, 230, 0, 0.4);
  --matrix-green: #00ff88;
  --matrix-green-glow: rgba(0, 255, 136, 0.4);
  
  --text-main: #f0f6fc;
  --text-muted: #8b9bb4;
  --text-dim: #4d5d78;

  --border-neon: 1px solid rgba(0, 243, 255, 0.25);
  --border-subtle: 1px solid rgba(255, 255, 255, 0.08);

  --font-display: 'Orbitron', -apple-system, sans-serif;
  --font-sans: 'Rajdhani', -apple-system, BlinkMacSystemFont, sans-serif;

  --nav-height: 70px;
  --header-height: 64px;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.4;
}

/* Background Ambient Lighting */
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.25) 50%
  );
  background-size: 100% 4px;
  z-index: 99;
  opacity: 0.6;
}

.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}

.cyan-glow {
  top: -10%;
  left: 20%;
  width: 320px;
  height: 320px;
  background: var(--neon-cyan);
  opacity: 0.12;
}

.magenta-glow {
  bottom: 10%;
  right: -10%;
  width: 360px;
  height: 360px;
  background: var(--neon-magenta);
  opacity: 0.1;
}

/* Main Container */
.app-container {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 50% 20%, #111a2f 0%, var(--bg-deep) 80%);
  overflow: hidden;
  z-index: 1;
}

/* Header */
.app-header {
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: var(--border-subtle);
  background: rgba(8, 12, 22, 0.7);
  backdrop-filter: blur(12px);
  z-index: 20;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-ring {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-magenta));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px var(--neon-cyan-glow);
}

.user-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: bold;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--neon-cyan-glow);
}

.user-rank {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Cyber Buttons */
.cyber-btn-mini {
  background: rgba(14, 24, 44, 0.9);
  border: var(--border-neon);
  border-radius: 8px;
  color: var(--text-main);
  padding: 6px 12px;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cyber-btn-mini:active {
  transform: scale(0.95);
}

.cyber-btn-mini.icon-only {
  padding: 6px 10px;
}

.turbo-btn {
  border-color: var(--neon-yellow);
  color: var(--neon-yellow);
  box-shadow: 0 0 12px var(--neon-yellow-glow);
}

.turbo-btn.active {
  background: var(--neon-yellow);
  color: #000;
  animation: pulseTurbo 0.8s infinite alternate;
}

/* Viewport for Screens */
.screens-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.screen-view {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 16px;
  display: none;
  flex-direction: column;
  scrollbar-width: none;
}

.screen-view::-webkit-scrollbar {
  display: none;
}

.screen-view.active {
  display: flex;
}

/* SCREEN 1: CORE STYLES */
#screen-core {
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px 16px;
}

.balance-card {
  width: 100%;
  background: var(--bg-card);
  border: var(--border-subtle);
  border-radius: 16px;
  padding: 14px 20px;
  backdrop-filter: blur(16px);
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.balance-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.balance-currency-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

.passive-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  background: rgba(0, 255, 136, 0.12);
  border: 1px solid rgba(0, 255, 136, 0.3);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--matrix-green);
}

.rate-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--matrix-green);
  box-shadow: 0 0 6px var(--matrix-green);
  animation: blinkDot 1.5s infinite;
}

.balance-amount-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.currency-symbol {
  font-size: 1.8rem;
  color: var(--neon-cyan);
  text-shadow: 0 0 12px var(--neon-cyan-glow);
}

.balance-value {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 0 16px var(--neon-cyan-glow);
}

/* Clicker Arena */
.clicker-arena {
  position: relative;
  width: 280px;
  height: 280px;
  margin: auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hologram-rings {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ring {
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(0, 243, 255, 0.25);
}

.ring-outer {
  width: 270px;
  height: 270px;
  animation: rotateClockwise 25s linear infinite;
}

.ring-mid {
  width: 230px;
  height: 230px;
  border-color: rgba(255, 0, 127, 0.3);
  animation: rotateCounterClockwise 18s linear infinite;
}

.ring-inner {
  width: 190px;
  height: 190px;
  border-color: rgba(255, 230, 0, 0.2);
  animation: rotateClockwise 12s linear infinite;
}

/* Cyber Core Button */
.cyber-core {
  position: relative;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  touch-action: manipulation;
  transition: transform 0.08s ease-out;
}

.core-glow {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--neon-cyan-glow) 0%, transparent 70%);
  animation: pulseCoreGlow 3s ease-in-out infinite alternate;
}

.core-chip {
  position: relative;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: linear-gradient(145deg, #101c36, #090e1c);
  border: 2px solid var(--neon-cyan);
  box-shadow: 
    0 0 25px var(--neon-cyan-glow),
    inset 0 0 20px rgba(0, 243, 255, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.core-svg {
  width: 84px;
  height: 84px;
}

.core-label {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 1px;
  color: var(--neon-cyan);
  margin-top: 4px;
  opacity: 0.85;
}

/* Energy Card */
.energy-card {
  width: 100%;
  background: var(--bg-card);
  border: var(--border-subtle);
  border-radius: 14px;
  padding: 12px 18px;
  backdrop-filter: blur(12px);
}

.energy-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.energy-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.energy-numbers {
  font-family: var(--font-display);
  color: var(--neon-yellow);
}

.energy-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.energy-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff9900, var(--neon-yellow));
  border-radius: 10px;
  transition: width 0.15s ease-out;
  position: relative;
  box-shadow: 0 0 10px var(--neon-yellow-glow);
}

.energy-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.4) 50%, 
    transparent 100%
  );
  animation: energyShimmer 2s infinite;
}

/* SCREEN 2: HARDWARE & BOOSTS */
.screen-header {
  margin-bottom: 16px;
}

.screen-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px var(--neon-cyan-glow);
}

.screen-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.hardware-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 16px;
}

.upgrade-card {
  background: var(--bg-card);
  border: var(--border-subtle);
  border-radius: 14px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
}

.upgrade-card:hover {
  border-color: rgba(0, 243, 255, 0.4);
  background: var(--bg-card-hover);
}

.upgrade-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.upgrade-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(0, 243, 255, 0.08);
  border: 1px solid rgba(0, 243, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.upgrade-texts {
  display: flex;
  flex-direction: column;
}

.upgrade-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.upgrade-effect {
  font-size: 0.8rem;
  color: var(--matrix-green);
  font-weight: 600;
}

.upgrade-level {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.upgrade-action-btn {
  background: linear-gradient(135deg, rgba(0, 243, 255, 0.2), rgba(255, 0, 127, 0.2));
  border: var(--border-neon);
  border-radius: 10px;
  color: #fff;
  padding: 8px 14px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 85px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upgrade-action-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.upgrade-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}

.upgrade-cost-text {
  font-size: 0.85rem;
  color: var(--neon-cyan);
}

/* SCREEN 3: CONTRACTS & HACKS */
.contracts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 16px;
}

.contract-card {
  background: var(--bg-card);
  border: var(--border-subtle);
  border-radius: 14px;
  padding: 14px 16px;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contract-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.contract-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.contract-icon {
  font-size: 1.3rem;
}

.contract-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.contract-reward {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--neon-yellow);
  padding: 2px 8px;
  background: rgba(255, 230, 0, 0.1);
  border-radius: 6px;
  border: 1px solid rgba(255, 230, 0, 0.3);
}

.contract-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.contract-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.contract-progress-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
}

.contract-progress-fill {
  height: 100%;
  background: var(--neon-cyan);
  border-radius: 6px;
  transition: width 0.3s ease;
}

.contract-claim-btn {
  background: var(--neon-cyan);
  border: none;
  border-radius: 8px;
  color: #000;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 900;
  padding: 6px 14px;
  cursor: pointer;
}

.contract-claim-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

/* SCREEN 4: TERMINAL & STATS */
.stats-overview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.stat-box {
  background: var(--bg-card);
  border: var(--border-subtle);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.stat-number {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--neon-cyan);
  margin-top: 4px;
}

.terminal-card {
  background: #050810;
  border: 1px solid rgba(0, 243, 255, 0.3);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  margin-bottom: 16px;
}

.terminal-bar {
  background: #0d1424;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.terminal-caption {
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 6px;
}

.terminal-body {
  padding: 12px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8rem;
  color: var(--matrix-green);
  line-height: 1.6;
  height: 140px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
}

.terminal-body::-webkit-scrollbar {
  display: none;
}

.term-line {
  margin-bottom: 4px;
  word-break: break-all;
}

.terminal-actions {
  margin-top: auto;
  padding-bottom: 16px;
}

.cyber-btn-primary {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(90deg, #00f3ff, #ff007f);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 20px var(--neon-cyan-glow);
  transition: all 0.2s ease;
}

.cyber-btn-primary:active {
  transform: scale(0.98);
}

/* Bottom Navigation */
.app-nav {
  height: var(--nav-height);
  background: rgba(8, 12, 22, 0.92);
  border-top: var(--border-subtle);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  z-index: 20;
}

.nav-tab {
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.nav-tab .nav-icon {
  font-size: 1.3rem;
  filter: grayscale(80%);
  transition: all 0.2s ease;
}

.nav-tab .nav-text {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.nav-tab.active {
  color: var(--neon-cyan);
}

.nav-tab.active .nav-icon {
  filter: grayscale(0%);
  transform: scale(1.15);
}

.nav-tab.active .nav-text {
  text-shadow: 0 0 8px var(--neon-cyan-glow);
}

/* Offline Modal */
.cyber-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.cyber-modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 360px;
  background: #0f172a;
  border: 1px solid var(--neon-cyan);
  border-radius: 18px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 0 40px var(--neon-cyan-glow);
  z-index: 2;
  animation: modalPop 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.modal-header {
  margin-bottom: 12px;
}

.modal-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 8px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--neon-cyan);
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.offline-reward-box {
  background: rgba(0, 243, 255, 0.08);
  border: 1px dashed var(--neon-cyan);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}

.offline-reward-num {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  color: #fff;
  display: block;
  text-shadow: 0 0 12px var(--neon-cyan-glow);
}

.offline-currency {
  font-size: 0.85rem;
  color: var(--neon-yellow);
  font-weight: 700;
}

.offline-time-info {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 20px;
}

/* Toast Notifications */
.cyber-toast {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--neon-cyan);
  border-radius: 30px;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 20px var(--neon-cyan-glow);
  z-index: 1000;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
}

.cyber-toast.hidden {
  opacity: 0;
  transform: translate(-50%, -10px);
  pointer-events: none;
}
