/* components.css — cards, buttons, badges, FAB, bottom sheet, filters, heatmap cells, forms */

/* ---- Icon button (gear, close, etc.) ---- */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-inner);
  color: var(--text-secondary);
  transition: color var(--transition-fast), background var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:active {
  color: var(--text-primary);
  background: var(--bg-subtle);
}
.icon-btn svg { width: 20px; height: 20px; }

/* ---- Bottom sheet ---- */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1500;
  opacity: 0;
  transition: opacity var(--transition-med);
  display: flex;
  align-items: flex-end;
}
.sheet-overlay--visible { opacity: 1; }

.bottom-sheet {
  width: 100%;
  background: var(--bg-elevated);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  border-top: 1px solid var(--border-subtle);
  padding: 0 20px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform var(--transition-med);
  max-height: 85dvh;
  overflow-y: auto;
}
.sheet-overlay--visible .bottom-sheet { transform: translateY(0); }

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 16px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}
.sheet-title {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 700;
}
.sheet-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--text-muted);
  border-radius: var(--radius-badge);
}
.sheet-close svg { width: 18px; height: 18px; }

/* ---- Form elements ---- */
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 6px;
}

.form-input {
  display: block;
  width: 100%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-inner);
  padding: 13px 16px;
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast);
  min-height: 48px;
}
.form-input:focus { border-color: var(--border-active); }
.form-input::placeholder { color: var(--text-muted); }

.btn-primary {
  display: block;
  width: 100%;
  background: var(--accent-primary);
  color: var(--text-on-accent);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-inner);
  padding: 14px;
  min-height: 52px;
  transition: background var(--transition-fast), opacity var(--transition-fast);
  margin-top: 8px;
}
.btn-primary:active { background: var(--accent-dim); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.sheet-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 8px;
}

/* ---- XP pill ---- */
.xp-pill {
  font-size: 12px;
  font-weight: 600;
  color: var(--xp-color);
  background: rgba(255, 107, 53, 0.1);
  border: 1px solid rgba(255, 107, 53, 0.25);
  border-radius: 20px;
  padding: 5px 12px;
  white-space: nowrap;
}
.xp-pill--near { color: var(--priority-med); border-color: rgba(255, 184, 48, 0.3); background: rgba(255, 184, 48, 0.08); }
.xp-pill--capped { color: var(--text-muted); border-color: var(--border-subtle); background: transparent; }

/* ---- Filter bar ---- */
.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 16px;
  padding-bottom: 2px;
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-btn {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 6px 14px;
  min-height: 34px;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.filter-btn--active {
  color: var(--accent-primary);
  border-color: var(--border-active);
  background: rgba(163, 255, 18, 0.06);
}

/* ---- Task list ---- */
.task-list { display: flex; flex-direction: column; gap: 10px; }

.task-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-med);
}
.task-card--done { opacity: 0.45; }
.task-card--completing {
  border-color: var(--accent-primary);
  box-shadow: 0 0 20px var(--accent-glow);
}

.task-check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--text-muted);
  margin-top: 1px;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.task-check:not(:disabled):active { border-color: var(--accent-primary); }
.task-check--done {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%230A0A0D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M2 6l3 3 5-5'/%3E%3C/svg%3E");
  background-size: 12px;
  background-position: center;
  background-repeat: no-repeat;
}

.task-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.task-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-title { font-size: 15px; font-weight: 500; line-height: 1.3; word-break: break-word; }
.task-card--done .task-title { text-decoration: line-through; color: var(--text-muted); }

.task-meta { display: flex; align-items: center; gap: 8px; }
.task-xp { font-size: 12px; font-weight: 600; color: var(--xp-color); margin-left: auto; }

/* ---- Badges ---- */
.badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: var(--radius-badge);
}
.badge--low     { color: var(--priority-low);  background: rgba(78, 205, 196, 0.12); }
.badge--medium  { color: var(--priority-med);  background: rgba(255, 184, 48, 0.12); }
.badge--high    { color: var(--priority-high); background: rgba(255, 59, 59, 0.12); }
.badge--carried { color: var(--priority-med);  background: rgba(255, 184, 48, 0.12); }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state-title {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}
.empty-state-sub { font-size: 14px; color: var(--text-muted); }

/* ---- FAB ---- */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 20px);
  right: 20px;
  width: var(--fab-size);
  height: var(--fab-size);
  border-radius: 50%;
  background: var(--accent-primary);
  color: var(--text-on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  box-shadow: 0 4px 20px rgba(163, 255, 18, 0.3);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.fab:active { transform: scale(0.92); box-shadow: 0 2px 10px rgba(163, 255, 18, 0.2); }
.fab svg { width: 24px; height: 24px; }

/* ---- Priority selector (add sheet) ---- */
.priority-group { display: flex; gap: 8px; }
.priority-btn {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 8px;
  border-radius: var(--radius-inner);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  background: var(--bg-subtle);
  min-height: 44px;
  transition: all var(--transition-fast);
}
.priority-btn--low.priority-btn--active    { color: var(--priority-low);  border-color: var(--priority-low);  background: rgba(78, 205, 196, 0.1); }
.priority-btn--medium.priority-btn--active { color: var(--priority-med);  border-color: var(--priority-med);  background: rgba(255, 184, 48, 0.1); }
.priority-btn--high.priority-btn--active   { color: var(--priority-high); border-color: var(--priority-high); background: rgba(255, 59, 59, 0.1); }

/* ---- Page subtitle ---- */
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ---- Habits header ---- */
.habits-header { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; padding-top: env(safe-area-inset-top); }
.habits-header-top { display: flex; flex-direction: column; gap: 2px; }
.habits-header-bottom { display: flex; align-items: center; gap: 10px; }

.freeze-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  color: var(--freeze-color);
  background: rgba(136, 204, 255, 0.08);
  border: 1px solid var(--freeze-glow);
  border-radius: 20px;
  padding: 5px 12px;
}
.freeze-pill svg { width: 13px; height: 13px; }

.btn-freeze {
  font-size: 12px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 5px 12px;
  min-height: 30px;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn-freeze:not(:disabled):active { color: var(--freeze-color); border-color: rgba(136, 204, 255, 0.4); }
.btn-freeze:disabled { opacity: 0.35; cursor: not-allowed; }

/* ---- Habit list ---- */
.habit-list { display: flex; flex-direction: column; gap: 10px; }

.habit-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 16px;
  transition: border-color var(--transition-fast);
}

.habit-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.habit-name { font-size: 15px; font-weight: 500; }
.habit-streak { font-size: 13px; font-weight: 600; color: var(--streak-fire); }

.habit-milestones { display: flex; gap: 6px; }
.milestone-badge {
  font-size: 10px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  padding: 2px 7px;
  border-radius: var(--radius-badge);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}
.milestone-badge--unlocked {
  color: var(--accent-primary);
  border-color: var(--border-active);
  background: rgba(163, 255, 18, 0.06);
}

.habit-right { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; }

.habit-toggle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.habit-toggle:not(:disabled):not(.habit-toggle--on):active {
  border-color: var(--accent-primary);
  background: rgba(163, 255, 18, 0.08);
}
.habit-toggle--on {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--text-on-accent);
  box-shadow: 0 0 16px var(--accent-glow);
}
.habit-toggle svg { width: 22px; height: 22px; }

.habit-xp { font-size: 11px; font-weight: 600; color: var(--xp-color); }
.habit-toggle--on ~ .habit-xp,
.habit-right .habit-xp { color: var(--text-muted); }

/* ---- Day-of-week selector ---- */
.days-group { display: flex; gap: 6px; }
.day-btn {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  padding: 8px 4px;
  border-radius: var(--radius-badge);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  background: var(--bg-subtle);
  min-height: 40px;
  transition: all var(--transition-fast);
}
.day-btn--active {
  color: var(--accent-primary);
  border-color: var(--border-active);
  background: rgba(163, 255, 18, 0.08);
}

/* ---- Settings / options sheet ---- */
.settings-content { display: flex; flex-direction: column; gap: 12px; padding-bottom: 8px; }

/* ---- Danger outline button ---- */
.btn-danger-outline {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-inner);
  color: var(--danger);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  min-height: 52px;
  transition: background var(--transition-fast);
}
.btn-danger-outline:active { background: rgba(255, 59, 59, 0.08); }

/* ---- Dashboard ---- */
.player-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 20px;
  padding-top: max(20px, calc(env(safe-area-inset-top) + 12px));
  margin-bottom: 16px;
}
.player-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.player-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--accent-primary);
  background: rgba(163,255,18,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--accent-primary);
  flex-shrink: 0;
}
/* Avatar colour modifiers — level rewards */
.player-avatar.avatar--indigo-violet {
  background: linear-gradient(135deg, var(--avatar-indigo-from), var(--avatar-indigo-to));
}
.player-avatar.avatar--crimson-orange {
  background: linear-gradient(135deg, var(--avatar-crimson-from), var(--avatar-crimson-to));
}
.player-avatar.avatar--purple-pink {
  background: linear-gradient(135deg, var(--avatar-purple-from), var(--avatar-purple-to));
}
.player-avatar.avatar--rainbow {
  background: linear-gradient(135deg, var(--avatar-rainbow-from), var(--avatar-rainbow-to));
  animation: rainbow-shift 4s linear infinite;
}
@keyframes rainbow-shift {
  0%   { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

/* Badge rings — wraps around avatar element */
.avatar-badge-wrap {
  position: relative;
  display: inline-flex;
}
.avatar-badge-wrap::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  pointer-events: none;
}
.avatar-badge-wrap--gold::after {
  border: 2px solid #FFD166;
  box-shadow: 0 0 6px #FFD16680;
}
.avatar-badge-wrap--diamond::after {
  border: 2px solid #88CCFF;
  box-shadow: 0 0 8px #88CCFF99;
}
.avatar-badge-wrap--glow::after {
  border: 2px solid #B57BFF;
  box-shadow: 0 0 12px #B57BFF, 0 0 24px #B57BFF60;
  animation: badge-pulse 2s ease-in-out infinite;
}
@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 12px #B57BFF, 0 0 24px #B57BFF60; }
  50%       { box-shadow: 0 0 20px #B57BFF, 0 0 40px #B57BFF80; }
}

.player-info { flex: 1; min-width: 0; }
.player-name  { font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 700; }
.player-level { font-size: 12px; font-weight: 600; color: var(--accent-primary); margin-top: 3px; }

.xp-progress-label { font-size: 11px; color: var(--text-muted); text-align: right; margin-bottom: 6px; }
.xp-bar-track {
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 3px;
  overflow: hidden;
}
.xp-bar-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 3px;
  box-shadow: 2px 0 12px var(--xp-glow);
  width: 0;
  transition: width 800ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-inner);
  padding: 14px 10px;
  text-align: center;
}
.stat-value { font-size: 26px; font-weight: 600; color: var(--text-primary); line-height: 1; margin-bottom: 6px; }
.stat-label  { font-size: 11px; color: var(--text-muted); line-height: 1.3; white-space: pre-line; }

.dashboard-section { margin-bottom: 28px; }
.dashboard-section-title {
  font-family: 'Syne', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

/* Heatmap */
.heatmap { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--bg-subtle);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--transition-fast);
}
.heatmap-cell:active { transform: scale(0.82); }
.heatmap-cell--dim    { background: rgba(163,255,18,0.18); }
.heatmap-cell--med    { background: rgba(163,255,18,0.42); }
.heatmap-cell--bright { background: rgba(163,255,18,0.72); }
.heatmap-cell--full   { background: var(--accent-primary); box-shadow: 0 0 6px var(--accent-glow); }

.heatmap-popup-total {
  font-size: 20px;
  font-weight: 600;
  color: var(--accent-primary);
  padding: 4px 0 12px;
}

/* Today's Focus */
.focus-list { display: flex; flex-direction: column; }
.focus-task {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border-subtle);
  transition: opacity var(--transition-med), transform var(--transition-med);
}
.focus-task:last-child { border-bottom: none; }
.focus-check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--text-muted);
  flex-shrink: 0;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.focus-check:not(:disabled):active { border-color: var(--accent-primary); background: rgba(163,255,18,0.1); }
.focus-task-title { flex: 1; font-size: 14px; font-weight: 500; min-width: 0; word-break: break-word; }
.focus-task--done .focus-task-title { text-decoration: line-through; color: var(--text-muted); }

/* XP Feed */
.feed-list { display: flex; flex-direction: column; }
.feed-event {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.feed-event:last-child { border-bottom: none; }
.feed-xp { font-size: 14px; font-weight: 600; color: var(--xp-color); flex-shrink: 0; min-width: 50px; padding-top: 1px; }
.feed-xp--negative { color: var(--text-muted); }
.feed-right { flex: 1; min-width: 0; }
.feed-desc  { font-size: 13px; line-height: 1.3; word-break: break-word; }
.feed-time  { font-size: 11px; color: var(--text-muted); margin-top: 3px; display: block; }

/* Settings sheet internals */
.settings-profile { padding-bottom: 16px; border-bottom: 1px solid var(--border-subtle); margin-bottom: 4px; }
.settings-profile-name  { font-family: 'Syne', sans-serif; font-size: 17px; font-weight: 700; }
.settings-profile-email { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

.settings-section { padding: 4px 0; }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 15px; font-weight: 500; }

.toggle-switch {
  width: 48px;
  height: 28px;
  border-radius: 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.toggle-switch--on { background: var(--accent-primary); border-color: var(--accent-primary); }
.toggle-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform var(--transition-fast), background var(--transition-fast);
  pointer-events: none;
}
.toggle-switch--on .toggle-switch-thumb { transform: translateX(20px); background: var(--text-on-accent); }

.settings-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.settings-stat-row:last-child { border-bottom: none; }
.settings-stat-label { font-size: 14px; color: var(--text-secondary); }
.settings-stat-value { font-size: 13px; font-weight: 600; }

.settings-danger { padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--border-subtle); }

/* ---- Project list ---- */
.project-list { display: flex; flex-direction: column; gap: 12px; }

.project-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.project-card:active { background: var(--bg-elevated); }
.project-card--running {
  border-color: var(--accent-primary);
  box-shadow: 0 0 20px var(--accent-glow);
}

.project-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.project-name {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 700;
  flex: 1;
  min-width: 0;
  word-break: break-word;
  line-height: 1.2;
}

.project-status {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: var(--radius-badge);
}
.project-status--active    { color: var(--accent-primary); background: rgba(163,255,18,0.1);  border: 1px solid rgba(163,255,18,0.25); }
.project-status--paused    { color: var(--priority-med);   background: rgba(255,184,48,0.1);   border: 1px solid rgba(255,184,48,0.25); }
.project-status--completed { color: var(--text-muted);     background: var(--bg-subtle);        border: 1px solid var(--border-subtle); }

.project-category {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-badge);
  padding: 2px 8px;
}

.project-progress-wrap { display: flex; flex-direction: column; gap: 5px; }
.project-progress-label { font-size: 11px; font-weight: 600; color: var(--text-muted); }
.project-progress-bar {
  height: 4px;
  background: var(--bg-subtle);
  border-radius: 2px;
  overflow: hidden;
}
.project-progress-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 2px;
  min-width: 2px;
  transition: width 600ms ease-out;
}

.project-meta { display: flex; align-items: center; gap: 10px; }
.project-xp   { font-size: 12px; font-weight: 600; color: var(--xp-color); }
.project-time { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-left: auto; }

.timer-running-dot {
  font-size: 10px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent-primary);
  animation: blink 1.2s step-start infinite;
}

/* ---- Project detail view ---- */
.project-detail-view {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-base);
  transform: translateX(100%);
  transition: transform var(--transition-med);
  z-index: 950;
  overflow-y: auto;
  padding: env(safe-area-inset-top) 20px max(80px, calc(env(safe-area-inset-bottom) + 80px));
}
.project-detail-view.view--visible { transform: translateX(0); }

.projects-list-view {
  transition: transform var(--transition-med), opacity var(--transition-med);
}
.projects-list-view.view--slide-left {
  transform: translateX(-12%);
  opacity: 0;
  pointer-events: none;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0 14px;
  position: sticky;
  top: 0;
  background: var(--bg-base);
  z-index: 10;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 24px;
}

.btn-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--radius-inner);
  color: var(--text-secondary);
  -webkit-tap-highlight-color: transparent;
}
.btn-back:active { background: var(--bg-subtle); color: var(--text-primary); }
.btn-back svg { width: 20px; height: 20px; }

.detail-title {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-content { display: flex; flex-direction: column; gap: 28px; }

.detail-description {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-top: -4px;
}

.detail-section { display: flex; flex-direction: column; gap: 14px; }

.detail-section-title {
  font-family: 'Syne', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.detail-empty { font-size: 13px; color: var(--text-muted); }

/* ---- Timer card ---- */
.timer-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.timer-card--running {
  border-color: var(--accent-primary);
  box-shadow: 0 0 24px var(--accent-glow);
  animation: timer-pulse 2s ease-in-out infinite;
}

.timer-display {
  font-size: 52px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.04em;
  line-height: 1;
}

.timer-btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 12px 40px;
  border-radius: var(--radius-inner);
  min-height: 48px;
  min-width: 140px;
  transition: background var(--transition-fast);
}
.timer-btn--start {
  background: rgba(163,255,18,0.1);
  border: 1px solid var(--border-active);
  color: var(--accent-primary);
}
.timer-btn--start:active { background: rgba(163,255,18,0.2); }
.timer-btn--stop {
  background: rgba(255,107,53,0.1);
  border: 1px solid rgba(255,107,53,0.35);
  color: var(--xp-color);
}
.timer-btn--stop:active { background: rgba(255,107,53,0.2); }

/* ---- Milestones ---- */
.milestone-list { display: flex; flex-direction: column; }

.milestone-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border-subtle);
  transition: opacity var(--transition-fast);
  position: relative;
}
.milestone-row--done { opacity: 0.45; }
.milestone-row:last-child { border-bottom: none; }

.milestone-title {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}
.milestone-row--done .milestone-title { text-decoration: line-through; color: var(--text-muted); }

.milestone-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.milestone-xp { font-size: 11px; font-weight: 600; color: var(--xp-color); }
.milestone-row--done .milestone-xp { color: var(--text-muted); }

.milestone-complete-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.milestone-complete-btn:not(:disabled):active {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(163,255,18,0.08);
}
.milestone-complete-btn svg { width: 15px; height: 15px; }

.milestone-done-icon { display: flex; align-items: center; color: var(--accent-primary); }
.milestone-done-icon svg { width: 18px; height: 18px; }

.milestone-add-row { display: flex; gap: 8px; align-items: center; }
.milestone-add-input { flex: 1; }
.milestone-add-btn {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  background: rgba(163,255,18,0.08);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-inner);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}
.milestone-add-btn:not(:disabled):active { background: rgba(163,255,18,0.18); }
.milestone-add-btn:disabled { opacity: 0.4; }
.milestone-add-btn svg { width: 20px; height: 20px; }

/* ---- Sessions ---- */
.session-list { display: flex; flex-direction: column; }

.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.session-row:last-child { border-bottom: none; }

.session-left { display: flex; flex-direction: column; gap: 2px; }
.session-date { font-size: 13px; font-weight: 500; }
.session-duration { font-size: 12px; color: var(--text-muted); }
.session-xp { font-size: 12px; font-weight: 600; color: var(--xp-color); flex-shrink: 0; }

/* ---- Notes ---- */
.notes-area {
  display: block;
  width: 100%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-inner);
  padding: 13px 16px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-primary);
  outline: none;
  resize: none;
  min-height: 120px;
  line-height: 1.6;
  transition: border-color var(--transition-fast);
}
.notes-area:focus { border-color: var(--border-active); }
.notes-area::placeholder { color: var(--text-muted); }

/* ---- Task options (long press) ---- */
.sheet-option-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text-muted);
  padding: 4px 0 12px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 8px;
}

.btn-outline {
  display: block;
  width: 100%;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-inner);
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  padding: 14px;
  min-height: 52px;
  margin-top: 8px;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.btn-outline:active { background: var(--bg-subtle); }

/* ---- Onboarding card ---- */
.onboarding-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 28px 24px 24px;
  max-width: 400px;
  width: 100%;
}

.onboarding-title {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 24px;
  line-height: 1.1;
}

.onboarding-pillars {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 28px;
}

.onboarding-pillar {
  display: grid;
  grid-template-columns: 24px 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 2px;
}
.onboarding-pillar svg {
  width: 20px;
  height: 20px;
  color: var(--accent-primary);
  grid-row: 1 / 3;
  margin-top: 2px;
}
.onboarding-pillar-heading {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.onboarding-pillar-body {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ---- Complete project ---- */
.complete-project-wrap { padding-top: 4px; }
.btn-complete-project {
  display: block;
  width: 100%;
  background: rgba(163,255,18,0.1);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-inner);
  color: var(--accent-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  padding: 14px;
  min-height: 52px;
  transition: background var(--transition-fast);
}
.btn-complete-project:active { background: rgba(163,255,18,0.2); }

/* ---- Habit sparkline (7-day) ---- */
.habit-sparkline {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-top: 5px;
}

.spark-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
  transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.spark-dot--done {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  box-shadow: 0 0 4px var(--accent-glow);
}

.spark-dot--today {
  width: 8px;
  height: 8px;
}

.habit-best {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ---- Recurring task badge ---- */
.badge--recurring {
  color: var(--accent-primary);
  background: rgba(163, 255, 18, 0.08);
  border: 1px solid rgba(163, 255, 18, 0.2);
  font-family: 'DM Sans', sans-serif;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
}

/* ================================================================
   BONUS DAY — discovery overlay + cap-hit ribbon
   Terminal-boot reveal meets slot-machine payoff. Commits to the
   existing cyber-terminal aesthetic (scanlines, neon glow, HUD typography).
   ================================================================ */

.bonus-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 13, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
  opacity: 0;
  transition: opacity 280ms ease;
  overflow: hidden;
}

.bonus-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 107, 53, 0.04) 0px,
    rgba(255, 107, 53, 0.04) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  animation: bonusScanlines 2.4s linear infinite;
}

.bonus-overlay--visible { opacity: 1; }

.bonus-inner {
  position: relative;
  width: 100%;
  max-width: 360px;
  padding: 36px 28px 32px;
  background: var(--bg-surface);
  border: 1px solid var(--xp-color);
  border-radius: var(--radius-card);
  box-shadow:
    0 0 60px rgba(255, 107, 53, 0.35),
    inset 0 0 40px rgba(255, 107, 53, 0.06);
  text-align: center;
}

.bonus-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3em;
  color: var(--accent-primary);
  text-transform: uppercase;
  opacity: 0;
  margin-bottom: 18px;
  white-space: nowrap;
  overflow: hidden;
  display: inline-block;
  max-width: 0;
  border-right: 2px solid var(--accent-primary);
  vertical-align: bottom;
}

.bonus-eyebrow--typing {
  animation:
    bonusEyebrowReveal 600ms steps(22) forwards,
    bonusTypeCaret 700ms step-end 600ms 3;
}

.bonus-title {
  font-family: 'Syne', sans-serif;
  font-size: 40px;
  font-weight: 800;
  color: var(--xp-color);
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  opacity: 0;
  transform: translateY(-22px);
  text-shadow: 0 0 24px rgba(255, 107, 53, 0.55);
}

.bonus-title--drop {
  animation: bonusDrop 560ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.bonus-number {
  font-family: 'Syne', sans-serif;
  font-size: 96px;
  font-weight: 800;
  color: var(--accent-primary);
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 10px 0 18px;
  opacity: 0;
  position: relative;
}

.bonus-number--flash {
  animation:
    bonusChromaticFlash 620ms ease-out forwards,
    bonusGlowPulse 2.4s ease-in-out 620ms infinite;
}

.bonus-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  opacity: 0;
  transition: opacity 320ms ease;
}

.bonus-sub--visible { opacity: 1; }

/* ---- Cap-hit ribbon (when the 500 ceiling is reached) ---- */
.bonus-burst {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  padding-top: max(0px, env(safe-area-inset-top));
  box-sizing: content-box;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(90deg, var(--xp-color) 0%, #FF8C42 50%, var(--xp-color) 100%);
  color: var(--text-on-accent);
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: translateY(-100%);
  transition: transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 9998;
  box-shadow: 0 8px 24px rgba(255, 107, 53, 0.45);
}

.bonus-burst--visible { transform: translateY(0); }

body.bonus-glow {
  animation: bonusEdgeFlash 700ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .bonus-overlay::before { animation: none; }
  .bonus-number--flash {
    animation: bonusGlowPulse 2.4s ease-in-out infinite;
  }
  .bonus-title--drop {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   ACHIEVEMENTS — rarity rings
   ============================================================ */
.ach-ring--common    { border: 1px solid var(--rarity-common); }
.ach-ring--rare      { border: 1px solid var(--rarity-rare); }
.ach-ring--legendary {
  border: 1px solid transparent;
  background-clip: padding-box;
  position: relative;
}
.ach-ring--legendary::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--rarity-legendary), var(--rarity-legendary-alt));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

/* ============================================================
   ACHIEVEMENT — common toast (top)
   ============================================================ */
.ach-toast {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(-16px);
  min-width: 260px;
  max-width: calc(100vw - 24px);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--radius-inner);
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  pointer-events: none;
  box-shadow: 0 8px 28px var(--rarity-common-glow);
  z-index: 3000;
}
.ach-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.ach-toast-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--rarity-common);
  color: var(--text-on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ach-toast-icon svg { width: 20px; height: 20px; }
.ach-toast-text { flex: 1; min-width: 0; }
.ach-toast-eyebrow {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--rarity-common);
  margin-bottom: 2px;
}
.ach-toast-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ach-toast-xp {
  color: var(--xp-color);
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

/* ============================================================
   ACHIEVEMENT — rare modal (centered card)
   ============================================================ */
.ach-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 13, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  opacity: 0;
  transition: opacity 220ms ease;
  z-index: 3000;
}
.ach-modal-overlay--visible { opacity: 1; }
.ach-modal {
  position: relative;
  background: var(--bg-elevated);
  border-radius: var(--radius-card);
  padding: 24px 22px 22px;
  width: 100%;
  max-width: 320px;
  text-align: center;
  box-shadow: 0 16px 48px var(--rarity-rare-glow);
  transform: scale(0.92);
  transition: transform 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ach-modal-overlay--visible .ach-modal { transform: scale(1); }
.ach-modal-eyebrow {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--rarity-rare);
  margin-bottom: 14px;
}
.ach-modal-badge {
  width: 76px;
  height: 76px;
  margin: 0 auto 14px;
  border-radius: 20px;
  background: var(--bg-subtle);
  color: var(--rarity-rare);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 0 var(--rarity-rare-glow);
}
.ach-modal-badge svg { width: 38px; height: 38px; }
.ach-modal-name {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
}
.ach-modal-desc {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 12px;
}
.ach-modal-xp {
  color: var(--xp-color);
  font-size: 14px;
  font-weight: 600;
}

/* ============================================================
   ACHIEVEMENT — legendary overlay (fullscreen)
   ============================================================ */
.ach-legendary-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 30% 20%, rgba(181, 123, 255, 0.28), transparent 60%),
    radial-gradient(circle at 70% 80%, rgba(255, 209, 102, 0.18), transparent 60%),
    rgba(10, 10, 13, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  opacity: 0;
  transition: opacity 360ms ease;
  z-index: 3000;
  overflow: hidden;
}
.ach-legendary-overlay::before {
  content: '';
  position: absolute;
  inset: -30%;
  background:
    conic-gradient(from 0deg, transparent 0deg, rgba(181, 123, 255, 0.12) 90deg, transparent 180deg, rgba(255, 209, 102, 0.1) 270deg, transparent 360deg);
  animation: achLegendaryBg 12s linear infinite;
  pointer-events: none;
}
.ach-legendary-overlay--visible { opacity: 1; }
.ach-legendary-inner {
  position: relative;
  text-align: center;
  max-width: 360px;
  z-index: 1;
}
.ach-legendary-eyebrow {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--rarity-legendary);
  margin-bottom: 18px;
  opacity: 0.85;
}
.ach-legendary-badge {
  width: 112px;
  height: 112px;
  margin: 0 auto 22px;
  border-radius: 28px;
  background: var(--bg-elevated);
  color: var(--rarity-legendary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 0 var(--rarity-legendary-glow);
}
.ach-legendary-badge svg { width: 56px; height: 56px; }
.ach-legendary-name {
  font-family: 'Syne', sans-serif;
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 10px;
  background: linear-gradient(135deg, var(--rarity-legendary), var(--rarity-legendary-alt));
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ach-legendary-desc {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 16px;
}
.ach-legendary-xp {
  color: var(--rarity-legendary-alt);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 28px;
}
.ach-legendary-btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-on-accent);
  background: linear-gradient(135deg, var(--rarity-legendary), var(--rarity-legendary-alt));
  border-radius: 999px;
  padding: 12px 28px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 260ms ease, transform 260ms ease;
}
.ach-legendary-btn--visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Player card: tappable affordance + title ---- */
.player-card--tappable {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--transition-fast);
}
.player-card--tappable:active { transform: scale(0.99); }
.player-title {
  font-size: 10px;
  letter-spacing: 0.16em;
  font-weight: 600;
  color: var(--xp-color);
  margin-top: 4px;
}

/* ---- Profile view ---- */
.profile-view {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-base);
  transform: translateX(100%);
  transition: transform var(--transition-med);
  z-index: 960;
  overflow-y: auto;
  padding: env(safe-area-inset-top) 20px max(80px, calc(env(safe-area-inset-bottom) + 80px));
}
.profile-view.view--visible { transform: translateX(0); }

.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0 26px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 22px;
}
.profile-avatar--lg {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 3px solid var(--accent-primary);
  background: rgba(163,255,18,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Syne', sans-serif;
  font-size: 38px;
  font-weight: 800;
  color: var(--accent-primary);
  margin-bottom: 14px;
  box-shadow: 0 0 32px var(--accent-glow);
}
.profile-name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.profile-name {
  font-family: 'Syne', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  cursor: pointer;
}
.profile-name-edit-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 180ms ease;
}
.profile-name-edit-btn:hover,
.profile-name-edit-btn:active {
  color: var(--accent-primary);
}
.profile-name-edit-btn i {
  width: 14px;
  height: 14px;
}
.profile-title-label {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--xp-color);
  margin-top: 6px;
  text-align: center;
}
.profile-level-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  width: 100%;
  margin-top: 22px;
  margin-bottom: 8px;
}
.profile-level-label {
  font-size: 13px;
  color: var(--accent-primary);
  font-weight: 700;
}
.profile-xp-label {
  font-size: 11px;
  color: var(--text-muted);
}

/* Stats grid (2 × 3) */
.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.profile-stat-cell {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-inner);
  padding: 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.profile-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}
.profile-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Section heading */
.profile-section-heading {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
}

/* Titles horizontal scroll */
.profile-titles-wrap {
  margin-bottom: 28px;
}
.title-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.title-scroll::-webkit-scrollbar { display: none; }
.title-pill {
  flex-shrink: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 8px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}
.title-pill--active {
  color: var(--xp-color);
  border-color: var(--xp-color);
  background: rgba(255, 107, 53, 0.08);
  box-shadow: 0 0 12px var(--xp-glow);
}
.profile-titles-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Achievements CTA */
.profile-ach-cta {
  margin-top: 4px;
}
.ach-progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.ach-progress-bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 3px;
  overflow: hidden;
}
.ach-progress-bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent-primary);
  border-radius: 3px;
  transition: width var(--transition-slow);
}
.ach-progress-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  white-space: nowrap;
}
.profile-ach-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}
.profile-ach-btn i { width: 16px; height: 16px; }

/* ---- Achievements Gallery ---- */
.achievements-view {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-base);
  transform: translateX(100%);
  transition: transform var(--transition-med);
  z-index: 970;
  overflow-y: auto;
  padding: env(safe-area-inset-top) 20px max(80px, calc(env(safe-area-inset-bottom) + 80px));
}
.achievements-view.view--visible { transform: translateX(0); }

.ach-filter-bar { margin-top: 4px; }

.ach-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.ach-card {
  position: relative;
  aspect-ratio: 1 / 1.1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 8px;
  background: var(--bg-surface);
  border-radius: var(--radius-inner);
  text-align: center;
  transition: transform var(--transition-fast), background var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.ach-card.ach-card--locked.ach-ring--common,
.ach-card.ach-card--locked.ach-ring--rare,
.ach-card.ach-card--locked.ach-ring--legendary {
  border-color: var(--border-subtle);
}
.ach-card.ach-card--locked.ach-ring--legendary::after { opacity: 0.25; }
.ach-card:active { transform: scale(0.97); }

.ach-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(163, 255, 18, 0.08);
}
.ach-card-icon i { width: 22px; height: 22px; }

.ach-card-name {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.ach-card--locked {
  opacity: 0.55;
  filter: grayscale(1);
}
.ach-card--locked .ach-card-icon {
  background: var(--bg-subtle);
}
.ach-card--hidden .ach-card-name {
  color: var(--text-muted);
  letter-spacing: 0.2em;
}

.ach-new-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 8px rgba(255, 59, 59, 0.6);
}

.ach-grid-empty {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  padding: 40px 0;
}

/* Detail sheet */
.ach-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 13, 0.72);
  backdrop-filter: blur(4px);
  z-index: 980;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-med);
}
.ach-sheet-overlay--visible { opacity: 1; }
.ach-sheet-overlay--visible .ach-sheet {
  transform: translateY(0);
}

.ach-sheet {
  width: 100%;
  max-width: 520px;
  max-height: 85dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-surface);
  border-top-left-radius: var(--radius-card);
  border-top-right-radius: var(--radius-card);
  padding: 28px 24px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transform: translateY(100%);
  transition: transform var(--transition-med);
}

.ach-sheet-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(163, 255, 18, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.ach-sheet-icon i { width: 32px; height: 32px; }

.ach-sheet-eyebrow {
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--text-muted);
}
.ach-sheet-name {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
}
.ach-sheet-desc {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-secondary);
  text-align: center;
  max-width: 340px;
}
.ach-sheet-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  justify-content: center;
}
.ach-sheet-meta-item {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg-subtle);
}
.ach-sheet-xp { color: var(--xp-color); }
.ach-sheet-title-tag { color: var(--rarity-legendary); }

/* Dormant player card */
.player-card--dormant .player-avatar {
  filter: grayscale(1) brightness(0.5);
}
.player-card--dormant .xp-bar-fill {
  filter: grayscale(1) brightness(0.6);
}
.player-dormant-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #EF4444;
  margin: 0;
}
