/* ==========================================================================
   FS CYBER DASH - GAME DESIGN SYSTEM & STYLESHEET
   Offline-First / Zero External CDN (Fonts loaded locally via fonts.css)
   ========================================================================== */

:root {
  --font-heading: 'Outfit', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Prompt', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --bg-dark: #050811;
  --bg-card: rgba(13, 18, 30, 0.75);
  --bg-card-border: rgba(0, 243, 255, 0.25);
  --text-main: #f0f6fc;
  --text-muted: #8b9bb4;

  --primary-glow: #00f3ff;
  --secondary-glow: #ff007f;
  --accent-glow: #ffd700;
  --accent-green: #00e5a3;

  --shadow-color: rgba(0, 243, 255, 0.18);
  --blob-1: rgba(0, 243, 255, 0.15);
  --blob-2: rgba(255, 0, 127, 0.15);
  --blob-3: rgba(0, 229, 163, 0.10);
}

/* Global Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Animated Background Blobs */
.background-ambient {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.8;
  animation: floatBlob 20s infinite alternate ease-in-out;
}

.blob-1 {
  width: 450px;
  height: 450px;
  background: var(--blob-1);
  top: -10%;
  left: -10%;
}

.blob-2 {
  width: 500px;
  height: 500px;
  background: var(--blob-2);
  bottom: -15%;
  right: -10%;
  animation-delay: -7s;
}

.blob-3 {
  width: 350px;
  height: 350px;
  background: var(--blob-3);
  top: 40%;
  left: 30%;
  animation-delay: -14s;
}

@keyframes floatBlob {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -50px) scale(1.1); }
  100% { transform: translate(-30px, 30px) scale(0.95); }
}

/* App Container Layout */
.app-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 820px;
  min-height: 90vh;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-sizing: border-box;
}

/* Header Area */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 0.75rem 1.25rem;
  border-radius: 16px;
  box-shadow: 0 4px 24px var(--shadow-color);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.back-btn {
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
}

.logo-icon {
  color: var(--primary-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

.title-group h1 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.1;
  background: linear-gradient(135deg, #ffffff 30%, var(--primary-glow) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.title-group .subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Stats Badges */
.game-stats {
  display: flex;
  gap: 0.75rem;
}

.stat-badge {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--bg-card-border);
  padding: 0.35rem 0.75rem;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 65px;
}

.stat-badge.gold .stat-value {
  color: var(--accent-glow);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

.stat-badge.cyan .stat-value {
  color: var(--primary-glow);
  text-shadow: 0 0 8px rgba(0, 243, 255, 0.4);
}

.stat-badge.red .stat-value {
  color: #ff4d6d;
  font-size: 0.85rem;
  letter-spacing: 1px;
}

.pause-btn {
  color: var(--accent-glow) !important;
  border-color: rgba(255, 215, 0, 0.4) !important;
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.8px;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-glow);
}

/* Controls / Toolbar */
.game-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 0.75rem 1.25rem;
  border-radius: 16px;
  box-shadow: 0 4px 24px var(--shadow-color);
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.control-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Glass & Icon Buttons */
.glass-btn {
  height: 38px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  padding: 0 0.85rem;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--primary-glow);
  color: var(--primary-glow);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-color);
}

.icon-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.share-btn {
  color: var(--primary-glow);
  border-color: rgba(0, 243, 255, 0.3);
}

.donate-btn {
  color: #00e5a3 !important;
  border-color: rgba(0, 229, 163, 0.4) !important;
}

/* Stage & Canvas Wrapper */
.game-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  width: 100%;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 540px;
  height: 520px;
  max-height: 68vh;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 8px 32px var(--shadow-color);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.touch-controls-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  pointer-events: none;
  opacity: 0.6;
}

.touch-zone {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 0.85rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.65);
  border-right: 1px dashed rgba(0, 243, 255, 0.15);
  text-shadow: 0 0 8px rgba(0, 243, 255, 0.4);
}

.touch-zone:last-child {
  border-right: none;
}

/* Mobile Virtual Controller Bar (Thumb Ergonomics) */
.mobile-virtual-controls {
  display: flex;
  width: 100%;
  max-width: 540px;
  gap: 12px;
  padding: 2px 4px;
  box-sizing: border-box;
}

.virtual-btn {
  flex: 1;
  height: 58px;
  min-height: 52px;
  border-radius: 16px;
  border: 2px solid var(--primary-glow);
  background: linear-gradient(180deg, rgba(0, 243, 255, 0.18), rgba(0, 243, 255, 0.05));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 4px 16px rgba(0, 243, 255, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: transform 0.08s ease, background 0.1s ease, box-shadow 0.1s ease;
}

.virtual-btn.btn-left {
  border-color: #00f3ff;
  color: #00f3ff;
  background: linear-gradient(180deg, rgba(0, 243, 255, 0.22), rgba(0, 243, 255, 0.06));
}

.virtual-btn.btn-center {
  border-color: #00e5a3;
  color: #00e5a3;
  background: linear-gradient(180deg, rgba(0, 229, 163, 0.22), rgba(0, 229, 163, 0.06));
  box-shadow: 0 4px 16px rgba(0, 229, 163, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.virtual-btn.btn-right {
  border-color: #ff007f;
  color: #ff007f;
  background: linear-gradient(180deg, rgba(255, 0, 127, 0.22), rgba(255, 0, 127, 0.06));
  box-shadow: 0 4px 16px rgba(255, 0, 127, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.virtual-btn:active,
.virtual-btn.active {
  transform: scale(0.95);
}

.virtual-btn.btn-left:active,
.virtual-btn.btn-left.active {
  background: rgba(0, 243, 255, 0.45);
  box-shadow: 0 0 24px rgba(0, 243, 255, 0.7);
  color: #ffffff;
}

.virtual-btn.btn-center:active,
.virtual-btn.btn-center.active {
  background: rgba(0, 229, 163, 0.45);
  box-shadow: 0 0 24px rgba(0, 229, 163, 0.7);
  color: #ffffff;
}

.virtual-btn.btn-right:active,
.virtual-btn.btn-right.active {
  background: rgba(255, 0, 127, 0.45);
  box-shadow: 0 0 24px rgba(255, 0, 127, 0.7);
  color: #ffffff;
}

.virtual-btn-icon {
  font-size: 1.35rem;
}

.virtual-btn-label {
  letter-spacing: 0.5px;
}

.game-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-bottom: 0.5rem;
}

/* Glass Modal Dialogs */
.glass-modal {
  border: none;
  background: transparent;
  padding: 0;
  margin: auto;
  max-width: 440px;
  width: 90%;
  outline: none;
}

.glass-modal::backdrop {
  background: rgba(5, 8, 15, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 24px;
  padding: 1.5rem;
  color: var(--text-main);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 85vh;
  overflow-y: auto;
}

.text-center {
  text-align: center;
  align-items: center;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.modal-header h2 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--primary-glow);
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 0.4rem;
}

.score-summary {
  display: flex;
  gap: 1rem;
  width: 100%;
}

.summary-box {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--bg-card-border);
  padding: 0.75rem;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

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

.summary-value {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-glow);
}

.high-score-msg {
  color: var(--accent-glow);
  font-size: 0.85rem;
  font-weight: 700;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  width: 100%;
}

.btn-primary {
  flex: 1;
  background: linear-gradient(135deg, var(--primary-glow), #00a8ff);
  color: #03050c;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.65rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  box-shadow: 0 0 15px var(--shadow-color);
}

/* Donate & Binance */
.channel-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 0.5rem 0 0.8rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--bg-card-border);
  width: 100%;
}

.channel-btn {
  flex: 1;
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.tab-icon-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.channel-btn.active {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.channel-btn[data-channel="promptpay"].active {
  border-color: rgba(0, 229, 163, 0.5);
  color: #00e5a3;
  background: rgba(0, 229, 163, 0.12);
}

.channel-btn[data-channel="binance"].active {
  border-color: rgba(240, 185, 11, 0.5);
  color: #F0B90B;
  background: rgba(240, 185, 11, 0.12);
}

.channel-view {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#donate-qr-container, #share-qr-container {
  background: #ffffff;
  padding: 12px;
  border-radius: 16px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  margin: 0.6rem auto;
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.25);
  max-width: 100%;
}

#donate-qr-container svg, #donate-qr-container canvas, #donate-qr-container img,
#share-qr-container svg, #share-qr-container canvas, #share-qr-container img {
  max-width: 100%;
  height: auto;
  display: block;
}

.custom-amount-group {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  margin: 0.4rem 0;
}

.binance-qr-wrapper {
  background: #ffffff;
  padding: 10px;
  border-radius: 16px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  margin: 0.5rem 0 0.4rem;
  box-shadow: 0 0 25px rgba(240, 185, 11, 0.35);
  border: 1px solid rgba(240, 185, 11, 0.4);
  max-width: 100%;
}

.binance-qr-img {
  width: 180px;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  object-fit: contain;
}

.amount-chips {
  display: flex;
  gap: 0.4rem;
  width: 100%;
  justify-content: center;
  margin: 0.5rem 0;
}

.chip-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  padding: 0.35rem 0.65rem;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.chip-btn.active {
  background: rgba(0, 229, 163, 0.2);
  border-color: #00e5a3;
  color: #00e5a3;
}

.amount-display-badge {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

.amount-display-badge span {
  color: #00e5a3;
  font-weight: 800;
}

.hidden {
  display: none !important;
}

.share-input-group {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.5rem;
}

.share-url-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--bg-card-border);
  color: #fff;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  font-size: 0.85rem;
}

.btn-copy {
  background: var(--primary-glow);
  color: #03050c;
  border: none;
  font-weight: 700;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* PromptPay Badge */
.promptpay-badge {
  background: linear-gradient(135deg, rgba(0, 75, 145, 0.4), rgba(0, 229, 163, 0.2));
  border: 1px solid #00e5a3;
  padding: 0.6rem 1rem;
  border-radius: 14px;
  width: 100%;
  margin: 0.4rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pp-logo {
  font-size: 0.75rem;
  font-weight: 700;
  color: #00e5a3;
  letter-spacing: 1px;
}

.donate-timeline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 0.3rem 0;
}

.timeline-step {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.step-num {
  background: #00e5a3;
  color: #03050c;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-text {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.timeline-arrow {
  color: #00e5a3;
  font-size: 0.7rem;
}

/* Responsive Media Queries */
@media (max-width: 650px) {
  .app-container {
    padding: 0.5rem;
    gap: 0.5rem;
  }
  .game-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
  }
  .game-header .brand {
    justify-content: space-between;
  }
  .title-group h1 {
    font-size: 1.25rem;
  }
  .game-stats {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
  }
  .stat-badge {
    min-width: 0;
    flex: 1;
    padding: 0.25rem 0.35rem;
  }
  .stat-label {
    font-size: 0.58rem;
  }
  .stat-value {
    font-size: 0.95rem;
  }
  .game-controls {
    padding: 0.45rem 0.75rem;
    gap: 0.5rem;
  }
  .canvas-wrapper {
    width: 100%;
    max-width: 440px;
    height: 380px;
    max-height: 50vh;
    border-radius: 20px;
  }
  .mobile-virtual-controls {
    gap: 6px;
  }
  .virtual-btn {
    height: 52px;
    font-size: 0.95rem;
    gap: 6px;
    border-radius: 14px;
  }
  .virtual-btn-icon {
    font-size: 1.15rem;
  }
  .controls-hint {
    font-size: 0.72rem;
    line-height: 1.35;
  }
}

@media (max-width: 380px) {
  .canvas-wrapper {
    height: 320px;
    max-height: 44vh;
  }
  .mobile-virtual-controls {
    gap: 4px;
  }
  .virtual-btn {
    height: 48px;
    font-size: 0.85rem;
    gap: 4px;
    border-radius: 12px;
    padding: 0 2px;
  }
  .virtual-btn-icon {
    font-size: 1rem;
  }
}
