/* ========================================
   CHORIZO MEJOR - Houston's Taco Rating App
   Mobile-first responsive design
   ======================================== */

/* --- CSS Variables --- */
:root {
  --color-primary: #D84315;
  --color-primary-dark: #BF360C;
  --color-primary-light: #FF7043;
  --color-secondary: #FBC02D;
  --color-secondary-dark: #F9A825;
  --color-accent: #2E7D32;
  --color-bg: #FFF8E1;
  --color-surface: #FFFFFF;
  --color-surface-alt: #FFF3E0;
  --color-text: #3E2723;
  --color-text-secondary: #6D4C41;
  --color-text-light: #8D6E63;
  --color-border: #D7CCC8;
  --color-gold: #FFD600;
  --color-silver: #B0BEC5;
  --color-bronze: #A1887F;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 3px rgba(62,39,35,0.1);
  --shadow-md: 0 4px 12px rgba(62,39,35,0.12);
  --shadow-lg: 0 8px 24px rgba(62,39,35,0.15);
  --nav-height: 64px;
  --header-height: 56px;
  --font-display: 'Ranchers', cursive;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  padding-top: var(--header-height);
  padding-bottom: var(--nav-height);
}

img { max-width: 100%; display: block; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }

/* ===================== HEADER ===================== */
#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--color-primary);
  color: white;
  box-shadow: var(--shadow-md);
}

.top-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.logo-icon { font-size: 28px; }

.logo-text {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.5px;
}

#header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--color-primary-dark);
}

.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: white;
  font-size: 16px;
  font-family: var(--font-body);
}

.search-bar input::placeholder { color: rgba(255,255,255,0.6); }
.search-bar .material-icons-round { color: rgba(255,255,255,0.7); }

/* ===================== BUTTONS ===================== */
.btn-icon {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.btn-icon:hover { background: rgba(255,255,255,0.15); }

.btn-primary {
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover { background: var(--color-primary-dark); }
.btn-primary:active { transform: scale(0.97); }

/* Place action row (Add Review + Favorite) */
.place-action-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 16px 0;
}
.place-action-row .btn-primary {
  flex: 1;
}
.btn-fav-place {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.btn-fav-place:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(216, 67, 21, 0.08);
}
.btn-fav-place.is-fav {
  border-color: #e53935;
  color: #e53935;
  background: rgba(229, 57, 53, 0.08);
}
.btn-fav-place.is-fav:hover {
  background: rgba(229, 57, 53, 0.15);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}

.btn-secondary:hover { background: var(--color-surface-alt); }

.btn-full { width: 100%; justify-content: center; }

.btn-small {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-back {
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  margin-bottom: 8px;
}

.btn-follow {
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
}

.btn-follow.following {
  background: var(--color-surface);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

/* ===================== BOTTOM NAV ===================== */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: space-around;
  border-top: 1px solid var(--color-border);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-btn {
  background: none;
  border: none;
  color: var(--color-text-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: color 0.2s;
  min-width: 56px;
}

.nav-btn .material-icons-round { font-size: 24px; transition: color 0.2s; }

.nav-btn.active {
  color: var(--color-primary);
}

/* ===================== FAB ===================== */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  right: 16px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  border: none;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
  transition: transform 0.2s, background 0.2s;
}

.fab:hover { background: var(--color-primary-dark); transform: scale(1.05); }
.fab:active { transform: scale(0.95); }
.fab .material-icons-round { font-size: 28px; }

/* ===================== VIEWS ===================== */
.view {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}

.hidden { display: none !important; }

/* ===================== FEED ===================== */
.feed-header h2 {
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--color-text);
  margin-bottom: 12px;
}

.feed-tabs, .leaderboard-tabs, .profile-tabs {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.tab.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.tab:hover:not(.active) {
  background: var(--color-surface-alt);
}

/* --- Cards --- */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 0;
}

.card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.card-user-info {
  flex: 1;
  min-width: 0;
}

.card-username {
  font-weight: 600;
  font-size: 14px;
  color: var(--color-text);
  cursor: pointer;
}

.card-username:hover { color: var(--color-primary); }

.card-meta {
  font-size: 12px;
  color: var(--color-text-light);
}

.card-photo {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  margin-top: 10px;
  background: #eee;
}

.card-body { padding: 12px 14px; }

.card-place-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--color-primary-dark);
  cursor: pointer;
}

.card-place-name:hover { text-decoration: underline; }

.card-ratings {
  display: flex;
  gap: 12px;
  margin: 8px 0;
  flex-wrap: wrap;
}

.card-rating-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--color-surface-alt);
  color: var(--color-text-secondary);
}

.card-rating-chip.highlight {
  background: var(--color-secondary);
  color: var(--color-text);
}

.card-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text-secondary);
  margin-top: 6px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.taco-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--color-bg);
  color: var(--color-text-secondary);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px 12px;
  border-top: 1px solid var(--color-border);
  margin-top: 8px;
}

.card-action-btn {
  background: none;
  border: none;
  color: var(--color-text-light);
  font-size: 13px;
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.card-action-btn:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.card-action-btn.liked { color: #E53935; }

.card-wait-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-accent);
  margin-top: 6px;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-icon { font-size: 64px; display: block; margin-bottom: 16px; }

.empty-state h3 {
  font-family: var(--font-display);
  font-size: 22px;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--color-text-secondary);
  font-size: 14px;
}

/* ===================== EXPLORE ===================== */
.explore-header h2 {
  font-family: var(--font-display);
  font-size: 24px;
  margin-bottom: 12px;
}

.explore-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.explore-filters select {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-body);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
}

#map {
  width: 100%;
  height: 240px;
  border-radius: var(--radius-md);
  background: #E8E0D8;
  margin-bottom: 16px;
  overflow: hidden;
  position: relative;
}

#map .mapboxgl-canvas {
  border-radius: var(--radius-md);
}

.search-bar-wrapper {
  position: relative;
  margin-bottom: 12px;
}

.search-bar-wrapper .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-light);
  font-size: 20px;
  pointer-events: none;
}

#place-search {
  width: 100%;
  padding: 12px 16px 12px 42px;
  border-radius: var(--radius-md);
  border: 2px solid #E8E0D8;
  background: var(--color-surface);
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

#place-search:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(216,67,21,0.1);
}

#place-search::placeholder {
  color: var(--color-text-light);
}

.place-card-img[src] {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.place-card {
  display: flex;
  gap: 12px;
  padding: 12px;
}

.place-card-img {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--color-surface-alt);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}

.place-card-info { flex: 1; min-width: 0; }

.place-card-name {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 2px;
  cursor: pointer;
  color: var(--color-text);
}

.place-card-name:hover { color: var(--color-primary); }

.place-card-address {
  font-size: 12px;
  color: var(--color-text-light);
  margin-bottom: 4px;
}

.place-card-stats {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.place-card-score {
  font-weight: 700;
  color: var(--color-primary);
}

/* ===================== PLACE DETAIL ===================== */
.place-banner {
  width: 100%;
  height: 180px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  overflow: hidden;
  position: relative;
}

.place-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

.place-banner-emoji {
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  font-size: 64px;
}

/* Place action links */
.place-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.place-links:empty {
  display: none;
}

.place-link-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border);
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.place-link-btn:active {
  transform: scale(0.97);
}

.place-link-btn.primary {
  grid-column: 1 / -1;
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.place-link-btn .link-icon {
  font-size: 18px;
  flex-shrink: 0;
}

/* Branded Yelp / Google buttons */
.yelp-btn, .google-btn {
  gap: 8px;
}

.brand-icon {
  flex-shrink: 0;
}

.rating-slot {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.ext-rating {
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
}

.ext-stars {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  line-height: 1;
}

.ext-count {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 400;
}

.ext-label {
  font-weight: 600;
  font-size: 14px;
}

/* Loading shimmer for rating slot */
.rating-loading {
  display: inline-block;
  width: 60px;
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--border) 25%, var(--bg-card) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (max-width: 400px) {
  .place-links {
    grid-template-columns: 1fr;
  }
}

.place-hero-info h2 {
  font-family: var(--font-display);
  font-size: 28px;
  margin-bottom: 4px;
}

.place-address {
  color: var(--color-text-secondary);
  font-size: 14px;
}

.place-neighborhood {
  color: var(--color-text-light);
  font-size: 13px;
  margin-bottom: 8px;
}

.place-meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
}

.place-ratings-summary {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

/* Hero rating (CM primary, Google fallback) */
.hero-rating {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  margin-bottom: 8px;
}

.hero-rating-number {
  font-size: 40px;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1;
}

.hero-rating-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero-rating-stars {
  display: flex;
  align-items: center;
  gap: 1px;
}

.hero-rating-stars svg {
  width: 18px;
  height: 18px;
}

.hero-rating-source {
  font-size: 13px;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.category-ratings {
  border-top: 1px solid var(--color-border);
  padding-top: 10px;
}

.rating-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.rating-bar:last-child { margin-bottom: 0; }

.rating-bar label {
  width: 64px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.bar-track {
  flex: 1;
  height: 8px;
  background: var(--color-border);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 4px;
  transition: width 0.4s ease;
  width: 0;
}

.bar-score {
  width: 28px;
  text-align: right;
  font-weight: 700;
  font-size: 14px;
  color: var(--color-primary);
}

.place-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

/* ===================== LEADERBOARD ===================== */
.leaderboard-header h2 {
  font-family: var(--font-display);
  font-size: 24px;
  margin-bottom: 12px;
}

.leaderboard-header select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-body);
  background: var(--color-surface);
  color: var(--color-text);
  margin-bottom: 16px;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.leaderboard-item:hover { box-shadow: var(--shadow-md); }

.leaderboard-rank {
  font-weight: 800;
  font-size: 18px;
  width: 32px;
  text-align: center;
  color: var(--color-text-light);
}

.leaderboard-rank.gold { color: var(--color-gold); }
.leaderboard-rank.silver { color: var(--color-silver); }
.leaderboard-rank.bronze { color: var(--color-bronze); }

.leaderboard-info { flex: 1; min-width: 0; }

.leaderboard-name {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 2px;
}

.leaderboard-neighborhood {
  font-size: 12px;
  color: var(--color-text-light);
}

.leaderboard-score {
  font-weight: 800;
  font-size: 20px;
  color: var(--color-primary);
}

.leaderboard-google-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 10px;
  color: #4285F4;
  background: #E8F0FE;
  border-radius: 3px;
  padding: 1px 4px;
  vertical-align: middle;
}

.leaderboard-section {
  margin-top: 24px;
}

.leaderboard-section h3 {
  font-family: var(--font-display);
  font-size: 20px;
  margin-bottom: 12px;
}

/* ===================== TACO OF THE YEAR ===================== */
.toty-hero {
  background: linear-gradient(135deg, var(--color-primary), #FF6F00);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  color: white;
  margin-bottom: 24px;
}

.toty-hero h2 {
  font-family: var(--font-display);
  font-size: 28px;
  margin-bottom: 6px;
}

.toty-subtitle {
  opacity: 0.9;
  font-size: 14px;
  margin-bottom: 16px;
}

.toty-countdown {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 13px;
}

.toty-countdown .cd-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.toty-countdown .cd-num {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.toty-countdown .cd-label {
  font-size: 11px;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.toty-categories h3, .toty-timeline h3 {
  font-family: var(--font-display);
  font-size: 22px;
  margin-bottom: 16px;
}

.toty-category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 32px;
}

.toty-category-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.toty-cat-icon { font-size: 32px; display: block; margin-bottom: 8px; }

.toty-category-card h4 {
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--color-text);
}

.toty-category-card p {
  font-size: 12px;
  color: var(--color-text-light);
  margin-bottom: 8px;
}

.toty-leader {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary);
}

/* --- Timeline --- */
.timeline { position: relative; padding-left: 28px; }

.timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--color-border);
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
}

.timeline-item:last-child { margin-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -22px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-border);
  border: 2px solid var(--color-bg);
}

.timeline-item.active .timeline-dot {
  background: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(216,67,21,0.2);
}

.timeline-content strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

.timeline-content p {
  font-size: 13px;
  color: var(--color-text-secondary);
}

/* ===================== PROFILE ===================== */
.profile-header-section {
  text-align: center;
  padding: 24px 16px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--color-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin: 0 auto 12px;
}

.profile-header-section h2 {
  font-family: var(--font-display);
  font-size: 24px;
  margin-bottom: 2px;
}

.handle {
  color: var(--color-text-light);
  font-size: 14px;
  margin-bottom: 16px;
}

.profile-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 12px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat strong {
  font-size: 18px;
  font-weight: 800;
}

.stat span {
  font-size: 12px;
  color: var(--color-text-light);
}

.badges {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--color-secondary);
  color: var(--color-text);
}

.badge.gold { background: var(--color-gold); }
.badge.silver { background: #E0E0E0; }

/* ===================== AUTH ===================== */
.auth-container {
  max-width: 380px;
  margin: 24px auto;
}

.auth-hero {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo { font-size: 64px; display: block; margin-bottom: 8px; }

.auth-hero h2 {
  font-family: var(--font-display);
  font-size: 28px;
  margin-bottom: 4px;
}

.auth-hero p {
  color: var(--color-text-secondary);
  font-size: 14px;
}

#auth-form {
  background: var(--color-surface);
  padding: 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(216,67,21,0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.detected-hood {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  background: #f5f0eb;
  color: var(--color-text-secondary);
}

.detected-hood.detecting {
  color: var(--color-primary);
  background: #fff3e0;
}

.detected-hood.success {
  color: #2e7d32;
  background: #e8f5e9;
  font-weight: 700;
  font-size: 15px;
}

.detected-hood.error {
  color: #c62828;
  background: #ffebee;
}

.distance-badge {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 4px;
}

.auth-toggle {
  text-align: center;
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 16px;
}

.auth-toggle a { font-weight: 600; }

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px !important;
  font-weight: 500 !important;
  color: var(--color-text) !important;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
}

/* ===================== MODALS ===================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(62,39,35,0.4);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.modal-content {
  background: var(--color-surface);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 24px;
  animation: slideUp 0.3s ease;
}

.modal-lg { max-width: 560px; }

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 22px;
}

/* --- Rating Inputs --- */
.rating-inputs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.rating-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rating-group label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.rating-val {
  font-weight: 800;
  color: var(--color-primary);
  font-size: 15px;
}

.rating-group input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--color-border);
  outline: none;
}

.rating-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.rating-group input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
  border: none;
  box-shadow: var(--shadow-sm);
}

.rating-overall-calc {
  background: var(--color-bg);
  border-radius: 8px;
  padding: 10px 12px;
  border: 2px solid var(--color-primary);
}

.rating-overall-calc label {
  font-size: 16px;
  font-weight: 700;
}

.overall-bar-track {
  height: 8px;
  background: #E8E0D8;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
}

.overall-bar-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 4px;
  transition: width 0.2s ease;
}

/* --- Tag Selector --- */
.tag-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-btn {
  padding: 6px 14px;
  border-radius: 16px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s;
}

.tag-btn.selected {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* --- Photo Upload --- */
.photo-upload {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
  position: relative;
  overflow: hidden;
}

.photo-upload:hover { border-color: var(--color-primary); }

.photo-upload .material-icons-round {
  font-size: 32px;
  color: var(--color-text-light);
}

.photo-upload p {
  font-size: 13px;
  color: var(--color-text-light);
  margin-top: 4px;
}

.photo-upload img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===================== SHARE CARD ===================== */
.share-card {
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: 16px;
}

.share-card-header {
  background: var(--color-primary);
  color: white;
  padding: 10px 14px;
  font-family: var(--font-display);
  font-size: 16px;
}

.share-card-body {
  background: var(--color-surface);
  padding: 16px;
  min-height: 100px;
}

.share-card-footer {
  background: var(--color-surface-alt);
  padding: 8px 14px;
  font-size: 12px;
  color: var(--color-text-light);
}

.share-actions {
  display: flex;
  gap: 8px;
}

.share-actions .btn-secondary { flex: 1; justify-content: center; }

/* ===================== TOAST ===================== */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 24px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-text);
  color: white;
  padding: 10px 24px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  z-index: 300;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  white-space: nowrap;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===================== RESPONSIVE ===================== */
@media (min-width: 768px) {
  .view { max-width: 720px; padding: 24px; }

  .modal-content {
    border-radius: var(--radius-xl);
    margin-bottom: 5vh;
  }

  .modal {
    align-items: center;
  }

  .toty-hero { padding: 48px 32px; }
  .toty-hero h2 { font-size: 36px; }
  .toty-countdown .cd-num { font-size: 36px; }

  #map { height: 320px; }
}

@media (min-width: 1024px) {
  .view { max-width: 800px; }

  .toty-category-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ===================== LOADING SPINNER ===================== */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 24px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===================== COMMENT SECTION ===================== */
.comment-section {
  padding: 0 14px 12px;
}

.comment {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.comment-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

.comment-body { flex: 1; }

.comment-user {
  font-weight: 600;
  font-size: 13px;
}

.comment-text {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.comment-time {
  font-size: 11px;
  color: var(--color-text-light);
}

.comment-input-row {
  display: flex;
  gap: 8px;
  padding: 8px 14px;
}

.comment-input-row input {
  flex: 1;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-family: var(--font-body);
  outline: none;
}

.comment-input-row input:focus {
  border-color: var(--color-primary);
}

.comment-input-row button {
  background: none;
  border: none;
  color: var(--color-primary);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-body);
}

/* ===================== GOOGLE SIGN-IN BUTTON ===================== */
.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow-sm);
}

.btn-google:hover {
  background: var(--color-surface-alt);
  box-shadow: var(--shadow-md);
}

.btn-google:active { transform: scale(0.98); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0;
  color: var(--color-text-light);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* ===================== PWA INSTALL PROMPT ===================== */
.install-prompt {
  position: fixed;
  top: calc(var(--header-height) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  width: calc(100% - 24px);
  max-width: 480px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.install-prompt-content {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
}

.install-icon { font-size: 28px; flex-shrink: 0; }

.install-text {
  flex: 1;
  min-width: 0;
}

.install-text strong {
  display: block;
  font-size: 14px;
  margin-bottom: 1px;
}

.install-text span {
  font-size: 12px;
  color: var(--color-text-light);
}

/* ===================== PROFILE AVATAR WITH PHOTO ===================== */
.profile-avatar.has-photo {
  overflow: hidden;
}

.profile-avatar.has-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===================== GAMIFICATION STYLES ===================== */

/* --- Tier Badge --- */
.profile-tier {
  margin-bottom: 12px;
  text-align: center;
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-primary), #FF6F00);
  color: white;
  margin-bottom: 6px;
}

.tier-badge.tier-1 { background: linear-gradient(135deg, #8D6E63, #A1887F); }
.tier-badge.tier-2 { background: linear-gradient(135deg, #FF8F00, #FFB300); }
.tier-badge.tier-3 { background: linear-gradient(135deg, #2E7D32, #43A047); }
.tier-badge.tier-4 { background: linear-gradient(135deg, #D84315, #FF5722); }
.tier-badge.tier-5 { background: linear-gradient(135deg, #6A1B9A, #AB47BC); }
.tier-badge.tier-6 { background: linear-gradient(135deg, #FFD600, #FF6F00); color: #3E2723; }

.tier-xp {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 4px;
}

.tier-streak {
  font-size: 13px;
  font-weight: 600;
  color: #FF6F00;
  margin-bottom: 6px;
}

.tier-progress-section {
  max-width: 280px;
  margin: 0 auto;
}

.tier-progress-bar {
  height: 8px;
  background: var(--color-border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}

.tier-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), #FF6F00);
  border-radius: 4px;
  transition: width 0.6s ease;
}

.tier-progress-label {
  font-size: 11px;
  color: var(--color-text-light);
}

/* --- Card Tier Badge --- */
.card-tier-badge {
  font-size: 12px;
  margin-left: 2px;
}

/* --- Enhanced Badges --- */
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--color-secondary);
  color: var(--color-text);
  cursor: default;
  transition: transform 0.15s;
}

.badge:hover { transform: scale(1.05); }

.badge-quality { background: #E3F2FD; color: #1565C0; }
.badge-exploration { background: #E8F5E9; color: #2E7D32; }
.badge-social { background: #FCE4EC; color: #C62828; }
.badge-dedication { background: #FFF3E0; color: #E65100; }
.badge-milestone { background: var(--color-secondary); color: var(--color-text); }
.badge-secret { background: linear-gradient(135deg, #6A1B9A, #AB47BC); color: white; }

/* --- Social Share Buttons --- */
.btn-social {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  color: white;
  transition: transform 0.1s, opacity 0.2s;
  flex: 1;
  justify-content: center;
}

.btn-social:hover { opacity: 0.9; }
.btn-social:active { transform: scale(0.97); }

.btn-x { background: #000000; }
.btn-fb { background: #1877F2; }
.btn-ig { background: linear-gradient(135deg, #833AB4, #FD1D1D, #F77737); }
.btn-copy { background: var(--color-text-secondary); }

.share-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.share-actions-row2 {
  display: flex;
  gap: 8px;
}

.share-actions-row2 .btn-secondary { flex: 1; justify-content: center; }

/* --- Share Prompt Modal --- */
.modal-share-prompt {
  text-align: center;
  padding: 32px 24px;
}

.share-prompt-content h3 {
  font-family: var(--font-display);
  font-size: 24px;
  margin-bottom: 6px;
}

.share-prompt-content p {
  color: var(--color-text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}

.share-prompt-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.btn-text {
  background: none;
  border: none;
  color: var(--color-text-light);
  font-size: 14px;
  font-family: var(--font-body);
  cursor: pointer;
  padding: 8px;
}

.btn-text:hover { color: var(--color-text); }

/* --- Level Up Modal --- */
.modal-levelup {
  text-align: center;
  padding: 40px 24px;
  background: linear-gradient(135deg, #FFF8E1, #FFECB3);
}

.levelup-content {
  animation: levelUpPop 0.6s ease;
}

@keyframes levelUpPop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.levelup-confetti {
  font-size: 40px;
  display: inline-block;
  animation: confettiBounce 1s ease infinite;
}

@keyframes confettiBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.levelup-icon {
  font-size: 72px;
  margin: 12px 0;
}

.levelup-title {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--color-primary);
  margin-bottom: 4px;
}

.levelup-desc {
  font-size: 16px;
  color: var(--color-text-secondary);
  font-weight: 600;
}

/* --- Onboarding Quest Banner --- */
.onboarding-banner {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
  border-left: 4px solid var(--color-primary);
}

.onboarding-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.onboarding-header h3 {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0;
}

.onboarding-pct {
  font-weight: 700;
  font-size: 14px;
  color: var(--color-primary);
}

.onboarding-bar {
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}

.onboarding-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: 3px;
  transition: width 0.4s ease;
}

.onboarding-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.onboarding-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-secondary);
  padding: 4px 0;
}

.onboarding-step.done {
  color: var(--color-accent);
  font-weight: 500;
}

.step-check { font-size: 16px; width: 20px; }

/* --- Taco Trails --- */
.trails-overview {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  align-items: center;
}

.trails-stat {
  text-align: center;
}

.trails-stat strong {
  display: block;
  font-size: 24px;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1;
}

.trails-stat span {
  font-size: 12px;
  color: var(--color-text-light);
}

.trails-bar {
  width: 100%;
  height: 8px;
  background: var(--color-border);
  border-radius: 4px;
  overflow: hidden;
}

.trails-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  border-radius: 4px;
  transition: width 0.6s ease;
}

.trails-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.trails-hood {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.trails-hood:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.trails-hood.complete {
  border: 2px solid var(--color-accent);
  background: #E8F5E9;
}

.trails-hood.started {
  border: 1px solid var(--color-primary);
}

.trails-hood-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  margin: 0 auto 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trails-hood-inner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--color-primary);
}

.trails-hood-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 2px;
  line-height: 1.2;
}

.trails-hood-count {
  font-size: 10px;
  color: var(--color-text-light);
}

/* --- User Leaderboard extras --- */
.user-lb-streak {
  font-size: 11px;
  color: #FF6F00;
  font-weight: 700;
}

.user-lb-tier {
  font-size: 24px;
}

@media (max-width: 400px) {
  .trails-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .share-prompt-buttons {
    grid-template-columns: 1fr;
  }
}
