/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #08080f;
  --card: #11111c;
  --border: #1e1e30;
  --gold: #c9a84c;
  --gold-l: #e8c96a;
  --text: #e8e8f2;
  --muted: #6b6b85;
  --green: #4caf82;
  --red: #e05c5c;
  --nav: 72px;
}

html, body { margin: 0; padding: 0; min-height: 100dvh; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif; overscroll-behavior: none; }

body { padding-bottom: var(--nav); }

::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::selection { background: rgba(201,168,76,0.2); }

/* ── Screens ─────────────────────────────────────────────────────────────── */
.screen { display: none; max-width: 480px; margin: 0 auto; padding: 24px 20px; padding-top: calc(24px + env(safe-area-inset-top)); animation: fadeIn 0.3s ease; }
.screen.active { display: block; }
.screen.fullscreen { max-width: 100%; min-height: 100dvh; display: none; flex-direction: column; align-items: center; justify-content: center; }
.screen.fullscreen.active { display: flex; }

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

/* ── Typography ──────────────────────────────────────────────────────────── */
h1 { font-size: 26px; font-weight: 700; color: var(--text); letter-spacing: -0.5px; margin: 0 0 8px; }
h2 { font-size: 16px; font-weight: 600; color: var(--text); margin: 0 0 14px; }
p { margin: 0; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 20px; margin-bottom: 16px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
button { cursor: pointer; font-family: inherit; border: none; background: none; }

.btn-primary { width: 100%; padding: 16px; background: var(--gold); color: #08080f; border-radius: 14px; font-size: 16px; font-weight: 700; transition: all 0.2s; }
.btn-primary:hover { background: var(--gold-l); }
.btn-primary:disabled { background: var(--border); color: var(--muted); cursor: not-allowed; }

.btn-ghost { padding: 8px 14px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; color: var(--muted); font-size: 13px; transition: all 0.2s; }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }

.btn-back { color: var(--muted); font-size: 15px; padding: 0; margin-bottom: 24px; display: inline-block; }

/* ── Inputs ──────────────────────────────────────────────────────────────── */
input, textarea {
  width: 100%; padding: 14px 16px; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; color: var(--text); font-size: 16px; font-family: inherit; outline: none;
  transition: border-color 0.2s; resize: none;
}
input:focus, textarea:focus { border-color: var(--gold); }
input::placeholder, textarea::placeholder { color: var(--muted); }

input[type="range"] {
  -webkit-appearance: none; appearance: none; background: var(--border);
  height: 4px; border-radius: 2px; padding: 0; border: none; width: 100%; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--gold); border: 3px solid var(--bg);
}
.scale-value { font-size: 52px; font-weight: 700; color: var(--gold); text-align: center; margin-bottom: 16px; }
.scale-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ── Auth Screen ─────────────────────────────────────────────────────────── */
.auth-container { width: 100%; max-width: 360px; padding: 24px; }
.auth-logo { text-align: center; margin-bottom: 40px; }
.auth-logo-icon { font-size: 40px; margin-bottom: 16px; }
.auth-logo h1 { font-size: 28px; margin: 0 0 6px; }
.auth-logo p { color: var(--muted); font-size: 14px; }
.auth-tabs { display: flex; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 20px; }
.auth-tab { flex: 1; padding: 10px; background: transparent; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; transition: all 0.2s; }
.auth-tab.active { background: var(--gold); color: #08080f; }
.auth-field { margin-bottom: 12px; }
.auth-error { color: var(--red); font-size: 13px; text-align: center; margin-bottom: 12px; display: none; }
.auth-footer { text-align: center; color: var(--muted); font-size: 12px; margin-top: 24px; line-height: 1.6; }

/* ── Nav ─────────────────────────────────────────────────────────────────── */
#bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: var(--nav);
  background: rgba(11,11,20,0.95); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border); display: flex; align-items: center;
  justify-content: space-around; padding: 0 8px; z-index: 100;
}
.nav-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 12px; flex: 1; background: none; border: none; cursor: pointer; }
.nav-btn .nav-icon { font-size: 18px; color: var(--muted); transition: color 0.2s; line-height: 1; }
.nav-btn .nav-label { font-size: 10px; color: var(--muted); font-weight: 400; transition: color 0.2s; }
.nav-btn.active .nav-icon, .nav-btn.active .nav-label { color: var(--gold); font-weight: 600; }

/* ── Home ────────────────────────────────────────────────────────────────── */
.home-greeting { color: var(--muted); font-size: 14px; margin: 0 0 4px; }
.home-name { font-size: 32px; font-weight: 700; letter-spacing: -0.8px; margin: 0 0 28px; }
.affirmation-card { background: linear-gradient(135deg, #c9a84c15, #c9a84c08); border: 1px solid #c9a84c30; border-radius: 18px; padding: 20px; margin-bottom: 24px; }
.affirmation-label { color: var(--gold); font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 10px; }
.affirmation-text { color: var(--text); font-size: 17px; line-height: 1.55; font-style: italic; }
.progress-bar-wrap { height: 4px; background: var(--border); border-radius: 2px; margin-bottom: 16px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-l)); border-radius: 2px; transition: width 0.5s ease; }
.task-card { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; margin-bottom: 10px; width: 100%; text-align: left; transition: all 0.2s; }
.task-card.done { background: #0a1a0f; border-color: #1a3d24; }
.task-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--border); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.task-card.done .task-icon { background: #1a3d24; color: var(--green); }
.task-card span { font-size: 15px; font-weight: 500; color: var(--text); flex: 1; }
.task-card.done span { color: var(--green); }
.task-arrow { color: var(--muted) !important; font-size: 16px; flex: 0 !important; }
.streak-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.streak-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px 10px; text-align: center; }
.streak-icon { font-size: 14px; margin-bottom: 4px; }
.streak-num { font-size: 26px; font-weight: 700; color: var(--muted); line-height: 1; margin-bottom: 6px; }
.streak-num.active { color: var(--gold); }
.streak-label { font-size: 11px; color: var(--muted); }

/* ── Routine ─────────────────────────────────────────────────────────────── */
.routine-tabs { display: flex; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 4px; gap: 4px; margin-bottom: 28px; }
.routine-tab { flex: 1; padding: 10px; background: transparent; border: none; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; transition: all 0.2s; position: relative; }
.routine-tab.active { background: var(--gold); color: #08080f; }
.routine-check { font-size: 9px; position: absolute; top: 4px; right: 8px; }
.routine-question { font-size: 22px; font-weight: 600; line-height: 1.4; letter-spacing: -0.3px; margin-bottom: 28px; color: var(--text); }
.routine-textarea { line-height: 1.6; }
.choice-btn { display: block; width: 100%; padding: 16px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; color: var(--text); font-size: 15px; text-align: left; margin-bottom: 10px; transition: all 0.2s; }
.choice-btn.selected { background: #c9a84c15; border-color: #c9a84c60; color: var(--gold); font-weight: 600; }
.routine-done { display: none; flex-direction: column; align-items: center; text-align: center; padding: 40px 24px; min-height: 70dvh; justify-content: center; }
.routine-done-icon { font-size: 48px; margin-bottom: 24px; }
.routine-done h2 { font-size: 24px; margin-bottom: 12px; }
.routine-done p { color: var(--muted); font-size: 15px; margin-bottom: 32px; line-height: 1.6; }
.routine-done-quote { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 20px; margin-bottom: 32px; width: 100%; max-width: 340px; }

/* ── Beliefs ─────────────────────────────────────────────────────────────── */
.beliefs-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.belief-card { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; margin-bottom: 10px; width: 100%; text-align: left; transition: all 0.2s; cursor: pointer; }
.category-badge { display: inline-block; background: #1a1a28; border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; font-size: 10px; color: var(--muted); margin-bottom: 8px; }
.belief-limiting { font-size: 14px; color: var(--text); line-height: 1.4; margin-bottom: 6px; }
.belief-reframe { font-size: 12px; color: var(--green); line-height: 1.4; }
.belief-count { background: #c9a84c20; border: 1px solid #c9a84c40; border-radius: 8px; padding: 2px 8px; font-size: 12px; color: var(--gold); font-weight: 600; flex-shrink: 0; }
.detail-box { border-radius: 16px; padding: 20px; margin-bottom: 16px; }
.detail-box.limiting { background: #1a0a0a; border: 1px solid #3d1a1a; }
.detail-box.reframe { background: #0a1a0f; border: 1px solid #1a3d24; }
.detail-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.detail-box.limiting .detail-label { color: #e07070; }
.detail-box.reframe .detail-label { color: var(--green); }
.detail-text { font-size: 16px; color: var(--text); line-height: 1.5; }
.detail-trigger { font-size: 13px; color: #a06060; margin-top: 10px; line-height: 1.5; }
.log-box { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 20px; margin-bottom: 20px; }
.log-success { color: var(--green); font-size: 15px; text-align: center; padding: 12px; display: none; }

/* ── Learn ───────────────────────────────────────────────────────────────── */
.learn-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.learn-category { font-size: 12px; font-weight: 500; margin-bottom: 20px; }
.learn-title { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.3; margin-bottom: 20px; }
.learn-box { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 20px; margin-bottom: 16px; }
.learn-box-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 10px; }
.learn-box.application { background: #c9a84c08; border-color: #c9a84c25; }
.learn-box.application .learn-box-label { color: var(--gold); }
.learn-box.application p { font-style: italic; }
.learn-concept { font-size: 15px; color: var(--text); line-height: 1.7; }
.learn-done-badge { display: none; text-align: center; padding: 18px; background: #0a1a0f; border: 1px solid #1a3d24; border-radius: 14px; color: var(--green); font-size: 16px; }

/* ── Progress ────────────────────────────────────────────────────────────── */
.prog-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 24px; }
.prog-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px 10px; text-align: center; }
.prog-streak { font-size: 28px; font-weight: 700; color: var(--muted); line-height: 1; margin-bottom: 4px; }
.prog-streak.active { color: var(--gold); }
.prog-streak-label { font-size: 10px; color: var(--muted); margin-bottom: 2px; }
.prog-streak-total { font-size: 10px; color: var(--muted); }
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week-cell { width: 100%; aspect-ratio: 1; border-radius: 10px; border: 2px solid transparent; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.mood-bars { display: flex; align-items: flex-end; height: 80px; gap: 6px; }
.total-card { background: #c9a84c08; border: 1px solid #c9a84c20; border-radius: 18px; padding: 20px; text-align: center; }
.total-num { font-size: 40px; font-weight: 700; color: var(--gold); letter-spacing: -1px; margin: 8px 0 4px; }

/* ── Utility ─────────────────────────────────────────────────────────────── */
.label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; display: block; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-muted { color: var(--muted); font-size: 14px; line-height: 1.6; }
