/* ===================================================================
   Verdant Canopy — Master Mobile WebApp Stylesheet
   Theme: Obsidian Charcoal, Vibrant Emerald & Gold Accents, Glassmorphism
   =================================================================== */

:root {
  --bg-primary: #0a0e14;
  --bg-card: rgba(18, 24, 34, 0.72);
  --bg-card-hover: rgba(26, 34, 48, 0.85);
  --bg-elevated: rgba(30, 41, 59, 0.75);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-bright: rgba(255, 255, 255, 0.18);
  --border-gold: rgba(245, 158, 11, 0.4);
  --border-emerald: rgba(16, 185, 129, 0.4);

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --emerald-400: #34d399;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-glow: rgba(16, 185, 129, 0.25);

  --gold-400: #fbbf24;
  --gold-500: #f59e0b;
  --gold-600: #d97706;
  --gold-glow: rgba(245, 158, 11, 0.25);

  --danger-500: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.25);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --shadow-btn: 0 4px 14px 0 rgba(16, 185, 129, 0.35);
  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg-primary);
  background-image: radial-gradient(circle at 50% 0%, rgba(16, 185, 129, 0.12) 0%, transparent 60%),
                    radial-gradient(circle at 100% 100%, rgba(245, 158, 11, 0.08) 0%, transparent 50%),
                    url('bg.jpg');
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 100% Smartphone Adaptation Container */
.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  background: rgba(10, 14, 20, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow-x: hidden;
  border-left: 1px solid var(--border-glass);
  border-right: 1px solid var(--border-glass);
}

@media (max-width: 480px) {
  .app-container {
    border-left: none;
    border-right: none;
  }
}

/* App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px 16px;
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-wrap {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(245, 158, 11, 0.25));
  border: 1px solid var(--border-emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 4px 12px var(--emerald-glow);
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-fallback-icon {
  font-size: 20px;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 40%, #a7f3d0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.streak-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-full);
  padding: 5px 10px;
  box-shadow: 0 2px 8px var(--gold-glow);
}

.streak-icon {
  font-size: 14px;
}

.streak-count {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--gold-400);
}

.streak-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--gold-500);
}

.btn-icon-primary {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--emerald-500), var(--emerald-600));
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  touch-action: manipulation;
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.btn-icon-primary:active {
  transform: scale(0.92);
}

/* App Main Content Area */
.app-content {
  flex: 1;
  padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 84px) 16px;
  overflow-y: auto;
  overflow-x: hidden;
}

.app-view {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.app-view.active {
  display: block;
}

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

/* View Header Row */
.view-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.view-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

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

.btn-create-habit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--emerald-500), var(--emerald-600));
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  touch-action: manipulation;
}

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

/* Glass Cards */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition-fast);
}

.glass-card:hover {
  border-color: var(--border-glass-bright);
}

/* 1. Dashboard: Hero Progress Card */
.hero-progress-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(18, 24, 34, 0.85) 100%);
  border: 1px solid var(--border-emerald);
  position: relative;
  overflow: hidden;
}

.hero-progress-card::after {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, var(--emerald-glow) 0%, transparent 70%);
  pointer-events: none;
}

.hero-left {
  flex: 1;
}

.hero-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--emerald-400);
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  margin-bottom: 6px;
}

.hero-heading {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
  margin-bottom: 4px;
}

.hero-caption {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-chip {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.chip-emerald {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald-400);
  border: 1px solid var(--border-emerald);
}

.chip-gold {
  background: rgba(245, 158, 11, 0.15);
  color: var(--gold-400);
  border: 1px solid var(--border-gold);
}

/* Radial Progress Ring */
.radial-progress-wrap {
  width: 86px;
  height: 86px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.radial-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.radial-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 8;
}

.radial-bar {
  fill: none;
  stroke: url(#emeraldGrad);
  stroke: var(--emerald-400);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 263.89;
  stroke-dashoffset: 52.7;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 0 6px var(--emerald-glow));
}

.radial-inner {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.radial-percent {
  font-size: 1rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1;
}

.radial-sub {
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  margin-top: 2px;
}

/* Weekly Strip Navigator */
.week-strip-section {
  margin-bottom: 20px;
}

.section-header-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-title {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.section-subtext {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.week-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.week-day-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  cursor: pointer;
  touch-action: manipulation;
  transition: all var(--transition-fast);
}

.week-day-pill:active {
  transform: scale(0.94);
}

.week-day-pill.today {
  border-color: var(--emerald-400);
  background: rgba(16, 185, 129, 0.12);
}

.week-day-pill.selected {
  border-color: var(--gold-400);
  box-shadow: 0 0 10px var(--gold-glow);
}

.week-day-name {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
}

.week-day-pill.today .week-day-name {
  color: var(--emerald-400);
}

.week-day-num {
  font-size: 0.95rem;
  font-weight: 800;
  color: #ffffff;
  margin: 2px 0 4px 0;
}

.week-day-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}

.week-day-pill.all-done .week-day-dot {
  background: var(--emerald-400);
  box-shadow: 0 0 6px var(--emerald-glow);
}

.week-day-pill.partial-done .week-day-dot {
  background: var(--gold-400);
}

/* Habits List Styling */
.habits-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.habit-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  gap: 12px;
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.habit-card.is-completed {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.3);
}

.habit-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.habit-emblem-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  position: relative;
}

.habit-card.is-completed .habit-emblem-box {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--border-emerald);
}

.habit-details {
  flex: 1;
  min-width: 0;
}

.habit-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.habit-card.is-completed .habit-title {
  color: #a7f3d0;
}

.habit-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.habit-category-tag {
  color: var(--gold-400);
  font-weight: 600;
}

.habit-streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
}

.habit-streak-badge.active {
  color: var(--gold-400);
  font-weight: 700;
}

.habit-card-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Big Tactile Checkbox Button */
.btn-checkin {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-glass-bright);
  background: rgba(255, 255, 255, 0.04);
  color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: all var(--transition-fast);
}

.btn-checkin:active {
  transform: scale(0.90);
}

.habit-card.is-completed .btn-checkin {
  background: linear-gradient(135deg, var(--emerald-500), var(--emerald-600));
  border-color: var(--emerald-400);
  color: #ffffff;
  box-shadow: 0 0 14px var(--emerald-glow);
}

.btn-habit-menu {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
}

.btn-habit-menu:hover, .btn-habit-menu:active {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

/* Category Filter Scroll */
.category-filters-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
  scrollbar-width: none;
}

.category-filters-scroll::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  white-space: nowrap;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: all var(--transition-fast);
}

.filter-pill:active {
  transform: scale(0.95);
}

.filter-pill.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(5, 150, 105, 0.3));
  border-color: var(--emerald-400);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--emerald-glow);
}

/* 3. Analytics View: Key Metrics Quad Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card {
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
}

.metric-icon-box {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.bg-gold-glow {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--border-gold);
  color: var(--gold-400);
}

.bg-emerald-glow {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--border-emerald);
  color: var(--emerald-400);
}

.bg-cyan-glow {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: #22d3ee;
}

.bg-purple-glow {
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #c084fc;
}

.metric-meta {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.metric-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
}

/* Heatmap Section */
.card-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
}

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

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend-text {
  font-size: 0.65rem;
  color: var(--text-dim);
}

.legend-cell {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.lvl-0 { background: rgba(255, 255, 255, 0.06); }
.lvl-1 { background: rgba(16, 185, 129, 0.28); }
.lvl-2 { background: rgba(16, 185, 129, 0.55); }
.lvl-3 { background: rgba(16, 185, 129, 0.80); }
.lvl-4 { background: #34d399; box-shadow: 0 0 6px var(--emerald-glow); }

.heatmap-scroll-wrap {
  width: 100%;
  overflow-x: auto;
  padding: 6px 0 10px 0;
  scrollbar-width: thin;
}

.heatmap-grid {
  display: grid;
  grid-template-rows: repeat(7, 14px);
  grid-auto-flow: column;
  grid-auto-columns: 14px;
  gap: 4px;
  width: max-content;
}

.heat-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  cursor: pointer;
  transition: transform var(--transition-fast), outline var(--transition-fast);
}

.heat-cell:active, .heat-cell.selected {
  transform: scale(1.3);
  outline: 2px solid var(--gold-400);
  z-index: 2;
}

.heatmap-inspect-info {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--gold-400);
  text-align: center;
  border: 1px dashed var(--border-glass-bright);
}

/* Streak Rankings */
.performance-bars-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.perf-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.perf-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
}

.perf-name {
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.perf-score {
  color: var(--gold-400);
}

.perf-bar-bg {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.perf-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--emerald-500), var(--gold-500));
}

/* 4. Settings View */
.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-avatar-wrap {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--emerald-500), var(--gold-500));
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px var(--emerald-glow);
}

.profile-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.profile-details {
  flex: 1;
}

.profile-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
}

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

.btn-outline-sm {
  background: transparent;
  border: 1px solid var(--border-glass-bright);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.btn-outline-sm:active {
  background: rgba(255, 255, 255, 0.08);
}

.settings-group {
  padding: 16px;
}

.settings-group-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.setting-item, .setting-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-glass);
}

.setting-item:last-child, .setting-action-row:last-child {
  border-bottom: none;
}

.setting-action-row {
  cursor: pointer;
  touch-action: manipulation;
}

.setting-action-row:active {
  opacity: 0.7;
}

.setting-info, .action-info {
  display: flex;
  flex-direction: column;
}

.setting-title, .action-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #ffffff;
}

.setting-desc, .action-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.action-arrow {
  color: var(--text-dim);
  font-size: 1rem;
}

.text-danger .action-title {
  color: var(--danger-500);
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: .3s;
}

input:checked + .slider {
  background-color: var(--emerald-500);
  box-shadow: 0 0 10px var(--emerald-glow);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(env(safe-area-inset-bottom, 0px) + 64px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(10, 14, 20, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
}

.nav-item {
  flex: 1;
  height: 56px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  touch-action: manipulation;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.nav-item:active {
  transform: scale(0.92);
}

.nav-icon {
  width: 22px;
  height: 22px;
  transition: transform var(--transition-fast);
}

.nav-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.nav-item.active {
  color: var(--emerald-400);
}

.nav-item.active .nav-icon {
  transform: translateY(-2px);
  stroke: var(--emerald-400);
}

/* Modals & Bottom Sheets */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  max-height: 85dvh;
  background: #121822;
  border-top: 1px solid var(--border-glass-bright);
  border-left: 1px solid var(--border-glass);
  border-right: 1px solid var(--border-glass);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 16px 20px calc(env(safe-area-inset-bottom, 0px) + 24px) 20px;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-backdrop.open .bottom-sheet {
  transform: translateY(0);
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  margin: 0 auto 12px auto;
  flex-shrink: 0;
}

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

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
}

.btn-close-modal {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.modal-scrollable {
  overflow-y: auto;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

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

.form-row {
  display: flex;
  gap: 12px;
}

.flex-1 {
  flex: 1;
}

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

/* Minimum 16px to prevent iOS Auto-zoom */
.form-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-glass-bright);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: #ffffff;
  font-family: var(--font-family);
  font-size: 16px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-input:focus {
  border-color: var(--emerald-400);
  box-shadow: 0 0 0 2px var(--emerald-glow);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 36px;
}

.form-textarea {
  resize: none;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.btn-primary, .btn-secondary, .btn-danger {
  flex: 1;
  min-height: 48px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform var(--transition-fast);
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--emerald-500), var(--emerald-600));
  color: #ffffff;
  box-shadow: var(--shadow-btn);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-glass-bright);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--danger-glow);
}

.btn-primary:active, .btn-secondary:active, .btn-danger:active {
  transform: scale(0.97);
}

.full-width {
  width: 100%;
}

.mt-4 {
  margin-top: 16px;
}

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

/* About / Help / Legal Modal Interiors */
.about-hero-box {
  text-align: center;
  padding: 16px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid var(--border-emerald);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.about-logo-badge {
  font-size: 36px;
  margin-bottom: 6px;
}

.about-hero-box h4 {
  font-size: 1.2rem;
  font-weight: 800;
  color: #ffffff;
}

.version-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gold-400);
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--border-gold);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin: 4px 0;
}

.about-tagline {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.legal-paragraph {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 14px;
}

.feature-bullets {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.feature-bullet-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.bullet-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.legal-text-scroll h4 {
  font-size: 0.95rem;
  color: #ffffff;
  margin: 14px 0 6px 0;
}

.legal-date {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-bottom: 10px;
}

/* Star Rating */
.star-rating-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 16px 0 8px 0;
}

.star-btn {
  background: transparent;
  border: none;
  font-size: 34px;
  color: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.15s ease, color 0.15s ease;
}

.star-btn.active {
  color: var(--gold-400);
  text-shadow: 0 0 12px var(--gold-glow);
}

.star-btn:active {
  transform: scale(1.2);
}

.rating-feedback-note {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold-400);
}

/* Onboarding Modal Overlay */
.onboarding-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 14, 20, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.onboarding-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.onboarding-box {
  width: 100%;
  max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border-emerald);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
}

.onboarding-carousel {
  width: 100%;
  position: relative;
  min-height: 220px;
}

.onboarding-slide {
  display: none;
  flex-direction: column;
  align-items: center;
}

.onboarding-slide.active {
  display: flex;
  animation: fadeIn 0.3s ease-out;
}

.slide-emblem {
  font-size: 54px;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 14px var(--emerald-glow));
}

.slide-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 10px;
}

.slide-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.carousel-dots {
  display: flex;
  gap: 8px;
  margin: 20px 0;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease;
}

.dot.active {
  width: 22px;
  border-radius: var(--radius-full);
  background: var(--emerald-400);
}

.onboarding-actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 76px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 150;
  pointer-events: none;
  width: 90%;
  max-width: 400px;
}

.toast {
  background: rgba(18, 24, 34, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-emerald);
  color: #ffffff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1), toastOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) 2.4s forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(14px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-8px) scale(0.95); }
}
