/* ==========================================================================
   Relic Odyssey: Jungle Guardian - Master Stylesheet
   ========================================================================== */

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

:root {
  --primary-gold: #f59e0b;
  --gold-glow: #d97706;
  --jade-green: #10b981;
  --ruby-red: #ef4444;
  --sapphire-blue: #38bdf8;
  --bg-dark: #0f172a;
  --glass-bg: rgba(15, 23, 42, 0.82);
  --glass-border: rgba(245, 158, 11, 0.35);
  --glass-gold: rgba(245, 158, 11, 0.15);
  --font-heading: 'Cinzel', serif;
  --font-body: 'Outfit', sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #06090e;
  font-family: var(--font-body);
  color: #ffffff;
}

#game-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#game-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* UI Overlay Layer */
#ui-root {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

.screen, .modal, .modal-overlay, .modal-content, .btn, button, input {
  pointer-events: auto;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Home Menu Screen
   ========================================================================== */
#menu-screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
  background: radial-gradient(circle at center, transparent 40%, rgba(0, 0, 0, 0.7) 100%);
}

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

.game-title-header h1 {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #fffbeb 0%, #f59e0b 50%, #b45309 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
  margin-bottom: 2px;
}

.game-title-header .subtitle {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: #38bdf8;
  font-weight: 800;
}

.currency-widget {
  display: flex;
  gap: 12px;
}

.currency-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 1.05rem;
  font-weight: 700;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.currency-pill.coins {
  border-color: rgba(245, 158, 11, 0.4);
  color: #fef08a;
}

.currency-pill.gems {
  border-color: rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
}

/* Center Character Card */
.center-character-info {
  text-align: center;
  margin-bottom: 40px;
}

.character-badge {
  display: inline-block;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 10px 24px;
  border-radius: 16px;
  backdrop-filter: blur(10px);
}

.character-badge h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  color: #fef08a;
}

.character-badge p {
  font-size: 0.85rem;
  color: #cbd5e1;
}

/* Bottom Menu Controls */
.bottom-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
}

.play-button-container {
  width: 100%;
  max-width: 320px;
}

.btn-play {
  width: 100%;
  padding: 18px 0;
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #1e1b18;
  background: linear-gradient(180deg, #fde047 0%, #f59e0b 50%, #d97706 100%);
  border: 2px solid #fef08a;
  border-radius: 35px;
  cursor: pointer;
  box-shadow: 0 0 30px rgba(245, 158, 11, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.8);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-play:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 40px rgba(245, 158, 11, 0.9);
}

.btn-play:active {
  transform: translateY(2px) scale(0.98);
}

.nav-buttons-grid {
  display: flex;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 480px;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  color: #ffffff;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

.nav-btn:hover {
  background: var(--glass-gold);
  border-color: var(--primary-gold);
  transform: translateY(-2px);
}

.nav-btn .nav-icon {
  font-size: 1.3rem;
}

.nav-btn span {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* ==========================================================================
   In-Game HUD
   ========================================================================== */
#hud-screen {
  width: 100%;
  height: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.hud-stats-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hud-score-box {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 6px 16px;
  border-radius: 12px;
  font-size: 1.6rem;
  font-weight: 900;
  color: #fef08a;
  text-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.hud-dist-box {
  background: var(--glass-bg);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #94a3b8;
}

.hud-biome-badge {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #6ee7b7;
  backdrop-filter: blur(8px);
}

.hud-pause-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 1.2rem;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.hud-powerups-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.powerup-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--glass-bg);
  border: 1px solid var(--primary-gold);
  padding: 4px 10px;
  border-radius: 20px;
}

.powerup-bar-track {
  width: 70px;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
}

.powerup-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.1s linear;
}

/* ==========================================================================
   Modals & Dialogs
   ========================================================================== */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-content {
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  background: var(--bg-dark);
  border: 2px solid var(--primary-gold);
  border-radius: 24px;
  box-shadow: 0 0 30px rgba(245, 158, 11, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPop 0.25s ease-out;
}

@keyframes modalPop {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
}

.modal-header h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  color: #fef08a;
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: #94a3b8;
  cursor: pointer;
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

/* Shop UI Styles */
.shop-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.shop-tab-btn {
  flex: 1;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #cbd5e1;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.shop-tab-btn.active {
  background: var(--glass-gold);
  border-color: var(--primary-gold);
  color: #fef08a;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 12px;
}

.shop-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 14px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.shop-card.equipped {
  border-color: var(--jade-green);
  background: rgba(16, 185, 129, 0.1);
}

.shop-card-icon {
  font-size: 2.2rem;
  margin-bottom: 6px;
}

.shop-card-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: #f8fafc;
}

.shop-card-desc, .shop-card-perk {
  font-size: 0.75rem;
  color: #94a3b8;
  margin: 4px 0 10px 0;
}

.shop-card-perk {
  color: #38bdf8;
}

.btn {
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  transition: transform 0.1s;
}

.btn:active {
  transform: scale(0.96);
}

.btn-buy {
  background: linear-gradient(180deg, #fde047 0%, #f59e0b 100%);
  color: #1e1b18;
}

.btn-equip {
  background: #38bdf8;
  color: #0f172a;
}

.btn-equipped {
  background: rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
  cursor: default;
}

.btn-upgrade {
  background: var(--primary-gold);
  color: #0f172a;
}

.btn-max {
  background: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  cursor: default;
}

/* Upgrade Row */
.upgrade-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px;
  border-radius: 14px;
  margin-bottom: 10px;
}

.upgrade-icon {
  font-size: 1.8rem;
}

.upgrade-info {
  flex: 1;
}

.upgrade-name {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.upgrade-pips {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: #94a3b8;
}

.lvl-pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}

.lvl-pip.filled {
  background: var(--primary-gold);
  box-shadow: 0 0 6px var(--primary-gold);
}

/* Daily Rewards Grid */
.daily-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.daily-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 10px 6px;
  text-align: center;
}

.daily-card.ready {
  border-color: var(--primary-gold);
  background: var(--glass-gold);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}

.daily-card.claimed {
  opacity: 0.45;
  border-color: var(--jade-green);
}

.daily-day {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 600;
}

.daily-icon {
  font-size: 1.6rem;
  margin: 6px 0;
}

.daily-reward {
  font-size: 0.8rem;
  font-weight: 700;
  color: #fef08a;
}

.daily-status {
  font-size: 0.7rem;
  margin-top: 4px;
  color: #38bdf8;
}

/* Leaderboard Rows */
.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  margin-bottom: 6px;
}

.leaderboard-row.player-row {
  border: 1px solid var(--primary-gold);
  background: var(--glass-gold);
}

.rank-badge {
  font-weight: 800;
  font-size: 0.9rem;
  width: 50px;
}

.rank-1 { color: #facc15; }
.rank-2 { color: #e2e8f0; }
.rank-3 { color: #f97316; }

.player-details {
  flex: 1;
}

.player-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.player-dist {
  font-size: 0.75rem;
  color: #94a3b8;
}

.player-score {
  font-weight: 800;
  color: #fef08a;
}

/* Missions Cards */
.mission-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 14px;
  border-radius: 16px;
  margin-bottom: 12px;
}

.mission-card.completed {
  border-color: var(--jade-green);
  background: rgba(16, 185, 129, 0.08);
}

.mission-header {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  margin-bottom: 8px;
}

.mission-reward {
  color: #fef08a;
}

.mission-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.mission-bar-fill {
  height: 100%;
  background: var(--primary-gold);
  border-radius: 4px;
}

.mission-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: #94a3b8;
}

.btn-claim-mission {
  background: var(--jade-green);
  color: #0f172a;
}

/* Game Over & Revive Screens */
.gameover-summary {
  text-align: center;
  padding: 10px 0;
}

.gameover-score-title {
  font-size: 0.9rem;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 2px;
}

.gameover-score-val {
  font-family: var(--font-heading);
  font-size: 2.8rem;
  font-weight: 900;
  color: #fef08a;
  text-shadow: 0 0 25px rgba(245, 158, 11, 0.6);
  margin: 6px 0;
}

.new-high-badge {
  display: inline-block;
  background: linear-gradient(90deg, #ef4444, #f59e0b);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 16px;
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.gameover-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin: 16px 0 24px 0;
}

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

.stat-box-label {
  font-size: 0.75rem;
  color: #94a3b8;
}

.stat-box-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  margin-top: 2px;
}

.revive-timer-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 4px solid var(--ruby-red);
  margin: 16px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 900;
  color: #f87171;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

/* Floating Game Toasts */
#toast-container {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}

.game-toast {
  background: var(--glass-bg);
  border-left: 4px solid var(--primary-gold);
  border-radius: 8px;
  padding: 8px 18px;
  font-weight: 700;
  font-size: 0.9rem;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.25s ease-out;
}

.game-toast.fade-out {
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s, transform 0.3s;
}

@keyframes toastIn {
  0% { opacity: 0; transform: translateY(-15px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Settings Form Controls */
.settings-group {
  margin-bottom: 16px;
}

.settings-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #cbd5e1;
}

.settings-slider {
  width: 100%;
  accent-color: var(--primary-gold);
}

.settings-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}
