/* ═══════════════════════════════════════════════════════
   CHRONOSCOP II — Full Application CSS
   Aesthetic: Scientific Observatory / Dark Laboratory
   ═══════════════════════════════════════════════════════ */

:root {
  --bg:        #060810;
  --bg2:       #0a0d16;
  --bg3:       #0e1220;
  --surface:   rgba(255,255,255,0.035);
  --surface2:  rgba(255,255,255,0.06);
  --surface3:  rgba(255,255,255,0.09);
  --border:    rgba(255,255,255,0.07);
  --border2:   rgba(255,255,255,0.12);
  --text:      #ddd8cc;
  --text-dim:  rgba(221,216,204,0.4);
  --text-mid:  rgba(221,216,204,0.65);
  --accent:    #d4a85a;      /* gold — compressed/fast */
  --accent2:   #6ab0d4;     /* blue — dilated/slow */
  --accent3:   #7ec89a;     /* green — flow */
  --accent4:   #c46a7e;     /* red — stress */
  --sidebar-w: 220px;
  --header-h:  64px;
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-mono:  'DM Mono', 'Courier New', monospace;
  --radius:     2px;
  --transition: 0.22s ease;
}

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

html { font-size: 15px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  cursor: default;
}

/* Desktop only — fixed height, no scroll */
@media (min-width: 769px) {
  body {
    height: 100vh;
    overflow: hidden;
  }
  #app { height: 100vh; overflow: hidden; }
  #main { overflow: hidden; }
  .view { overflow-y: auto; }
}

/* Mobile — natural scroll */
@media (max-width: 768px) {
  html, body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}



  /* ── HAMBURGER ── */
  .hamburger-btn { display: flex; }

  /* ── OVERLAY — only blocks when sidebar open ── */
  .sidebar-overlay {
    display: block;
    pointer-events: none;
  }
  .sidebar-overlay.active {
    pointer-events: all;
  }

  /* ── SIDEBAR — fixed overlay, doesn't affect layout ── */
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 220px;
    height: 100vh;
    height: 100dvh;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    flex-direction: column;
    overflow-y: auto;
    border-right: 1px solid var(--border2);
  }

  #sidebar.open {
    transform: translateX(0);
    box-shadow: 6px 0 40px rgba(0,0,0,0.7);
  }

  /* Sidebar internals — same as desktop */
  .nav-logo { display: flex; }
  .nav-links {
    flex-direction: column;
    padding: 8px 0;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
  }
  .nav-item {
    flex-direction: row;
    gap: 12px;
    padding: 12px 20px;
    border-left: 2px solid transparent;
    border-top: none;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    min-width: unset;
    width: 100%;
    flex: unset;
    justify-content: flex-start;
    align-items: center;
    text-align: left;
  }
  .nav-item.active {
    border-left-color: var(--accent);
    border-top-color: transparent;
    background: rgba(212,168,90,0.06);
  }
  .nav-icon { font-size: 1rem; width: 20px; flex-shrink: 0; }
  .nav-footer {
    display: flex;
    flex-direction: column;
    padding: 16px;
    border-top: 1px solid var(--border);
  }

  /* ── APP — normal block layout ── */
  #app {
    display: block;
    height: auto;
    min-height: 100vh;
  }

  /* ── MAIN — normal block, full width ── */
  #main {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
  }

  /* ── VIEW — natural height, scrolled by page ── */
  .view {
    display: none;
    flex: none;
    width: 100%;
    min-height: 100vh;
    height: auto;
    overflow: visible;
    padding: 68px 14px 40px 14px;
    animation: fadeIn 0.2s ease;
  }

  .view.active {
    display: block;
  }

  .view-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
  }

  .view-header h1 { font-size: 1.4rem; }
  .header-sub { font-size: 0.6rem; }

  /* ── PROFILE MENU — centered modal on mobile ── */
  #profile-menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    bottom: auto;
    right: auto;
    width: calc(100vw - 24px);
    max-width: 340px;
    max-height: 85vh;
    overflow-y: auto;
    z-index: 400;
  }

  /* ── DASHBOARD ── */
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .card-wide, .card-full { grid-column: span 1; }
  #osc-canvas { height: 80px; }
  .osc-stats { flex-wrap: wrap; }
  .osc-stat { min-width: 33%; }
  .today-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .today-val { font-size: 1.3rem; }
  #heatmap-canvas { height: 56px; }
  .heatmap-months { font-size: 0.5rem; }
  #mini-radar { width: 160px; height: 160px; }
  .journal-quick-card textarea { height: 56px; }
  #quick-journal-recent { max-height: 100px; overflow-y: auto; }

  /* ── SESSION ── */
  .session-layout { grid-template-columns: 1fr; gap: 16px; }
  .session-side { display: none; }
  .idle-ring-wrap { width: 200px; height: 200px; }
  #session-ring-canvas { width: 200px; height: 200px; }
  .idle-time { font-size: 1.8rem; }
  .results-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .result-verdict-full { grid-column: span 2; }
  .probe-container { padding: 20px 14px; }
  .probe-question-text { font-size: 1.15rem; }
  .probe-opt-btn { padding: 11px 14px; font-size: 0.88rem; }
  .estimate-container { padding: 16px 0; }
  .estimate-container h2 { font-size: 1.2rem; }
  #estimate-display { font-size: 1.6rem; }
  .results-panel { padding: 20px 16px; }

  /* ── JOURNAL ── */
  .journal-layout {
    grid-template-columns: 1fr;
    height: auto;
    gap: 16px;
  }
  .journal-compose { height: auto; min-height: auto; }
  #journal-textarea { height: 90px; }
  .journal-meta { flex-direction: column; align-items: stretch; gap: 10px; }
  .journal-meta-left { flex-wrap: wrap; }
  .journal-timeline { max-height: none; overflow: visible; }

  /* ── ANALYTICS ── */
  .analytics-grid { grid-template-columns: 1fr; gap: 12px; }
  .global-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  #ratio-history-canvas { height: 130px; }
  .sessions-table-wrap { max-height: 280px; overflow-y: auto; }
  .sessions-table { font-size: 0.6rem; }
  .sessions-table th, .sessions-table td { padding: 5px 6px; }
  .sessions-table th:nth-child(n+6),
  .sessions-table td:nth-child(n+6) { display: none; }

  /* ── MEDITATION ── */
  .meditation-layout { grid-template-columns: 1fr; gap: 16px; }
  .meditation-side { display: none; }
  .meditation-main { width: 100%; align-items: center; }
  .breath-circle-wrap { width: 260px; height: 260px; }
  #breath-canvas { width: 260px; height: 260px; }
  .meditation-controls { width: 100%; }
  .med-duration-select { flex-wrap: wrap; justify-content: center; }

  /* ── SCIENCE ── */
  .science-layout { grid-template-columns: 1fr; gap: 16px; }
  .science-side { order: -1; }
  .dimensions-grid { grid-template-columns: 1fr; gap: 10px; }
  .einstein-formula { flex-direction: column; gap: 10px; text-align: center; }

  /* ── CARDS & BUTTONS ── */
  .card { padding: 14px 14px; }
  .card-label { font-size: 0.55rem; margin-bottom: 12px; }
  .btn-primary { padding: 10px 18px; font-size: 0.7rem; }
  .btn-lg { padding: 12px 24px; font-size: 0.76rem; }
  .btn-action { padding: 12px 24px; font-size: 0.72rem; }

  /* ── LOGIN ── */
  .login-wrap { padding: 20px 14px; gap: 20px; }
  .login-panel { padding: 18px 14px; gap: 18px; }
  .login-rings { width: 56px; height: 56px; }
  .lr1 { width: 56px; height: 56px; }
  .lr2 { width: 40px; height: 40px; }
  .lr3 { width: 24px; height: 24px; }
  .name-input-wrap { flex-direction: column; }
  .btn-create { width: 100%; text-align: center; padding: 12px; }
  .avatar-picker { gap: 6px; }
  .avatar-opt { width: 38px; height: 38px; }

  /* ── LANG SWITCHER ── */
  .lang-dropdown {
    position: fixed;
    left: 230px;
    top: 50%;
    transform: translateY(-50%);
    bottom: auto;
    width: calc(100vw - 246px);
    max-height: 70vh;
    overflow-y: auto;
  }

  /* ── MOOD CHIPS ── */
  .mood-chip, .tempo-chip { padding: 5px 8px; font-size: 0.62rem; }
}



/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ═══════════════════════════
   LOADER
═══════════════════════════ */
#loader {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 28px;
  transition: opacity 0.6s ease;
}

#loader.fade-out { opacity: 0; pointer-events: none; }

.loader-ring {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 1px solid var(--border2);
  border-top-color: var(--accent);
  animation: spin 1.2s linear infinite;
}

.loader-text {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: var(--text-dim);
  text-align: center;
  line-height: 2;
}

.loader-text span { color: var(--accent); font-size: 0.6rem; letter-spacing: 0.5em; }

/* ═══════════════════════════
   APP SHELL
═══════════════════════════ */
#app { display: flex; }
#app.hidden { display: none; }

/* ═══════════════════════════
   SIDEBAR
═══════════════════════════ */
#sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.nav-logo {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.nav-logo-icon { flex-shrink: 0; }

.nav-logo-text {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--text-mid);
  line-height: 1.5;
}

.nav-logo-text em {
  font-style: normal;
  color: var(--accent);
}

.nav-links {
  list-style: none;
  padding: 16px 0;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.85rem;
  color: var(--text-dim);
  border-left: 2px solid transparent;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

.nav-item:hover { color: var(--text); background: var(--surface); }

.nav-item.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(212,168,90,0.06);
}

.nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-footer {
  padding: 20px;
  border-top: 1px solid var(--border);
}

.live-clock {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.live-date {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

/* ═══════════════════════════
   MAIN
═══════════════════════════ */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.view {
  display: none;
  padding: 32px 36px;
  animation: fadeIn 0.3s ease;
}

.view.active { display: block; }

.view-header {
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.view-header h1 {
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.header-sub {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
}

/* ═══════════════════════════
   CARDS
═══════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 20px 22px;
  border-radius: var(--radius);
}

.card-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  color: var(--text-dim);
  margin-bottom: 16px;
  text-transform: uppercase;
}

/* ═══════════════════════════
   DASHBOARD GRID
═══════════════════════════ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 280px;
  grid-template-rows: auto auto auto;
  gap: 16px;
}

.card-wide { grid-column: span 2; }
.card-full { grid-column: 1 / -1; }

/* OSCILLOSCOPE */
.oscilloscope-card { padding-bottom: 14px; }

#osc-canvas {
  width: 100%;
  height: 120px;
  display: block;
  margin-bottom: 12px;
}

.osc-stats {
  display: flex;
  gap: 0;
  border-top: 1px solid var(--border);
}

.osc-stat {
  flex: 1;
  padding: 10px 0;
  text-align: center;
  border-right: 1px solid var(--border);
}

.osc-stat:last-child { border-right: none; }

.osc-stat-val {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 2px;
}

.osc-stat-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

/* TODAY STATS */
.today-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.today-stat { text-align: center; }

.today-val {
  font-size: 1.8rem;
  font-weight: 300;
  color: var(--text);
  margin-bottom: 2px;
}

.today-lbl {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

/* HEATMAP */
.heatmap-legend {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

#heatmap-canvas {
  width: 100%;
  height: 80px;
  display: block;
}

.heatmap-months {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

/* RADAR CARD */
.radar-card { display: flex; flex-direction: column; align-items: center; }

#mini-radar { margin: 0 auto; }

.radar-profile {
  font-size: 0.9rem;
  color: var(--accent);
  text-align: center;
  margin-top: 8px;
  font-style: italic;
}

/* LAST SESSION */
.last-session-card .ls-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.last-session-card .ls-row:last-child { border-bottom: none; }
.ls-label { color: var(--text-dim); }
.ls-value { color: var(--text); }

/* QUICK JOURNAL */
.journal-quick-card textarea {
  width: 100%;
  height: 70px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 0.85rem;
  padding: 10px;
  resize: none;
  border-radius: var(--radius);
  margin-bottom: 10px;
  line-height: 1.5;
}

.journal-quick-card textarea:focus { outline: none; border-color: var(--accent); }

.quick-journal-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

#quick-journal-recent { max-height: 80px; overflow-y: auto; }

.qj-entry {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

.qj-time { color: var(--accent); flex-shrink: 0; }

/* ═══════════════════════════
   SESSION VIEW
═══════════════════════════ */
.session-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  margin-bottom: 20px;
}

.session-main {
  min-height: 400px;
  position: relative;
}

.session-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 0;
  gap: 32px;
}

.idle-ring-wrap {
  position: relative;
  width: 300px;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#session-ring-canvas {
  position: absolute; inset: 0;
}

.idle-center {
  position: relative;
  text-align: center;
  z-index: 2;
}

.idle-time {
  font-family: var(--font-mono);
  font-size: 2.8rem;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.idle-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  letter-spacing: 0.3em;
  margin-top: 6px;
}

/* PROBE STYLES */
.probe-container {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 32px;
  border-radius: var(--radius);
}

.probe-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.probe-progress-wrap {
  flex: 1;
  height: 1px;
  background: var(--border2);
}

.probe-progress-bar {
  height: 100%;
  background: var(--accent);
  transition: width 0.5s ease;
  width: 0%;
}

.probe-counter {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  flex-shrink: 0;
}

.probe-body {}

.probe-question-text {
  font-size: 1.5rem;
  font-weight: 300;
  line-height: 1.5;
  margin-bottom: 28px;
}

.probe-opts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.probe-opt-btn {
  padding: 14px 18px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 0.95rem;
  cursor: pointer;
  text-align: left;
  border-radius: var(--radius);
  transition: var(--transition);
  line-height: 1.4;
}

.probe-opt-btn:hover {
  border-color: var(--accent);
  background: rgba(212,168,90,0.06);
  color: var(--accent);
}

/* ESTIMATE */
.estimate-container {
  text-align: center;
  padding: 40px 0;
}

.estimate-container h2 {
  font-size: 1.8rem;
  font-weight: 300;
  margin-bottom: 12px;
}

.estimate-hint {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  margin-bottom: 32px;
}

#estimate-canvas {
  width: 100%;
  max-width: 500px;
  height: 80px;
  display: block;
  margin: 0 auto 20px;
}

#estimate-slider {
  -webkit-appearance: none;
  width: 100%;
  max-width: 500px;
  height: 1px;
  background: var(--border2);
  outline: none;
  margin-bottom: 16px;
  display: block;
  margin: 0 auto 20px;
}

#estimate-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 16px rgba(212,168,90,0.5);
}

.estimate-val-display {
  margin-bottom: 32px;
}

#estimate-display {
  font-family: var(--font-mono);
  font-size: 2.4rem;
  color: var(--accent);
  display: block;
  margin-bottom: 4px;
}

.estimate-unit {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.2em;
}

/* RESULTS PANEL */
.results-panel {
  background: var(--bg2);
  border: 1px solid var(--accent);
  padding: 28px 32px;
  border-radius: var(--radius);
  animation: slideUp 0.4s ease;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.result-stat {
  text-align: center;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.result-stat-val {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  color: var(--accent);
  margin-bottom: 4px;
}

.result-stat-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
}

.result-verdict-full {
  grid-column: span 2;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.result-verdict-text {
  font-size: 1.1rem;
  font-style: italic;
  margin-bottom: 8px;
}

.result-science-text {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  line-height: 1.7;
}

.session-side .card { margin-bottom: 16px; }

.recent-session-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.recent-session-item:last-child { border-bottom: none; }

.rsi-left { font-family: var(--font-mono); font-size: 0.68rem; }
.rsi-date { color: var(--text-dim); margin-bottom: 2px; }
.rsi-profile { color: var(--text); }
.rsi-ratio { font-family: var(--font-mono); font-size: 1.1rem; color: var(--accent); }

.session-instructions { font-size: 0.9rem; color: var(--text-mid); line-height: 1.7; }
.session-instructions ol { margin: 10px 0 0 18px; }
.session-instructions li { margin-bottom: 6px; }

/* ═══════════════════════════
   JOURNAL VIEW
═══════════════════════════ */
.journal-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  height: calc(100vh - 180px);
}

.journal-input-area {}

.journal-compose {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 20px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.journal-timestamp {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent);
  letter-spacing: 0.15em;
  margin-bottom: 12px;
}

#journal-textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.7;
  resize: none;
  margin-bottom: 16px;
  outline: none;
}

.journal-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.journal-meta-left { display: flex; gap: 8px; flex-wrap: wrap; }

.journal-timeline {
  overflow-y: auto;
  padding-right: 4px;
}

.timeline-empty {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
  padding: 60px 0;
}

.journal-entry {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  animation: fadeIn 0.3s ease;
}

.je-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.je-time {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent);
  letter-spacing: 0.1em;
}

.je-mood {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  padding: 2px 8px;
  border: 1px solid var(--border2);
  color: var(--text-mid);
  letter-spacing: 0.1em;
}

.je-tempo {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  margin-left: auto;
}

.je-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-mid);
}

/* ═══════════════════════════
   ANALYTICS VIEW
═══════════════════════════ */
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

#ratio-history-canvas { width: 100%; }
#profile-pie-canvas, #cumulative-radar { display: block; margin: 0 auto; }

#profile-pie-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 12px;
  justify-content: center;
}

.pie-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-mid);
}

.pie-legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.global-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.gs-item { text-align: center; }
.gs-val {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  color: var(--accent);
  margin-bottom: 4px;
}
.gs-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

.sessions-table-wrap {
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
}

.sessions-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.sessions-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--border2);
  font-weight: 400;
  position: sticky;
  top: 0;
  background: var(--bg2);
}

.sessions-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-mid);
}

.sessions-table tr:hover td { background: var(--surface2); }

/* ═══════════════════════════
   MEDITATION VIEW
═══════════════════════════ */
.meditation-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
}

.meditation-main {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.breath-circle-wrap {
  position: relative;
  width: 400px;
  height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 32px;
}

#breath-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}

.breath-center {
  position: relative;
  z-index: 2;
  text-align: center;
}

.breath-instruction {
  font-size: 1.4rem;
  font-style: italic;
  color: var(--text);
  margin-bottom: 8px;
}

.breath-count {
  font-family: var(--font-mono);
  font-size: 2rem;
  color: var(--accent2);
}

.meditation-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.med-duration-select {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
}

.btn-duration {
  padding: 6px 14px;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  cursor: pointer;
  border-radius: var(--radius);
  transition: var(--transition);
}

.btn-duration.active, .btn-duration:hover {
  border-color: var(--accent2);
  color: var(--accent2);
}

.med-science {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.7;
  margin-top: 12px;
  font-style: italic;
}

.meditation-side .card { margin-bottom: 16px; }

#med-history { max-height: 200px; overflow-y: auto; }

.med-history-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  display: flex;
  justify-content: space-between;
}

/* ═══════════════════════════
   SCIENCE VIEW
═══════════════════════════ */
.science-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 28px;
}

.science-article { padding-right: 8px; }

.science-section {
  margin-bottom: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
}

.science-section:last-child { border-bottom: none; }

.science-tag {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  color: var(--accent);
  margin-bottom: 12px;
}

.science-section h2 {
  font-size: 1.6rem;
  font-weight: 300;
  margin-bottom: 16px;
}

.science-section p {
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-mid);
  margin-bottom: 14px;
}

.dimensions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}

.dim-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 18px;
}

.dim-icon { font-size: 1.4rem; margin-bottom: 8px; }

.dim-card h3 {
  font-size: 1rem;
  font-weight: 400;
  margin-bottom: 8px;
}

.dim-card p {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0;
}

.einstein-formula {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  margin: 20px 0;
}

.formula {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 6px;
}

.formula-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

.formula-arrow {
  font-size: 1.4rem;
  color: var(--text-dim);
}

.cosmic-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.cosmic-ratio {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 4px;
}

.cosmic-desc {
  font-size: 0.88rem;
  color: var(--text-mid);
  line-height: 1.6;
}

.science-side .card { margin-bottom: 16px; }

.personal-ratio-display { text-align: center; padding: 20px 0; }

.big-ratio {
  font-family: var(--font-mono);
  font-size: 3rem;
  color: var(--accent);
  margin-bottom: 8px;
}

.ratio-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-style: italic;
}

.refs { display: flex; flex-direction: column; gap: 10px; }

.ref {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  line-height: 1.6;
  padding: 8px;
  border-left: 1px solid var(--border2);
}

/* ═══════════════════════════
   BUTTONS & FORM ELEMENTS
═══════════════════════════ */
.btn-primary {
  padding: 10px 24px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  border-radius: var(--radius);
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary:hover { background: var(--accent); color: var(--bg); }

.btn-lg { padding: 14px 40px; font-size: 0.8rem; }

.btn-small {
  padding: 6px 14px;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text-mid);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  border-radius: var(--radius);
  transition: var(--transition);
}

.btn-small:hover { border-color: var(--text-mid); color: var(--text); }

.select-styled {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-mid);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 6px 10px;
  border-radius: var(--radius);
  outline: none;
  cursor: pointer;
}

.select-styled:focus { border-color: var(--accent); }

.no-data {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  text-align: center;
  padding: 20px 0;
}

/* ═══════════════════════════
   UTILITIES
═══════════════════════════ */
.hidden { display: none !important; }

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

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

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 0.4; }
}

/* ═══════════════════════════════════════════════
   PROFILE NAV WIDGET & MENU
═══════════════════════════════════════════════ */

.nav-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 12px;
  position: relative;
}

.nav-profile:hover {
  border-color: var(--accent);
  background: rgba(212,168,90,0.06);
}

.nav-profile-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.nav-profile-info { flex: 1; min-width: 0; }

.nav-profile-name {
  font-size: 0.85rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-profile-sub {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.nav-profile-menu-icon {
  font-size: 1rem;
  color: var(--text-dim);
}

/* ── PROFILE MENU ── */
.profile-menu {
  position: fixed;
  bottom: 180px;
  left: calc(var(--sidebar-w) + 12px);
  width: 280px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  z-index: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: fadeIn 0.2s ease;
}

.pm-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.pm-header-avatar { border-radius: 50%; overflow: hidden; flex-shrink: 0; }

.pm-header-info {}

.pm-header-name {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 3px;
}

.pm-header-since {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

.pm-item {
  padding: 12px 18px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-mid);
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--border);
}

.pm-item:hover { background: var(--surface2); color: var(--text); }
.pm-item.pm-danger:hover { color: var(--accent4); }

.pm-export-box {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pm-export-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--accent);
  letter-spacing: 0.2em;
}

#pm-export-code {
  width: 100%;
  height: 60px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  padding: 8px;
  resize: none;
  outline: none;
  letter-spacing: 0.02em;
  line-height: 1.4;
  word-break: break-all;
}

.pm-export-note {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.pm-copy-btn {
  align-self: flex-start;
  padding: 6px 16px;
  border: 1px solid var(--accent2);
  background: transparent;
  color: var(--accent2);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: var(--transition);
}

.pm-copy-btn:hover { background: var(--accent2); color: var(--bg); }
.pm-copy-btn.copied { border-color: var(--accent3); color: var(--accent3); }

/* ═══════════════════════════════════════════════
   RESPONSIVE — Mobile Portrait
   Breakpoint: 768px
   Sidebar: slide-in overlay, hamburger trigger
═══════════════════════════════════════════════ */

/* ── HAMBURGER BUTTON ── */
.hamburger-btn {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 300;
  width: 40px;
  height: 40px;
  background: var(--bg2);
  border: 1px solid var(--border);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
}

.hamburger-btn span {
  display: block;
  width: 18px;
  height: 1px;
  background: var(--text-mid);
  transition: var(--transition);
}

/* SIDEBAR OVERLAY */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: all;
}





/* ── VERY SMALL SCREENS ── */


/* ── LANDSCAPE MOBILE ── */


/* ── SAFE AREA (notch/home bar) ── */


/* Quick journal entry inline layout */
.qj-entry {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.7rem;
  flex-wrap: wrap;
}
.qj-time { color: var(--accent); font-family: var(--font-mono); font-size: 0.62rem; flex-shrink: 0; }
.qj-mood-inline { font-family: var(--font-mono); font-size: 0.6rem; flex-shrink: 0; }
.qj-text { color: var(--text-dim); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ═══════════════════════════════════════
   MOBILE — max-width: 768px
   Scroll: JavaScript controlled
   Sidebar: fixed overlay
═══════════════════════════════════════ */

/* Hamburger — hidden on desktop */
.hamburger-btn { display: none; }
.sidebar-overlay { display: none; }

@media (max-width: 768px) {

  /* ── HAMBURGER ── */
  .hamburger-btn {
    display: flex;
    position: fixed;
    top: 12px; left: 12px;
    z-index: 300;
    width: 42px; height: 42px;
    background: var(--bg2);
    border: 1px solid var(--border2);
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .hamburger-btn span {
    display: block;
    width: 18px; height: 1.5px;
    background: var(--text-mid);
  }

  /* ── OVERLAY ── */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 150;
    touch-action: manipulation;
  }

  .sidebar-overlay.active {
    display: block;
  }

  /* ── SIDEBAR ── */
  #sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 220px;
    height: 100%;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    flex-direction: column;
    overflow-y: auto;
    border-right: 1px solid var(--border2);
  }

  #sidebar.open { transform: translateX(0); box-shadow: 8px 0 40px rgba(0,0,0,0.8); }

  .nav-logo { display: flex; }

  .nav-links {
    flex-direction: column;
    padding: 8px 0;
    overflow-y: auto;
    flex: 1;
  }

  .nav-item {
    flex-direction: row;
    gap: 12px;
    padding: 13px 20px;
    border-left: 2px solid transparent;
    border-top: none;
    font-size: 0.85rem;
    min-width: unset;
    width: 100%;
    flex: unset;
    justify-content: flex-start;
    align-items: center;
    text-align: left;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .nav-item.active { border-left-color: var(--accent); background: rgba(212,168,90,0.06); }
  .nav-icon { font-size: 1rem; width: 20px; flex-shrink: 0; }
  .nav-footer { display: flex; flex-direction: column; }

  /* ── APP SHELL ── */
  #app { display: block; height: auto; }

  /* ── MAIN ── */
  #main { display: block; width: 100%; height: auto; overflow: visible; }

  /* ── VIEW — JS handles scroll via scrollTop ── */
  .view {
    display: none;
    width: 100%;
    min-height: 100vh;
    height: auto;
    overflow: visible;
    padding: 66px 14px 60px 14px;
    box-sizing: border-box;
  }

  .view.active { display: block; }

  .view-header { margin-bottom: 14px; padding-bottom: 10px; }
  .view-header h1 { font-size: 1.3rem; }

  /* ── PROFILE MENU ── */
  #profile-menu {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    bottom: auto; right: auto;
    width: calc(100vw - 20px);
    max-width: 340px;
    max-height: 85vh;
    overflow-y: auto;
    z-index: 400;
  }

  /* ── DASHBOARD ── */
  .dashboard-grid { grid-template-columns: 1fr; gap: 12px; }
  .card-wide, .card-full { grid-column: span 1; }
  #osc-canvas { height: 75px; }
  .osc-stats { flex-wrap: wrap; }
  .osc-stat { min-width: 33%; }
  .today-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .today-val { font-size: 1.3rem; }
  #heatmap-canvas { height: 54px; }
  .heatmap-months { font-size: 0.48rem; }
  #mini-radar { width: 150px; height: 150px; }
  .journal-quick-card textarea { height: 54px; }

  /* ── SESSION ── */
  .session-layout { grid-template-columns: 1fr; gap: 14px; }
  .session-side { display: none; }
  .idle-ring-wrap { width: 200px; height: 200px; }
  #session-ring-canvas { width: 200px; height: 200px; }
  .idle-time { font-size: 1.8rem; }
  .results-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .result-verdict-full { grid-column: span 2; }
  .results-panel { padding: 16px 14px; }
  .probe-container { padding: 18px 14px; }
  .probe-question-text { font-size: 1.1rem; }
  .probe-opt-btn { padding: 11px 12px; font-size: 0.86rem; }
  .estimate-container { padding: 14px 0; }
  .estimate-container h2 { font-size: 1.1rem; }
  #estimate-display { font-size: 1.5rem; }

  /* ── JOURNAL ── */
  .journal-layout { grid-template-columns: 1fr; height: auto; gap: 14px; }
  .journal-compose { height: auto; }
  #journal-textarea { height: 90px; }
  .journal-meta { flex-direction: column; gap: 10px; }
  .journal-chips-wrap { width: 100%; }
  .journal-timeline { max-height: none; overflow: visible; }

  /* ── ANALYTICS ── */
  .analytics-grid { grid-template-columns: 1fr; gap: 12px; }
  .global-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  #ratio-history-canvas { height: 120px; }
  .sessions-table-wrap { overflow-x: auto; }
  .sessions-table { font-size: 0.58rem; }
  .sessions-table th, .sessions-table td { padding: 5px 6px; }
  .sessions-table th:nth-child(n+6), .sessions-table td:nth-child(n+6) { display: none; }

  /* ── MEDITATION ── */
  .meditation-layout { grid-template-columns: 1fr; gap: 14px; }
  .meditation-side { display: none; }
  .meditation-main { width: 100%; align-items: center; }
  .breath-circle-wrap { width: 250px; height: 250px; }
  #breath-canvas { width: 250px; height: 250px; }
  .med-duration-select { flex-wrap: wrap; justify-content: center; }

  /* ── SCIENCE ── */
  .science-layout { grid-template-columns: 1fr; gap: 14px; }
  .science-side { order: -1; }
  .dimensions-grid { grid-template-columns: 1fr; gap: 10px; }
  .einstein-formula { flex-direction: column; gap: 10px; text-align: center; }

  /* ── CARDS ── */
  .card { padding: 13px 13px; }
  .card-label { font-size: 0.54rem; margin-bottom: 10px; }
  .btn-primary { padding: 10px 18px; font-size: 0.7rem; }
  .btn-lg { padding: 12px 24px; }

  /* ── LOGIN ── */
  .login-wrap { padding: 20px 14px; gap: 18px; }
  .login-panel { padding: 18px 14px; gap: 16px; }
  .name-input-wrap { flex-direction: column; }
  .btn-create { width: 100%; text-align: center; padding: 12px; }
  .avatar-opt { width: 36px; height: 36px; }

  /* ── LANG DROPDOWN ── */
  .lang-dropdown {
    position: fixed;
    left: 228px; top: 50%;
    transform: translateY(-50%);
    bottom: auto;
    width: calc(100vw - 244px);
    max-height: 70vh;
    overflow-y: auto;
  }

  /* ── CHIPS ── */
  .mood-chip, .tempo-chip { padding: 5px 8px; font-size: 0.6rem; }
}

/* ── CHIP SELECTION LABEL ── */
.chip-selection-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  margin-top: 4px;
  margin-bottom: 2px;
  min-height: 16px;
  transition: color 0.2s ease;
}

/* ── TOUCH FIX — all interactive elements ── */
button, input[type="range"], input[type="checkbox"],
.btn-primary, .btn-small, .btn-action, .btn-secondary,
.btn-create, .btn-ghost, .btn-lg, .btn-import-trigger,
.probe-opt-btn, .mood-chip, .tempo-chip,
.nav-item, .profile-card-item, .pm-item, .pm-copy-btn,
.btn-duration, .pm-lang-opt, .pm-lang-block,
.avatar-opt, .pci-delete, .lang-btn, .lang-option {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  user-select: none;
}

/* Selected chip base state */
.mood-chip.selected, .tempo-chip.selected {
  font-weight: 500;
}
