/* ═══════════ SOLO LEVELING OS — STYLES ═══════════ */

:root {
  --bg: #080911;
  --bg-card: #0f1119;
  --bg-card-hover: #161825;
  --bg-sidebar: #0a0c14;
  --bg-input: #131520;
  --border: #1e2035;
  --border-light: #282b45;
  --text: #e4e6f0;
  --text-secondary: #8890ab;
  --text-muted: #4a5070;
  --purple: #8b5cf6;
  --purple-dim: rgba(139,92,246,0.12);
  --purple-glow: rgba(139,92,246,0.25);
  --gold: #f59e0b;
  --gold-dim: rgba(245,158,11,0.12);
  --gold-glow: rgba(245,158,11,0.25);
  --blue: #3b82f6;
  --blue-dim: rgba(59,130,246,0.12);
  --green: #10b981;
  --green-dim: rgba(16,185,129,0.12);
  --red: #ef4444;
  --red-dim: rgba(239,68,68,0.12);
  --orange: #f97316;
  --orange-dim: rgba(249,115,22,0.12);
  --cyan: #06b6d4;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 30px rgba(0,0,0,0.5);
  --transition: 0.25s ease;
  --sidebar-w: 220px;
  --header-h: 60px;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Heebo', sans-serif; }
html { font-size: 15px; }
body { background: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple); }

/* ═══════════ PLAYER HEADER BAR ═══════════ */
.player-bar {
  position: fixed; top: 0; right: var(--sidebar-w); left: 0; height: var(--header-h);
  background: linear-gradient(180deg, #0d0f1a 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 2rem; padding: 0 2rem;
  z-index: 90;
}
.player-info { display: flex; align-items: center; gap: 0.75rem; }
.rank-badge {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.95rem;
  background: linear-gradient(135deg, var(--green), #059669);
  color: #fff; box-shadow: 0 0 12px rgba(16,185,129,0.4);
}
.player-rank-title { font-weight: 700; font-size: 1rem; color: var(--green); letter-spacing: 2px; }
.player-xp-wrap { flex: 1; max-width: 300px; }
.xp-label { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 4px; }
.xp-label strong { color: var(--gold); }
.xp-bar {
  height: 8px; background: var(--bg-input); border-radius: 4px; overflow: hidden;
  border: 1px solid var(--border);
}
.xp-fill {
  height: 100%; width: 0%; border-radius: 4px;
  background: linear-gradient(90deg, var(--purple), var(--gold));
  transition: width 0.8s ease;
}
.player-date { font-size: 0.85rem; color: var(--text-muted); margin-right: auto; direction: ltr; }

/* ═══════════ SIDEBAR ═══════════ */
.sidebar {
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--bg-sidebar); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 100;
  transition: width var(--transition);
}
.sidebar-logo {
  padding: 1.25rem 1rem; display: flex; align-items: center; gap: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.logo-icon { font-size: 1.5rem; }
.logo-text { font-weight: 800; font-size: 0.9rem; line-height: 1.3; color: var(--purple); }
.logo-text small { font-weight: 400; font-size: 0.7rem; color: var(--text-muted); }
.nav-links { flex: 1; overflow-y: auto; padding: 0.5rem 0; }
.nav-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 1.25rem; color: var(--text-secondary);
  text-decoration: none; cursor: pointer; transition: all var(--transition);
  border-right: 3px solid transparent; font-size: 0.85rem; font-weight: 500;
}
.nav-item:hover { background: var(--purple-dim); color: var(--text); }
.nav-item.active {
  background: var(--purple-dim); color: var(--purple);
  border-right-color: var(--purple);
}
.nav-icon { font-size: 1.1rem; width: 24px; text-align: center; }
.nav-group-label {
  font-size: 0.6rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1.5px; padding: 0.75rem 1.25rem 0.25rem;
  border-top: 1px solid var(--border); margin-top: 0.25rem;
}
.nav-group-label:first-child { border-top: none; margin-top: 0; }
.sidebar-toggle {
  display: none; position: fixed; top: 12px; right: 12px; z-index: 200;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  width: 40px; height: 40px; border-radius: 10px; font-size: 1.2rem; cursor: pointer;
}

/* ═══════════ MAIN CONTENT ═══════════ */
.content {
  margin-right: var(--sidebar-w); margin-top: var(--header-h);
  padding: 2rem; min-height: calc(100vh - var(--header-h));
}
.tab-section { display: none; animation: fadeIn 0.3s ease; }
.tab-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ═══════════ SECTION HEADER ═══════════ */
.section-header { margin-bottom: 1.5rem; }
.section-header h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: 1px; }
.section-sub { color: var(--text-secondary); font-size: 0.85rem; margin-top: 0.25rem; }

/* ═══════════ GRID ═══════════ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.25rem; margin-bottom: 1.25rem; }

/* ═══════════ CARDS ═══════════ */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  transition: all var(--transition); margin-bottom: 1.25rem;
}
.card:hover { border-color: var(--border-light); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.card-header h2 { font-size: 1rem; font-weight: 700; }
.card-warning { border-color: rgba(239,68,68,0.3); }
.card-glow-purple { box-shadow: 0 0 20px var(--purple-dim); border-color: rgba(139,92,246,0.3); }
.card-glow-gold { box-shadow: 0 0 20px var(--gold-dim); border-color: rgba(245,158,11,0.3); }
.card-glow-red { box-shadow: 0 0 20px var(--red-dim); border-color: rgba(239,68,68,0.3); }
.clickable { cursor: pointer; }

/* ═══════════ BADGES ═══════════ */
.badge {
  padding: 2px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 700;
}
.badge-gold { background: var(--gold-dim); color: var(--gold); }
.badge-green { background: var(--green-dim); color: var(--green); }
.badge-red { background: var(--red-dim); color: var(--red); }
.badge-blue { background: var(--blue-dim); color: var(--blue); }

/* ═══════════ INPUTS & FORMS ═══════════ */
.input-field {
  width: 100%; padding: 0.6rem 0.85rem; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 0.85rem; transition: all var(--transition);
}
.input-field:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 8px var(--purple-dim); }
.input-field::placeholder { color: var(--text-muted); }
.input-sm { max-width: 140px; padding: 0.4rem 0.6rem; font-size: 0.8rem; }
.textarea { resize: vertical; min-height: 60px; }
select.input-field { cursor: pointer; }

.form-row { display: flex; gap: 1rem; margin-bottom: 0.75rem; }
.form-group { flex: 1; display: flex; flex-direction: column; gap: 0.3rem; }
.form-group label { font-size: 0.75rem; color: var(--text-secondary); font-weight: 600; }
.form-group.flex-2 { flex: 2; }
.quest-form { padding-top: 0.5rem; }
.hidden { display: none !important; }

.add-row { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.add-row .input-field { flex: 1; }

/* ═══════════ BUTTONS ═══════════ */
.btn {
  padding: 0.55rem 1.25rem; border: none; border-radius: var(--radius-sm);
  font-weight: 700; font-size: 0.85rem; cursor: pointer;
  transition: all var(--transition); display: inline-flex; align-items: center; gap: 0.5rem;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-gold { background: linear-gradient(135deg, var(--gold), #d97706); color: #000; }
.btn-gold:hover { box-shadow: 0 4px 15px var(--gold-glow); }
.btn-purple { background: linear-gradient(135deg, var(--purple), #7c3aed); color: #fff; }
.btn-purple:hover { box-shadow: 0 4px 15px var(--purple-glow); }
.btn-green { background: linear-gradient(135deg, var(--green), #059669); color: #fff; }
.btn-blue { background: linear-gradient(135deg, var(--blue), #2563eb); color: #fff; }
.btn-red { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.75rem; }
.btn-icon {
  width: 30px; height: 30px; padding: 0; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; font-size: 0.8rem;
}

/* ═══════════ QUEST LIST (STATUS) ═══════════ */
.quest-list { display: flex; flex-direction: column; gap: 0.5rem; }
.quest-item {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.75rem;
  background: var(--bg-input); border-radius: var(--radius-sm);
  border: 1px solid var(--border); transition: all var(--transition);
}
.quest-item:hover { border-color: var(--border-light); }
.quest-item.done { opacity: 0.5; }
.quest-item.done .quest-text { text-decoration: line-through; }
.quest-check {
  width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--border-light);
  background: transparent; cursor: pointer; display: flex; align-items: center;
  justify-content: center; color: transparent; font-size: 0.7rem; transition: all var(--transition);
  flex-shrink: 0;
}
.quest-check.checked {
  background: var(--green); border-color: var(--green); color: #fff;
}
.quest-text { flex: 1; font-size: 0.9rem; }
.quest-delete {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 0.85rem; padding: 2px 6px; border-radius: 4px;
}
.quest-delete:hover { color: var(--red); background: var(--red-dim); }

/* ═══════════ STATS GRID ═══════════ */
.stats-grid { display: flex; flex-direction: column; gap: 0.75rem; }
.stat-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem 0;
}
.stat-item label { font-size: 0.85rem; min-width: 100px; color: var(--text-secondary); }
.stat-input {
  width: 100px; padding: 0.4rem 0.6rem; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 0.85rem; text-align: center;
}
.stat-input:focus { outline: none; border-color: var(--purple); }
.stat-unit { font-size: 0.75rem; color: var(--text-muted); }
.stat-value { font-size: 0.85rem; color: var(--gold); font-weight: 700; min-width: 40px; }
.energy-slider {
  flex: 1; -webkit-appearance: none; height: 6px;
  background: linear-gradient(90deg, var(--red), var(--gold), var(--green));
  border-radius: 3px; outline: none;
}
.energy-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px;
  background: var(--text); border-radius: 50%; cursor: pointer;
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
}

/* ═══════════ HABITS LIST ═══════════ */
.habits-list { display: flex; flex-direction: column; gap: 0.4rem; }
.habit-item {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.75rem;
  background: var(--bg-input); border-radius: var(--radius-sm);
  border: 1px solid var(--border); cursor: pointer; transition: all var(--transition);
}
.habit-item:hover { border-color: var(--border-light); }
.habit-item.done { border-color: rgba(16,185,129,0.3); background: rgba(16,185,129,0.05); }
.habit-check { width: 20px; height: 20px; border-radius: 5px; border: 2px solid var(--border-light);
  background: transparent; display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; color: transparent; flex-shrink: 0; transition: all var(--transition);
}
.habit-item.done .habit-check { background: var(--green); border-color: var(--green); color: #fff; }
.habit-name { flex: 1; font-size: 0.82rem; }
.habit-streak {
  font-size: 0.7rem; color: var(--orange); font-weight: 700;
  padding: 2px 8px; background: var(--orange-dim); border-radius: 10px;
}

/* ═══════════ TRAINING TODAY ═══════════ */
.training-today { display: flex; flex-direction: column; gap: 0.75rem; }
.training-field { display: flex; flex-direction: column; gap: 0.25rem; }
.training-field label { font-size: 0.75rem; color: var(--text-secondary); }

/* ═══════════ COLLAPSIBLE ═══════════ */
.collapsible { overflow: hidden; transition: max-height 0.3s ease; max-height: 500px; }
.collapsible.collapsed { max-height: 0; }
.collapse-arrow { transition: transform var(--transition); font-size: 0.8rem; color: var(--text-muted); }
.collapsed + .collapse-arrow, .card-header .collapse-arrow { }
.protocol-steps { display: flex; flex-direction: column; gap: 0.5rem; padding-top: 0.5rem; }
.protocol-step {
  padding: 0.75rem; background: var(--bg-input); border-radius: var(--radius-sm);
  border-right: 3px solid var(--red); font-size: 0.85rem; line-height: 1.5;
}
.protocol-step strong { color: var(--red); }

/* ═══════════ TABLES ═══════════ */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.data-table th {
  text-align: right; padding: 0.6rem 0.75rem; background: var(--bg-input);
  color: var(--text-secondary); font-weight: 600; font-size: 0.75rem;
  border-bottom: 1px solid var(--border); white-space: nowrap;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.data-table td {
  padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table tr:hover td { background: rgba(139,92,246,0.03); }
.data-table td:last-child { white-space: nowrap; }

/* Zone colors */
.zone-1 td:first-child { color: var(--green); font-weight: 700; }
.zone-2 td:first-child { color: var(--blue); font-weight: 700; }
.zone-3 td:first-child { color: var(--gold); font-weight: 700; }
.zone-4 td:first-child { color: var(--orange); font-weight: 700; }
.zone-5 td:first-child { color: var(--red); font-weight: 700; }
.zone-6 td:first-child { color: var(--purple); font-weight: 700; }

/* Status colors */
.status-good { color: var(--green); font-weight: 600; }
.status-excellent { color: var(--cyan); font-weight: 600; }
.status-warning { color: var(--gold); font-weight: 600; }
.status-danger { color: var(--red); font-weight: 600; }
.priority-high { color: var(--red); }
.priority-met { color: var(--green); }
.priority-add { color: var(--gold); }

/* Rank colors in table */
.rank-b { color: var(--blue); font-weight: 700; }
.rank-c { color: var(--green); font-weight: 700; }
.rank-current { background: var(--purple-dim) !important; }
.rank-current td { background: var(--purple-dim) !important; }

/* ═══════════ STAT CARDS ═══════════ */
.stat-card { text-align: center; padding: 1.5rem; }
.stat-big-label { font-size: 0.75rem; color: var(--text-secondary); font-weight: 600; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 0.5rem; }
.stat-big-value { font-size: 2rem; font-weight: 900; margin-bottom: 0.25rem; }
.stat-big-sub { font-size: 0.75rem; color: var(--text-muted); }
.stat-input-inline {
  margin-top: 0.75rem; width: 140px; padding: 0.35rem 0.6rem;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 0.8rem; text-align: center;
}
.stat-input-inline:focus { outline: none; border-color: var(--purple); }

/* ═══════════ IMPROVE LIST ═══════════ */
.improve-list { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; padding-top: 0.5rem; }
.improve-list li { font-size: 0.85rem; color: var(--text-secondary); }

/* ═══════════ MISSIONS GRID ═══════════ */
.missions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 0.75rem; }
.mission-card {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; transition: all var(--transition);
}
.mission-card:hover { border-color: var(--border-light); }
.mission-name { font-weight: 700; font-size: 0.9rem; margin-bottom: 0.5rem; }
.mission-meta { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.mission-meta span { font-size: 0.7rem; padding: 2px 8px; border-radius: 10px; }
.mission-domain-body { background: var(--green-dim); color: var(--green); }
.mission-domain-mind { background: var(--purple-dim); color: var(--purple); }
.mission-domain-career { background: var(--gold-dim); color: var(--gold); }
.mission-domain-knowledge { background: var(--blue-dim); color: var(--blue); }
.mission-progress-bar {
  height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 0.5rem;
}
.mission-progress-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--purple), var(--gold));
  transition: width 0.6s ease;
}
.mission-xp { font-size: 0.75rem; color: var(--gold); font-weight: 700; margin-top: 0.3rem; }
.mission-deadline { font-size: 0.7rem; color: var(--text-muted); }
.mission-actions { display: flex; gap: 0.4rem; margin-top: 0.5rem; }

/* ═══════════ DOMAINS GRID ═══════════ */
.domains-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.domain-card {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; text-align: center;
}
.domain-header { font-weight: 800; font-size: 1rem; margin-bottom: 0.5rem; }
.domain-icon { font-size: 1.2rem; }
.domain-xp { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.25rem; }
.domain-rank { font-size: 1.5rem; font-weight: 900; margin-bottom: 0.5rem; }
.domain-bar {
  height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 0.75rem;
}
.domain-fill { height: 100%; border-radius: 3px; transition: width 0.6s ease; }
.domain-body { border-color: rgba(16,185,129,0.3); }
.domain-body .domain-rank { color: var(--green); }
.domain-body .domain-fill { background: var(--green); }
.domain-mind { border-color: rgba(139,92,246,0.3); }
.domain-mind .domain-rank { color: var(--purple); }
.domain-mind .domain-fill { background: var(--purple); }
.domain-career { border-color: rgba(245,158,11,0.3); }
.domain-career .domain-rank { color: var(--gold); }
.domain-career .domain-fill { background: var(--gold); }
.domain-knowledge { border-color: rgba(59,130,246,0.3); }
.domain-knowledge .domain-rank { color: var(--blue); }
.domain-knowledge .domain-fill { background: var(--blue); }
.domain-examples { list-style: none; text-align: right; font-size: 0.7rem; color: var(--text-muted); display: flex; flex-direction: column; gap: 0.15rem; }

/* ═══════════ RANK BADGES ═══════════ */
.rank-table .rank-badge { display: inline-flex; width: 32px; height: 32px; font-size: 0.8rem; }
.rank-e { background: linear-gradient(135deg, #6b7280, #4b5563); }
.rank-d { background: linear-gradient(135deg, #92400e, #78350f); }
.rank-c { background: linear-gradient(135deg, var(--green), #059669); }
.rank-b { background: linear-gradient(135deg, var(--blue), #2563eb); }
.rank-a { background: linear-gradient(135deg, var(--purple), #7c3aed); }
.rank-s { background: linear-gradient(135deg, var(--red), #dc2626); box-shadow: 0 0 15px rgba(239,68,68,0.4); }

/* ═══════════ DEBRIEF HISTORY ═══════════ */
.debrief-entry {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem;
}
.debrief-entry-header {
  font-weight: 700; font-size: 1rem; color: var(--purple); margin-bottom: 0.75rem;
  padding-bottom: 0.5rem; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.debrief-section { margin-bottom: 0.5rem; }
.debrief-section strong { color: var(--text-secondary); font-size: 0.8rem; display: block; margin-bottom: 0.2rem; }
.debrief-section p { font-size: 0.85rem; line-height: 1.5; }

/* ═══════════ FINANCE REMINDERS ═══════════ */
.reminder-item {
  padding: 0.6rem 0.75rem; border-radius: var(--radius-sm); margin-bottom: 0.4rem;
  font-size: 0.85rem; border-right: 3px solid;
}
.reminder-urgent { background: var(--red-dim); border-right-color: var(--red); }
.reminder-important { background: var(--orange-dim); border-right-color: var(--orange); }
.reminder-normal { background: var(--gold-dim); border-right-color: var(--gold); }

/* ═══════════ FILTER GROUP ═══════════ */
.filter-group { display: flex; gap: 0.5rem; }

/* ═══════════ PRIORITY BADGES IN QUEST TABLE ═══════════ */
.priority-critical { color: var(--red); font-weight: 800; }
.priority-high-text { color: var(--red); font-weight: 600; }
.priority-medium-text { color: var(--gold); font-weight: 600; }
.priority-low-text { color: var(--green); font-weight: 600; }

/* Quest status badges */
.status-done { color: var(--green); }
.status-progress { color: var(--blue); }
.status-todo { color: var(--text-muted); }
.status-skipped { color: var(--red); }

/* ═══════════ RESPONSIVE ═══════════ */
@media (max-width: 1024px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .domains-grid { grid-template-columns: 1fr 1fr; }
  .missions-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(100%); width: 240px; transition: transform 0.3s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: flex; }
  .player-bar { right: 0; padding: 0 1rem; gap: 1rem; }
  .player-xp-wrap { max-width: 180px; }
  .content { padding: 1rem; }
  .grid-3 { grid-template-columns: 1fr; }
  .domains-grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  .section-header h1 { font-size: 1.2rem; }
  .mobile-nav { display: block; }
  .sidebar { display: none !important; }
  .sidebar-toggle { display: none !important; }
  .content { margin-right: 0; padding-bottom: 80px; }
  .player-bar { right: 0; flex-wrap: wrap; height: auto; min-height: var(--header-h); padding: 8px 12px; gap: 8px; }
  .player-date { display: none; }
  .daily-timer { font-size: 0.7rem; }
  .ai-fab { bottom: 72px; }
  .ai-chat { bottom: 140px; }
  .toast { bottom: 80px; }
}

/* ═══════════ TOAST ═══════════ */
.toast {
  position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(100px);
  background: var(--purple); color: #fff; padding: 0.75rem 1.5rem;
  border-radius: var(--radius); font-weight: 600; font-size: 0.85rem;
  box-shadow: 0 8px 30px rgba(139,92,246,0.4);
  transition: transform 0.3s ease; z-index: 1000;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ═══════════ LOGIN SCREEN ═══════════ */
.login-screen {
  position: fixed; inset: 0; z-index: 500;
  background: #050609;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  background-image:
    radial-gradient(ellipse at 50% -20%, rgba(139,92,246,0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(245,158,11,0.06) 0%, transparent 40%),
    radial-gradient(ellipse at 20% 90%, rgba(59,130,246,0.05) 0%, transparent 40%);
}
.login-particles {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
}
.login-particles span {
  position: absolute; width: 3px; height: 3px; border-radius: 50%;
  background: rgba(139,92,246,0.4);
  animation: loginFloat 8s infinite ease-in-out;
}
.login-particles span:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; }
.login-particles span:nth-child(2) { left: 80%; top: 15%; animation-delay: 1s; background: rgba(245,158,11,0.3); }
.login-particles span:nth-child(3) { left: 30%; top: 70%; animation-delay: 2s; }
.login-particles span:nth-child(4) { left: 70%; top: 80%; animation-delay: 3s; background: rgba(245,158,11,0.3); }
.login-particles span:nth-child(5) { left: 50%; top: 10%; animation-delay: 4s; width: 2px; height: 2px; }
.login-particles span:nth-child(6) { left: 15%; top: 50%; animation-delay: 5s; background: rgba(59,130,246,0.3); }
.login-particles span:nth-child(7) { left: 90%; top: 45%; animation-delay: 6s; }
.login-particles span:nth-child(8) { left: 40%; top: 90%; animation-delay: 7s; background: rgba(245,158,11,0.3); }
.login-particles span:nth-child(9) { left: 60%; top: 35%; animation-delay: 2.5s; width: 2px; height: 2px; }
.login-particles span:nth-child(10) { left: 25%; top: 85%; animation-delay: 4.5s; background: rgba(59,130,246,0.3); }
@keyframes loginFloat {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.3; }
  50% { transform: translateY(-30px) scale(1.5); opacity: 0.8; }
}
.login-card {
  background: linear-gradient(165deg, rgba(15,17,25,0.95), rgba(10,12,20,0.98));
  border: 1px solid rgba(139,92,246,0.15);
  border-radius: 24px; padding: 2.5rem 2rem; width: 400px; max-width: 92vw;
  text-align: center;
  box-shadow: 0 25px 80px rgba(0,0,0,0.7), 0 0 40px rgba(139,92,246,0.08), inset 0 1px 0 rgba(255,255,255,0.03);
  position: relative; z-index: 1;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.login-glow {
  position: absolute; top: -1px; left: 20%; right: 20%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--purple), var(--gold), var(--purple), transparent);
  border-radius: 2px; opacity: 0.6;
}
.login-logo {
  font-size: 3.5rem; margin-bottom: 0.75rem;
  filter: drop-shadow(0 0 20px rgba(139,92,246,0.4));
  animation: loginLogoFloat 3s ease-in-out infinite;
}
@keyframes loginLogoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.login-title {
  font-size: 1.8rem; font-weight: 900; letter-spacing: 5px;
  background: linear-gradient(135deg, #c4b5fd, var(--purple), var(--gold), #fbbf24);
  background-size: 200% 200%;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: loginGradient 4s ease infinite;
  margin-bottom: 2px;
}
@keyframes loginGradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.login-subtitle {
  font-size: 0.6rem; font-weight: 600; letter-spacing: 6px; color: var(--text-muted);
  margin-bottom: 4px; text-transform: uppercase;
}
.login-sub {
  color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 1.25rem;
}
.login-rank-preview {
  display: flex; justify-content: center; gap: 6px; margin-bottom: 1.5rem;
}
.login-rank {
  width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 900; color: #fff; letter-spacing: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: transform 0.2s;
}
.login-rank:hover { transform: scale(1.15); }
.login-tabs {
  display: flex; gap: 0; margin-bottom: 1.25rem; border-radius: 10px;
  overflow: hidden; border: 1px solid rgba(139,92,246,0.2);
  background: rgba(139,92,246,0.05);
}
.login-tab {
  flex: 1; padding: 0.65rem; background: transparent; border: none;
  color: var(--text-muted); font-weight: 700; font-size: 0.85rem; cursor: pointer;
  transition: all 0.3s;
}
.login-tab.active {
  background: linear-gradient(135deg, var(--purple), rgba(139,92,246,0.8));
  color: #fff; box-shadow: 0 2px 12px rgba(139,92,246,0.3);
}
.login-form { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1rem; }
.login-input-wrap {
  position: relative; display: flex; align-items: center;
}
.login-input-icon {
  position: absolute; right: 12px; font-size: 1rem; pointer-events: none; z-index: 1;
}
.login-input {
  padding-right: 40px !important; width: 100%; font-size: 1rem;
  background: rgba(19,21,32,0.8) !important;
  border: 1px solid rgba(139,92,246,0.12) !important;
  transition: border-color 0.3s, box-shadow 0.3s !important;
}
.login-input:focus {
  border-color: var(--purple) !important;
  box-shadow: 0 0 0 3px rgba(139,92,246,0.15) !important;
}
.btn-login-main {
  width: 100%; padding: 0.85rem; border: none; border-radius: 12px;
  background: linear-gradient(135deg, var(--purple), #7c3aed);
  color: #fff; font-size: 1rem; font-weight: 800; cursor: pointer;
  transition: all 0.3s; letter-spacing: 1px;
  box-shadow: 0 4px 20px rgba(139,92,246,0.3);
}
.btn-login-main:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(139,92,246,0.5);
}
.btn-login-main:active { transform: translateY(0); }
.btn-login-gold {
  width: 100%; padding: 0.85rem; border: none; border-radius: 12px;
  background: linear-gradient(135deg, var(--gold), #d97706);
  color: #000; font-size: 1rem; font-weight: 800; cursor: pointer;
  transition: all 0.3s; letter-spacing: 1px;
  box-shadow: 0 4px 20px rgba(245,158,11,0.3);
}
.btn-login-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(245,158,11,0.5);
}
.btn-login-gold:active { transform: translateY(0); }
.login-divider { display: flex; align-items: center; gap: 0.75rem; margin: 0.75rem 0; color: var(--text-muted); font-size: 0.8rem; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--border), transparent); }
.btn-full { width: 100%; justify-content: center; }
.login-error {
  color: var(--red); font-size: 0.8rem; margin-top: 0.5rem; padding: 0.5rem;
  background: var(--red-dim); border-radius: var(--radius-sm);
  border: 1px solid rgba(239,68,68,0.2);
}
.login-tip {
  margin-top: 1.25rem; font-size: 0.75rem; color: var(--text-muted);
  padding: 0.75rem; background: rgba(139,92,246,0.06);
  border: 1px solid rgba(139,92,246,0.1);
  border-radius: 10px; line-height: 1.5; text-align: right;
}
.login-tip strong { color: var(--gold); }
.login-footer {
  margin-top: 1.25rem; font-size: 0.65rem; font-weight: 800; letter-spacing: 3px;
  color: var(--text-muted); text-transform: uppercase;
}
#google-btn-wrap { display: flex; justify-content: center; margin: 0.5rem 0; }

/* Login mobile */
@media (max-width: 480px) {
  .login-card { padding: 2rem 1.5rem; border-radius: 20px; }
  .login-title { font-size: 1.5rem; letter-spacing: 3px; }
  .login-subtitle { font-size: 0.5rem; letter-spacing: 4px; }
  .login-logo { font-size: 3rem; }
  .login-rank { width: 24px; height: 24px; font-size: 0.6rem; }
  .login-input { font-size: 16px !important; } /* prevents zoom on iOS */
  .btn-login-main, .btn-login-gold { padding: 0.75rem; font-size: 0.95rem; }
}

/* ═══════════ TIP CARDS ═══════════ */
.tip-card {
  display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem;
  background: linear-gradient(135deg, rgba(139,92,246,0.08), rgba(245,158,11,0.05));
  border-color: rgba(139,92,246,0.2); margin-bottom: 1.25rem;
}
.tip-icon { font-size: 1.5rem; }
.tip-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.tip-text { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; margin-top: 0.15rem; }
.card-tip { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.75rem; line-height: 1.5; padding: 0.4rem 0.6rem; background: rgba(139,92,246,0.04); border-radius: var(--radius-sm); border-right: 2px solid var(--purple-dim); }
.card-tip strong { color: var(--gold); }

.player-name-text { font-size: 0.85rem; color: var(--text-secondary); }

/* Daily Countdown Timer */
.daily-timer {
  display: flex; align-items: center; gap: 6px; padding: 4px 12px;
  background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.2);
  border-radius: 8px; font-size: 0.8rem;
}
.timer-label { color: var(--text-muted); }
.timer-value {
  color: var(--gold); font-weight: 700; font-size: 0.9rem; font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}

/* AI animated dots */
.ai-dots span { animation: dotBlink 1.4s ease-in-out infinite; }
.ai-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBlink { 0%,60%,100% { opacity: 0; } 30% { opacity: 1; } }

/* ═══════════ ANIMATIONS ═══════════ */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes pulseGlow { 0%,100% { filter: drop-shadow(0 0 8px rgba(139,92,246,0.4)); } 50% { filter: drop-shadow(0 0 20px rgba(139,92,246,0.8)); } }
@keyframes glowText { 0%,100% { text-shadow: 0 0 8px rgba(139,92,246,0.3); } 50% { text-shadow: 0 0 20px rgba(139,92,246,0.7), 0 0 40px rgba(139,92,246,0.3); } }
@keyframes xpPulse { 0%,100% { box-shadow: 0 0 4px rgba(139,92,246,0.3); } 50% { box-shadow: 0 0 16px rgba(139,92,246,0.6); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes particle { 0% { transform: translateY(0) scale(1); opacity:0.6; } 100% { transform: translateY(-400px) scale(0); opacity:0; } }
@keyframes bounceIn { 0% { transform: scale(0); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes checkPop { 0% { transform: scale(0) rotate(-45deg); } 60% { transform: scale(1.3) rotate(10deg); } 100% { transform: scale(1) rotate(0); } }

.animate-float { animation: float 3s ease-in-out infinite; }
.animate-pulse-glow { animation: pulseGlow 2s ease-in-out infinite; }
.animate-glow { animation: glowText 2s ease-in-out infinite; }

/* Card entrance animations */
.card { animation: fadeInUp 0.5s ease-out both; }
.card:nth-child(2) { animation-delay: 0.08s; }
.card:nth-child(3) { animation-delay: 0.16s; }
.card:nth-child(4) { animation-delay: 0.24s; }
.card:nth-child(5) { animation-delay: 0.32s; }

/* Tab section entrance */
.tab-section.active { animation: fadeIn 0.4s ease-out; }

/* Player bar animations */
.xp-fill { transition: width 1s cubic-bezier(0.25,1,0.5,1); animation: xpPulse 2s ease-in-out infinite; }
.rank-badge { transition: all 0.5s; animation: pulseGlow 3s ease-in-out infinite; }
.player-bar { animation: slideInRight 0.5s ease-out; }

/* Quest/habit check animation */
.quest-check.checked, .habit-check.checked { animation: checkPop 0.4s ease-out; }
.quest-item.done .quest-text { transition: all 0.3s; }

/* Hover effects */
.nav-item { transition: all 0.25s ease; }
.nav-item:hover { transform: translateX(-4px); }
.nav-item.active { border-left: 3px solid var(--purple); }
.btn { transition: all 0.2s ease; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

/* Sidebar animation */
.sidebar { transition: transform 0.35s cubic-bezier(0.4,0,0.2,1); }

/* Toast animation */
.toast { transition: all 0.3s ease; }
.toast.show { animation: slideInLeft 0.3s ease-out; }

/* ═══════════ ONBOARDING ═══════════ */
.onboarding { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; }
.onboarding-overlay { position: absolute; inset: 0; background: rgba(4,4,10,0.92); backdrop-filter: blur(8px); }
.onboarding-card {
  position: relative; z-index: 1; width: 480px; max-width: 92vw; padding: 40px 36px;
  background: linear-gradient(160deg, #0f1119 0%, #161825 100%);
  border: 1px solid var(--border-light); border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 40px rgba(139,92,246,0.1);
  animation: scaleIn 0.5s ease-out;
  overflow: hidden;
}
.onboarding-particles span {
  position: absolute; width: 4px; height: 4px; background: var(--purple); border-radius: 50%;
  animation: particle 4s linear infinite; opacity: 0;
}
.onboarding-particles span:nth-child(1) { left: 10%; animation-delay: 0s; animation-duration: 5s; }
.onboarding-particles span:nth-child(2) { left: 25%; animation-delay: 0.8s; animation-duration: 4s; }
.onboarding-particles span:nth-child(3) { left: 40%; animation-delay: 1.5s; animation-duration: 6s; }
.onboarding-particles span:nth-child(4) { left: 55%; animation-delay: 0.3s; animation-duration: 4.5s; background: var(--gold); }
.onboarding-particles span:nth-child(5) { left: 70%; animation-delay: 2s; animation-duration: 5.5s; }
.onboarding-particles span:nth-child(6) { left: 85%; animation-delay: 1s; animation-duration: 3.5s; background: var(--gold); }
.onboarding-particles span:nth-child(7) { left: 15%; animation-delay: 2.5s; animation-duration: 4s; }
.onboarding-particles span:nth-child(8) { left: 60%; animation-delay: 0.5s; animation-duration: 5s; }

.onboard-step { display: none; text-align: center; animation: fadeInUp 0.5s ease-out; }
.onboard-step.active { display: block; }
.onboard-icon { font-size: 3rem; margin-bottom: 16px; display: inline-block; }
.onboard-title { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); margin-bottom: 12px; }
.onboard-text { font-size: 0.95rem; color: var(--text-secondary); line-height: 1.7; margin-bottom: 10px; }
.onboard-text strong { color: var(--purple-light); }
.onboard-sub { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; margin-top: 8px; }
.onboard-sub strong { color: var(--gold); }
.onboard-preview {
  margin: 16px auto; padding: 12px 20px; background: rgba(139,92,246,0.08);
  border: 1px solid rgba(139,92,246,0.15); border-radius: 10px;
  font-size: 0.9rem; color: var(--text-secondary);
}
.onboard-ranks { display: flex; gap: 10px; justify-content: center; margin: 16px 0; }
.rank-mini {
  width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; font-size: 0.9rem; animation: bounceIn 0.5s ease-out both;
}
.rank-mini:nth-child(2) { animation-delay: 0.1s; }
.rank-mini:nth-child(3) { animation-delay: 0.2s; }
.rank-mini:nth-child(4) { animation-delay: 0.3s; }
.rank-mini:nth-child(5) { animation-delay: 0.4s; }
.rank-mini:nth-child(6) { animation-delay: 0.5s; }

.onboard-nav { margin-top: 28px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.onboard-dots { display: flex; gap: 8px; }
.onboard-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--border-light);
  transition: all 0.3s; cursor: pointer;
}
.onboard-dot.active { background: var(--purple); box-shadow: 0 0 8px rgba(139,92,246,0.5); transform: scale(1.3); }
.onboard-btns { display: flex; gap: 12px; }

/* ═══════════ QUESTIONNAIRE ═══════════ */
.q-fields { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; text-align: right; }
.q-row { display: flex; gap: 12px; }
.q-row .q-field { flex: 1; }
.q-field { display: flex; flex-direction: column; gap: 4px; }
.q-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }
.q-options { display: flex; gap: 8px; flex-wrap: wrap; }
.q-opt {
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-input); color: var(--text-secondary); cursor: pointer;
  font-size: 0.85rem; transition: all 0.2s; font-family: inherit;
}
.q-opt:hover { border-color: var(--purple); color: var(--text-primary); }
.q-opt.selected { background: rgba(139,92,246,0.15); border-color: var(--purple); color: var(--purple-light); font-weight: 600; }
.q-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.q-chip {
  padding: 8px 16px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--bg-input); color: var(--text-secondary); cursor: pointer;
  font-size: 0.85rem; transition: all 0.25s; font-family: inherit;
}
.q-chip:hover { border-color: var(--purple); transform: translateY(-2px); }
.q-chip.selected {
  background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(109,40,217,0.15));
  border-color: var(--purple); color: var(--purple-light); font-weight: 600;
  box-shadow: 0 2px 12px rgba(139,92,246,0.2);
}

/* ═══════════ NEW SECTIONS STYLES ═══════════ */
.commitment-box { padding: 16px; background: rgba(245,158,11,0.05); border: 1px solid rgba(245,158,11,0.15); border-radius: 12px; }
.commitment-text { font-size: 1.1rem; font-weight: 700; color: var(--gold); text-align: center; margin-bottom: 12px; }
.commitment-progress { text-align: center; color: var(--text-secondary); font-size: 0.9rem; }
.chips-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { padding: 6px 14px; border-radius: 20px; background: rgba(139,92,246,0.1); border: 1px solid rgba(139,92,246,0.2); color: var(--purple-light); font-size: 0.85rem; display: flex; align-items: center; gap: 6px; }
.chip-remove { cursor: pointer; opacity: 0.5; font-size: 0.75rem; }
.chip-remove:hover { opacity: 1; color: var(--red); }
.comfort-suggestion { padding: 16px; background: rgba(139,92,246,0.06); border: 1px dashed rgba(139,92,246,0.3); border-radius: 10px; text-align: center; font-size: 1rem; color: var(--text-primary); line-height: 1.6; }
.comfort-active-text { font-size: 1.1rem; font-weight: 700; color: var(--purple-light); padding: 12px; background: rgba(139,92,246,0.08); border-radius: 10px; }
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; font-size: 0.85rem; background: rgba(255,255,255,0.02); border: 1px solid var(--border); }
.history-item.done { border-color: rgba(16,185,129,0.3); }
.history-item.skipped { border-color: rgba(239,68,68,0.2); opacity: 0.6; }
.history-date { color: var(--text-muted); font-size: 0.75rem; min-width: 60px; }
.beliefs-list { display: flex; flex-direction: column; gap: 10px; }
.belief-item { padding: 12px; border-radius: 10px; background: rgba(139,92,246,0.04); border: 1px solid var(--border); }
.belief-negative { color: var(--red); font-size: 0.85rem; text-decoration: line-through; opacity: 0.7; }
.belief-positive { color: var(--green); font-size: 0.9rem; font-weight: 600; margin-top: 4px; }
.belief-remove { float: left; cursor: pointer; color: var(--text-muted); font-size: 0.75rem; }
.belief-remove:hover { color: var(--red); }
.mindset-flip { padding: 16px; background: rgba(139,92,246,0.04); border-radius: 12px; }
.routine-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.routine-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; background: rgba(255,255,255,0.02); border: 1px solid var(--border); font-size: 0.88rem; }
.routine-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; transition: all 0.2s; }
.routine-check.checked { background: var(--green); border-color: var(--green); color: #fff; }
.routine-remove { margin-right: auto; cursor: pointer; color: var(--text-muted); font-size: 0.75rem; }
.routine-remove:hover { color: var(--red); }
.reflection-questions { display: flex; flex-direction: column; gap: 14px; }
.vision-fields { display: flex; flex-direction: column; gap: 12px; }
.progress-chart { padding: 16px; background: rgba(139,92,246,0.03); border-radius: 12px; min-height: 260px; }

/* ═══════════ AI CHAT ═══════════ */
.ai-fab {
  position: fixed; bottom: 24px; left: 24px; z-index: 1000;
  width: 60px; height: 60px; border-radius: 50%; border: 2px solid var(--purple);
  background: linear-gradient(135deg, var(--purple), #6d28d9); color: #fff;
  font-size: 1.6rem; cursor: pointer; box-shadow: 0 4px 20px rgba(139,92,246,0.5);
  transition: all 0.3s; display: flex; align-items: center; justify-content: center;
}
.ai-fab:hover { transform: scale(1.1); box-shadow: 0 6px 30px rgba(139,92,246,0.7); }

.ai-chat {
  position: fixed; bottom: 96px; left: 24px; z-index: 1001;
  width: 380px; max-height: 520px; border-radius: 16px;
  background: var(--bg-card); border: 1px solid var(--border-light);
  box-shadow: 0 12px 40px rgba(0,0,0,0.6); display: flex; flex-direction: column;
  overflow: hidden; animation: aiSlideUp 0.3s ease-out;
}
@keyframes aiSlideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.ai-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(109,40,217,0.1));
  border-bottom: 1px solid var(--border);
}
.ai-chat-title { font-weight: 700; color: var(--purple-light); font-size: 0.95rem; }
.ai-chat-close { background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; padding: 4px; }
.ai-chat-close:hover { color: var(--text-primary); }

.ai-messages {
  flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px;
  max-height: 380px; min-height: 200px;
}
.ai-msg {
  padding: 10px 14px; border-radius: 12px; font-size: 0.88rem; line-height: 1.6;
  max-width: 90%; word-wrap: break-word; white-space: pre-wrap;
}
.ai-bot {
  background: rgba(139,92,246,0.1); border: 1px solid rgba(139,92,246,0.2);
  color: var(--text-primary); align-self: flex-start; border-top-right-radius: 4px;
}
.ai-user {
  background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.2);
  color: var(--text-primary); align-self: flex-end; border-top-left-radius: 4px;
}
.ai-typing { color: var(--text-muted); font-style: italic; font-size: 0.82rem; }

.ai-input-wrap {
  display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border);
  background: var(--bg-input);
}
.ai-input {
  flex: 1; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; color: var(--text-primary); font-size: 0.88rem; outline: none;
  font-family: inherit;
}
.ai-input:focus { border-color: var(--purple); }
.ai-send-btn {
  background: var(--purple); border: none; border-radius: 8px; padding: 0 16px;
  color: #fff; font-size: 1.1rem; cursor: pointer; transition: background 0.2s;
}
.ai-send-btn:hover { background: #7c3aed; }

@media (max-width: 500px) {
  .ai-chat { left: 8px; right: 8px; width: auto; bottom: 88px; max-height: 65vh; }
  .ai-fab { bottom: 16px; left: 16px; width: 52px; height: 52px; font-size: 1.4rem; }
}

/* ═══════════ MOBILE BOTTOM NAV ═══════════ */
.mobile-nav {
  display: none; /* shown on mobile only */
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 300;
  background: linear-gradient(180deg, rgba(10,12,20,0.95), #0a0c14);
  border-top: 1px solid var(--border-light);
  backdrop-filter: blur(12px);
  padding: 6px 0 env(safe-area-inset-bottom, 8px);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.mobile-nav::-webkit-scrollbar { display: none; }
.mobile-nav-inner {
  display: flex; justify-content: flex-start; min-width: max-content; padding: 0 8px;
}
.mobile-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 12px; color: var(--text-muted); text-decoration: none;
  cursor: pointer; transition: all 0.2s; min-width: 56px; flex-shrink: 0;
  border-radius: 10px; font-size: 0.65rem; font-weight: 600;
}
.mobile-nav-item .mnav-icon { font-size: 1.2rem; transition: transform 0.2s; }
.mobile-nav-item:active .mnav-icon { transform: scale(1.3); }
.mobile-nav-item.active {
  color: var(--purple);
  background: rgba(139,92,246,0.1);
}
.mobile-nav-item.active .mnav-icon { transform: scale(1.15); }

/* ═══════════ ACHIEVEMENT POPUP ═══════════ */
.achievement-popup {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 5000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4,4,10,0.85); backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.achievement-popup.show { opacity: 1; pointer-events: auto; }
.achievement-card {
  text-align: center; padding: 40px 50px; border-radius: 20px;
  background: linear-gradient(160deg, #161825 0%, #1a1d30 100%);
  border: 2px solid var(--gold); box-shadow: 0 0 60px rgba(245,158,11,0.3), 0 0 120px rgba(139,92,246,0.15);
  animation: achieveBounce 0.6s ease-out;
  max-width: 90vw;
}
.achievement-icon { font-size: 4rem; margin-bottom: 12px; animation: float 2s ease-in-out infinite; }
.achievement-title { font-size: 1.6rem; font-weight: 900; color: var(--gold); margin-bottom: 8px;
  text-shadow: 0 0 20px rgba(245,158,11,0.4); }
.achievement-sub { font-size: 1rem; color: var(--text-secondary); margin-bottom: 6px; }
.achievement-xp { font-size: 1.3rem; font-weight: 800; color: var(--purple); margin: 12px 0; }
.achievement-close {
  margin-top: 16px; padding: 10px 32px; border: 2px solid var(--gold); border-radius: 10px;
  background: transparent; color: var(--gold); font-weight: 700; cursor: pointer;
  font-size: 0.9rem; transition: all 0.2s; font-family: inherit;
}
.achievement-close:hover { background: var(--gold); color: #000; }
@keyframes achieveBounce {
  0% { transform: scale(0.3) rotate(-5deg); opacity: 0; }
  50% { transform: scale(1.08) rotate(1deg); }
  100% { transform: scale(1) rotate(0); }
}

/* Confetti particles */
.confetti-container { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 5001; pointer-events: none; overflow: hidden; }
.confetti-piece {
  position: absolute; top: -20px; width: 10px; height: 10px; border-radius: 2px;
  animation: confettiFall 3s linear forwards;
}
@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ═══════════ NON-NEGOTIABLES ═══════════ */
.nonneg-card { border-color: rgba(239,68,68,0.3); background: linear-gradient(135deg, var(--bg-card), rgba(239,68,68,0.03)); }
.nonneg-item {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 0.85rem;
  background: var(--bg-input); border-radius: var(--radius-sm);
  border: 1px solid var(--border); border-right: 3px solid var(--red);
  transition: all 0.2s; cursor: pointer;
}
.nonneg-item.done { border-right-color: var(--green); background: rgba(16,185,129,0.05); }
.nonneg-item .habit-check { border-color: var(--red); }
.nonneg-item.done .habit-check { background: var(--green); border-color: var(--green); color: #fff; }
.nonneg-item .habit-name { font-weight: 700; }
.nonneg-warning {
  margin-top: 12px; padding: 10px 14px; border-radius: 8px;
  background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.2);
  color: var(--red); font-size: 0.8rem; font-weight: 600; text-align: center;
  animation: pulseGlow 2s ease-in-out infinite;
}

/* ═══════════ BATTLE LOG (FAILURES) ═══════════ */
.failure-item {
  padding: 14px; border-radius: 10px; margin-bottom: 10px;
  background: rgba(239,68,68,0.04); border: 1px solid rgba(239,68,68,0.15);
  border-right: 3px solid var(--red);
}
.failure-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.failure-date { font-size: 0.75rem; color: var(--text-muted); }
.failure-text { font-size: 0.9rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.failure-trigger { font-size: 0.8rem; color: var(--orange); }
.failure-lesson { font-size: 0.8rem; color: var(--green); margin-top: 4px; font-style: italic; }

/* ═══════════ COMFORT DIFFICULTY ═══════════ */
.difficulty-select { display: flex; gap: 8px; margin: 12px 0; justify-content: center; }
.diff-btn {
  padding: 6px 18px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--bg-input); color: var(--text-secondary); cursor: pointer;
  font-size: 0.82rem; font-weight: 600; transition: all 0.2s; font-family: inherit;
}
.diff-btn:hover { border-color: var(--text-muted); }
.diff-btn.active-easy { background: rgba(16,185,129,0.15); border-color: var(--green); color: var(--green); }
.diff-btn.active-medium { background: rgba(245,158,11,0.15); border-color: var(--gold); color: var(--gold); }
.diff-btn.active-extreme { background: rgba(239,68,68,0.15); border-color: var(--red); color: var(--red); box-shadow: 0 0 12px rgba(239,68,68,0.2); }

/* ═══════════ AI MODE TOGGLE ═══════════ */
.ai-mode-btn {
  padding: 4px 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg-input); color: var(--text-muted); cursor: pointer;
  font-size: 0.7rem; font-weight: 700; transition: all 0.2s; font-family: inherit;
}
.ai-mode-btn.tough { background: rgba(239,68,68,0.15); border-color: var(--red); color: var(--red); }

/* ═══════════ DAMAGE TOAST ═══════════ */
.toast-damage {
  background: linear-gradient(135deg, var(--red), #dc2626) !important;
  box-shadow: 0 8px 30px rgba(239,68,68,0.4) !important;
}
.toast-success {
  background: linear-gradient(135deg, var(--green), #059669) !important;
  box-shadow: 0 8px 30px rgba(16,185,129,0.4) !important;
}
.toast-levelup {
  background: linear-gradient(135deg, var(--gold), #d97706) !important;
  color: #000 !important;
  box-shadow: 0 8px 30px rgba(245,158,11,0.5) !important;
  font-size: 1rem !important;
}

/* ═══════════ MORNING TIMER ═══════════ */
.morning-timer-wrap {
  padding: 20px; text-align: center; background: linear-gradient(135deg, rgba(245,158,11,0.06), rgba(139,92,246,0.04));
  border-radius: 12px; border: 1px solid rgba(245,158,11,0.15);
}
.morning-timer-step {
  font-size: 1.3rem; font-weight: 800; color: var(--gold); margin-bottom: 8px;
}
.morning-timer-name {
  font-size: 1rem; color: var(--text); margin-bottom: 12px;
}
.morning-timer-display {
  font-size: 3rem; font-weight: 900; font-variant-numeric: tabular-nums;
  color: var(--purple); letter-spacing: 2px; margin: 8px 0;
  text-shadow: 0 0 20px rgba(139,92,246,0.4);
}
.morning-timer-controls { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }

/* ═══════════ SUGGESTION CHIPS ═══════════ */
.suggest-chips {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px;
}
.suggest-chip {
  background: rgba(139,92,246,0.1); border: 1px solid rgba(139,92,246,0.25);
  color: var(--purple-light); padding: 4px 10px; border-radius: 20px;
  font-size: 0.75rem; cursor: pointer; transition: all 0.2s;
  white-space: nowrap; user-select: none;
}
.suggest-chip:hover {
  background: rgba(139,92,246,0.25); border-color: var(--purple);
  transform: scale(1.05);
}
.suggest-chip:active { transform: scale(0.95); }
.suggest-chip.chip-gold {
  background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.25);
  color: var(--gold);
}
.suggest-chip.chip-gold:hover {
  background: rgba(245,158,11,0.25); border-color: var(--gold);
}
.suggest-chip.chip-green {
  background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.25);
  color: var(--green);
}
.suggest-chip.chip-green:hover {
  background: rgba(16,185,129,0.25); border-color: var(--green);
}
.suggest-chip.chip-red {
  background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.25);
  color: var(--red);
}
.suggest-chip.chip-red:hover {
  background: rgba(239,68,68,0.25); border-color: var(--red);
}
.suggest-label {
  font-size: 0.7rem; color: var(--text-muted); margin: 8px 0 4px;
  display: flex; align-items: center; gap: 4px;
}
.suggest-label::before {
  content: '💡'; font-size: 0.8rem;
}
.btn-ai-suggest {
  background: linear-gradient(135deg, var(--purple), var(--gold));
  color: #fff; border: none; padding: 5px 12px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  transition: all 0.2s; margin: 4px 0;
}
.btn-ai-suggest:hover {
  transform: scale(1.05); box-shadow: 0 0 12px rgba(139,92,246,0.4);
}
.btn-ai-suggest:active { transform: scale(0.95); }
.xp-quick-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px; margin-top: 8px;
}
.xp-quick-btn {
  background: rgba(139,92,246,0.08); border: 1px solid rgba(139,92,246,0.2);
  color: var(--text); padding: 8px 10px; border-radius: 8px;
  font-size: 0.8rem; cursor: pointer; transition: all 0.2s;
  text-align: center; display: flex; flex-direction: column; gap: 2px;
}
.xp-quick-btn:hover {
  background: rgba(139,92,246,0.2); border-color: var(--purple);
  transform: translateY(-1px);
}
.xp-quick-btn .xp-quick-label { font-weight: 600; }
.xp-quick-btn .xp-quick-xp { font-size: 0.7rem; color: var(--gold); font-weight: 700; }
