/* ═══════════════════════════════════════════════
   LIFECOACH — Game-inspired CSS
   ═══════════════════════════════════════════════ */

:root {
  /* Dark theme (default) */
  --bg:           #0a0a1a;
  --bg2:          #0f0f24;
  --card:         #12122e;
  --card2:        #1a1a3a;
  --border:       #2a2a5a;
  --border2:      #3a3a7a;
  --text:         #e2e8f0;
  --text2:        #94a3b8;
  --text3:        #64748b;
  --primary:      #7c3aed;
  --primary-glow: rgba(124,58,237,0.4);
  --blue:         #3b82f6;
  --blue-glow:    rgba(59,130,246,0.3);
  --gold:         #f59e0b;
  --gold-glow:    rgba(245,158,11,0.4);
  --green:        #10b981;
  --red:          #ef4444;
  --pink:         #ec4899;
  --success:      #10b981;
  --danger:       #ef4444;
  --nav-height:   64px;
  --topbar-height:56px;
  --radius:       12px;
  --radius-lg:    16px;
  --radius-xl:    24px;
  --shadow:       0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow:  0 0 32px var(--primary-glow);
}

[data-theme="light"] {
  --bg:           #f0f4ff;
  --bg2:          #e8eeff;
  --card:         #ffffff;
  --card2:        #f8f9ff;
  --border:       #e2e8f0;
  --border2:      #cbd5e1;
  --text:         #1e1b4b;
  --text2:        #4338ca;
  --text3:        #94a3b8;
  --primary:      #7c3aed;
  --primary-glow: rgba(124,58,237,0.2);
  --blue:         #2563eb;
  --blue-glow:    rgba(37,99,235,0.2);
  --gold:         #d97706;
  --gold-glow:    rgba(217,119,6,0.25);
  --card-shadow:  0 2px 16px rgba(0,0,0,0.08);
  --shadow:       0 4px 24px rgba(0,0,0,0.12);
}

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

h1,h2,h3,h4 { font-family: 'Rajdhani', sans-serif; font-weight: 700; }

/* ─── App Structure ─── */
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative; }

.screen { min-height: 100vh; }
.hidden { display: none !important; }

/* ─── Cards ─── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow);
  transition: background 0.3s, border-color 0.3s;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.625rem 1.25rem; border-radius: var(--radius); border: none;
  font-family: 'Rajdhani', sans-serif; font-weight: 600; font-size: 1rem;
  cursor: pointer; transition: all 0.2s; text-decoration: none;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--blue));
  color: #fff; box-shadow: 0 4px 16px var(--primary-glow);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px var(--primary-glow); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent; color: var(--text2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--card2); color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; transform: translateY(-1px); }

.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.875rem; }
.btn-lg { padding: 0.875rem 2rem; font-size: 1.125rem; }

/* ─── Forms ─── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.8rem; color: var(--text2); margin-bottom: 0.375rem; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%; padding: 0.625rem 0.875rem;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: 'Inter', sans-serif; font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
textarea { resize: vertical; min-height: 60px; }
select { appearance: none; cursor: pointer; }

/* ─── Gender / Type / Day Selects ─── */
.gender-select, .type-select { display: flex; gap: 0.5rem; }

.gender-btn, .type-btn {
  flex: 1; padding: 0.625rem; background: var(--bg2);
  border: 2px solid var(--border); border-radius: var(--radius);
  color: var(--text2); cursor: pointer; font-family: 'Rajdhani', sans-serif;
  font-weight: 600; font-size: 1rem; transition: all 0.2s;
}
.gender-btn.active, .type-btn.active {
  border-color: var(--primary); color: var(--primary);
  background: rgba(124,58,237,0.15); box-shadow: 0 0 12px var(--primary-glow);
}

.days-select { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.day-btn {
  padding: 0.4rem 0.6rem; background: var(--bg2);
  border: 2px solid var(--border); border-radius: 8px;
  color: var(--text2); cursor: pointer; font-family: 'Rajdhani', sans-serif;
  font-weight: 600; font-size: 0.85rem; transition: all 0.2s;
}
.day-btn.active {
  border-color: var(--blue); color: var(--blue);
  background: rgba(59,130,246,0.15);
}

/* ─── SETUP SCREEN ─── */
.setup-container {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 2rem 1.5rem;
  background: radial-gradient(ellipse at top, #1a0a3a 0%, var(--bg) 70%);
}
.setup-logo { text-align: center; margin-bottom: 2rem; }
.logo-icon { font-size: 4rem; animation: float 3s ease-in-out infinite; }
.logo-title {
  font-family: 'Orbitron', monospace; font-size: 2.5rem; font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--blue), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; letter-spacing: 4px;
}
.logo-sub { color: var(--text2); font-size: 0.9rem; letter-spacing: 2px; margin-top: 0.25rem; }
.setup-card { width: 100%; max-width: 400px; }
.setup-card h2 { color: var(--text); margin-bottom: 1.5rem; font-size: 1.3rem; }

/* ─── USER SELECT SCREEN ─── */
.user-select-container {
  min-height: 100vh; padding: 1.5rem;
  background: radial-gradient(ellipse at top, #1a0a3a 0%, var(--bg) 70%);
}
.screen-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.logo-small { font-family: 'Orbitron', monospace; font-weight: 700; color: var(--primary); font-size: 1rem; letter-spacing: 2px; }
.select-title { font-family: 'Rajdhani', sans-serif; font-size: 1.75rem; margin-bottom: 1.5rem; color: var(--text); }

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

.user-select-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  cursor: pointer; transition: all 0.25s; text-align: center;
}
.user-select-card:hover {
  border-color: var(--primary); transform: translateY(-4px);
  box-shadow: 0 8px 32px var(--primary-glow);
}
.user-select-card .mini-avatar { width: 80px; height: 80px; margin: 0 auto 0.75rem; }
.user-select-card .user-name { font-family: 'Rajdhani', sans-serif; font-size: 1.1rem; font-weight: 700; }
.user-select-card .user-level { font-size: 0.75rem; color: var(--gold); margin-top: 0.25rem; }

/* ─── TOP BAR ─── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-height);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1rem;
  background: var(--card); border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
.topbar-left { display: flex; align-items: center; }
.avatar-switch-btn {
  display: flex; align-items: center; gap: 0.5rem;
  background: none; border: none; cursor: pointer; color: var(--text);
  padding: 0.25rem; border-radius: var(--radius);
}
.avatar-switch-btn:hover { background: var(--card2); }
.topbar-avatar { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; border: 2px solid var(--primary); }
.topbar-username { font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 1rem; }
.topbar-center .logo-text { font-family: 'Orbitron', monospace; font-size: 0.9rem; font-weight: 700; color: var(--primary); letter-spacing: 2px; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; }
.level-badge {
  background: linear-gradient(135deg, var(--gold), #fbbf24);
  color: #1a1a00; font-family: 'Orbitron', monospace;
  font-size: 0.7rem; font-weight: 700; padding: 0.25rem 0.625rem;
  border-radius: 20px; letter-spacing: 1px;
}

.theme-toggle {
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 50%; width: 36px; height: 36px;
  cursor: pointer; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.theme-toggle:hover { transform: rotate(20deg); border-color: var(--primary); }

/* ─── BOTTOM NAV ─── */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 50;
  display: flex; background: var(--card);
  border-top: 1px solid var(--border);
  height: var(--nav-height);
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 0.2rem; background: none; border: none;
  cursor: pointer; color: var(--text3); transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}
.nav-btn.active { color: var(--primary); }
.nav-btn.active .nav-icon { transform: scale(1.2); }
.nav-icon { font-size: 1.3rem; transition: transform 0.2s; }
.nav-label { font-size: 0.65rem; font-weight: 600; letter-spacing: 0.5px; }

/* ─── TAB CONTENT ─── */
.tab-content {
  padding: 1rem 1rem calc(var(--nav-height) + 1rem);
  margin-top: 0; min-height: calc(100vh - var(--topbar-height));
}
.tab-pane { animation: fadeIn 0.25s ease; }

/* ─── XP BAR ─── */
.xp-bar-container { padding: 1rem 1.25rem; margin-bottom: 1rem; }
.xp-info { display: flex; justify-content: space-between; margin-bottom: 0.5rem; }
.xp-label { font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--gold); }
.xp-count { font-size: 0.85rem; color: var(--text2); }
.xp-bar-track {
  height: 12px; background: var(--bg2); border-radius: 6px;
  overflow: hidden; position: relative;
}
.xp-bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--primary), var(--blue));
  border-radius: 6px; transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative; box-shadow: 0 0 12px var(--blue-glow);
}
.xp-bar-glow {
  position: absolute; top: 0; right: 0; width: 20px; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6));
  animation: shimmer 2s infinite;
}
.xp-remaining { font-size: 0.75rem; color: var(--text3); margin-top: 0.4rem; text-align: right; }

/* ─── AVATAR SCENE ─── */
.avatar-section { padding: 0; overflow: hidden; position: relative; margin-bottom: 1rem; }
.avatar-scene { width: 100%; aspect-ratio: 4/3; }
.avatar-scene svg { width: 100%; height: 100%; }

.level-reveal-badge {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--gold); color: #1a0a00;
  padding: 0.5rem 1.25rem; border-radius: 20px;
  font-family: 'Orbitron', monospace; font-weight: 700; font-size: 0.9rem;
  animation: bounceIn 0.5s; z-index: 10;
}

/* ─── TASKS ─── */
.section-title {
  font-family: 'Rajdhani', sans-serif; font-size: 1.1rem; font-weight: 700;
  color: var(--text2); margin: 1rem 0 0.5rem;
  display: flex; align-items: center; gap: 0.5rem;
  text-transform: uppercase; letter-spacing: 1px; font-size: 0.9rem;
}
.tasks-list { display: flex; flex-direction: column; gap: 0.5rem; }

.task-item {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.75rem 1rem;
  transition: all 0.2s; animation: slideIn 0.3s ease;
}
.task-item:hover { border-color: var(--border2); }
.task-item.completed { opacity: 0.5; }
.task-item.completed .task-name { text-decoration: line-through; }
.task-item.late-50 { border-left: 3px solid var(--gold); }
.task-item.late-0 { border-left: 3px solid var(--red); opacity: 0.6; }

.task-check {
  width: 24px; height: 24px; border-radius: 6px;
  border: 2px solid var(--border2); background: var(--bg2);
  cursor: pointer; flex-shrink: 0; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; font-size: 0.9rem;
}
.task-check:hover { border-color: var(--primary); background: var(--primary-glow); }
.task-item.completed .task-check {
  background: var(--green); border-color: var(--green); color: #fff;
}

.task-info { flex: 1; min-width: 0; }
.task-name { font-weight: 500; font-size: 0.95rem; }
.task-meta { display: flex; gap: 0.5rem; margin-top: 0.2rem; flex-wrap: wrap; }
.task-xp { font-size: 0.75rem; color: var(--gold); font-weight: 700; }
.task-late-badge { font-size: 0.65rem; padding: 0.1rem 0.4rem; border-radius: 4px; font-weight: 600; }
.task-late-badge.late-50 { background: rgba(245,158,11,0.2); color: var(--gold); }
.task-late-badge.late-0 { background: rgba(239,68,68,0.2); color: var(--red); }

.task-actions { display: flex; gap: 0.35rem; flex-shrink: 0; }
.task-action-btn {
  width: 28px; height: 28px; border-radius: 6px; border: none;
  background: var(--bg2); color: var(--text2); cursor: pointer;
  font-size: 0.8rem; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.task-action-btn:hover { background: var(--card2); color: var(--text); transform: scale(1.1); }

.empty-state { text-align: center; color: var(--text3); padding: 1.5rem; font-size: 0.9rem; }

/* ─── TRANSFERS ─── */
#transfers-section { margin-bottom: 1rem; }
.transfer-item {
  background: var(--card); border: 1px solid var(--gold);
  border-radius: var(--radius); padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}
.transfer-item-info { font-size: 0.9rem; margin-bottom: 0.5rem; }
.transfer-item-info strong { color: var(--gold); }
.transfer-xp { font-size: 0.75rem; color: var(--gold); font-weight: 700; margin-bottom: 0.5rem; }
.transfer-btns { display: flex; gap: 0.5rem; }

.transfer-warning { font-size: 0.8rem; color: var(--gold); margin-bottom: 1rem; }

/* ─── SCOREBOARD ─── */
.tab-title { font-size: 1.5rem; margin-bottom: 1rem; }
.score-filters { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filter-btn {
  padding: 0.375rem 0.75rem; background: var(--card2);
  border: 1px solid var(--border); border-radius: 20px;
  color: var(--text2); cursor: pointer; font-size: 0.8rem; font-weight: 600;
  transition: all 0.2s; font-family: 'Rajdhani', sans-serif;
}
.filter-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

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

.score-entry {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 0.875rem 1rem;
  transition: all 0.25s; animation: slideIn 0.3s ease;
}
.score-entry.is-current-user { border-color: var(--primary); box-shadow: 0 0 16px var(--primary-glow); }
.rank-number { font-family: 'Orbitron', monospace; font-weight: 700; font-size: 1.1rem; color: var(--text3); width: 28px; text-align: center; }
.rank-1 .rank-number { color: var(--gold); font-size: 1.3rem; }
.rank-2 .rank-number { color: #94a3b8; }
.rank-3 .rank-number { color: #a87c52; }

.score-avatar { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; border: 2px solid var(--border2); flex-shrink: 0; }
.score-avatar svg { width: 100%; height: 100%; }
.score-info { flex: 1; }
.score-name { font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 1.1rem; }
.score-meta { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.2rem; }
.score-level-badge { font-size: 0.65rem; background: var(--gold); color: #1a0a00; padding: 0.1rem 0.4rem; border-radius: 4px; font-weight: 700; font-family: 'Orbitron', monospace; }
.score-xp-bar-track { height: 4px; background: var(--bg2); border-radius: 2px; margin-top: 0.4rem; flex: 1; }
.score-xp-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--blue)); border-radius: 2px; }
.score-xp-value { font-family: 'Rajdhani', sans-serif; font-weight: 700; color: var(--gold); font-size: 0.85rem; white-space: nowrap; }

/* ─── PROFILE TAB ─── */
.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.stat-box { text-align: center; }
.stat-value { font-family: 'Orbitron', monospace; font-size: 1.4rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.7rem; color: var(--text3); margin-top: 0.2rem; text-transform: uppercase; letter-spacing: 0.5px; }

.achievements-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.achievement-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1rem; text-align: center;
  transition: all 0.25s;
}
.achievement-card.earned { border-color: var(--gold); box-shadow: 0 0 16px var(--gold-glow); }
.achievements-grid.locked .achievement-card { opacity: 0.4; filter: grayscale(0.5); }
.achievement-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.achievement-name { font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 0.95rem; }
.achievement-desc { font-size: 0.75rem; color: var(--text2); margin-top: 0.25rem; }
.achievement-thresh { font-size: 0.7rem; color: var(--text3); margin-top: 0.25rem; }

/* ─── CONFIG TAB ─── */
.config-tabs { display: flex; gap: 0.4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.config-tab-btn {
  padding: 0.375rem 0.875rem; background: var(--card2);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text2); cursor: pointer; font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem; font-weight: 600; transition: all 0.2s;
}
.config-tab-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.config-pane { animation: fadeIn 0.2s; }
.config-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.config-header h3 { font-size: 1.1rem; }
.config-desc { font-size: 0.85rem; color: var(--text2); margin-bottom: 1rem; }
.config-desc strong { color: var(--primary); }

.config-item {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.75rem 1rem;
  margin-bottom: 0.5rem; transition: all 0.2s;
}
.config-item-info { flex: 1; }
.config-item-name { font-weight: 600; font-size: 0.95rem; }
.config-item-meta { font-size: 0.75rem; color: var(--text2); margin-top: 0.15rem; }
.config-item-actions { display: flex; gap: 0.35rem; }

.level-preview { margin-top: 1rem; }
.level-preview-row { display: flex; justify-content: space-between; font-size: 0.85rem; padding: 0.3rem 0; border-bottom: 1px solid var(--border); }
.level-preview-row:last-child { border-bottom: none; }
.level-num { color: var(--primary); font-weight: 700; }
.level-xp { color: var(--gold); }

.user-assign { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.assign-btn {
  padding: 0.375rem 0.75rem; border-radius: 20px;
  border: 2px solid var(--border); background: var(--bg2);
  color: var(--text2); cursor: pointer; font-size: 0.85rem;
  font-family: 'Rajdhani', sans-serif; font-weight: 600; transition: all 0.2s;
}
.assign-btn.active { border-color: var(--primary); color: var(--primary); background: rgba(124,58,237,0.15); }

.transfer-user-list { display: flex; flex-direction: column; gap: 0.5rem; }
.transfer-user-btn {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem; background: var(--bg2);
  border: 2px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: all 0.2s; text-align: left;
  font-family: 'Inter', sans-serif; color: var(--text);
}
.transfer-user-btn:hover { border-color: var(--primary); }
.transfer-user-btn.selected { border-color: var(--primary); background: rgba(124,58,237,0.15); }
.transfer-user-mini-avatar { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; }

/* ─── MODALS ─── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 0.15s;
}
.modal {
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 1.5rem; animation: slideUp 0.3s cubic-bezier(0.4,0,0.2,1);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.modal-header h3 { font-size: 1.25rem; }
.modal-close {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 50%;
  width: 32px; height: 32px; cursor: pointer; color: var(--text2);
  font-size: 0.9rem; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.modal-close:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1.25rem; }

/* ─── ACHIEVEMENT OVERLAY ─── */
.achievement-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.9); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.3s;
}
.achievement-popup {
  text-align: center; padding: 2rem 1.5rem; position: relative; z-index: 2; max-width: 380px;
  animation: bounceIn 0.5s cubic-bezier(0.4,0,0.2,1);
}
.achievement-glow {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 300px; height: 300px; border-radius: 50%;
  background: radial-gradient(circle, rgba(245,158,11,0.3) 0%, transparent 70%);
  animation: pulse 2s infinite; z-index: -1;
}
.achievement-icon-big { font-size: 5rem; animation: bounce 1s infinite alternate; margin-bottom: 1rem; }
.achievement-unlock-label { font-family: 'Orbitron', monospace; font-size: 0.75rem; color: var(--gold); letter-spacing: 3px; margin-bottom: 0.5rem; }
.achievement-unlock-name { font-size: 1.75rem; margin-bottom: 0.5rem; color: var(--gold); }
.achievement-unlock-desc { color: var(--text2); font-size: 0.95rem; }

/* ─── LEVEL UP OVERLAY ─── */
.levelup-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.92); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.3s;
}
.levelup-popup { text-align: center; position: relative; z-index: 2; padding: 2rem 1.5rem; animation: zoomIn 0.4s cubic-bezier(0.4,0,0.2,1); }
.levelup-flash {
  position: absolute; inset: 0;
  background: radial-gradient(circle, rgba(124,58,237,0.4) 0%, transparent 70%);
  animation: flash 0.5s ease-out;
}
.levelup-stars { font-size: 2rem; animation: bounce 0.8s infinite alternate; margin-bottom: 0.5rem; }
.levelup-title { font-family: 'Orbitron', monospace; font-size: 3rem; font-weight: 900; color: var(--primary); text-shadow: 0 0 30px var(--primary-glow); margin-bottom: 1rem; }
.levelup-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--gold), #fbbf24);
  color: #1a0a00; font-family: 'Orbitron', monospace;
  font-size: 2rem; font-weight: 900; padding: 0.5rem 2rem;
  border-radius: 12px; margin-bottom: 1rem;
  box-shadow: 0 0 40px var(--gold-glow);
}
.levelup-unlock-text { color: var(--text2); font-size: 0.95rem; max-width: 300px; margin: 0 auto; }

/* ─── CONFETTI ─── */
.confetti-container { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti-piece {
  position: absolute; width: 8px; height: 8px; top: -10px;
  animation: confettiFall linear forwards;
  border-radius: 2px;
}

/* ─── FLOATING XP ─── */
.floating-xp {
  position: fixed; pointer-events: none; z-index: 1000;
  font-family: 'Orbitron', monospace; font-weight: 700; font-size: 1.1rem;
  color: var(--gold); text-shadow: 0 0 10px var(--gold-glow);
  animation: floatUp 1.5s ease-out forwards;
}

/* ─── UTILS ─── */
.mt-4 { margin-top: 1rem; }
.p-4 { padding: 1rem; }

/* ─── ANIMATIONS ─── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideIn { from { transform: translateX(-20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes bounceIn { 0% { transform: scale(0.3); opacity: 0; } 60% { transform: scale(1.1); } 80% { transform: scale(0.9); } 100% { transform: scale(1); opacity: 1; } }
@keyframes zoomIn { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes bounce { 0% { transform: translateY(0); } 100% { transform: translateY(-12px); } }
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(400%); } }
@keyframes pulse { 0%,100% { transform: translate(-50%,-50%) scale(1); opacity: 0.8; } 50% { transform: translate(-50%,-50%) scale(1.2); opacity: 0.4; } }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes floatUp { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-80px); opacity: 0; } }
@keyframes confettiFall {
  0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}
@keyframes xpPulse { 0%,100% { box-shadow: 0 0 12px var(--blue-glow); } 50% { box-shadow: 0 0 28px var(--primary-glow); } }

/* ─── DESKTOP (wider screens) ─── */
@media (min-width: 520px) {
  #app { box-shadow: 0 0 80px rgba(0,0,0,0.5); }
  .modal { border-radius: var(--radius-xl); max-height: 85vh; }
  .modal-overlay { align-items: center; }
}

/* ═══════════════════════════════════════════════
   AUTH SCHERMEN (login / forgot / reset / change-pw)
   ═══════════════════════════════════════════════ */

.auth-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg1);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  padding: 28px 24px;
}

.auth-card h2 {
  margin: 0 0 20px 0;
  font-family: var(--font-game);
  font-size: 1.2rem;
  color: var(--text1);
}

.auth-card .btn-lg {
  width: 100%;
  margin-top: 8px;
}

.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="text"] {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  box-sizing: border-box;
}

/* Foutmelding */
.form-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 14px;
}

/* Succesmelding */
.form-success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #4ade80;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 14px;
}

/* Helptext */
.form-hint {
  color: var(--text3);
  font-size: 0.875rem;
  margin: -8px 0 16px 0;
  line-height: 1.5;
}

/* Tijdelijk wachtwoord weergavebox */
.temp-pw-box {
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 0.875rem;
  margin-bottom: 12px;
  color: var(--text2);
  line-height: 1.6;
}

.temp-pw-code {
  display: inline-block;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 12px;
  font-family: monospace;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  color: var(--gold);
  margin: 4px 0;
}

/* Account beheer in config */
.badge-admin {
  display: inline-block;
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--gold);
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 4px;
  font-family: var(--font-ui);
}

.btn-danger-icon {
  filter: hue-rotate(300deg);
  opacity: 0.8;
}
.btn-danger-icon:hover { opacity: 1; }

/* ═══════════════════════════════════════════════
   PASSKEY KNOP (login scherm)
   ═══════════════════════════════════════════════ */
.btn-passkey {
  background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(124,58,237,0.15));
  border: 1px solid rgba(59,130,246,0.4);
  color: var(--text1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.btn-passkey:hover { background: linear-gradient(135deg, rgba(59,130,246,0.25), rgba(124,58,237,0.25)); border-color: rgba(59,130,246,0.7); }
.btn-passkey:disabled { opacity: 0.5; cursor: not-allowed; }
.passkey-icon { font-size: 1.1rem; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text3);
  font-size: 0.8rem;
  margin: 12px 0;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Passkeys lijst in config */
.passkey-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.passkey-item:last-child { border-bottom: none; }
.passkey-device-icon { font-size: 1.2rem; flex-shrink: 0; }
.passkey-info { flex: 1; min-width: 0; }
.passkey-name { display: block; font-size: 0.875rem; color: var(--text1); font-weight: 500; }
.passkey-date { display: block; font-size: 0.75rem; color: var(--text3); }

/* ═══════════════════════════════════════════════
   GEZONDHEID TAB
   ═══════════════════════════════════════════════ */
.health-chart-card {
  padding: 16px;
}
#health-chart-wrap {
  position: relative;
  height: 230px;
}
#health-chart-wrap .empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.health-entry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  align-items: end;
}
@media (max-width: 380px) {
  .health-entry-grid { grid-template-columns: 1fr 1fr; }
  .health-entry-grid > :first-child { grid-column: 1 / -1; }
}

/* Tabel */
.health-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.health-table th {
  color: var(--text3);
  font-weight: 600;
  text-align: left;
  padding: 4px 6px 8px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-ui);
}
.health-table td {
  padding: 7px 6px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
}
.health-table tr:last-child td { border-bottom: none; }

/* Bronnen sectie */
.health-source-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.health-source-icon { font-size: 1.5rem; flex-shrink: 0; }
.health-source-info { flex: 1; min-width: 0; }
.health-source-name   { font-size: 0.9rem; font-weight: 600; color: var(--text1); }
.health-source-status { font-size: 0.8rem; color: var(--text3); margin-top: 2px; }
.health-source-actions { display: flex; flex-direction: column; gap: 4px; }
.health-source-hint {
  font-size: 0.78rem;
  color: var(--text3);
  margin: 6px 0 0 44px;
  line-height: 1.5;
}
.health-source-hint a { color: var(--primary); }

/* API sleutel sectie */
.health-apikey-section { margin-left: 44px; margin-top: 10px; }
.health-apikey-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.apikey-code {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--gold);
  word-break: break-all;
  flex: 1;
  min-width: 0;
}

/* iOS Shortcut instructies */
.shortcut-instructions {
  font-size: 0.8rem;
  color: var(--text2);
}
.shortcut-instructions summary {
  cursor: pointer;
  color: var(--text3);
  padding: 4px 0;
  user-select: none;
}
.shortcut-steps {
  margin-top: 8px;
  padding: 12px;
  background: var(--bg2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.shortcut-steps ol { padding-left: 18px; margin: 0; line-height: 1.8; }
.shortcut-steps code {
  background: var(--bg3);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.78rem;
}
.shortcut-url {
  color: var(--primary);
  word-break: break-all;
  font-family: monospace;
  font-size: 0.75rem;
}
