*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --sidebar-width: 260px;
  --custom-accent: var(--world-accent);
  --forest: #1b2e1e;
  --forest-light: #243828;
  --forest-mid: #2d4a32;
  --cream: #f4f1e6;
  --cream-dark: #e8e4d9;
  --card-white: #ffffff;
  --text-dark: #1a2e1a;
  --text-muted: #5c6b5c;
  --mint: #6fcf97;
  --mint-dark: #4caf7a;
  --sage: #8fbc8f;
  --gold: #e8a838;
  --gold-light: #f5d78e;
  --orange-pill: #f0d4a8;
  --green-pill: #d4edda;
  --hero-green: #2d5a3d;
  --scanner-bg: #1a3a28;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --shadow-soft: 0 2px 12px rgba(26, 46, 26, 0.08);
  --shadow-card: 0 4px 20px rgba(26, 46, 26, 0.1);
  --world-bg-start: #1a3a28;
  --world-bg-mid: #2d5a3d;
  --world-bg-end: #3d7a52;
  --world-accent: #6fcf97;
  --font-serif: "Fraunces", Georgia, serif;
  --font-sans: "DM Sans", system-ui, -apple-system, sans-serif;
  --rarity-common-bg: #e2ebe2;
  --rarity-common-text: #3d5c42;
  --rarity-uncommon-bg: #dbeafe;
  --rarity-uncommon-text: #1e40af;
  --rarity-rare-bg: #ede9fe;
  --rarity-rare-text: #5b21b6;
  --rarity-epic-bg: #fde68a;
  --rarity-epic-text: #92400e;
  --rarity-common: #6b8e6b;
  --rarity-uncommon: #3b82f6;
  --rarity-rare: #8b5cf6;
  --rarity-epic: #e8a838;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  background: var(--cream);
  color: var(--text-dark);
  line-height: 1.5;
  transition: background 0.6s ease, color 0.4s ease;
}

body.modal-open,
body.transport-active {
  overflow: hidden;
}

h1, h2, h3, .page-title, .card-title-serif, .hero-greeting {
  font-family: var(--font-serif);
  font-weight: 600;
}

.hidden {
  display: none !important;
}

/* Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--forest);
  color: #fff;
  z-index: 200;
  padding: 1.25rem 1rem 1rem;
  transition: background 0.6s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  padding: 0 0.25rem;
}

.brand-icon {
  font-size: 1.5rem;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  display: block;
  line-height: 1.2;
}

.brand-tagline {
  font-size: 0.65rem;
  color: var(--custom-accent, var(--mint));
  letter-spacing: 0.02em;
}

.sidebar-profile-card {
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.profile-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.profile-avatar {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: var(--mint-dark);
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.profile-accessory {
  position: absolute;
  bottom: -4px;
  right: -6px;
  font-size: 0.75rem;
  background: var(--card-white);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

/* Avatar frames */
.profile-avatar.frame-leaf {
  box-shadow: 0 0 0 3px #4caf7a, 0 0 0 5px rgba(76, 175, 122, 0.35);
}

.profile-avatar.frame-gold {
  box-shadow: 0 0 0 3px var(--gold), 0 0 0 5px rgba(232, 168, 56, 0.4);
}

.profile-avatar.frame-neon {
  box-shadow: 0 0 0 2px var(--world-accent), 0 0 8px var(--world-accent), 0 0 16px color-mix(in srgb, var(--world-accent) 50%, transparent);
}

.profile-avatar.frame-pixel {
  border-radius: 4px;
  box-shadow:
    0 0 0 2px var(--mint-dark),
    2px 2px 0 0 var(--gold),
    -2px -2px 0 0 var(--sage);
}

/* Profile card backgrounds */
.sidebar-profile-card.profile-bg-leaves {
  background: rgba(255, 255, 255, 0.08) url("data:image/svg+xml,%3Csvg width='20' height='20' xmlns='http://www.w3.org/2000/svg'%3E%3Ctext x='2' y='14' font-size='10' fill='rgba(255,255,255,0.08)'%3E🌿%3C/text%3E%3C/svg%3E") repeat;
}

.sidebar-profile-card.profile-bg-dots {
  background: rgba(255, 255, 255, 0.08) radial-gradient(circle, rgba(255,255,255,0.12) 1px, transparent 1px);
  background-size: 12px 12px;
}

.sidebar-profile-card.profile-bg-waves {
  background: linear-gradient(135deg, rgba(12, 74, 110, 0.35) 0%, rgba(255, 255, 255, 0.08) 50%, rgba(34, 211, 238, 0.15) 100%);
}

.sidebar-profile-card.profile-bg-grid {
  background: rgba(255, 255, 255, 0.08) linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 14px 14px;
}

.profile-display {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.profile-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-points {
  font-size: 0.8rem;
  color: var(--gold-light);
  font-weight: 600;
}

.sidebar-rank {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  color: #2d6a4f;
  background: linear-gradient(135deg, #b7e4c7 0%, #d8f3dc 100%);
  border: 1px solid #74c69d;
  border-radius: 20px;
  padding: 0.1rem 0.5rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.profile-placeholder {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 0.85rem;
}

.daily-goal-section {
  margin-top: 0.25rem;
}

.daily-goal-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 0.35rem;
}

.daily-goal-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  overflow: hidden;
}

.daily-goal-fill {
  height: 100%;
  width: 0%;
  background: var(--world-accent);
  border-radius: 3px;
  transition: width 0.5s ease, background 0.6s ease;
}

.nav-section-label {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.4);
  margin: 0 0 0.5rem 0.5rem;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  text-align: left;
  transition: background 0.2s, color 0.2s;
  position: relative;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.active {
  background: color-mix(in srgb, var(--world-accent) 20%, transparent);
  color: #fff;
}

.nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.nav-label {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  flex: 1;
  min-width: 0;
}

.nav-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.nav-sub {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.45);
}

.nav-item.active .nav-sub {
  color: rgba(255, 255, 255, 0.55);
}

.nav-dot {
  width: 6px;
  height: 6px;
  background: var(--mint);
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0;
}

.nav-item.active .nav-dot {
  opacity: 1;
  background: var(--custom-accent, var(--world-accent));
}

:root[data-custom-accent] .nav-item.active {
  background: color-mix(in srgb, var(--custom-accent) 20%, transparent);
}

:root[data-custom-accent] .sidebar-points {
  color: color-mix(in srgb, var(--custom-accent) 70%, white);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 0.5rem;
}

.sidebar-footer-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
  transition: color 0.2s, background 0.2s;
}

.sidebar-footer-link:hover {
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.05);
}

/* Main content */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 1.5rem 2rem 3rem;
  max-width: 1100px;
}

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 180;
  width: 44px;
  height: 44px;
  padding: 0;
  align-items: center;
  justify-content: center;
  background: var(--card-white);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

.hamburger,
.hamburger::before,
.hamburger::after {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-dark);
  border-radius: 1px;
}

.hamburger {
  position: relative;
}

.hamburger::before,
.hamburger::after {
  content: "";
  position: absolute;
  left: 0;
}

.hamburger::before { top: -6px; }
.hamburger::after { top: 6px; }

.page {
  animation: fadeIn 0.25s ease;
}

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

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.page-title {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-dark);
}

.page-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.header-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pill {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.pill-green {
  background: var(--green-pill);
  color: var(--text-dark);
}

.pill-orange {
  background: var(--orange-pill);
  color: var(--text-dark);
}

.page-header-simple {
  margin-bottom: 1.25rem;
}

.hero-greeting-compact {
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.hero-greeting-compact .hero-greeting {
  font-size: 1.35rem;
  margin: 0 0 0.75rem;
}

.hero-greeting-compact::after {
  display: none;
}

.home-grid-simple {
  grid-template-columns: 1fr;
  margin-bottom: 1.25rem;
}

.impact-mini-row-home {
  max-width: 520px;
}

.impact-toggle-btn {
  margin-top: 0.75rem;
  padding: 0.5rem 0;
  border: none;
  background: none;
  color: var(--mint-dark);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.impact-toggle-btn:hover {
  text-decoration: underline;
}

.impact-details {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--cream-dark);
}

/* Collection page */
.collection-progress-card {
  background: var(--card-white);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-soft);
}

.collection-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.collection-progress-bar {
  height: 10px;
  background: var(--cream-dark);
  border-radius: 5px;
  overflow: hidden;
}

.collection-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--world-accent);
  border-radius: 5px;
  transition: width 0.5s ease;
}

.collection-rarity-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--cream-dark);
  font-size: 0.75rem;
  font-weight: 600;
}

.rarity-breakdown-item {
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.collection-rarity-filter {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.rarity-filter-btn.rarity-common:not(.active) {
  border-color: color-mix(in srgb, var(--rarity-common) 40%, var(--cream-dark));
  color: var(--rarity-common-text);
}

.rarity-filter-btn.rarity-uncommon:not(.active) {
  border-color: color-mix(in srgb, var(--rarity-uncommon) 40%, var(--cream-dark));
  color: var(--rarity-uncommon-text);
}

.rarity-filter-btn.rarity-rare:not(.active) {
  border-color: color-mix(in srgb, var(--rarity-rare) 40%, var(--cream-dark));
  color: var(--rarity-rare-text);
}

.rarity-filter-btn.rarity-epic:not(.active) {
  border-color: color-mix(in srgb, var(--rarity-epic) 40%, var(--cream-dark));
  color: var(--rarity-epic-text);
}

.rarity-badge {
  display: inline-block;
  font-size: 0.55rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.3;
}

.rarity-badge.rarity-common,
.rarity-breakdown-item.rarity-common {
  background: var(--rarity-common-bg);
  color: var(--rarity-common-text);
}

.rarity-badge.rarity-uncommon,
.rarity-breakdown-item.rarity-uncommon {
  background: var(--rarity-uncommon-bg);
  color: var(--rarity-uncommon-text);
}

.rarity-badge.rarity-rare,
.rarity-breakdown-item.rarity-rare {
  background: var(--rarity-rare-bg);
  color: var(--rarity-rare-text);
}

.rarity-badge.rarity-epic,
.rarity-breakdown-item.rarity-epic {
  background: linear-gradient(135deg, var(--rarity-epic-bg), #fde68a);
  color: var(--rarity-epic-text);
  animation: epic-shimmer 3s ease-in-out infinite;
}

@keyframes epic-shimmer {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.08); }
}

.collection-detail-rarity {
  margin-bottom: 0.5rem;
}

.collection-detail-rarity .rarity-badge {
  font-size: 0.7rem;
  padding: 0.25rem 0.65rem;
}

.collection-filter {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.collection-filter-btn {
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--cream-dark);
  border-radius: 999px;
  background: var(--card-white);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.collection-filter-btn:hover {
  border-color: var(--mint-dark);
  color: var(--text-dark);
}

.collection-filter-btn.active {
  background: var(--forest);
  border-color: var(--forest);
  color: #fff;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.collection-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1rem 0.5rem;
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-md);
  background: var(--card-white);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  text-align: center;
}

.collection-cell.discovered {
  background: var(--card-white);
  box-shadow: var(--shadow-soft);
}

.collection-cell.discovered:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.collection-cell.undiscovered {
  background: var(--cream);
  opacity: 0.55;
  cursor: default;
}

.collection-cell.undiscovered.rarity-common {
  border-color: color-mix(in srgb, var(--rarity-common) 35%, var(--cream-dark));
}

.collection-cell.undiscovered.rarity-uncommon {
  border-color: color-mix(in srgb, var(--rarity-uncommon) 35%, var(--cream-dark));
}

.collection-cell.undiscovered.rarity-rare {
  border-color: color-mix(in srgb, var(--rarity-rare) 35%, var(--cream-dark));
}

.collection-cell.undiscovered.rarity-epic {
  border-color: color-mix(in srgb, var(--rarity-epic) 45%, var(--cream-dark));
}

.collection-cell.undiscovered:hover {
  opacity: 0.75;
}

.collection-cell.undiscovered.rarity-common:hover {
  background: color-mix(in srgb, var(--rarity-common-bg) 50%, var(--cream));
}

.collection-cell.undiscovered.rarity-uncommon:hover {
  background: color-mix(in srgb, var(--rarity-uncommon-bg) 50%, var(--cream));
}

.collection-cell.undiscovered.rarity-rare:hover {
  background: color-mix(in srgb, var(--rarity-rare-bg) 50%, var(--cream));
}

.collection-cell.undiscovered.rarity-epic:hover {
  background: color-mix(in srgb, var(--rarity-epic-bg) 50%, var(--cream));
}

.collection-cell.undiscovered .rarity-hint {
  opacity: 0;
  transition: opacity 0.2s;
}

.collection-cell.undiscovered:hover .rarity-hint {
  opacity: 1;
}

.collection-cell.discovered.rarity-common {
  border-color: color-mix(in srgb, var(--rarity-common) 20%, var(--cream-dark));
}

.collection-cell.discovered.rarity-uncommon {
  border-color: color-mix(in srgb, var(--rarity-uncommon) 20%, var(--cream-dark));
}

.collection-cell.discovered.rarity-rare {
  border-color: color-mix(in srgb, var(--rarity-rare) 20%, var(--cream-dark));
}

.collection-cell.discovered.rarity-epic {
  border-color: color-mix(in srgb, var(--rarity-epic) 25%, var(--cream-dark));
}

.collection-cell-icon {
  font-size: 2rem;
  line-height: 1;
}

.collection-cell-silhouette {
  filter: grayscale(1);
  opacity: 0.4;
}

.collection-cell-name {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.25;
}

.collection-cell.undiscovered .collection-cell-name {
  color: var(--text-muted);
}

.collection-bonus-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--cream-dark);
}

.collection-bonus-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.collection-bonus-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  background: var(--card-white);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.collection-bonus-item:hover {
  background: var(--cream);
}

.collection-bonus-icon {
  font-size: 1.5rem;
}

.collection-bonus-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.9rem;
}

.collection-bonus-tag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  background: var(--orange-pill);
  border-radius: 999px;
  color: var(--text-dark);
}

.collection-detail-content {
  text-align: center;
}

.collection-detail-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 0.5rem;
}

.collection-detail-title {
  margin: 0 0 0.35rem;
  font-family: var(--font-serif);
  font-size: 1.35rem;
}

.collection-detail-category {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.collection-detail-date,
.collection-detail-scans {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.collection-detail-tip {
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-dark);
  text-align: left;
  padding: 0.75rem 1rem;
  background: var(--cream);
  border-radius: var(--radius-sm);
}

.community-layout-simple {
  grid-template-columns: 1fr 240px;
}

.world-hero-clean {
  aspect-ratio: 16 / 9;
  min-height: 180px;
  max-height: 320px;
}

.world-hero-clean .world-hero-art {
  opacity: 1;
}

.world-hero-clean .world-hero-content {
  padding: 1.25rem 1.5rem 4.25rem;
}

.impact-detail-compact {
  padding-top: 1rem;
}

.stats-grid-compact {
  margin-bottom: 0.75rem;
}

/* Hero greeting card */
.hero-greeting-card {
  background: linear-gradient(135deg, var(--hero-green) 0%, var(--world-bg-end) 100%);
  border-radius: var(--radius-xl);
  padding: 1.5rem 1.75rem;
  color: #fff;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  transition: background 0.6s ease;
}

.hero-greeting-card::after {
  content: "🌿";
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 4rem;
  opacity: 0.15;
}

.hero-date {
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.8;
}

.hero-greeting {
  margin: 0.35rem 0 0.75rem;
  font-size: 1.75rem;
  font-weight: 700;
}

.hero-stats-row {
  display: flex;
  gap: 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.hero-progress-section {
  max-width: 100%;
}

.hero-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: 0.35rem;
  opacity: 0.9;
}

.hero-progress-bar {
  height: 10px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  overflow: hidden;
}

.hero-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--world-accent);
  border-radius: 5px;
  transition: width 0.5s ease, background 0.6s ease;
}

/* Home grid */
.home-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.25rem;
  align-items: start;
}

.scanner-card {
  background: var(--card-white);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-soft);
  transition: box-shadow 0.4s ease;
}

body[data-world] .scanner-card,
body[data-world] .impact-mini-card,
body[data-world] .community-stat-card,
body[data-world] .leaderboard-card,
body[data-world] .friends-add-card,
body[data-world] .settings-card,
body[data-world] .myworld-stat-card,
body[data-world] .impact-section-card,
body[data-world] .impact-detail-card,
body[data-world] .myworld-badges-sidebar,
body[data-world] .collection-progress-card,
body[data-world] .collection-cell.discovered {
  border: 1px solid color-mix(in srgb, var(--world-accent) 12%, var(--cream-dark));
}

.scanner-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
}

.card-title-serif {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.ai-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  background: var(--green-pill);
  color: var(--text-dark);
  border-radius: 999px;
}

.scanner-viewfinder {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--scanner-bg);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 1rem;
}

#video,
#photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scanner-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
  line-height: 1.5;
}

.scanner-camera-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

.viewfinder-corners span {
  position: absolute;
  width: 32px;
  height: 32px;
  border-color: var(--gold);
  border-style: solid;
  border-width: 0;
  z-index: 3;
  pointer-events: none;
}

.viewfinder-corners span:nth-child(1) {
  top: 16px; left: 16px;
  border-top-width: 3px; border-left-width: 3px;
}

.viewfinder-corners span:nth-child(2) {
  top: 16px; right: 16px;
  border-top-width: 3px; border-right-width: 3px;
}

.viewfinder-corners span:nth-child(3) {
  bottom: 16px; left: 16px;
  border-bottom-width: 3px; border-left-width: 3px;
}

.viewfinder-corners span:nth-child(4) {
  bottom: 16px; right: 16px;
  border-bottom-width: 3px; border-right-width: 3px;
}

.scanner-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-scan-primary {
  flex: 1;
  min-width: 140px;
  padding: 0.85rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--gold);
  color: var(--text-dark);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s, transform 0.15s;
}

.btn-scan-primary:hover:not(:disabled) {
  filter: brightness(1.05);
}

.btn-scanner-secondary {
  padding: 0.65rem 1rem;
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  background: var(--cream);
  color: var(--text-dark);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-scanner-secondary:hover:not(:disabled) {
  background: var(--cream-dark);
}

button:active:not(:disabled) {
  transform: scale(0.98);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Impact mini cards */
.home-sidebar-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.impact-mini-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}

.impact-mini-card {
  background: var(--card-white);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.5rem;
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.impact-mini-icon {
  font-size: 1.25rem;
  display: block;
  margin-bottom: 0.25rem;
}

.impact-mini-value {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
}

.impact-mini-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.quick-actions-card {
  background: var(--card-white);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-soft);
}

.quick-actions-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quick-action-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--cream);
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.quick-action-item.done {
  background: rgba(111, 207, 151, 0.15);
}

.quick-action-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.quick-action-info {
  flex: 1;
  min-width: 0;
}

.quick-action-name {
  font-size: 0.85rem;
  font-weight: 600;
  display: block;
}

.quick-action-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.quick-action-pts {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold);
  flex-shrink: 0;
}

.quick-action-check {
  width: 28px;
  height: 28px;
  border: 2px solid var(--cream-dark);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.quick-action-check.done {
  background: var(--mint);
  border-color: var(--mint);
  color: #fff;
}

/* Leaderboard & Friends page */
.rank-pills-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.rank-pill {
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.rank-pill-weekly {
  background: var(--green-pill);
  color: var(--text-dark);
}

.rank-pill-global {
  background: color-mix(in srgb, var(--world-accent) 25%, var(--cream));
  color: var(--text-dark);
}

.friends-add-card,
.friends-section {
  background: var(--card-white);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-soft);
  margin-bottom: 1rem;
}

.friend-add-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.friend-add-form input {
  flex: 1;
  min-width: 160px;
  padding: 0.75rem 1rem;
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  background: var(--cream);
  font-size: 0.9rem;
}

.friend-add-form input:focus {
  outline: none;
  border-color: var(--mint-dark);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--world-accent) 25%, transparent);
}

.friend-add-btn {
  width: auto !important;
  padding: 0.75rem 1.25rem;
  white-space: nowrap;
}

.friends-list,
.friend-requests-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.friend-row,
.friend-request-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--cream);
}

.friend-request-actions {
  display: flex;
  gap: 0.35rem;
  margin-left: auto;
}

.btn-accept,
.btn-decline {
  padding: 0.35rem 0.65rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-accept {
  background: var(--mint-dark);
  color: #fff;
}

.btn-decline {
  background: var(--cream-dark);
  color: var(--text-muted);
}

.empty-state {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
}

.friend-suggestions {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Actions page (legacy — removed from nav) */
.actions-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.actions-stat-card {
  background: var(--card-white);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.actions-stat-icon {
  font-size: 1.1rem;
  display: block;
  margin-bottom: 0.25rem;
}

.actions-stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-serif);
}

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

.filter-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.filter-pill {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 999px;
  background: var(--cream-dark);
  color: var(--text-dark);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.filter-pill:hover {
  background: var(--cream);
}

.filter-pill.active {
  background: var(--forest);
  color: #fff;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.action-card {
  background: var(--card-white);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-soft);
}

.action-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.action-card-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: var(--cream);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.action-card-title-row {
  flex: 1;
  min-width: 0;
}

.action-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
}

.action-card-pts {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold);
  background: var(--orange-pill);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.action-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
  line-height: 1.45;
}

.action-card-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.btn-action-done {
  width: 100%;
  padding: 0.7rem;
  border: 2px solid var(--mint-dark);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--mint-dark);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action-done:hover:not(:disabled) {
  background: rgba(76, 175, 122, 0.1);
}

.btn-action-done.completed {
  background: var(--mint);
  border-color: var(--mint);
  color: #fff;
}

/* Community page */
.community-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.community-stat-card {
  background: var(--card-white);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.community-stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-serif);
}

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

.community-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.community-tab {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 999px;
  background: var(--cream-dark);
  color: var(--text-dark);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.community-tab.active {
  background: var(--forest);
  color: #fff;
}

.community-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.25rem;
  align-items: start;
}

.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.activity-card {
  background: var(--card-white);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-soft);
}

.activity-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.activity-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
}

.activity-user {
  flex: 1;
  min-width: 0;
}

.activity-name {
  font-weight: 700;
  font-size: 0.9rem;
}

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

.activity-badge {
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
  background: var(--green-pill);
  border-radius: 999px;
  font-weight: 600;
}

.activity-text {
  font-size: 0.85rem;
  margin: 0 0 0.35rem;
}

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

.leaderboard-card {
  background: var(--card-white);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-soft);
}

.leaderboard-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.friends-leaderboard {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.leaderboard-row.highlight {
  background: color-mix(in srgb, var(--world-accent) 18%, var(--cream));
}

.leaderboard-rank {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  min-width: 24px;
}

.leaderboard-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: #fff;
  flex-shrink: 0;
}

.leaderboard-info {
  flex: 1;
  min-width: 0;
}

.leaderboard-name {
  font-weight: 600;
  font-size: 0.85rem;
}

.leaderboard-badge {
  font-size: 0.65rem;
  color: var(--text-muted);
}

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

.leaderboard-pts {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--gold);
}

.community-sidebar-card {
  background: var(--card-white);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-soft);
  margin-bottom: 1rem;
}

.community-sidebar-card h3 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.badges-preview {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.badge-preview-item {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: var(--cream);
  border-radius: 50%;
}

.friend-summary {
  font-size: 0.8rem;
  margin: 0 0 0.5rem;
  color: var(--text-muted);
}

.friend-suggestion {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--cream);
}

.friend-suggestion:last-child {
  border-bottom: none;
}

.link-btn {
  background: none;
  border: none;
  color: var(--mint-dark);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.link-btn:hover {
  text-decoration: underline;
}

.demo-card {
  background: var(--card-white);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-soft);
  margin-bottom: 0.75rem;
}

.demo-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.demo-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.challenge-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  background: var(--green-pill);
  border-radius: 999px;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.challenge-progress {
  height: 6px;
  background: var(--cream);
  border-radius: 3px;
  margin-top: 0.75rem;
  overflow: hidden;
}

.challenge-progress-fill {
  height: 100%;
  background: var(--mint);
  border-radius: 3px;
}

.community-panel.hidden {
  display: none;
}

/* Communities */
.communities-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.community-card {
  padding: 1rem 1.1rem;
  background: var(--cream);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-md);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.community-card.joined {
  border-color: color-mix(in srgb, var(--mint) 35%, var(--cream-dark));
  background: color-mix(in srgb, var(--green-pill) 40%, var(--card-white));
}

.community-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.community-card-icon {
  font-size: 1.75rem;
  line-height: 1;
  flex-shrink: 0;
}

.community-card-info {
  flex: 1;
  min-width: 0;
}

.community-card-name {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
}

.community-card-members {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.community-card-desc {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.community-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.btn-community-toggle {
  padding: 0.4rem 0.85rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s;
}

.btn-join {
  background: var(--mint-dark);
  color: #fff;
}

.btn-leave {
  background: var(--cream-dark);
  color: var(--text-muted);
}

.btn-community-toggle:hover {
  filter: brightness(1.05);
}

.section-hint,
.sidebar-hint {
  margin: 0 0 0.85rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.sidebar-hint strong {
  color: var(--text-dark);
  font-weight: 700;
}

/* Community detail modal */
.community-detail-content {
  width: min(100%, 460px);
  max-height: 85vh;
  overflow-y: auto;
  text-align: left;
}

.community-detail-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.35rem;
}

.community-detail-title {
  margin: 0 0 0.25rem;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  text-align: left;
}

.community-detail-members {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.community-detail-desc {
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-dark);
}

.community-detail-section {
  margin-bottom: 1.25rem;
}

.community-detail-section h3 {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.community-detail-activity {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.community-activity-item {
  padding: 0.65rem 0.75rem;
  background: var(--cream);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.community-activity-user {
  font-weight: 700;
  display: block;
  margin-bottom: 0.15rem;
}

.community-activity-action {
  color: var(--text-dark);
}

.community-activity-time {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.community-detail-leaderboard {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Challenges */
.challenges-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.challenge-create-card {
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--cream);
  border-radius: var(--radius-sm);
  border: 1px solid var(--cream-dark);
}

.challenge-create-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
}

.challenge-create-form select {
  flex: 1;
  min-width: 140px;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  background: var(--card-white);
  font-size: 0.85rem;
  font-family: var(--font-sans);
}

.challenge-create-form select:focus {
  outline: none;
  border-color: var(--mint-dark);
}

.challenge-send-btn {
  width: auto !important;
  padding: 0.65rem 1rem;
  white-space: nowrap;
}

.challenge-card {
  padding: 1rem 1.1rem;
  background: var(--cream);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-md);
}

.challenge-card-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.challenge-card-info {
  flex: 1;
  min-width: 0;
}

.challenge-card-title {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
}

.challenge-card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.challenge-reward {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold);
  background: var(--orange-pill);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.challenge-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.challenge-pending-actions {
  display: flex;
  gap: 0.5rem;
}

.challenge-join-community-btn {
  margin-top: 0.75rem;
  width: auto !important;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
}

.challenge-complete-badge {
  display: inline-block;
  margin-top: 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--mint-dark);
  background: var(--green-pill);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

body[data-world] .community-card,
body[data-world] .challenge-card,
body[data-world] .challenge-create-card {
  border-color: color-mix(in srgb, var(--world-accent) 12%, var(--cream-dark));
}

@media (max-width: 480px) {
  .community-tabs {
    gap: 0.35rem;
  }

  .community-tab {
    padding: 0.45rem 0.75rem;
    font-size: 0.75rem;
  }

  .challenge-create-form {
    flex-direction: column;
  }

  .challenge-send-btn {
    width: 100% !important;
  }
}

/* My World page */
.myworld-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 1.25rem;
  align-items: start;
}

.world-hero {
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: 1.25rem;
  position: relative;
  min-height: 180px;
  background: linear-gradient(
    135deg,
    var(--fallback-start, var(--world-bg-start)),
    var(--fallback-mid, var(--world-bg-mid)),
    var(--fallback-end, var(--world-bg-end))
  );
  box-shadow: var(--shadow-card);
  transition: background 0.6s ease;
}

.world-hero-art {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.world-hero-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.72) 0%,
    rgba(0, 0, 0, 0.35) 40%,
    rgba(0, 0, 0, 0.08) 70%,
    transparent 100%
  );
  z-index: 1;
}

.world-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.world-banner-fallback {
  background: linear-gradient(
    135deg,
    var(--fallback-start, var(--world-bg-start)),
    var(--fallback-mid, var(--world-bg-mid)),
    var(--fallback-end, var(--world-bg-end))
  );
}

.world-hero-art.world-banner-fallback .world-banner-img {
  display: none;
}

.world-hero-content {
  position: absolute;
  inset: 0;
  padding: 1.25rem 1.5rem 4.25rem;
  text-align: left;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  pointer-events: none;
}

.world-hero-name {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
}

.world-progress-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem 1.25rem;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  z-index: 3;
}

.world-progress-overlay p {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
}

.world-progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.35rem;
}

.world-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--world-accent);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.world-pts-away {
  font-size: 0.75rem;
  opacity: 0.85;
}

.myworld-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.myworld-stat-card {
  background: var(--card-white);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.myworld-stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-serif);
}

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

.impact-section-card,
.impact-detail-card {
  background: var(--card-white);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-soft);
  margin-bottom: 1.25rem;
}

.impact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.impact-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(111, 207, 151, 0.12);
  border-radius: var(--radius-md);
}

.impact-item-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.impact-item-text {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.35;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat-card {
  text-align: center;
  padding: 0.75rem;
  background: var(--cream);
  border-radius: var(--radius-sm);
}

.stat-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--mint-dark);
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.level-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.level-label {
  font-weight: 600;
}

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

.level-progress-bar {
  height: 8px;
  background: var(--cream);
  border-radius: 4px;
  overflow: hidden;
}

.level-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--world-accent);
  border-radius: 4px;
  transition: width 0.5s ease, background 0.6s ease;
}

.myworld-badges-sidebar {
  background: var(--card-white);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-soft);
}

.badges-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.badge-list-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--cream);
}

.badge-list-item.locked {
  opacity: 0.45;
}

.badge-list-emoji {
  font-size: 1.1rem;
}

.badge-list-name {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 600;
}

.badge-list-status {
  font-size: 0.75rem;
  color: var(--mint-dark);
  font-weight: 600;
}

.badge-list-item.locked .badge-list-status {
  color: var(--text-muted);
}

/* Settings page */
.settings-card {
  background: var(--card-white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-soft);
  margin-bottom: 1rem;
}

.settings-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.settings-desc {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

#api-key {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  background: var(--cream);
  color: var(--text-dark);
  font-size: 0.9rem;
  font-family: ui-monospace, monospace;
}

#api-key:focus {
  outline: none;
  border-color: var(--mint-dark);
  box-shadow: 0 0 0 3px rgba(76, 175, 122, 0.2);
}

.settings-hint {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.settings-hint a {
  color: var(--mint-dark);
}

/* Buttons */
.btn-primary,
.btn-secondary {
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s, transform 0.15s;
}

.btn-primary {
  background: var(--mint-dark);
  color: #fff;
  width: 100%;
  transition: background 0.4s ease;
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-secondary {
  background: var(--cream);
  color: var(--text-dark);
  border: 1px solid var(--cream-dark);
}

.btn-secondary:hover {
  background: var(--cream-dark);
}

/* Scan overlay & HUD */
.error {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  background: rgba(26, 46, 26, 0.9);
  color: #fca5a5;
  font-size: 0.9rem;
  z-index: 5;
}

.identify-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(111, 207, 151, 0.15);
  border-radius: var(--radius-sm);
  color: var(--text-dark);
  font-size: 0.9rem;
}

.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(76, 175, 122, 0.3);
  border-top-color: var(--mint-dark);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hud-card {
  margin-top: 1rem;
  padding: 1.25rem;
  background: var(--cream);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.hud-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.hud-tag {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.hud-id {
  font-size: 0.7rem;
  color: var(--mint-dark);
  font-family: ui-monospace, monospace;
}

.hud-divider {
  height: 1px;
  margin: 0.65rem 0;
  background: var(--cream-dark);
}

.hud-name {
  margin: 0 0 0.5rem;
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
}

.hud-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.hud-points,
.hud-category {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.hud-points {
  color: var(--mint-dark);
  background: rgba(111, 207, 151, 0.2);
}

.hud-category {
  color: var(--text-dark);
  background: var(--green-pill);
}

.hud-block {
  margin-top: 0.65rem;
}

.hud-label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hud-block p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-dark);
}

.hud-block-fact p,
.hud-fact-line {
  font-style: italic;
  color: var(--text-muted);
}

.hud-fact-line {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
}

.hud-fact-line::before {
  content: "• ";
  color: var(--mint-dark);
  font-style: normal;
  font-weight: 700;
}

.hud-bullet-list {
  margin: 0;
  padding: 0 0 0 1.15rem;
  list-style: none;
}

.hud-bullet-list li {
  position: relative;
  margin-bottom: 0.45rem;
  padding-left: 0.15rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-dark);
}

.hud-bullet-list li:last-child {
  margin-bottom: 0;
}

.hud-bullet-list li::before {
  content: "";
  position: absolute;
  left: -1rem;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mint-dark);
}

.verify-disposal-section {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--cream-dark);
}

.btn-verify-disposal {
  display: block;
  width: 100%;
  padding: 0.9rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--mint-dark);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s, transform 0.15s;
}

.btn-verify-disposal:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn-verify-disposal:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.verify-disposal-subtext {
  margin: 0.5rem 0 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.verified-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  color: var(--mint-dark);
  background: var(--green-pill);
}

.btn-retry-bin {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.7rem 1rem;
  border: 2px solid color-mix(in srgb, var(--gold) 50%, var(--cream-dark));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--orange-pill) 40%, var(--card-white));
  color: var(--text-dark);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-retry-bin:hover {
  background: var(--orange-pill);
  border-color: var(--gold);
}

.bin-scan-instruction {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  margin: 0;
  padding: 0.5rem 1rem;
  background: rgba(26, 46, 26, 0.82);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
}

.scanner-viewfinder.bin-mode .viewfinder-corners span {
  border-color: var(--mint);
}

/* Bin correction modal */
.bin-correction-content {
  text-align: center;
  border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--cream-dark));
  background: color-mix(in srgb, var(--orange-pill) 25%, var(--card-white));
}

.bin-correction-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.bin-correction-title {
  color: color-mix(in srgb, #c2410c 70%, var(--text-dark));
}

.bin-correction-message {
  margin: 0 0 1.25rem;
  text-align: left;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-dark);
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.65);
  border-radius: var(--radius-sm);
}

.bin-correction-close-btn {
  margin-top: 0.5rem;
}

/* Verify success animation */
.verify-success-overlay {
  position: fixed;
  inset: 0;
  z-index: 960;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.verify-success-overlay.active {
  opacity: 1;
}

.verify-success-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.verify-confetti-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  opacity: 0;
  animation: verify-confetti-burst 1.2s ease-out forwards;
}

@keyframes verify-confetti-burst {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate(
      calc((var(--x, 0.5) - 0.5) * 200px),
      calc((var(--y, 0.5) - 0.5) * -180px)
    ) scale(0.3) rotate(540deg);
  }
}

.verify-confetti-particle:nth-child(odd) { --x: 0.2; --y: 0.8; }
.verify-confetti-particle:nth-child(even) { --x: 0.8; --y: 0.2; }
.verify-confetti-particle:nth-child(3n) { --x: 0.5; --y: 0.1; }
.verify-confetti-particle:nth-child(4n) { --x: 0.1; --y: 0.5; }
.verify-confetti-particle:nth-child(5n) { --x: 0.9; --y: 0.6; }

.verify-success-burst {
  position: relative;
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--mint);
  box-shadow:
    0 0 0 0 rgba(111, 207, 151, 0.6),
    0 8px 32px rgba(76, 175, 122, 0.45);
  transform: scale(0);
  animation: verify-burst-in 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.verify-success-overlay.active .verify-success-burst {
  animation: verify-burst-in 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             verify-burst-pulse 0.8s ease 0.4s 2;
}

@keyframes verify-burst-in {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes verify-burst-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(111, 207, 151, 0.5), 0 8px 32px rgba(76, 175, 122, 0.45); }
  50% { box-shadow: 0 0 0 16px rgba(111, 207, 151, 0), 0 8px 32px rgba(76, 175, 122, 0.45); }
}

.verify-checkmark {
  font-size: 2.5rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

.verify-success-points {
  position: absolute;
  bottom: 38%;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--mint-dark);
  font-family: var(--font-serif);
  opacity: 0;
  transform: translateY(20px);
  animation: verify-points-float 1.4s ease 0.35s forwards;
}

.verify-success-overlay.active .verify-success-points {
  animation: verify-points-float 1.4s ease 0.35s forwards;
}

@keyframes verify-points-float {
  0% { opacity: 0; transform: translateY(20px); }
  25% { opacity: 1; transform: translateY(0); }
  75% { opacity: 1; transform: translateY(-24px); }
  100% { opacity: 0; transform: translateY(-48px); }
}

.disposal-section {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--cream-dark);
}

.hud-meta-visible {
  margin-bottom: 0.65rem;
}

.disposal-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.disposal-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  background: var(--card-white);
  color: var(--text-dark);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.disposal-btn:hover:not(:disabled) {
  border-color: var(--mint-dark);
  background: color-mix(in srgb, var(--mint) 8%, var(--card-white));
}

.disposal-btn:disabled {
  cursor: default;
  opacity: 0.85;
}

.disposal-btn-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  line-height: 1;
}

.disposal-btn-label {
  flex: 1;
  min-width: 0;
}

.disposal-btn-check {
  flex-shrink: 0;
  font-size: 1rem;
  color: var(--mint-dark);
  opacity: 0;
}

.disposal-btn.selected {
  border-color: var(--mint-dark);
  background: color-mix(in srgb, var(--mint) 12%, var(--card-white));
}

.disposal-btn.selected .disposal-btn-check {
  opacity: 1;
}

.disposal-btn.correct {
  border-color: var(--mint-dark);
  background: color-mix(in srgb, var(--mint) 18%, var(--card-white));
}

.disposal-btn.wrong {
  border-color: color-mix(in srgb, #e85d3a 45%, var(--cream-dark));
  background: color-mix(in srgb, #e85d3a 6%, var(--card-white));
}

.disposal-btn.partial {
  border-color: color-mix(in srgb, var(--gold) 50%, var(--cream-dark));
  background: color-mix(in srgb, var(--gold) 10%, var(--card-white));
}

.disposal-feedback {
  margin: 0.75rem 0 0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.5;
  font-weight: 600;
}

.disposal-feedback.correct {
  background: var(--green-pill);
  color: var(--text-dark);
}

.disposal-feedback.partial {
  background: var(--orange-pill);
  color: var(--text-dark);
}

.disposal-feedback.wrong {
  background: color-mix(in srgb, #e85d3a 12%, var(--cream));
  color: var(--text-dark);
}

.identify-error {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(239, 68, 68, 0.1);
  border-radius: var(--radius-sm);
  color: #b91c1c;
  font-size: 0.9rem;
}

.scan-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
}

.scan-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(111, 207, 151, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(111, 207, 151, 0.08) 1px, transparent 1px);
  background-size: 32px 32px;
  animation: grid-pulse 3s ease-in-out infinite;
}

.scan-mesh {
  position: absolute;
  inset: -50%;
  background:
    repeating-linear-gradient(60deg, transparent, transparent 24px, rgba(111, 207, 151, 0.03) 24px, rgba(111, 207, 151, 0.03) 25px);
  animation: mesh-rotate 20s linear infinite;
}

.scan-corners span {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: var(--mint);
  border-style: solid;
  border-width: 0;
}

.scan-corners span:nth-child(1) { top: 12px; left: 12px; border-top-width: 2px; border-left-width: 2px; }
.scan-corners span:nth-child(2) { top: 12px; right: 12px; border-top-width: 2px; border-right-width: 2px; }
.scan-corners span:nth-child(3) { bottom: 12px; left: 12px; border-bottom-width: 2px; border-left-width: 2px; }
.scan-corners span:nth-child(4) { bottom: 12px; right: 12px; border-bottom-width: 2px; border-right-width: 2px; }

.scan-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--mint) 50%, transparent);
  box-shadow: 0 0 12px var(--mint);
  animation: scan-sweep 2.2s ease-in-out infinite;
}

@keyframes grid-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.6; }
}

@keyframes mesh-rotate {
  to { transform: rotate(360deg); }
}

@keyframes scan-sweep {
  0% { top: 8%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 92%; opacity: 0; }
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
  width: min(90vw, 420px);
}

.toast {
  width: 100%;
  padding: 0.75rem 1.125rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: var(--shadow-card);
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-points {
  background: var(--green-pill);
  color: var(--text-dark);
}

.toast-badge {
  background: #ede9fe;
  color: #5b21b6;
}

.toast-info {
  background: var(--card-white);
  color: var(--text-dark);
  border: 1px solid var(--cream-dark);
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 46, 26, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: min(100%, 420px);
  padding: 1.75rem;
  background: var(--card-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
}

.modal-content h2 {
  margin: 0 0 0.5rem;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  text-align: center;
}

.modal-subtitle {
  margin: 0 0 1.25rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.required {
  color: #dc2626;
}

#profile-username {
  width: 100%;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  background: var(--cream);
  font-size: 0.95rem;
}

#profile-username:focus {
  outline: none;
  border-color: var(--mint-dark);
  box-shadow: 0 0 0 3px rgba(76, 175, 122, 0.2);
}

.avatar-picker {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
}

.avatar-category-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 0.5rem;
  margin-bottom: 0.2rem;
}

.avatar-category-label:first-child {
  margin-top: 0;
}

.avatar-group-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
}

.avatar-option {
  aspect-ratio: 1;
  padding: 0;
  font-size: 2rem;
  background: var(--cream);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.15s;
  line-height: 1;
}

.avatar-option:hover {
  border-color: var(--cream-dark);
  transform: scale(1.08);
}

.avatar-option.selected {
  border-color: var(--mint-dark);
  box-shadow: 0 0 0 3px rgba(76, 175, 122, 0.35);
  transform: scale(1.1);
}

.modal-actions {
  margin-top: 0.5rem;
}

.help-content h3 {
  margin: 1rem 0 0.35rem;
  font-size: 0.95rem;
}

.help-content h3:first-child {
  margin-top: 0;
}

.help-content p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Transport modal */
.transport-modal {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.transport-modal.visible {
  opacity: 1;
}

.transport-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--world-bg-mid) 60%, transparent) 0%, rgba(10, 10, 10, 0.95) 70%);
  transition: background 0.6s ease;
}

.transport-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.transport-particle {
  position: absolute;
  bottom: -10px;
  border-radius: 50%;
  opacity: 0;
  animation: particle-rise linear infinite;
}

@keyframes particle-rise {
  0% { transform: translateY(0) scale(0.5); opacity: 0; }
  10% { opacity: 0.8; }
  90% { opacity: 0.6; }
  100% { transform: translateY(-100vh) scale(1.2); opacity: 0; }
}

.transport-content {
  position: relative;
  text-align: center;
  padding: 2rem;
  max-width: 480px;
  width: 90%;
  z-index: 1;
}

.transport-world-banner {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 180px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.25rem;
  opacity: 0;
  transform: scale(0.92) translateY(20px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  position: relative;
  background: linear-gradient(
    135deg,
    var(--fallback-start, var(--world-bg-start)),
    var(--fallback-mid, var(--world-bg-mid)),
    var(--fallback-end, var(--world-bg-end))
  );
}

.transport-world-banner.revealed {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.transport-world-banner .world-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.transport-world-banner.world-banner-fallback .world-banner-img {
  display: none;
}

.transport-warp {
  position: absolute;
  inset: -50%;
  pointer-events: none;
}

.warp-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80px;
  height: 80px;
  margin: -40px 0 0 -40px;
  border: 2px solid color-mix(in srgb, var(--world-accent) 60%, transparent);
  border-radius: 50%;
  animation: warp-expand 2s ease-out infinite;
}

.warp-ring:nth-child(2) { animation-delay: 0.4s; }
.warp-ring:nth-child(3) { animation-delay: 0.8s; }

.warp-streaks {
  position: absolute;
  inset: 0;
  background: repeating-conic-gradient(from 0deg at 50% 50%, transparent 0deg 10deg, color-mix(in srgb, var(--world-accent) 12%, transparent) 10deg 11deg);
  animation: warp-spin 5s linear infinite;
  opacity: 0.35;
}

@keyframes warp-expand {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(4); opacity: 0; }
}

@keyframes warp-spin {
  to { transform: rotate(360deg); }
}

.transport-text {
  position: relative;
  z-index: 1;
  animation: transport-rise 0.8s ease-out 0.3s both;
}

@keyframes transport-rise {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.transport-label {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 0.75rem;
}

.transport-world-name {
  margin: 0 0 0.75rem;
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  color: var(--world-accent);
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.5s ease 0.5s, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s;
}

.transport-world-name.slide-in {
  opacity: 1;
  transform: translateX(0);
}

.transport-desc {
  margin: 0 0 0.5rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.95rem;
}

.transport-level {
  margin: 0 0 1.5rem;
  font-size: 0.85rem;
  color: var(--world-accent);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 46, 26, 0.5);
  z-index: 150;
  backdrop-filter: blur(2px);
}

/* Responsive */
@media (max-width: 960px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop:not(.hidden) {
    display: block;
  }

  .sidebar-toggle {
    display: flex;
  }

  .main-content {
    padding: 4rem 1rem 2rem;
  }

  .home-grid {
    grid-template-columns: 1fr;
  }

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

  .actions-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .actions-grid {
    grid-template-columns: 1fr;
  }

  .community-layout,
  .myworld-layout {
    grid-template-columns: 1fr;
  }

  .community-sidebar {
    order: -1;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .impact-grid {
    grid-template-columns: 1fr;
  }

  .myworld-stats-row,
  .community-stats-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .avatar-group-row {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (min-width: 961px) {
  .sidebar-backdrop {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .page-title {
    font-size: 1.5rem;
  }

  .impact-mini-row {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .impact-mini-label {
    font-size: 0.55rem;
  }

  .actions-stats-row {
    grid-template-columns: 1fr 1fr;
  }

  .wanderer-bubble {
    right: 0.75rem;
    bottom: 0.75rem;
    max-width: calc(100vw - 1.5rem);
  }
}

/* Wandering visitor bubble */
.wanderer-bubble {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 850;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 2rem 0.65rem 0.85rem;
  background: var(--card-white);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  max-width: 260px;
  animation: wanderer-bounce-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wanderer-bubble:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(26, 46, 26, 0.15);
}

.wanderer-bubble.bubble-hidden {
  opacity: 0;
  transform: translateX(120%);
  pointer-events: none;
}

.wanderer-bubble.bubble-collapsed {
  padding: 0.5rem;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  justify-content: center;
  gap: 0;
}

.wanderer-bubble.bubble-collapsed .wanderer-bubble-text,
.wanderer-bubble.bubble-collapsed .wanderer-dismiss {
  display: none;
}

.wanderer-bubble.bubble-collapsed .wanderer-emoji {
  font-size: 1.75rem;
}

.wanderer-bubble.bubble-collapsed.quest-pending .wanderer-badge {
  display: flex;
}

.wanderer-bubble.quest-pending .wanderer-badge {
  display: flex;
}

@keyframes wanderer-bounce-in {
  0% { opacity: 0; transform: translateX(80px) translateY(20px); }
  60% { transform: translateX(-6px) translateY(-4px); }
  100% { opacity: 1; transform: translateX(0) translateY(0); }
}

.wanderer-emoji {
  font-size: 2rem;
  line-height: 1;
  animation: wanderer-wiggle 3s ease-in-out infinite;
}

@keyframes wanderer-wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-6deg); }
  75% { transform: rotate(6deg); }
}

.wanderer-bubble-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.wanderer-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-dark);
}

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

.wanderer-badge {
  position: absolute;
  top: -6px;
  left: -6px;
  width: 20px;
  height: 20px;
  background: var(--gold);
  color: var(--text-dark);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.wanderer-dismiss {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: var(--cream);
  border-radius: 50%;
  font-size: 1rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wanderer-dismiss:hover {
  background: var(--cream-dark);
  color: var(--text-dark);
}

/* Wanderer event modal */
.wanderer-modal-content {
  width: min(100%, 440px);
}

.wanderer-modal-header {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
  text-align: left;
}

.wanderer-modal-header h2 {
  text-align: left;
  margin: 0;
  font-size: 1.2rem;
}

.wanderer-modal-header .modal-subtitle {
  text-align: left;
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
}

.wanderer-modal-emoji {
  font-size: 2.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.wanderer-actions-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.wanderer-action-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--cream);
  border-radius: var(--radius-sm);
  border: 1px solid var(--cream-dark);
  transition: background 0.2s, border-color 0.2s;
}

.wanderer-action-item.done {
  background: rgba(111, 207, 151, 0.15);
  border-color: color-mix(in srgb, var(--mint) 40%, var(--cream-dark));
}

.wanderer-action-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.wanderer-action-info {
  flex: 1;
  min-width: 0;
}

.wanderer-action-name {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
}

.wanderer-action-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.wanderer-action-pts {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold);
  flex-shrink: 0;
}

.wanderer-action-check {
  width: 32px;
  height: 32px;
  border: 2px solid var(--cream-dark);
  border-radius: 50%;
  background: var(--card-white);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.wanderer-action-check:hover:not(:disabled) {
  border-color: var(--mint-dark);
}

.wanderer-action-check.done {
  background: var(--mint);
  border-color: var(--mint);
  color: #fff;
}

.wanderer-progress-text {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--mint-dark);
  margin: 0 0 1rem;
}

/* Prize modal */
.prize-modal-content {
  text-align: center;
}

.prize-sparkle {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
  animation: prize-sparkle 1.5s ease-in-out infinite;
}

@keyframes prize-sparkle {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
  50% { transform: scale(1.15) rotate(12deg); opacity: 0.85; }
}

.prize-preview {
  margin: 1rem auto 0.75rem;
  padding: 1.25rem;
  background: var(--cream);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
}

.prize-preview .profile-avatar {
  width: 56px;
  height: 56px;
  font-size: 1.75rem;
}

.prize-preview-accent {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  box-shadow: var(--shadow-soft);
}

.prize-name {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 1.25rem;
  color: var(--text-dark);
}

.prize-later-btn {
  margin-top: 0.5rem;
  width: 100%;
}

/* Customize settings */
.customize-card {
  margin-bottom: 1rem;
}

.customize-preview-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: var(--cream);
  border-radius: var(--radius-sm);
}

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

.customize-preview-card {
  padding: 0.75rem 1.25rem;
  background: var(--forest);
  border-radius: var(--radius-sm);
  min-width: 100px;
}

.customize-preview-card .profile-avatar {
  width: 48px;
  height: 48px;
  font-size: 1.5rem;
}

.customize-section {
  margin-bottom: 1.25rem;
}

.customize-section:last-child {
  margin-bottom: 0;
}

.customize-heading {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
}

.customize-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.customize-option {
  position: relative;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 2px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  background: var(--cream);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: border-color 0.2s, transform 0.15s, opacity 0.2s;
}

.customize-option:hover:not(:disabled):not(.locked) {
  border-color: var(--mint-dark);
  transform: scale(1.05);
}

.customize-option.selected {
  border-color: var(--mint-dark);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--mint) 30%, transparent);
}

.customize-option.locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.customize-option.locked::after {
  content: "🔒";
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-size: 0.55rem;
}

.customize-option.none-option {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
}

.accent-picker .customize-option {
  border-radius: 50%;
}

.background-picker .customize-option {
  width: 64px;
  height: 40px;
  border-radius: var(--radius-sm);
}

.background-picker .customize-option.profile-bg-leaves {
  background: var(--cream) url("data:image/svg+xml,%3Csvg width='16' height='16' xmlns='http://www.w3.org/2000/svg'%3E%3Ctext x='1' y='12' font-size='8' fill='%234caf7a'%3E🌿%3C/text%3E%3C/svg%3E") repeat;
}

.background-picker .customize-option.profile-bg-dots {
  background: var(--cream) radial-gradient(circle, var(--mint-dark) 1px, transparent 1px);
  background-size: 8px 8px;
}

.background-picker .customize-option.profile-bg-waves {
  background: linear-gradient(135deg, #0c4a6e 0%, var(--cream) 50%, #22d3ee 100%);
}

.background-picker .customize-option.profile-bg-grid {
  background: var(--cream) linear-gradient(rgba(76,175,122,0.2) 1px, transparent 1px), linear-gradient(90deg, rgba(76,175,122,0.2) 1px, transparent 1px);
  background-size: 10px 10px;
}

/* Upcycle idea row with How-to button */
.upcycle-idea-list {
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.upcycle-idea-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: color-mix(in srgb, var(--mint) 7%, var(--cream));
  border: 1px solid color-mix(in srgb, var(--mint-dark) 18%, var(--cream-dark));
  border-radius: var(--radius-sm);
}

.upcycle-idea-row::before {
  content: "";
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mint-dark);
}

.upcycle-idea-text {
  flex: 1;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text-dark);
}

.btn-how-to {
  flex-shrink: 0;
  padding: 0.3rem 0.65rem;
  border: 1.5px solid color-mix(in srgb, var(--mint-dark) 55%, var(--cream-dark));
  border-radius: var(--radius-sm);
  background: var(--card-white);
  color: var(--mint-dark);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.btn-how-to:hover {
  background: color-mix(in srgb, var(--mint) 12%, var(--card-white));
  border-color: var(--mint-dark);
}

/* Tutorial panel */
.tutorial-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tutorial-back-btn {
  align-self: flex-start;
  margin-bottom: 1rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  background: var(--cream);
  color: var(--mint-dark);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.tutorial-back-btn:hover {
  background: var(--cream-dark);
}

.tutorial-title {
  margin: 0 0 0.65rem;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-dark);
}

.tutorial-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.tutorial-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.tutorial-badge-difficulty-easy {
  background: var(--green-pill);
  color: var(--mint-dark);
}

.tutorial-badge-difficulty-medium {
  background: var(--orange-pill);
  color: #b45309;
}

.tutorial-badge-difficulty-hard {
  background: color-mix(in srgb, #e85d3a 14%, var(--cream));
  color: #b91c1c;
}

.tutorial-badge-time {
  background: var(--cream-dark);
  color: var(--text-muted);
}

.tutorial-section-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.tutorial-materials-block {
  margin-bottom: 0.85rem;
}

.tutorial-materials-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tutorial-material-tag {
  padding: 0.2rem 0.55rem;
  background: color-mix(in srgb, var(--mint) 10%, var(--cream));
  border: 1px solid color-mix(in srgb, var(--mint-dark) 20%, var(--cream-dark));
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--text-dark);
  font-weight: 500;
}

.tutorial-steps-block {
  margin-bottom: 0;
}

.tutorial-steps-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: tutorial-step;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tutorial-steps-list li {
  counter-increment: tutorial-step;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.55rem 0.7rem;
  background: var(--cream);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-dark);
}

.tutorial-steps-list li::before {
  content: counter(tutorial-step);
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--mint-dark);
  color: #fff;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
}

/* Upcycle ideas button & modal */
.upcycle-ideas-btn {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.65rem 1rem;
  border: 2px solid color-mix(in srgb, var(--mint-dark) 45%, var(--cream-dark));
  border-radius: var(--radius-sm);
  background: var(--card-white);
  color: var(--mint-dark);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.upcycle-ideas-btn:hover {
  background: color-mix(in srgb, var(--mint) 10%, var(--card-white));
  border-color: var(--mint-dark);
}

.upcycle-modal-content {
  text-align: left;
  max-height: 85vh;
  overflow-y: auto;
}

.upcycle-modal-title {
  text-align: center;
}

.upcycle-bullet-list {
  margin: 0 0 1rem;
  padding: 0 0 0 1.15rem;
  list-style: none;
}

.upcycle-bullet-list li {
  position: relative;
  margin-bottom: 0.55rem;
  padding-left: 0.15rem;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text-dark);
}

.upcycle-bullet-list li:last-child {
  margin-bottom: 0;
}

.upcycle-bullet-list li::before {
  content: "";
  position: absolute;
  left: -1rem;
  top: 0.55em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mint-dark);
}

.upcycle-modal-tip {
  margin: 0 0 1.25rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--mint-dark);
  background: color-mix(in srgb, var(--mint) 14%, var(--cream));
  border-radius: var(--radius-sm);
  line-height: 1.45;
}

/* Lifecycle view button */
.lifecycle-view-btn {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.65rem 1rem;
  border: 1px solid color-mix(in srgb, var(--mint-dark) 35%, var(--cream-dark));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--mint) 12%, var(--card-white));
  color: var(--mint-dark);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.lifecycle-view-btn:hover {
  background: color-mix(in srgb, var(--mint) 22%, var(--card-white));
  border-color: var(--mint-dark);
}

/* Lifecycle modal */
.lifecycle-modal {
  position: fixed;
  inset: 0;
  z-index: 920;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.lifecycle-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 18, 14, 0.78);
  backdrop-filter: blur(8px);
}

.lifecycle-content {
  position: relative;
  width: min(100%, 640px);
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  background: rgba(22, 32, 26, 0.92);
  border: 1px solid rgba(111, 207, 151, 0.18);
  border-radius: var(--radius-xl);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
  color: #e8f0ea;
}

.lifecycle-title {
  margin: 0 0 0.25rem;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  text-align: center;
  color: #fff;
}

.lifecycle-subtitle {
  margin: 0 0 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.55);
}

/* 3D scan frame — isolated item spin */
.scan3d-stage {
  --lifecycle-glow: var(--mint);
  perspective: 900px;
  height: 200px;
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scan3d-scene {
  position: relative;
  width: 150px;
  height: 150px;
  transform-style: preserve-3d;
  animation: scan3d-float 5s ease-in-out infinite;
}

.scan3d-wireframe {
  position: absolute;
  inset: -14px;
  transform-style: preserve-3d;
  pointer-events: none;
}

.scan3d-wireframe-subtle {
  opacity: 0.45;
  animation: scan3d-wireframe-pulse 4s ease-in-out infinite;
}

.scan3d-cube {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotateX(-10deg);
}

.scan3d-edge {
  position: absolute;
  inset: 0;
  border: 1px solid color-mix(in srgb, var(--lifecycle-glow) 55%, transparent);
  border-radius: 4px;
  box-shadow:
    0 0 10px color-mix(in srgb, var(--lifecycle-glow) 30%, transparent),
    inset 0 0 6px color-mix(in srgb, var(--lifecycle-glow) 10%, transparent);
  background: transparent;
}

.scan3d-edge-front  { transform: translateZ(75px); }
.scan3d-edge-back   { transform: rotateY(180deg) translateZ(75px); }
.scan3d-edge-left   { transform: rotateY(-90deg) translateZ(75px); }
.scan3d-edge-right  { transform: rotateY(90deg) translateZ(75px); }
.scan3d-edge-top    { transform: rotateX(90deg) translateZ(75px); }
.scan3d-edge-bottom { transform: rotateX(-90deg) translateZ(75px); }

.scan3d-platform {
  position: absolute;
  bottom: 4px;
  left: 50%;
  width: 100px;
  height: 100px;
  transform: translateX(-50%) rotateX(78deg);
  border-radius: 50%;
  background: radial-gradient(
    ellipse at center,
    color-mix(in srgb, var(--lifecycle-glow) 50%, transparent) 0%,
    color-mix(in srgb, var(--lifecycle-glow) 18%, transparent) 45%,
    transparent 72%
  );
  box-shadow: 0 0 28px color-mix(in srgb, var(--lifecycle-glow) 45%, transparent);
  pointer-events: none;
}

.scan3d-isolate-loading {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(8, 14, 11, 0.55);
  border-radius: var(--radius-sm);
}

.scan3d-isolate-loading .spinner {
  width: 1.35rem;
  height: 1.35rem;
  border-width: 2px;
}

.scan3d-stage.is-isolating .scan3d-item-spin {
  opacity: 0.15;
}

.scan3d-item-spin {
  position: absolute;
  inset: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  animation: scan3d-item-rotate 9s linear infinite;
  transition: opacity 0.3s ease;
}

.scan3d-item-spin.hidden {
  display: none;
}

.scan3d-isolated-item {
  max-width: 88%;
  max-height: 88%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  filter:
    drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45))
    drop-shadow(0 0 18px color-mix(in srgb, var(--lifecycle-glow) 42%, transparent));
}

.scan3d-isolated-item.is-fallback {
  max-width: 88%;
  max-height: 88%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0;
}

@keyframes scan3d-wireframe-pulse {
  0%, 100% { opacity: 0.38; }
  50% { opacity: 0.55; }
}

@keyframes scan3d-item-rotate {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(360deg); }
}

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

/* Dual-path timelines */
.lifecycle-paths {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.lifecycle-path {
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.lifecycle-path-landfill {
  background: color-mix(in srgb, #e85d3a 8%, rgba(30, 20, 18, 0.6));
  border-color: color-mix(in srgb, #e85d3a 25%, transparent);
}

.lifecycle-path-recycle {
  background: color-mix(in srgb, var(--mint) 10%, rgba(18, 30, 22, 0.6));
  border-color: color-mix(in srgb, var(--mint) 25%, transparent);
}

.lifecycle-path-title {
  margin: 0 0 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lifecycle-path-landfill .lifecycle-path-title {
  color: #f0a080;
}

.lifecycle-path-recycle .lifecycle-path-title {
  color: var(--mint);
}

.lifecycle-steps {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.lifecycle-step {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(10px);
}

.lifecycle-steps.animating .lifecycle-step {
  animation: lifecycle-step-in 0.45s ease forwards;
  animation-delay: var(--step-delay, 0s);
}

.lifecycle-path-recycle .lifecycle-steps.animating .lifecycle-step {
  animation-name: lifecycle-step-in-up;
}

.lifecycle-step-icon {
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
  width: 1.5rem;
  text-align: center;
}

.lifecycle-step-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.lifecycle-step-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
}

.lifecycle-step-desc {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.35;
}

@keyframes lifecycle-step-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes lifecycle-step-in-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.lifecycle-close-btn {
  width: 100%;
}

/* Lifecycle emoji journey */
.lifecycle-journey {
  margin-bottom: 1.25rem;
  text-align: center;
}

.lifecycle-journey-label {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.lj-steps {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0.25rem;
  flex-wrap: nowrap;
}

.lj-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  flex: 1;
  min-width: 0;
  max-width: 100px;
  opacity: 0;
  transform: translateY(14px) scale(0.82);
}

.lj-steps.animating .lj-step {
  animation: lj-pop-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  animation-delay: calc(var(--i) * 0.7s);
}

.lj-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  font-size: 1.75rem;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  flex-shrink: 0;
  line-height: 1;
}

.lj-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  line-height: 1.3;
  word-break: break-word;
}

.lj-sep {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
  align-self: center;
  padding-bottom: 1.5rem;
  opacity: 0;
}

.lj-steps.animating .lj-sep {
  animation: lj-fade-in 0.3s ease forwards;
  animation-delay: calc(var(--i) * 0.7s);
}

@keyframes lj-pop-in {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes lj-fade-in {
  to { opacity: 1; }
}

@media (max-width: 560px) {
  .scan3d-stage {
    height: 170px;
  }

  .scan3d-scene {
    width: 125px;
    height: 125px;
  }

  .scan3d-platform {
    width: 85px;
    height: 85px;
  }

  .lj-emoji {
    width: 42px;
    height: 42px;
    font-size: 1.4rem;
  }

  .lj-label {
    font-size: 0.6rem;
  }

  .lj-sep {
    font-size: 0.75rem;
  }
}

/* ============================================================
   QUEST BOOK — Floating Button
   ============================================================ */

.quest-book-fab {
  position: fixed;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 400;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  border: none;
  background: var(--forest);
  box-shadow: 0 4px 16px rgba(0,0,0,0.28), 0 1px 4px rgba(0,0,0,0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.3s;
  padding: 0;
}

.quest-book-fab:hover,
.quest-book-fab:focus-visible {
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  outline: none;
}

.quest-book-fab-icon {
  font-size: 1.5rem;
  line-height: 1;
  display: block;
}

.quest-book-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid var(--forest);
  display: block;
}

.quest-book-badge.hidden {
  display: none !important;
}

/* ============================================================
   QUEST BOOK — Modal Overlay
   ============================================================ */

.quest-book-modal {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.quest-book-modal.hidden {
  display: none !important;
}

.quest-book-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(4px);
}

.quest-book-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  max-width: 860px;
  width: 100%;
}

.quest-book-close {
  align-self: flex-end;
  background: rgba(255,255,255,0.18);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1rem;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
  margin-right: 4px;
}
.quest-book-close:hover { background: rgba(255,255,255,0.32); }

/* ============================================================
   QUEST BOOK — Book Spread
   ============================================================ */

.quest-book-cover {
  display: flex;
  align-items: stretch;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 20px 60px rgba(0,0,0,0.55),
    0 6px 20px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.1);
  background: #3d1f08;
}

.quest-book-page {
  flex: 1;
  min-width: 0;
  position: relative;
  background: #f5f0e3;
  overflow: hidden;
}

.quest-book-left {
  border-radius: 12px 0 0 12px;
  background: linear-gradient(160deg, #fdf8ef 0%, #f2ebda 100%);
}

.quest-book-right {
  border-radius: 0 12px 12px 0;
  background: linear-gradient(160deg, #f5eedf 0%, #ece5d0 100%);
}

.quest-book-spine {
  width: 18px;
  flex-shrink: 0;
  background: linear-gradient(to right,
    #2c1206 0%,
    #5a2d0c 20%,
    #7a3d12 50%,
    #5a2d0c 80%,
    #2c1206 100%
  );
  box-shadow: inset 0 0 8px rgba(0,0,0,0.4);
  position: relative;
}

.quest-book-spine::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: 40%;
  width: 2px;
  background: rgba(0,0,0,0.2);
}

/* Lined paper effect */
.quest-page-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 29px,
    rgba(180, 160, 120, 0.25) 30px
  );
  background-position: 0 56px;
}

.quest-book-page-inner {
  position: relative;
  z-index: 1;
  padding: 1.5rem 1.5rem 1.5rem 1.75rem;
  height: 100%;
  min-height: 420px;
  max-height: 75vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(100,70,30,0.2) transparent;
}

.quest-book-page-inner::-webkit-scrollbar {
  width: 4px;
}
.quest-book-page-inner::-webkit-scrollbar-thumb {
  background: rgba(100,70,30,0.2);
  border-radius: 2px;
}

.quest-book-heading {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  color: #3d1f08;
  margin: 0 0 0.25rem;
  letter-spacing: 0.01em;
  border-bottom: 2px solid rgba(100,70,30,0.25);
  padding-bottom: 0.5rem;
}

.quest-world-title {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: #6b3a10;
  margin-bottom: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ============================================================
   QUEST BOOK — Quest Rows
   ============================================================ */

.quest-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quest-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(150,110,60,0.15);
  transition: background 0.15s;
}

.quest-row-done {
  background: rgba(100,180,100,0.12);
  border-color: rgba(60,140,60,0.2);
}

.quest-row-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.quest-icon {
  font-size: 1rem;
  flex-shrink: 0;
  line-height: 1;
}

.quest-name {
  font-size: 0.82rem;
  color: #3a2010;
  font-weight: 500;
  flex: 1;
  line-height: 1.3;
}

.quest-name-done {
  text-decoration: line-through;
  opacity: 0.65;
}

.quest-check {
  color: #2e7d32;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.quest-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quest-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(100,70,30,0.15);
  border-radius: 3px;
  overflow: hidden;
}

.quest-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #7cb342, #33691e);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.quest-progress-complete {
  background: linear-gradient(90deg, #43a047, #1b5e20);
}

.quest-progress-text {
  font-size: 0.72rem;
  color: #6b4a20;
  font-weight: 500;
  white-space: nowrap;
  min-width: 36px;
  text-align: right;
}

/* ============================================================
   QUEST BOOK — Right Page
   ============================================================ */

.quest-right-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quest-next-desc {
  font-size: 0.82rem;
  color: #5a3a18;
  line-height: 1.5;
  font-style: italic;
  margin: 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed rgba(120,80,30,0.25);
}

.quest-next-preview {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  opacity: 0.6;
}

.quest-next-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  background: rgba(150,110,50,0.08);
}

.quest-next-name {
  font-size: 0.78rem;
  color: #6b4a20;
  flex: 1;
}

.quest-next-hint {
  font-size: 0.75rem;
  color: #8b6030;
  font-style: italic;
  margin: 0;
  text-align: center;
  margin-top: 0.25rem;
}

.quest-complete-msg {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: #2e6b30;
  line-height: 1.6;
  text-align: center;
  font-style: italic;
  padding: 1rem 0;
}

.quest-complete-stars {
  text-align: center;
  font-size: 1.5rem;
  letter-spacing: 0.2rem;
}

.quest-world-locked-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  background: rgba(150,110,50,0.12);
  color: #8b6030;
  border-radius: 20px;
  padding: 0.2rem 0.6rem;
  margin-bottom: 0.5rem;
  border: 1px solid rgba(150,110,50,0.2);
}

/* ============================================================
   QUEST BOOK — Responsive
   ============================================================ */

@media (max-width: 600px) {
  .quest-book-cover {
    flex-direction: column;
  }
  .quest-book-spine {
    width: 100%;
    height: 12px;
    background: linear-gradient(to bottom,
      #2c1206 0%, #5a2d0c 30%, #7a3d12 50%, #5a2d0c 70%, #2c1206 100%
    );
  }
  .quest-book-spine::after {
    top: 40%; bottom: 40%;
    left: 0; right: 0;
    width: auto;
    height: 2px;
  }
  .quest-book-left { border-radius: 12px 12px 0 0; }
  .quest-book-right { border-radius: 0 0 12px 12px; }
  .quest-book-page-inner { min-height: 200px; max-height: 45vh; }
  .quest-book-fab {
    right: 0.75rem;
    width: 46px;
    height: 46px;
  }
}
