/**
 * Adventure Meme Games Platform - Custom Theme
 * Playful cartoon adventure styling with 3D gaming buttons, glowing cards, and canvas game bezels.
 */

:root {
  --font-display: 'Baloo 2', cursive, sans-serif;
  --font-body: 'Fredoka', cursive, sans-serif;
  --color-bg-deep: #0b1120;
  --color-bg-surface: #131c31;
  --color-bg-card: #1e293b;
  --color-bg-hover: #26334d;
  --color-primary-gold: #f59e0b;
  --color-primary-gold-bright: #fbbf24;
  --color-primary-gold-dark: #b45309;
  --color-accent-green: #10b981;
  --color-accent-green-bright: #34d399;
  --color-accent-green-dark: #047857;
  --color-accent-purple: #8b5cf6;
  --color-accent-purple-dark: #6d28d9;
  --color-accent-orange: #f97316;
  --color-accent-blue: #0ea5e9;
  --color-text-light: #f8fafc;
  --color-text-muted: #94a3b8;
  --radius-card: 18px;
  --radius-button: 14px;
}

/* Base Body & Layout */
body.adventure-body {
  font-family: var(--font-body);
  background-color: var(--color-bg-deep);
  color: var(--color-text-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 20%, rgba(245, 158, 11, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 60%, rgba(16, 185, 129, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 50% 90%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
  background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6, .brand-text {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.adventure-main-content {
  flex: 1 0 auto;
  padding-bottom: 70px; /* spacing for mobile nav */
}

@media (min-width: 992px) {
  .adventure-main-content {
    padding-bottom: 30px;
  }
}

/* Navbar */
.adventure-navbar {
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 2px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  z-index: 1050;
}

.brand-badge-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.4);
  font-size: 1.25rem;
  color: #fff;
  border: 2px solid #fbbf24;
}

.brand-text {
  font-size: 1.45rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.nav-route {
  color: #cbd5e1 !important;
  font-size: 0.95rem;
  padding: 0.5rem 0.85rem !important;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.nav-route:hover, .nav-route.active {
  color: #fbbf24 !important;
  background: rgba(251, 191, 36, 0.12);
}

/* Coin Pills & Badges */
.coin-badge-pill {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 2px solid #fbbf24;
  border-radius: 9999px;
  padding: 5px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.25);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.coin-badge-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.45);
}

.coin-icon-bounce {
  font-size: 1.15rem;
  display: inline-block;
  animation: coinFloat 2.4s ease-in-out infinite;
}

@keyframes coinFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-3px) rotate(8deg); }
}

.coin-amount {
  font-family: var(--font-display);
  font-weight: 800;
  color: #fbbf24;
  font-size: 1.05rem;
  letter-spacing: 0.5px;
}

/* 3D Adventure Gaming Buttons */
.btn-adventure-primary {
  background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 60%, #d97706 100%);
  color: #451a03;
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
  border-bottom: 4px solid #b45309;
  border-radius: var(--radius-button);
  padding: 0.55rem 1.4rem;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-adventure-primary:hover {
  background: linear-gradient(180deg, #fcd34d 0%, #fbbf24 60%, #f59e0b 100%);
  color: #451a03;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.45);
}

.btn-adventure-primary:active {
  transform: translateY(3px);
  border-bottom-width: 1px;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.btn-adventure-success {
  background: linear-gradient(180deg, #34d399 0%, #10b981 60%, #059669 100%);
  color: #064e3b;
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
  border-bottom: 4px solid #047857;
  border-radius: var(--radius-button);
  padding: 0.55rem 1.4rem;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-adventure-success:hover {
  background: linear-gradient(180deg, #6ee7b7 0%, #34d399 60%, #10b981 100%);
  color: #064e3b;
  transform: translateY(-1px);
}

.btn-adventure-success:active {
  transform: translateY(3px);
  border-bottom-width: 1px;
}

.btn-adventure-purple {
  background: linear-gradient(180deg, #a78bfa 0%, #8b5cf6 60%, #7c3aed 100%);
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
  border-bottom: 4px solid #5b21b6;
  border-radius: var(--radius-button);
  padding: 0.55rem 1.4rem;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.35);
  transition: transform 0.1s ease;
}

.btn-adventure-purple:hover {
  color: #fff;
  transform: translateY(-1px);
}

.btn-adventure-purple:active {
  transform: translateY(3px);
  border-bottom-width: 1px;
}

.btn-outline-adventure {
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: #f8fafc;
  font-family: var(--font-display);
  font-weight: 700;
  border-radius: var(--radius-button);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.5rem 1.2rem;
  transition: all 0.2s ease;
}

.btn-outline-adventure:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fbbf24;
  border-color: #fbbf24;
}

.btn-icon-round {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  transition: all 0.2s;
  padding: 0;
}

.btn-icon-round:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.05);
}

.user-avatar-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(251, 191, 36, 0.4);
  border-radius: 9999px;
  padding: 4px 12px 4px 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 600;
}

.user-avatar-mini {
  width: 28px;
  height: 28px;
  background: #334155;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

/* Adventure Hero Section */
.adventure-hero {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  min-height: 420px;
  display: flex;
  align-items: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  border: 3px solid rgba(251, 191, 36, 0.3);
}

.adventure-hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(11, 17, 32, 0.95) 0%, rgba(11, 17, 32, 0.75) 45%, rgba(11, 17, 32, 0.25) 100%);
}

.adventure-hero-content {
  position: relative;
  z-index: 2;
  padding: 3rem 2.5rem;
  max-width: 650px;
}

.adventure-hero-title {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.1;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.8);
  margin-bottom: 1rem;
}

.adventure-hero-subtitle {
  font-size: 1.15rem;
  color: #e2e8f0;
  margin-bottom: 1.5rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

/* Floating Coin Particles */
.floating-coin-badge {
  position: absolute;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 2px solid #fbbf24;
  border-radius: 9999px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #fbbf24;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.3);
  animation: floatSlow 3s ease-in-out infinite;
}

@keyframes floatSlow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* Cards & Game Grids */
.adventure-card {
  background: var(--color-bg-card);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-card);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.adventure-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  border-color: rgba(251, 191, 36, 0.4);
}

.game-card-thumb-wrap {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: #0f172a;
}

.game-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.adventure-card:hover .game-card-thumb {
  transform: scale(1.05);
}

.game-card-category-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fbbf24;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 8px;
  padding: 3px 8px;
}

.game-card-fav-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.game-card-fav-btn:hover, .game-card-fav-btn.active {
  color: #ef4444;
  transform: scale(1.1);
}

.game-card-body {
  padding: 1.15rem;
}

.game-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: #ffffff;
}

.game-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-bottom: 0.9rem;
}

.game-reward-banner {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 10px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

/* Category Filter Tabs */
.filter-tabs-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.filter-tab-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 12px;
  padding: 0.45rem 1.1rem;
  white-space: nowrap;
  transition: all 0.2s ease;
  cursor: pointer;
}

.filter-tab-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.filter-tab-btn.active {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #fbbf24;
  color: #451a03;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

/* Canvas Game Stage */
.game-stage-container {
  background: #020617;
  border: 3px solid #f59e0b;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(0, 0, 0, 0.8);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 800px;
  margin: 0 auto;
}

.game-canvas {
  width: 100%;
  height: auto;
  max-height: 480px;
  aspect-ratio: 4/3;
  display: block;
  background: #0b1120;
}

.game-controls-bar {
  background: #0f172a;
  border-top: 2px solid rgba(255, 255, 255, 0.1);
  padding: 0.75rem 1rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Mobile Touch D-Pad */
.touch-controls-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0.85rem;
  background: rgba(15, 23, 42, 0.95);
  border-top: 2px solid rgba(251, 191, 36, 0.2);
}

.d-pad-btn {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #1e293b;
  border: 2px solid #334155;
  color: #fff;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 0 #0f172a;
  user-select: none;
  touch-action: manipulation;
}

.d-pad-btn:active {
  transform: translateY(4px);
  box-shadow: none;
  background: #334155;
}

.touch-action-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  border: 3px solid #34d399;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 0 #047857;
  user-select: none;
  touch-action: manipulation;
}

.touch-action-btn:active {
  transform: translateY(4px);
  box-shadow: none;
}

/* Mobile Sticky Bottom Navigation */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(11, 17, 32, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 6px 4px calc(env(safe-area-inset-bottom, 0px) + 6px);
  z-index: 1040;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}

.mobile-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 10px;
  transition: all 0.15s ease;
}

.mobile-nav-link i {
  font-size: 1.35rem;
  margin-bottom: 2px;
}

.mobile-nav-link.active, .mobile-nav-link:hover {
  color: #fbbf24;
}

/* Keep dense data views usable on phones without changing table semantics. */
.table-responsive {
  border-radius: 12px;
  -webkit-overflow-scrolling: touch;
}

.table-responsive > .table {
  min-width: 680px;
}

.table-responsive .table th,
.table-responsive .table td {
  white-space: nowrap;
}

.table-responsive .table td:nth-child(2) {
  white-space: normal;
  min-width: 140px;
}

@media (max-width: 991.98px) {
  .adventure-navbar .navbar-collapse {
    max-height: calc(100vh - 76px);
    overflow-y: auto;
    padding-bottom: 0.75rem;
  }

  .adventure-navbar .navbar-nav {
    width: 100%;
  }

  .adventure-navbar .nav-link {
    padding: 0.7rem 0.85rem !important;
  }

  .adventure-navbar .navbar-collapse > .d-flex {
    justify-content: flex-start;
    padding-top: 0.5rem;
  }
}

@media (max-width: 575.98px) {
  .adventure-main-content {
    padding-bottom: 86px;
  }

  .container,
  .container-fluid {
    --bs-gutter-x: 1.25rem;
  }

  .adventure-hero {
    min-height: 360px;
    border-radius: 16px;
  }

  .adventure-hero-content {
    padding: 2rem 1.25rem;
  }

  .adventure-hero-title {
    font-size: clamp(1.8rem, 10vw, 2.6rem);
  }

  .adventure-hero-subtitle {
    font-size: 1rem;
  }

  .adventure-card {
    border-radius: 14px;
  }

  .adventure-card.p-4 {
    padding: 1rem !important;
  }

  .display-6 {
    font-size: 1.8rem;
  }

  .mobile-nav-link {
    min-width: 58px;
    font-size: 0.65rem;
  }

  .mobile-nav-link i {
    font-size: 1.2rem;
  }

  .toast-container {
    width: min(100%, 360px);
    padding: 0.75rem !important;
  }
}

/* Modals & Dropdowns */
.adventure-modal-card {
  background: #131c31;
  border: 2px solid rgba(251, 191, 36, 0.4);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

.adventure-modal-fallback {
  background: rgba(0, 0, 0, 0.72);
}

.adventure-modal-fallback .modal-dialog {
  min-height: calc(100% - 1rem);
  display: flex;
  align-items: center;
}

.game-result-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(2, 6, 23, 0.86);
  backdrop-filter: blur(6px);
}

.game-result-card {
  position: relative;
  width: min(100%, 520px);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding: 1.35rem 1.25rem 1.5rem;
  border: 2px solid rgba(251, 191, 36, 0.65);
  border-radius: 22px;
  background: linear-gradient(145deg, #1e293b, #0f172a);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.65), 0 0 35px rgba(245, 158, 11, 0.25);
}

.game-result-close {
  position: absolute;
  top: 0.65rem;
  right: 0.8rem;
  border: 0;
  background: transparent;
  color: #cbd5e1;
  font-size: 2rem;
  line-height: 1;
}

.game-result-emoji {
  font-size: 3rem;
  margin: 0.35rem 0 0.15rem;
}

.game-result-stats {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.7);
}

.game-result-stats > div {
  min-width: 130px;
}

.game-result-stats span,
.game-result-stats strong {
  display: block;
}

.game-result-card .btn-adventure-primary {
  min-width: 142px;
}

.game-result-card .btn-outline-adventure {
  min-width: 152px;
}

.game-result-stats span {
  color: #94a3b8;
  font-size: 0.72rem;
  margin-bottom: 0.25rem;
}

.game-result-stats strong {
  color: #f8fafc;
  font-size: 1.35rem;
}

.adventure-dropdown {
  background: #131c31;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.adventure-dropdown .dropdown-item {
  color: #e2e8f0;
  font-weight: 600;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  transition: all 0.15s;
}

.adventure-dropdown .dropdown-item:hover {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

/* Form Controls */
.adventure-input {
  background: #0f172a;
  border: 2px solid #334155;
  color: #f8fafc;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font-weight: 500;
  transition: border-color 0.2s;
}

.adventure-input:focus {
  background: #0b1120;
  border-color: #fbbf24;
  color: #ffffff;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.25);
  outline: none;
}

/* Stats Box */
.stat-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 1.25rem;
}

.stat-box-title {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}

.stat-box-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: #ffffff;
  margin-top: 0.35rem;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #0b1120;
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #f59e0b;
}

/* Daily Streaks Card */
.streak-day-badge {
  background: #0f172a;
  border: 2px dashed #334155;
  border-radius: 14px;
  padding: 12px 6px;
  text-align: center;
  transition: all 0.2s ease;
}

.streak-day-badge.claimed {
  background: rgba(16, 185, 129, 0.15);
  border: 2px solid #10b981;
  color: #34d399;
}

.streak-day-badge.active-today {
  background: rgba(245, 158, 11, 0.2);
  border: 2px solid #fbbf24;
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35);
}

/* Winner Ticker */
.winner-ticker {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  font-size: 0.88rem;
}
