/* ═══════════════════════════════════════════
   DECADE CLOCK — style.css
   Dark cinematic · Bebas Neue + Outfit
═══════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #080810;
  --bg2:       #0e0e1a;
  --card:      #12121f;
  --card2:     #1a1a2e;
  --border:    rgba(255,255,255,0.06);
  --border2:   rgba(255,255,255,0.12);

  --gold:      #f5c518;
  --gold2:     #ffd84d;
  --cyan:      #00e5ff;
  --ghost:     rgba(0,229,255,0.55);
  --red:       #ff4d6d;
  --green:     #39ff82;
  --purple:    #c084fc;

  --text:      #e8e8f0;
  --muted:     #5a5a7a;
  --muted2:    #8888aa;

  --radius:    16px;
  --ease:      cubic-bezier(0.4,0,0.2,1);
  --t:         0.3s;
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── PARTICLE CANVAS ── */
#particle-canvas {
  position: fixed; inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
}

/* ── NOISE OVERLAY ── */
.noise-overlay {
  position: fixed; inset: 0; z-index: 1;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  opacity: 0.5;
}

/* ════════════════════════════════
   INTRO SCREEN
════════════════════════════════ */
.intro-screen {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 0%, rgba(245,197,24,0.08) 0%, transparent 60%),
              var(--bg);
  padding: 24px;
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.intro-screen.fade-out {
  opacity: 0; transform: scale(0.96); pointer-events: none;
}

.intro-inner {
  text-align: center;
  max-width: 560px;
  animation: introReveal 1s var(--ease) both;
}
@keyframes introReveal {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.intro-eyebrow {
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 20px;
}

.intro-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(72px, 18vw, 140px);
  line-height: 0.9;
  letter-spacing: 0.02em;
  color: #fff;
}
.intro-title-ghost {
  color: transparent;
  -webkit-text-stroke: 2px var(--gold);
  text-shadow: 0 0 60px rgba(245,197,24,0.3);
}

.intro-desc {
  font-size: 16px;
  line-height: 1.8;
  color: var(--muted2);
  margin: 28px auto;
  max-width: 420px;
}
.intro-desc strong { color: var(--text); }

.intro-stats-row {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin: 32px 0;
}
.intro-stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.is-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 40px;
  color: var(--gold);
  line-height: 1;
}
.is-label { font-size: 11px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }

.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 18px 44px;
  background: var(--gold);
  color: #080810;
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: none; border-radius: 99px;
  cursor: pointer;
  box-shadow: 0 0 50px rgba(245,197,24,0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}
.cta-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 0 80px rgba(245,197,24,0.55);
}
.cta-btn:active { transform: scale(0.98); }

.intro-note {
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.05em;
}

/* ════════════════════════════════
   APP
════════════════════════════════ */
.app {
  position: relative; z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app.hidden { display: none; }

/* ── TOP NAV ── */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(8,8,16,0.8);
  backdrop-filter: blur(20px);
  position: sticky; top: 0; z-index: 50;
}

.nav-brand {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 24px;
  letter-spacing: 0.08em;
  color: #fff;
}
.nav-brand span { color: var(--gold); }

.nav-center {
  font-size: 13px;
  color: var(--muted2);
}
.nav-center strong { color: var(--gold); font-size: 15px; }

.ghost-toggle-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 18px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 99px;
  color: var(--muted2);
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t) var(--ease);
}
.ghost-toggle-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.ghost-toggle-btn.active {
  background: rgba(0,229,255,0.1);
  border-color: var(--cyan);
  color: var(--cyan);
}
.ghost-badge {
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(255,255,255,0.07);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.ghost-toggle-btn.active .ghost-badge {
  background: var(--cyan);
  color: #080810;
}

/* ── MAIN LAYOUT ── */
.main-layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ════════════════════════════════
   HABITS PANEL (LEFT)
════════════════════════════════ */
.habits-panel {
  width: 360px;
  min-width: 320px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 28px 24px;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(18,18,31,0.9) 0%, rgba(8,8,16,0.7) 100%);
}

.panel-header { margin-bottom: 24px; }
.panel-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  letter-spacing: 0.06em;
  color: #fff;
  margin-bottom: 6px;
}
.panel-sub { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* AGE STEPPER */
.habit-age-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.age-label { font-size: 12px; color: var(--muted2); }
.age-stepper { display: flex; align-items: center; gap: 14px; }
.age-btn {
  width: 30px; height: 30px;
  background: var(--card2); border: 1px solid var(--border2);
  border-radius: 8px; color: #fff;
  font-size: 18px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.age-btn:hover { background: var(--gold); color: #080810; border-color: var(--gold); }
.age-val {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 32px; color: var(--gold); line-height: 1;
  min-width: 40px; text-align: center;
}

/* HABIT ROWS */
.habits-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }

.habit-row {
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--t), box-shadow var(--t);
}
.habit-row:hover { border-color: rgba(245,197,24,0.2); }
.habit-row.active-slide {
  border-color: rgba(245,197,24,0.4);
  box-shadow: 0 0 20px rgba(245,197,24,0.08);
}

.habit-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.habit-emoji { font-size: 16px; flex-shrink: 0; }
.habit-info { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.habit-name { font-size: 13px; font-weight: 600; color: var(--text); }
.habit-unit { font-size: 10px; color: var(--muted); letter-spacing: 0.04em; }
.habit-val {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 26px;
  color: var(--gold);
  line-height: 1;
  min-width: 32px;
  text-align: right;
  transition: transform 0.15s;
}
.habit-val.pop { transform: scale(1.3); }

/* SLIDER */
.slider-wrap { position: relative; margin-bottom: 8px; }
.hslider-track {
  position: relative;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 99px;
}
.hslider-fill {
  position: absolute;
  top: 0; left: 0; height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold), var(--gold2));
  box-shadow: 0 0 8px rgba(245,197,24,0.5);
  pointer-events: none;
  transition: width 0.15s ease;
}
.hslider {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  margin: 0; padding: 0;
}
.hslider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--gold);
  box-shadow: 0 0 10px rgba(245,197,24,0.8);
  cursor: pointer;
}
.hslider::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--gold);
}
.hslider-track { overflow: visible; }

.habit-impact {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  min-height: 14px;
  transition: color 0.3s;
}
.impact-pos { color: var(--green); }
.impact-neg { color: var(--red); }
.impact-neu { color: var(--muted2); }

/* OPTIMIZE BTN */
.optimize-btn {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, rgba(245,197,24,0.15), rgba(245,197,24,0.05));
  border: 1px solid rgba(245,197,24,0.3);
  border-radius: var(--radius);
  color: var(--gold);
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.25s var(--ease);
}
.optimize-btn:hover {
  background: rgba(245,197,24,0.2);
  border-color: var(--gold);
  box-shadow: 0 0 30px rgba(245,197,24,0.2);
  transform: translateY(-2px);
}
.optimize-btn.optimizing { animation: optimizePulse 0.6s ease; }
@keyframes optimizePulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.02); box-shadow: 0 0 40px rgba(245,197,24,0.4); }
}

/* ════════════════════════════════
   FUTURE PANEL (RIGHT)
════════════════════════════════ */
.future-panel {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
}

/* TRAJECTORY BLOCK */
.traj-block {
  padding: 22px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}
.traj-block::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(245,197,24,0.04), transparent 60%);
  pointer-events: none;
}

.traj-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.traj-label {
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted2);
}
.traj-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 52px;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(245,197,24,0.4);
  transition: text-shadow 0.3s;
}

.traj-track {
  height: 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 99px;
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
}
.traj-fill {
  position: absolute; top: 0; left: 0;
  height: 100%; width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--red), var(--gold), var(--green));
  background-size: 300% 100%;
  transition: width 0.9s var(--ease), background-position 0.9s;
}
.traj-glow {
  position: absolute; top: 0; left: 0;
  height: 100%; width: 0%;
  border-radius: 99px;
  background: inherit;
  filter: blur(6px); opacity: 0.6;
  transition: width 0.9s var(--ease);
}

.traj-verdict {
  font-size: 13px;
  color: var(--muted2);
  font-weight: 500;
  letter-spacing: 0.01em;
  min-height: 18px;
  transition: color 0.4s;
}

/* SECTION HEADERS */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 0.06em;
  color: #fff;
}
.tl-legend { display: flex; gap: 16px; font-size: 12px; }
.leg-you   { color: var(--gold); }
.leg-ghost { color: var(--cyan); }
.leg-ghost.hidden { display: none; }

/* ── TIMELINE ── */
.timeline-scroll { margin-bottom: 28px; }

.timeline {
  position: relative;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Vertical line */
.timeline::before {
  content: '';
  position: absolute;
  left: 100px;
  top: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(180deg,
    transparent 0%,
    var(--border2) 10%,
    var(--border2) 90%,
    transparent 100%);
}

.tl-item {
  display: flex;
  align-items: flex-start;
  gap: 0;
  position: relative;
  padding: 16px 0;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.tl-item.visible { opacity: 1; transform: translateY(0); }

.tl-age {
  width: 100px;
  flex-shrink: 0;
  padding-right: 24px;
  text-align: right;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  line-height: 1;
  color: var(--muted);
  padding-top: 4px;
  transition: color 0.3s;
}
.tl-item.current .tl-age { color: var(--gold); }

/* Node dot */
.tl-node {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--card2);
  border: 2px solid var(--muted);
  flex-shrink: 0;
  margin-top: 8px;
  position: relative; z-index: 2;
  transition: all 0.4s var(--ease);
}
.tl-item.current .tl-node {
  width: 16px; height: 16px;
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(245,197,24,0.7);
  margin-top: 5px;
}
.tl-item.milestone .tl-node {
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 16px rgba(57,255,130,0.5);
}
.tl-item.warning .tl-node {
  background: var(--red);
  border-color: var(--red);
  box-shadow: 0 0 16px rgba(255,77,109,0.5);
}

.tl-content {
  flex: 1;
  padding-left: 20px;
  padding-right: 16px;
}
.tl-event-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  line-height: 1.3;
}
.tl-event-desc {
  font-size: 12px;
  color: var(--muted2);
  line-height: 1.5;
}
.tl-ghost-note {
  font-size: 11px;
  color: var(--cyan);
  margin-top: 5px;
  font-style: italic;
  display: none;
}
.ghost-active .tl-ghost-note { display: block; }

.tl-badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 5px;
}
.badge-great { background: rgba(57,255,130,0.12); color: var(--green); border: 1px solid rgba(57,255,130,0.3); }
.badge-warn  { background: rgba(255,77,109,0.12);  color: var(--red);   border: 1px solid rgba(255,77,109,0.3); }
.badge-info  { background: rgba(245,197,24,0.1);   color: var(--gold);  border: 1px solid rgba(245,197,24,0.25); }

/* ── GHOST PANEL ── */
.ghost-panel {
  padding: 20px 22px;
  background: rgba(0,229,255,0.04);
  border: 1px solid rgba(0,229,255,0.2);
  border-radius: var(--radius);
  margin-bottom: 28px;
}
.ghost-panel.hidden { display: none; }

.ghost-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.04em;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ghost-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.ghost-compare-item {
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.gci-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.gci-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.gci-key { font-size: 11px; color: var(--muted2); }
.gci-val-now { font-size: 13px; font-weight: 600; color: var(--text); }
.gci-val-ghost {
  font-size: 13px; font-weight: 600; color: var(--cyan);
  display: flex; align-items: center; gap: 4px;
}
.gci-delta {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 99px;
  font-weight: 700;
}
.delta-pos { background: rgba(57,255,130,0.15); color: var(--green); }
.delta-neg { background: rgba(255,77,109,0.15);  color: var(--red); }

/* ── METRICS GRID ── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.metric-card {
  padding: 18px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  transition: transform var(--t), box-shadow var(--t);
}
.metric-card:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(0,0,0,0.4); }

.metric-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--mc-color, var(--gold));
  opacity: 0.6;
}

.metric-emoji { font-size: 22px; margin-bottom: 10px; display: block; }
.metric-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 6px;
}
.metric-value {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  line-height: 1;
  color: var(--text);
  margin-bottom: 4px;
}
.metric-sublabel {
  font-size: 11px;
  color: var(--muted2);
}

/* ── BOTTOM ACTIONS ── */
.bottom-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
}
.action-btn {
  padding: 13px 28px;
  border-radius: 99px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--muted2);
}
.action-btn:hover { border-color: var(--gold); color: var(--gold); }
.action-btn.primary {
  background: var(--gold);
  color: #080810;
  border-color: var(--gold);
}
.action-btn.primary:hover {
  box-shadow: 0 0 40px rgba(245,197,24,0.4);
  transform: translateY(-2px);
}

.share-toast {
  text-align: center;
  font-size: 13px;
  color: var(--green);
  padding: 10px;
  animation: toastIn 0.3s var(--ease);
}
.share-toast.hidden { display: none; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── HIDDEN ── */
.hidden { display: none !important; }

/* ════════════════════════════════
   SCROLLBAR
════════════════════════════════ */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 99px; }

/* ════════════════════════════════
   RESPONSIVE
════════════════════════════════ */
@media (max-width: 860px) {
  .main-layout { flex-direction: column; }
  .habits-panel {
    width: 100%; min-width: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 420px;
    overflow-y: auto;
  }
  .future-panel { padding: 20px 16px; }
  .timeline::before { left: 64px; }
  .tl-age { width: 64px; font-size: 22px; }
  .ghost-grid { grid-template-columns: 1fr 1fr; }
  .top-nav { padding: 12px 16px; }
  .nav-center { display: none; }
}

@media (max-width: 520px) {
  .intro-stats-row { gap: 20px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
}

/* ════════════════════════════════
   LOAD ANIMATIONS
════════════════════════════════ */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.traj-block   { animation: fadeSlideUp 0.5s 0.1s var(--ease) both; }
.section-header { animation: fadeSlideUp 0.5s 0.2s var(--ease) both; }
.metrics-grid { animation: fadeSlideUp 0.5s 0.3s var(--ease) both; }
