/* 
  Baby Dino Jump Game - Stylesheet
  Theme: Neon Retro Cyber-Prehistoric
  Designed for maximum aesthetic "wow" factor, utilizing fluid layouts, 
  glassmorphism, vibrant neon gradients, and CSS keyframe micro-animations.
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&family=Outfit:wght@400;600;800;900&display=swap');

:root {
  /* Dynamic Color Palette */
  --bg-dark: #090810;
  --bg-card: rgba(20, 16, 35, 0.65);
  --border-glass: rgba(255, 255, 255, 0.08);
  --neon-cyan: #00f0ff;
  --neon-pink: #ff007f;
  --neon-purple: #bd00ff;
  --neon-yellow: #ffee00;
  --text-primary: #ffffff;
  --text-secondary: #b5b2c9;
  
  /* Fonts */
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  /* Visual Effects */
  --glow-cyan: 0 0 15px rgba(0, 240, 255, 0.4);
  --glow-pink: 0 0 15px rgba(255, 0, 127, 0.4);
  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  
  /* Transitions */
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

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

/* Parallax Cyber Background */
body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 30%, #1a103c 0%, var(--bg-dark) 80%);
  z-index: -2;
}

/* Background Grid Animation */
.bg-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(255, 0, 127, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 0, 127, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center;
  z-index: -1;
  pointer-events: none;
}

/* Layout Container */
.app-container {
  width: 100%;
  max-width: 1100px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  position: relative;
  z-index: 1;
}

/* Header & Title Styling */
header {
  text-align: center;
  margin-bottom: 5px;
}

h1.game-title {
  font-family: var(--font-title);
  font-size: 3rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple), var(--neon-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
  animation: title-glow 3s ease-in-out infinite alternate;
}

.game-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 5px;
  font-weight: 600;
}

/* Glassmorphic Panels */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  transition: var(--transition-smooth);
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.6);
}

/* Dashboard / Main Screen Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
  width: 100%;
}

@media (max-width: 850px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* Section Card Header Styling */
.card-header {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border-glass);
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header.neon-blue { color: var(--neon-cyan); border-bottom-color: rgba(0, 240, 255, 0.15); }
.card-header.neon-pink { color: var(--neon-pink); border-bottom-color: rgba(255, 0, 127, 0.15); }
.card-header.neon-purple { color: #d64dff; border-bottom-color: rgba(189, 0, 255, 0.15); }

/* Crop Section Styles */
.crop-section {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.crop-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.crop-instruction {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.4;
}

/* Interactive Crop Area */
.crop-container {
  width: 100%;
  max-width: 480px;
  aspect-ratio: 1024 / 494; /* Match image ratio */
  background-color: #120e24;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  cursor: crosshair;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.crop-image-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.45;
  filter: grayscale(30%);
  pointer-events: none;
}

.crop-canvas-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

/* Live Character Preview Panel */
.character-preview-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 15px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  width: 100%;
  max-width: 320px;
  margin-top: 5px;
}

.character-preview-card h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.preview-avatar-wrapper {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 240, 255, 0.2) 0%, transparent 70%);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.preview-avatar-canvas {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  animation: character-idle 2.5s ease-in-out infinite alternate;
}

/* Button & Control System */
.btn-container {
  display: flex;
  gap: 15px;
  width: 100%;
  margin-top: 5px;
}

.btn {
  flex: 1;
  padding: 14px 28px;
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  width: 200%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transform: skewX(-20deg);
  transition: 0.75s;
}

.btn:hover::after {
  left: 120%;
}

.btn-cyan {
  background: linear-gradient(135deg, #00d2ff 0%, #007bff 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(0, 210, 255, 0.35);
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.btn-cyan:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 210, 255, 0.5);
  filter: brightness(1.1);
}

.btn-pink {
  background: linear-gradient(135deg, #ff007f 0%, #a80054 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(255, 0, 127, 0.35);
}

.btn-pink:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 0, 127, 0.5);
  filter: brightness(1.1);
}

.btn:active {
  transform: translateY(1px);
}

/* Sidebar Components: High Scores & Achievements */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

.sidebar-body {
  padding: 15px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: calc(100% - 55px);
  overflow-y: auto;
}

/* Leaderboard List */
.scores-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  transition: var(--transition-smooth);
}

.score-row:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(0, 240, 255, 0.2);
}

.score-player {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.score-rank {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 900;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.score-rank.first { background: var(--neon-yellow); color: #000; }
.score-rank.second { background: #d1d1d1; color: #000; }
.score-rank.third { background: #cd7f32; color: #000; }
.score-rank.normal { color: var(--text-secondary); background: rgba(255,255,255,0.06); }

.score-points {
  font-family: var(--font-title);
  font-weight: 800;
  color: var(--neon-cyan);
}

.no-scores {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: 15px 0;
  font-style: italic;
}

/* Achievements Section */
.achievements-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.achievement-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  opacity: 0.45;
  transition: var(--transition-smooth);
}

.achievement-card.unlocked {
  opacity: 1;
  background: rgba(189, 0, 255, 0.05);
  border-color: rgba(189, 0, 255, 0.2);
}

.achievement-icon {
  font-size: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.achievement-card.unlocked .achievement-icon {
  background: rgba(189, 0, 255, 0.25);
  text-shadow: 0 0 8px rgba(189, 0, 255, 0.8);
}

.achievement-info {
  display: flex;
  flex-direction: column;
}

.achievement-title {
  font-size: 0.85rem;
  font-weight: 600;
}

.achievement-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 1px;
}

/* AUDIO CONTROL SYSTEM */
.settings-bar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  width: 100%;
}

.settings-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-primary);
  font-size: 1.1rem;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: var(--transition-smooth);
}

.settings-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
  color: var(--neon-cyan);
}

.settings-btn.active {
  background: rgba(0, 240, 255, 0.1);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

/* GAME CANVAS VIEWPORT SECTION */
.game-viewport-card {
  width: 100%;
  overflow: hidden;
  position: relative;
  display: none; /* Controlled via JS */
  flex-direction: column;
}

.game-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 15px 25px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 5;
}

.hud-panel {
  display: flex;
  flex-direction: column;
}

.hud-score-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 2px;
}

.hud-score-val {
  font-family: var(--font-title);
  font-size: 2rem;
  font-weight: 900;
  color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
}

.hud-highscore-val {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-secondary);
}

.hud-env-badge {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 6px 14px;
  font-family: var(--font-title);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  color: var(--neon-pink);
  border-color: rgba(255, 0, 127, 0.3);
}

.hud-env-badge::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-pink);
  box-shadow: var(--glow-pink);
}

/* Canvas Element */
.game-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 7;
  background: #000;
  display: block;
  border-radius: 20px;
}

/* Mobile Controls Overlay */
.mobile-controls {
  display: none; /* Shown on touch devices */
  justify-content: space-between;
  width: 100%;
  padding: 10px 15px;
  gap: 20px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid var(--border-glass);
}

.control-btn {
  flex: 1;
  height: 60px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  font-family: var(--font-title);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.control-btn:active {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--neon-cyan);
}

/* Keyboard Hints */
.keyboard-hints {
  display: flex;
  justify-content: center;
  gap: 25px;
  margin-top: 5px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.key-hint {
  display: flex;
  align-items: center;
  gap: 8px;
}

.key-cap {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: monospace;
  font-size: 0.75rem;
  color: #fff;
  box-shadow: 0 2px 0 rgba(255,255,255,0.1);
}

/* GAME OVER MODAL OVERLAY */
.gameover-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 6, 15, 0.85);
  backdrop-filter: blur(12px);
  display: none; /* Controlled via JS */
  justify-content: center;
  align-items: center;
  z-index: 10;
  border-radius: 20px;
}

.gameover-card {
  width: 90%;
  max-width: 440px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border-color: rgba(255, 0, 127, 0.3);
}

.gameover-title {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--neon-pink);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 5px;
  text-shadow: 0 0 10px rgba(255, 0, 127, 0.6);
  animation: gameover-pulse 1.5s infinite ease-in-out;
}

.gameover-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 25px;
}

.gameover-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  width: 100%;
  margin-bottom: 25px;
}

.stat-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 12px 10px;
  border-radius: 10px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.stat-val {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
}

.stat-val.highlight {
  color: var(--neon-cyan);
}

.gameover-card input[type="text"] {
  width: 100%;
  padding: 12px;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 1rem;
  text-align: center;
  margin-bottom: 20px;
  outline: none;
  transition: var(--transition-smooth);
}

.gameover-card input[type="text"]:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.2);
}

/* KEYFRAME ANIMATIONS */
@keyframes title-glow {
  0% { filter: drop-shadow(0 2px 5px rgba(0, 240, 255, 0.3)); }
  100% { filter: drop-shadow(0 2px 15px rgba(255, 0, 127, 0.5)); }
}

@keyframes character-idle {
  0% { transform: translateY(0px) rotate(0deg); }
  100% { transform: translateY(-6px) rotate(3deg); }
}

@keyframes gameover-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Custom Scrollbar for sidebars */
.sidebar-body::-webkit-scrollbar {
  width: 6px;
}

.sidebar-body::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.sidebar-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Detect Touch Devices to reveal mobile controls */
@media (hover: none) and (pointer: coarse) {
  .mobile-controls {
    display: flex;
  }
  .keyboard-hints {
    display: none;
  }
}

/* Player Name Input Menu */
#player-name-menu {
  width: 100%;
  padding: 10px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 1rem;
  text-align: center;
  outline: none;
  transition: var(--transition-smooth);
}

#player-name-menu:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.2);
}

/* Clear scores button */
#btn-clear-scores:hover {
  opacity: 1 !important;
  transform: scale(1.15);
  background: rgba(255, 0, 127, 0.1) !important;
}

#btn-clear-scores:active {
  transform: scale(0.95);
}

