/* Robbie Tracker SPA - Xcode Replica UI Design System */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg-main: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.75);
  --bg-card-hover: rgba(51, 65, 85, 0.85);
  --bg-glass: rgba(15, 23, 42, 0.85);
  --accent-primary: #6366f1;
  --accent-hover: #4f46e5;
  --accent-gold: #f59e0b;
  --accent-green: #10b981;
  --accent-green-bg: rgba(16, 185, 129, 0.15);
  --accent-red: #ef4444;
  --accent-red-bg: rgba(239, 68, 68, 0.15);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-glass: rgba(255, 255, 255, 0.15);
  --shadow-glow: 0 10px 30px -5px rgba(99, 102, 241, 0.3);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

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

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #0b1120;
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-main);
}

/* App Container - Scaled like an iPhone Frame */
#app {
  width: 100%;
  max-width: 430px;
  height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg-main);
  background-image: 
    linear-gradient(to bottom, rgba(15, 23, 42, 0.75), rgba(2, 6, 23, 0.88)),
    url('assets/background.png');
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.8);
}

@media (max-width: 768px) {
  html, body {
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #0b1120 !important;
  }

  #app {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background-color: #0b1120 !important;
  }

  .tab-bar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
    height: calc(58px + env(safe-area-inset-bottom, 28px)) !important;
    padding-top: 10px !important;
    padding-bottom: env(safe-area-inset-bottom, 24px) !important;
    box-sizing: border-box !important;
    background: #0b1120 !important;
    backdrop-filter: blur(25px) !important;
    -webkit-backdrop-filter: blur(25px) !important;
    align-items: center !important;
  }
}

/* Top App Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
  z-index: 100;
  flex-shrink: 0;
}

.brand-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

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

.child-selector-pill {
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #fff;
  padding: 4px 10px;
  border-radius: 14px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.child-selector-pill:active {
  transform: scale(0.95);
  background: rgba(99, 102, 241, 0.35);
}

/* Wallet Badge */
.wallet-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 5px 12px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.coin-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.coin-amount {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--accent-gold);
}

/* PWA Install Banner */
.install-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.25), rgba(245, 158, 11, 0.25));
  border-bottom: 1px solid var(--border-glass);
  flex-shrink: 0;
  z-index: 90;
}

.install-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.install-icon {
  font-size: 1.2rem;
}

.install-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
}

.install-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.install-btn {
  background: var(--accent-primary);
  color: #fff;
  border: none;
  padding: 5px 12px;
  border-radius: 14px;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.4);
  transition: transform 0.15s ease;
}

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

/* Dynamic View Container with Smooth Inner Scrolling */
#view-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 16px 16px 72px 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

#view-container::-webkit-scrollbar {
  display: none;
}

.view-content {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  gap: 16px;
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- WELCOME ROW --- */
.welcome-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px;
}

.welcome-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.welcome-title {
  font-size: 1.2rem;
  font-weight: 800;
}

.custom-log-btn {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--accent-primary);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15 ease;
}

.custom-log-btn:active {
  transform: scale(0.95);
}

/* --- ANIMATED CAROUSEL CARD DECK --- */
.carousel-section-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  position: relative;
}

.carousel-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  gap: 16px;
  padding: 12px 20px 24px 20px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.carousel-card {
  flex: 0 0 270px;
  height: 320px;
  scroll-snap-align: center;
  border-radius: var(--radius-lg);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  position: relative;
  background: linear-gradient(160deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid var(--border-glass);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.25s, box-shadow 0.25s;
  cursor: pointer;
  overflow: hidden;
}

.carousel-card.good {
  background: linear-gradient(160deg, rgba(16, 185, 129, 0.22) 0%, rgba(15, 23, 42, 0.92) 80%);
  border-color: rgba(16, 185, 129, 0.4);
}

.carousel-card.good:hover {
  border-color: rgba(16, 185, 129, 0.8);
  box-shadow: 0 18px 40px rgba(16, 185, 129, 0.35);
  transform: translateY(-4px) scale(1.02);
}

.carousel-card.try {
  background: linear-gradient(160deg, rgba(239, 68, 68, 0.22) 0%, rgba(15, 23, 42, 0.92) 80%);
  border-color: rgba(239, 68, 68, 0.4);
}

.carousel-card.try:hover {
  border-color: rgba(239, 68, 68, 0.8);
  box-shadow: 0 18px 40px rgba(239, 68, 68, 0.35);
  transform: translateY(-4px) scale(1.02);
}

.carousel-card.popping {
  animation: cardPulsePop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes cardPulsePop {
  0% { transform: scale(1); }
  50% { transform: scale(1.08) rotate(2deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.carousel-card-icon-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-card-ring {
  position: absolute;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
  transition: transform 0.3s ease;
}

.carousel-card.good .carousel-card-ring {
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.4);
}

.carousel-card.try .carousel-card-ring {
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.4);
}

.carousel-card-img {
  width: 68px;
  height: 68px;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4));
  transition: transform 0.2s ease;
}

.carousel-card:hover .carousel-card-img {
  transform: scale(1.1);
}

.carousel-card-info {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.carousel-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.25;
}

.carousel-card-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.carousel-log-btn {
  width: 100%;
  padding: 12px 16px;
  border-radius: 18px;
  border: none;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.carousel-log-btn.good {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.carousel-log-btn.try {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

.carousel-log-btn:active {
  transform: scale(0.95);
}

/* Floating Coin Delta Animation on Tap */
.floating-coin-popup {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.6rem;
  font-weight: 900;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.9);
  border: 2px solid #fff;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  animation: floatCoinUp 0.85s forwards ease-out;
  z-index: 50;
}

.floating-coin-popup.good {
  color: #10b981;
  border-color: #10b981;
}

.floating-coin-popup.try {
  color: #ef4444;
  border-color: #ef4444;
}

@keyframes floatCoinUp {
  0% { opacity: 1; transform: translate(-50%, -40%) scale(0.6); }
  40% { opacity: 1; transform: translate(-50%, -90%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -150%) scale(1); }
}

.hero-swipe-card.happy {
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.85), rgba(5, 150, 105, 0.95));
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 15px 40px rgba(16, 185, 129, 0.4);
}

.hero-swipe-card.sad {
  background: linear-gradient(145deg, rgba(239, 68, 68, 0.85), rgba(220, 38, 38, 0.95));
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 15px 40px rgba(239, 68, 68, 0.4);
}

.hero-avatar-wrap {
  position: relative;
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}

.hero-aura {
  position: absolute;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.4) 0%, transparent 70%);
  animation: auraPulse 3s infinite alternate ease-in-out;
}

.hero-aura.happy {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.6) 0%, transparent 70%);
}

.hero-aura.sad {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.5) 0%, transparent 70%);
}

.hero-avatar-img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3.5px solid #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 2;
}

.hero-text-block {
  text-align: center;
}

.hero-mood-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.hero-mood-sub {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.9);
  margin-top: 2px;
  font-weight: 500;
}

/* Gesture Hint Bar inside card */
.hero-gesture-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(10px);
  padding: 8px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.gesture-hint {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 10px;
}

.gesture-hint.left {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

.gesture-hint.right {
  background: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
}

.gesture-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: #fff;
  text-align: center;
  flex: 1;
  padding: 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Overlay badges during drag */
.swipe-overlay {
  position: absolute;
  top: 14px;
  padding: 6px 14px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.95rem;
  pointer-events: none;
  opacity: 0;
  z-index: 10;
}

.swipe-overlay.right {
  right: 14px;
  color: var(--accent-green);
  border: 2px solid var(--accent-green);
  background: rgba(16, 185, 129, 0.25);
}

.swipe-overlay.left {
  left: 14px;
  color: var(--accent-red);
  border: 2px solid var(--accent-red);
  background: rgba(239, 68, 68, 0.25);
}

/* Action Buttons below hero card */
.swipe-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.swipe-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease;
}

.swipe-btn:active {
  transform: scale(0.9);
}

.swipe-btn.try {
  background: var(--accent-red-bg);
  border: 2px solid var(--accent-red);
  color: var(--accent-red);
}

.swipe-btn.good {
  background: var(--accent-green-bg);
  border: 2px solid var(--accent-green);
  color: var(--accent-green);
}

.btn-icon {
  width: 24px;
  height: 24px;
}

/* --- QUICK PRESETS CAROUSEL --- */
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
}

.preset-chip-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.preset-chip-list::-webkit-scrollbar {
  display: none;
}

.preset-chip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  padding: 8px 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.preset-chip:active {
  transform: scale(0.95);
}

.preset-chip-title {
  font-size: 0.8rem;
  font-weight: 600;
}

.preset-chip-delta {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 6px;
}

.preset-chip-delta.good {
  color: var(--accent-green);
  background: var(--accent-green-bg);
}

.preset-chip-delta.try {
  color: var(--accent-red);
  background: var(--accent-red-bg);
}

/* --- CARDS & LISTS --- */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px;
}

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

.activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.activity-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.activity-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.activity-badge.good { background: var(--accent-green-bg); }
.activity-badge.try { background: var(--accent-red-bg); }

.activity-title {
  font-size: 0.88rem;
  font-weight: 600;
}

.activity-time {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.activity-delta {
  font-size: 0.95rem;
  font-weight: 800;
}

.activity-delta.good { color: var(--accent-green); }
.activity-delta.try { color: var(--accent-red); }

/* Filter Chips Bar */
.filter-bar {
  display: flex;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-glass);
  padding: 4px;
  border-radius: 20px;
  gap: 4px;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  flex: 1 0 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.filter-chip.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* STORE GRID */
.store-banner {
  background: linear-gradient(135deg, #f59e0b 0%, #ec4899 100%);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.banner-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
}

.banner-sub {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.85);
}

.store-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.reward-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.reward-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.reward-img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.reward-title {
  font-size: 0.88rem;
  font-weight: 700;
}

.reward-detail {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.reward-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.reward-cost {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent-gold);
}

.redeem-btn {
  background: var(--accent-primary);
  color: #fff;
  border: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.redeem-btn:disabled {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

/* STATS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 800;
}

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

/* FORMS & BUTTONS */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

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

.form-input, .form-select {
  width: 100%;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--accent-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-danger {
  width: 100%;
  padding: 12px;
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

/* BOTTOM TAB BAR */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: calc(58px + env(safe-area-inset-bottom, 28px));
  padding-top: 10px;
  padding-bottom: env(safe-area-inset-bottom, 24px);
  box-sizing: border-box;
  background: #0b1120;
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-top: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 9999;
}

/* Pseudo-element to fill any iOS Safari bottom safe area gap seamlessly */
.tab-bar::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 120px;
  background: #0b1120;
  pointer-events: none;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  width: 20%;
  height: 52px;
}

.tab-item.active {
  color: var(--accent-primary);
}

.tab-icon {
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-img-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  transition: transform 0.2s ease, filter 0.2s ease;
}

.tab-item.active .tab-img-icon {
  transform: scale(1.15);
  filter: drop-shadow(0 0 6px rgba(99, 102, 241, 0.6));
}

.swipe-btn-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.preset-row-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.chip-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  vertical-align: middle;
}

.stat-custom-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  margin-bottom: 4px;
}

.bonus-btn-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 4px;
}

.overlay-custom-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 6px;
}

/* --- FULL-WIDTH HERO REWARD CARDS CSS --- */
.pie-rewards-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.pie-reward-card {
  background: linear-gradient(160deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
  border: 1.5px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.pie-reward-card.unlocked {
  border-color: rgba(245, 158, 11, 0.7);
  box-shadow: 0 15px 40px rgba(245, 158, 11, 0.35);
  background: linear-gradient(160deg, rgba(245, 158, 11, 0.12) 0%, rgba(15, 23, 42, 0.95) 80%);
}

.pie-tier-badge {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 12px;
}

.pie-tier-badge.small { color: #38bdf8; background: rgba(15, 23, 42, 0.85); border: 1px solid rgba(56, 189, 248, 0.5); }
.pie-tier-badge.medium { color: #a855f7; background: rgba(15, 23, 42, 0.85); border: 1px solid rgba(168, 85, 247, 0.5); }
.pie-tier-badge.large { color: #f59e0b; background: rgba(15, 23, 42, 0.85); border: 1px solid rgba(245, 158, 11, 0.5); }

.reward-hero-wrapper {
  position: relative;
  width: 100%;
  height: 185px;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 12px;
  background: #0f172a;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.6);
  touch-action: pan-y;
  user-select: none;
  cursor: grab;
}

.reward-hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}

.reward-hero-slide.active {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.reward-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reward-hero-badge-top-left {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.reward-hero-badge-top-right {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.reward-hero-badge-bottom-right {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 5;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(245, 158, 11, 0.6);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent-gold);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.reward-hero-badge-bottom-right.unlocked {
  background: #f59e0b;
  color: #000;
  border-color: #fff;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.8);
  animation: unlockGlow 1.5s infinite alternate;
}

.hero-swipe-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.2s ease, transform 0.2s ease;
}

.hero-swipe-arrow:hover {
  background: var(--accent-gold);
  color: #000;
  transform: translateY(-50%) scale(1.1);
}

.hero-swipe-arrow.prev { left: 10px; }
.hero-swipe-arrow.next { right: 10px; }

.hero-dots-overlay {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.45);
  padding: 4px 10px;
  border-radius: 12px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-y;
  user-select: none;
}

.pie-photo-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}

.pie-photo-slide.active {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.pie-reward-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.pie-swipe-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.2s ease, transform 0.2s ease;
}

.pie-swipe-arrow:hover {
  background: var(--accent-gold);
  color: #000;
  transform: translateY(-50%) scale(1.15);
}

.pie-swipe-arrow.prev { left: -14px; }
.pie-swipe-arrow.next { right: -14px; }

.pie-dots-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 6px;
}

.pie-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease;
}

.pie-dot.active {
  background: var(--accent-gold);
  transform: scale(1.35);
}

/* --- PHOTO MANAGEMENT IN MODAL --- */
.photo-manager-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 10px;
}

.photo-manager-card {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
}

.photo-manager-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-manager-del {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  border: none;
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.btn-add-photo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px dashed var(--accent-gold);
  color: var(--accent-gold);
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  width: 100%;
  margin-top: 6px;
}

.btn-add-photo:hover {
  background: rgba(245, 158, 11, 0.15);
}

@keyframes unlockGlow {
  0% { transform: scale(1); box-shadow: 0 0 10px rgba(245, 158, 11, 0.6); }
  100% { transform: scale(1.08); box-shadow: 0 0 22px rgba(245, 158, 11, 1); }
}

.pie-progress-bar-wrap {
  width: 100%;
  max-width: 220px;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin: 10px 0 6px 0;
}

/* --- DINO GROWTH KIDS VIEW & MODE SWITCHER CSS --- */
.mode-switcher-toggle {
  display: flex;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid var(--border-glass);
  padding: 4px;
  border-radius: 20px;
  gap: 4px;
  margin: 0 auto;
}

.mode-btn {
  padding: 6px 14px;
  border-radius: 16px;
  border: none;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-muted);
  background: none;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.mode-btn.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.dino-growth-card {
  background: linear-gradient(160deg, rgba(16, 185, 129, 0.15) 0%, rgba(15, 23, 42, 0.95) 80%);
  border: 1.5px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
}

.dino-hero-wrap {
  position: relative;
  width: 170px;
  height: 170px;
  margin: 14px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dino-hero-aura {
  position: absolute;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.35) 0%, transparent 70%);
  animation: auraPulse 3s infinite alternate ease-in-out;
}

.dino-hero-img {
  width: 150px;
  height: 150px;
  border-radius: 28px;
  object-fit: cover;
  border: 4px solid #fff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  position: relative;
  z-index: 2;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
  animation: dinoIdleBreathing 2.8s infinite alternate ease-in-out;
}

@keyframes dinoIdleBreathing {
  0% { transform: scale(var(--dino-scale, 1)) translateY(0px) rotate(0deg); }
  50% { transform: scale(calc(var(--dino-scale, 1) * 1.03)) translateY(-8px) rotate(1.5deg); }
  100% { transform: scale(var(--dino-scale, 1)) translateY(4px) rotate(-1.5deg); }
}

.dino-hero-img.jumping {
  animation: dinoHappyJump 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

@keyframes dinoHappyJump {
  0% { transform: scale(var(--dino-scale, 1)) translateY(0) rotate(0deg); }
  35% { transform: scale(calc(var(--dino-scale, 1) * 1.2)) translateY(-35px) rotate(-8deg); }
  65% { transform: scale(calc(var(--dino-scale, 1) * 0.9)) translateY(6px) rotate(5deg); }
  100% { transform: scale(var(--dino-scale, 1)) translateY(0) rotate(0deg); }
}

/* Floating Sparkle Particles on Dino Tap */
.dino-pop-particle {
  position: absolute;
  font-size: 1.4rem;
  pointer-events: none;
  z-index: 10;
  animation: popParticle 0.9s ease-out forwards;
}

@keyframes popParticle {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(0.6) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: translate(var(--dx, 20px), var(--dy, -40px)) scale(1.2) rotate(15deg);
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--dx, 20px) * 1.5), calc(var(--dy, -40px) * 1.8)) scale(0.4) rotate(40deg);
  }
}

.dino-speech-bubble {
  background: rgba(255, 255, 255, 0.95);
  color: #0f172a;
  padding: 8px 16px;
  border-radius: 18px;
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 8px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  position: relative;
}

.dino-speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px 6px 0;
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.95) transparent;
}

.dino-stage-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
}

.dino-level-pill {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--accent-green);
  padding: 4px 14px;
  border-radius: 14px;
  font-size: 0.78rem;
  font-weight: 800;
  margin-top: 4px;
}

.pie-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* MODALS */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 380px;
  background: #1e293b;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 20px;
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 800;
}

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

/* --- LANDSCAPE & ROTATION RESPONSIVE ADAPTATIONS --- */
@media (orientation: landscape) and (max-height: 600px) {
  #app {
    max-width: 680px;
    height: 100dvh;
    border-radius: 0;
  }

  .hero-swipe-card {
    height: 210px;
    padding: 12px 16px;
  }

  .hero-avatar-wrap {
    width: 70px;
    height: 70px;
    margin-top: 0;
  }

  .hero-aura {
    width: 85px;
    height: 85px;
  }

  .hero-avatar-img {
    width: 65px;
    height: 65px;
  }

  .hero-mood-title {
    font-size: 1rem;
  }

  .hero-mood-sub {
    font-size: 0.7rem;
  }

  .hero-gesture-bar {
    padding: 5px 10px;
  }

  .gesture-title {
    font-size: 0.78rem;
  }

  .swipe-btn {
    width: 42px;
    height: 42px;
  }

  .btn-icon {
    width: 20px;
    height: 20px;
  }

  .store-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .tab-item {
    flex-direction: row;
    justify-content: center;
    gap: 6px;
  }

  .tab-icon {
    font-size: 1.05rem;
  }
}

/* --- LARGE SCREEN / DESKTOP RESPONSIVE FRAME --- */
@media (min-width: 768px) and (min-height: 650px) {
  #app {
    position: relative;
    border-radius: 36px;
    height: 92vh;
    max-height: 880px;
    border: 1px solid var(--border-glass);
    box-shadow: 
      0 25px 70px rgba(0, 0, 0, 0.7),
      0 0 40px rgba(99, 102, 241, 0.2);
  }

  .tab-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    transform: none;
    max-width: 100%;
    border-bottom-left-radius: 36px;
    border-bottom-right-radius: 36px;
  }
}

/* ==================== MAXIMIZED CHILD ADVENTURE TIMELINE ==================== */
.timeline-fullscreen-mode {
  flex: 1;
  min-height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.compact-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 2px;
  flex-shrink: 0;
}

.compact-balance-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--accent-gold);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.compact-coin-icon {
  width: 15px;
  height: 15px;
}

.timeline-hero-canvas.zoomed-in {
  flex: 1;
  min-height: 480px;
  display: flex;
  flex-direction: column;
  position: relative;
  border-radius: var(--radius-lg);
  background: radial-gradient(ellipse at 50% 90%, rgba(16, 185, 129, 0.2) 0%, rgba(15, 23, 42, 0.95) 60%, rgba(2, 6, 23, 0.98) 100%);
  border: 1.5px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 35px rgba(16, 185, 129, 0.2);
  overflow: hidden;
}

.timeline-floating-controls {
  position: absolute;
  top: 12px;
  left: 14px;
  right: 14px;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.stage-state-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 5px 12px;
  border-radius: 18px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  pointer-events: auto;
}

.stage-state-pill.celebrating {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.35), rgba(217, 119, 6, 0.35));
  border-color: var(--accent-gold);
  color: #fef08a;
}

.stage-state-pill.bouncing {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.35), rgba(5, 150, 105, 0.35));
  border-color: var(--accent-green);
  color: #6ee7b7;
}

.stage-state-pill.walking {
  background: rgba(15, 23, 42, 0.85);
  color: #cbd5e1;
}

.btn-find-robbie-pill {
  background: rgba(99, 102, 241, 0.4);
  border: 1px solid rgba(99, 102, 241, 0.7);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 18px;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  transition: all 0.2s ease;
  pointer-events: auto;
}

.btn-find-robbie-pill:hover {
  background: rgba(99, 102, 241, 0.65);
  transform: scale(1.04);
}

/* ==================== ZOOMED-IN SCROLLABLE TIMELINE VIEWPORT ==================== */
.dino-trail-viewport.zoomed {
  flex: 1;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  position: relative;
  padding: 160px 80px 90px;
  display: flex;
  align-items: center;
  cursor: grab;
  will-change: scroll-position;
  transform: translateZ(0);
}

.dino-trail-viewport.active-dragging {
  cursor: grabbing;
  user-select: none;
}

.dino-trail-viewport::-webkit-scrollbar {
  height: 8px;
}

.dino-trail-viewport::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.7);
  border-radius: 4px;
}

.dino-trail-viewport::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, #10b981, #f59e0b);
  border-radius: 4px;
}

.dino-trail-track.zoomed {
  min-width: 1600px;
  height: 200px;
  position: relative;
  display: flex;
  align-items: center;
  transform: translateZ(0);
}

/* Zoomed Path Background Line */
.trail-line-bg.zoomed {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 18px;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.5);
  z-index: 1;
}

/* Zoomed Filled Progress Path */
.trail-line-fill.zoomed {
  position: absolute;
  top: 50%;
  left: 0;
  height: 18px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, #10b981 0%, #3b82f6 30%, #f59e0b 70%, #ec4899 100%);
  border-radius: 999px;
  box-shadow: 0 0 26px rgba(16, 185, 129, 0.85);
  z-index: 2;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: width;
}

.dino-trail-viewport.animating {
  scroll-behavior: auto !important;
}

.trail-line-fill.animating,
.robbie-trail-walker.animating {
  transition: none !important;
  pointer-events: none;
}

/* ==================== ZOOMED-IN ANIMATED ROBBIE WALKER ==================== */
.robbie-trail-walker.zoomed {
  position: absolute;
  top: 50%;
  transform: translate3d(-50%, -75px, 0);
  z-index: 25;
  cursor: pointer;
  transition: left 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  will-change: left, transform;
}

/* Dynamic Floating Speech Bubble Over Robbie */
.robbie-floating-bubble {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #ffffff, #f1f5f9);
  color: #0f172a;
  padding: 8px 16px;
  border-radius: 18px;
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  border: 2px solid #ffffff;
  pointer-events: none;
  z-index: 30;
  animation: bubbleFloat 2.5s infinite alternate ease-in-out;
}

.robbie-floating-bubble::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 7px 7px 0;
  border-style: solid;
  border-color: #ffffff transparent;
}

@keyframes bubbleFloat {
  0% { transform: translateX(-50%) translateY(0); }
  100% { transform: translateX(-50%) translateY(-6px); }
}

.robbie-walker-avatar-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.robbie-walker-halo {
  position: absolute;
  width: 120px;
  height: 120px;
  top: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.55) 0%, transparent 70%);
  animation: walkerAuraPulse 2.5s infinite alternate ease-in-out;
  pointer-events: none;
}

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

.robbie-frame-capsule.zoomed {
  width: 96px;
  height: 96px;
  border-radius: 28px;
  overflow: hidden;
  border: 4px solid var(--accent-green, #10b981);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.65), 0 0 25px rgba(16, 185, 129, 0.75);
  position: relative;
  z-index: 3;
  background: #0b1120;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.robbie-trail-walker.celebrating .robbie-frame-capsule.zoomed {
  border-color: var(--accent-gold, #f59e0b);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.65), 0 0 30px rgba(245, 158, 11, 0.85);
}

.robbie-walker-img.zoomed,
.robbie-walker-video.zoomed {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.robbie-walker-tag {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 900;
  padding: 3px 12px;
  border-radius: 12px;
  margin-top: 5px;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
  z-index: 4;
}

/* Walking & Bouncing & Animating Modes: Steady smooth frame (zero CSS box bounce on video) */
.robbie-trail-walker.animating .robbie-frame-capsule,
.robbie-trail-walker.walking .robbie-frame-capsule,
.robbie-trail-walker.bouncing .robbie-frame-capsule {
  animation: none !important;
  transform: none !important;
}

/* Celebrating Animation Mode: ONLY celebration still state bounces & dances when arrived */
.robbie-trail-walker.celebrating:not(.animating) .robbie-frame-capsule {
  animation: robbieVictoryDance 1.3s infinite ease-in-out;
  border-color: var(--accent-gold);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45), 0 0 14px rgba(245, 158, 11, 0.45);
}

@keyframes robbieVictoryDance {
  0%, 100% { transform: translateY(0px) scale(1) rotate(0deg); }
  25% { transform: translateY(-8px) scale(1.04) rotate(-4deg); }
  50% { transform: translateY(0px) scale(0.98) rotate(4deg); }
  75% { transform: translateY(-8px) scale(1.04) rotate(-4deg); }
}

/* ==================== FLOATING REWARD SHOWCASE FLAG ==================== */
.reward-showcase-flag {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 15;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.trail-milestone-node:hover .reward-showcase-flag {
  transform: translateX(-50%) translateY(-6px) scale(1.06);
}

.reward-flag-pill {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
  white-space: nowrap;
  margin-bottom: 4px;
}

.reward-flag-pill.small { border-color: #38bdf8; color: #7dd3fc; }
.reward-flag-pill.medium { border-color: #a855f7; color: #d8b4fe; }
.reward-flag-pill.large { border-color: #f59e0b; color: #fde047; }

.reward-flag-img-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  overflow: hidden;
  background: #1e293b;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 6px 16px rgba(0,0,0,0.5);
}

.reward-showcase-flag.unlocked .reward-flag-img-wrap {
  border-color: var(--accent-gold);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.5), 0 6px 16px rgba(0,0,0,0.4);
  animation: rewardUnlockedGlow 3s infinite alternate ease-in-out;
}

@keyframes rewardUnlockedGlow {
  0% { box-shadow: 0 0 10px rgba(245, 158, 11, 0.4); }
  100% { box-shadow: 0 0 18px rgba(245, 158, 11, 0.7); }
}

.reward-flag-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reward-flag-crown {
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 1.1rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
  z-index: 5;
}

.reward-flag-ribbon {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2px 4px;
  font-size: 0.62rem;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

.reward-flag-ribbon.unlocked {
  background: linear-gradient(90deg, #10b981, #059669);
  color: #fff;
}

.reward-flag-ribbon.locked {
  background: rgba(15, 23, 42, 0.85);
  color: #cbd5e1;
}

.reward-photo-thumb {
  border-radius: 50%;
  object-fit: cover;
}

/* ==================== ZOOMED-IN MILESTONE NODES ==================== */
.trail-milestone-node.zoomed {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.milestone-badge-glow.zoomed {
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: transparent;
  z-index: 1;
  pointer-events: none;
}

.trail-milestone-node.reached .milestone-badge-glow {
  background: radial-gradient(circle, rgba(245, 158, 11, 0.55) 0%, transparent 70%);
  animation: walkerAuraPulse 2.8s infinite alternate ease-in-out;
}

.trail-milestone-node.next-target .milestone-badge-glow {
  background: radial-gradient(circle, rgba(99, 102, 241, 0.65) 0%, transparent 70%);
  animation: walkerAuraPulse 1.4s infinite alternate ease-in-out;
}

.milestone-icon-circle.zoomed {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #1e293b;
  border: 3px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.trail-milestone-node:hover .milestone-icon-circle {
  transform: scale(1.22);
  border-color: #fff;
}

.trail-milestone-node.reached .milestone-icon-circle {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: #fef08a;
  box-shadow: 0 0 22px rgba(16, 185, 129, 0.85);
}

.trail-milestone-node.is-reward .milestone-icon-circle.zoomed {
  width: 64px;
  height: 64px;
  border-width: 3.5px;
  border-color: var(--accent-gold);
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
}

.trail-milestone-node.is-reward.reached .milestone-icon-circle.zoomed {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #fff;
  box-shadow: 0 0 28px rgba(245, 158, 11, 0.95);
}

.milestone-icon-img.zoomed {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.trail-milestone-node.is-reward .milestone-icon-img.zoomed {
  width: 44px;
  height: 44px;
}

.milestone-check-badge.zoomed {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 20px;
  height: 20px;
  background: #f59e0b;
  color: #0b1120;
  font-size: 0.78rem;
  font-weight: 900;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

.milestone-card-popup.zoomed {
  position: absolute;
  top: 68px;
  background: rgba(15, 23, 42, 0.96);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  padding: 8px 12px;
  min-width: 110px;
  text-align: center;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.milestone-pts-tag {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--accent-gold);
}

.milestone-title-text {
  font-size: 0.84rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
}

.milestone-status-tag {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 4px;
  display: inline-block;
}

.milestone-status-tag.unlocked {
  background: rgba(16, 185, 129, 0.28);
  color: #34d399;
}

.milestone-status-tag.pending {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

/* --- PRESETS & HISTORY SEAMLESS HEADERS & SCROLLABLE LISTS --- */
.presets-header-sticky,
.history-header-sticky {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  width: 100%;
}

.presets-scroll-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
  padding-bottom: 20px;
  -webkit-overflow-scrolling: touch;
}

.presets-scroll-list::-webkit-scrollbar,
.history-scroll-list::-webkit-scrollbar {
  width: 4px;
}

.presets-scroll-list::-webkit-scrollbar-thumb,
.history-scroll-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.history-scroll-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
  padding-bottom: 20px;
  -webkit-overflow-scrolling: touch;
}

/* --- HISTORY DATE SECTION HEADINGS --- */
.history-date-group {
  margin-bottom: 16px;
}

.history-date-group:last-child {
  margin-bottom: 0;
}

.history-date-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  border-left: 3px solid var(--accent-gold);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.history-date-title {
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-color);
}

.history-date-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}





