/* ════════════════════════════════════════════════════════════════
   POLYMATH OS — Desktop Web Edition
   Proper sidebar + topbar layout. Not a phone frame.
   ════════════════════════════════════════════════════════════════ */

:root {
  --bg: #06080C;
  --surface: #0C1018;
  --surface-2: #101620;
  --surface-hover: #141C2A;
  --border: #161E2E;
  --border-light: #243044;
  --border-accent: rgba(0,255,135,0.18);
  --border-amber: rgba(255,181,71,0.25);

  --glass-fill: rgba(13,19,35,0.60);
  --glass-fill-heavy: rgba(10,15,28,0.94);
  --glass-border: rgba(160,178,220,0.10);
  --glass-border-bright: rgba(190,202,232,0.18);
  --glass-scrim: rgba(6,8,14,0.70);

  --accent: #00FF87;
  --accent-bright: #3EEDB5;
  --accent-dim: rgba(0,255,135,0.08);
  --accent-bg: rgba(0,255,135,0.05);
  --teal: #5BD6C0;
  --blue: #7B8FFF;
  --pink: #FF6B9D;
  --purple: #A795F6;
  --red: #F07A7A;
  --amber: #FFB547;
  --amber-dim: rgba(255,181,71,0.12);
  --amber-bg: rgba(255,181,71,0.06);

  --text-primary: #EEF0F6;
  --text-secondary: #A7B3CE;
  --text-muted: #536075;
  --text-dim: #243044;

  --display: 'Fraunces', Georgia, serif;
  --sans: 'Outfit', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-pill: 100px;

  --sidebar-w: 216px;
  --topbar-h: 52px;
}

/* ─── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text-primary); font-family: var(--sans); overscroll-behavior: none; overflow: hidden; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Starfield ───────────────────────────────────────────── */
#starfield {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(110% 70% at 60% -5%, rgba(0,255,135,0.045), transparent 55%),
    radial-gradient(80% 50% at 90% 10%, rgba(123,143,255,0.035), transparent 50%),
    radial-gradient(60% 40% at 10% 90%, rgba(91,214,192,0.025), transparent 50%),
    var(--bg);
}
.star { position: absolute; border-radius: 50%; background: #cfe3ff; }
.star.gold { background: var(--amber); }
@keyframes twinkle { 0%,100% { opacity: .2 } 50% { opacity: 1 } }
.shooting-star { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff; box-shadow: 0 0 6px 1px rgba(255,255,255,.8); }
.constellation-line { position: absolute; height: 1px; transform-origin: left center; background: linear-gradient(90deg, rgba(255,181,71,0), rgba(255,181,71,.3), rgba(255,181,71,0)); }
.constellation-node { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 6px 1px rgba(255,181,71,.55); transform: translate(-50%,-50%); }

/* ─── App root ───────────────────────────────────────────── */
#app {
  position: relative; z-index: 1;
  width: 100%; height: 100vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* ─── Topbar ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  background: rgba(6, 8, 14, 0.90);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(150, 168, 210, 0.09);
  flex-shrink: 0;
  position: relative; z-index: 100;
  animation: fadeInDown .35s cubic-bezier(.2,.8,.2,1) both;
}

.topbar-logo {
  font-family: var(--mono);
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--accent);
  display: flex; align-items: center; gap: 9px;
  white-space: nowrap; flex-shrink: 0;
  user-select: none;
}

.logo-pulse {
  width: 7px; height: 7px;
  background: var(--accent); border-radius: 50%;
  box-shadow: 0 0 10px var(--accent);
  animation: logoPulse 2.4s ease-in-out infinite;
}

@keyframes logoPulse {
  0%,100% { opacity: 1; box-shadow: 0 0 8px var(--accent); transform: scale(1); }
  50% { opacity: .55; box-shadow: 0 0 20px var(--accent); transform: scale(1.15); }
}

.topbar-search {
  flex: 1; max-width: 400px; margin-left: auto;
  position: relative;
}

.topbar-search input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px 14px 8px 34px;
  color: var(--text-primary);
  font-family: var(--mono); font-size: 11px;
  outline: none;
  transition: border-color .2s, background .2s;
}

.topbar-search input:focus {
  border-color: var(--blue);
  background: var(--surface-hover);
}

.topbar-search input::placeholder { color: var(--text-muted); }

.topbar-search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 13px; pointer-events: none;
  transition: color .2s;
}

.topbar-search input:focus + .topbar-search-icon,
.topbar-search:focus-within .topbar-search-icon { color: var(--blue); }

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

.topbar-date {
  font-family: var(--mono); font-size: 10px;
  color: var(--text-muted); letter-spacing: .5px;
}

.topbar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-family: var(--sans); font-weight: 700; font-size: 14px; color: var(--bg);
  transition: transform .15s, box-shadow .15s;
  flex-shrink: 0;
}

.topbar-avatar:hover { transform: scale(1.08); box-shadow: 0 0 0 3px var(--accent-dim); }

/* ─── App body (sidebar + content) ──────────────────────── */
.app-body {
  display: flex; flex: 1; overflow: hidden;
}

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: rgba(6, 8, 14, 0.80);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-right: 1px solid rgba(150, 168, 210, 0.08);
  display: flex; flex-direction: column;
  padding: 18px 0;
  flex-shrink: 0;
  overflow-y: auto;
  animation: slideInSidebar .4s cubic-bezier(.2,.8,.2,1) both;
}

@keyframes slideInSidebar { from { opacity: 0; transform: translateX(-10px) } to { opacity: 1; transform: none } }

.sidebar-section { padding: 0 10px; margin-bottom: 4px; }

.sidebar-label {
  font-family: var(--mono); font-size: 9px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-dim);
  padding: 6px 8px 4px;
}

.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13.5px; font-weight: 500;
  transition: all .18s cubic-bezier(.2,.8,.2,1);
  user-select: none;
  border: 1px solid transparent;
  position: relative;
}

.sidebar-item::before {
  content: '';
  position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 2px; border-radius: 1px;
  background: var(--accent);
  opacity: 0;
  transition: opacity .2s;
}

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

.sidebar-item.active {
  background: rgba(0,255,135,0.07);
  color: var(--accent);
  border-color: rgba(0,255,135,0.12);
}

.sidebar-item.active::before { opacity: 1; }

.sidebar-icon {
  width: 18px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.sidebar-icon svg { width: 16px; height: 16px; }

.sidebar-divider {
  height: 1px; background: var(--border);
  margin: 10px 10px; border-radius: 1px;
}

/* ─── Main content ───────────────────────────────────────── */
.main-content {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}

.screen {
  padding: 28px 32px 40px;
  min-height: 100%;
  animation: screenEnter .32s cubic-bezier(.2,.8,.2,1) both;
}

/* Notes screen fills full height without scroll */
.screen.notes-active {
  padding: 20px 24px 0;
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
}

@keyframes screenEnter { from { opacity: 0; transform: translateY(12px) } to { opacity: 1; transform: none } }

/* ─── Animations ─────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px) } to { opacity: 1; transform: none } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-10px) } to { opacity: 1; transform: none } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px) } to { opacity: 1; transform: none } }
@keyframes shimmer { 0% { transform: translateX(-60px); opacity: 0 } 8% { opacity: .9 } 60%,100% { transform: translateX(500px); opacity: 0 } }
@keyframes spin { to { transform: rotate(360deg) } }
@keyframes pulse { from { transform: scale(1); opacity: .6 } to { transform: scale(1.8); opacity: 1 } }
@keyframes staggerIn { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }

.anim-in { animation: fadeInUp .38s cubic-bezier(.2,.8,.2,1) both; }
.anim-in-2 { animation: fadeInUp .38s cubic-bezier(.2,.8,.2,1) .07s both; }
.anim-in-3 { animation: fadeInUp .38s cubic-bezier(.2,.8,.2,1) .14s both; }
.anim-in-4 { animation: fadeInUp .38s cubic-bezier(.2,.8,.2,1) .21s both; }
.anim-fade { animation: fadeIn .3s ease both; }
.anim-right { animation: slideInRight .35s cubic-bezier(.2,.8,.2,1) both; }

/* ─── Page header ────────────────────────────────────────── */
.page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 28px;
}

.page-title { font-family: var(--display); font-size: 28px; margin-bottom: 6px; line-height: 1.15; }
.page-sub { font-family: var(--mono); font-size: 11px; color: var(--text-muted); letter-spacing: .5px; }

/* ─── Generic card ───────────────────────────────────────── */
.card {
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 20px;
  backdrop-filter: blur(8px);
}

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 14px; margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-family: var(--mono); font-size: 9.5px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 8px;
}

.card-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

/* ─── Section helpers ────────────────────────────────────── */
.section-label {
  font-family: var(--mono); font-weight: 700; color: var(--text-muted);
  font-size: 9px; letter-spacing: 2.5px; text-transform: uppercase;
  margin: 4px 0 10px;
}

.section-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }

/* ─── Progress bars ──────────────────────────────────────── */
.gilded { height: 5px; border-radius: 3px; background: rgba(0,255,135,0.07); overflow: hidden; position: relative; }
.gilded-fill {
  height: 100%; border-radius: 3px; background: var(--accent);
  transition: width .9s cubic-bezier(.2,.8,.2,1);
  position: relative; overflow: hidden;
}
.gilded-fill::after {
  content: ''; position: absolute; top: 0; left: 0; width: 60px; height: 100%;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.5), rgba(255,255,255,0));
  animation: shimmer 4s linear infinite;
}

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  background: var(--glass-fill); border: 1px solid var(--border-light);
  border-radius: var(--r-md); padding: 8px 16px;
  color: var(--text-primary); font-family: var(--mono); font-size: 11px;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-hover); border-color: var(--text-muted); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 700; }
.btn-accent:hover { background: var(--accent-bright); border-color: var(--accent-bright); }

.add-link { font-family: var(--mono); font-weight: 700; color: var(--accent); font-size: 11px; letter-spacing: 1px; cursor: pointer; transition: opacity .15s; }
.add-link:hover { opacity: .7; }

.outline-btn {
  background: var(--glass-fill); border: 1px solid var(--glass-border);
  padding: 9px 18px; border-radius: var(--r-pill);
  font-family: var(--mono); font-weight: 700; color: var(--accent); font-size: 12px;
  transition: all .15s; cursor: pointer;
}
.outline-btn:hover { background: var(--accent-dim); border-color: var(--border-accent); }

.pill-btn {
  background: var(--accent); color: var(--bg);
  font-family: var(--sans); font-weight: 600; font-size: 14px;
  padding: 12px 22px; border-radius: var(--r-pill);
  cursor: pointer; transition: all .15s;
}
.pill-btn:hover { background: var(--accent-bright); }

/* ─── Avatar ─────────────────────────────────────────────── */
.avatar {
  background: var(--accent); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.avatar-text { font-family: var(--sans); font-weight: 700; color: var(--bg); }
.avatar.sm { width: 34px; height: 34px; }
.avatar.sm .avatar-text { font-size: 14px; }
.avatar.lg { width: 64px; height: 64px; }
.avatar.lg .avatar-text { font-size: 26px; }

/* ─── Empty states ───────────────────────────────────────── */
.empty-card {
  background: var(--glass-fill); border: 1px solid var(--glass-border);
  border-radius: var(--r-lg); padding: 40px; text-align: center;
}
.empty-icon-circle { width: 64px; height: 64px; border-radius: 50%; background: var(--surface-hover); display: inline-flex; align-items: center; justify-content: center; font-size: 28px; margin-bottom: 16px; }
.empty-title { font-family: var(--display); font-size: 20px; margin-bottom: 8px; }
.empty-sub { font-family: var(--sans); color: var(--text-muted); font-size: 14px; margin-bottom: 22px; line-height: 20px; }
.empty-state { text-align: center; padding-top: 80px; }
.empty-state .emoji { font-size: 52px; margin-bottom: 18px; }
.empty-state .title { font-family: var(--display); font-size: 22px; margin-bottom: 6px; }
.empty-state .sub { font-family: var(--sans); color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }

/* ════════════════ HOME ════════════════ */

.home-greeting {
  margin-bottom: 28px;
}

.greeting { font-family: var(--display); font-style: italic; font-size: 30px; line-height: 1.15; }
.greeting-date { font-family: var(--mono); color: var(--text-muted); font-size: 11px; margin-top: 6px; letter-spacing: .5px; }

.home-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
}

.home-left { display: flex; flex-direction: column; gap: 20px; }
.home-right { display: flex; flex-direction: column; gap: 20px; }

/* XP Banner */
.xp-banner {
  background: rgba(0,255,135,0.03);
  border: 1px solid var(--border-accent);
  border-radius: var(--r-xl);
  padding: 24px 26px;
  position: relative; overflow: hidden;
}

.xp-banner::before {
  content: '';
  position: absolute; top: -60px; right: -40px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(0,255,135,0.06), transparent 70%);
  pointer-events: none;
}

.xp-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.xp-label { font-family: var(--mono); font-weight: 700; color: var(--accent); font-size: 9.5px; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 8px; }
.xp-points { font-family: var(--display); font-weight: 700; font-size: 46px; letter-spacing: -.5px; line-height: 1; }
.streak-badge { background: var(--amber-bg); border: 1px solid var(--border-amber); border-radius: var(--r-pill); padding: 8px 14px; font-size: 20px; }
.xp-sub { font-family: var(--mono); color: var(--accent); font-size: 10.5px; opacity: .75; margin-top: 10px; }

/* Tasks */
.task-input-row { display: flex; gap: 8px; margin-bottom: 12px; }
.task-input {
  flex: 1; font-family: var(--sans);
  background: var(--surface-hover); border: 1px solid var(--border-light);
  border-radius: var(--r-md); padding: 10px 14px;
  color: var(--text-primary); font-size: 14px;
  outline: none; transition: border-color .15s;
}
.task-input:focus { border-color: var(--accent); }
.task-input::placeholder { color: var(--text-muted); }
.task-input-btn { background: var(--accent); color: var(--bg); border-radius: var(--r-md); padding: 0 16px; font-weight: 600; font-size: 14px; }

.task-row {
  display: flex; align-items: center;
  padding: 10px 8px; border-radius: var(--r-sm);
  cursor: pointer; transition: background .12s;
  border-bottom: 1px solid var(--border);
}
.task-row:hover { background: var(--surface-hover); }
.task-row:last-child { border-bottom: none; }
.task-check {
  width: 20px; height: 20px; border-radius: 6px;
  border: 1.5px solid var(--border-light);
  margin-right: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.task-check.done { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 800; font-size: 12px; }
.task-text { font-family: var(--sans); font-size: 14px; flex: 1; line-height: 1.4; }
.task-text.done { color: var(--text-muted); text-decoration: line-through; }
.empty-tasks { font-family: var(--sans); color: var(--text-muted); font-size: 13px; text-align: center; padding: 20px 0; font-style: italic; }

/* Skills mini strip */
.skills-hscroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.skills-hscroll::-webkit-scrollbar { display: none; }
.skill-mini {
  background: var(--glass-fill); border: 1px solid var(--glass-border);
  border-radius: var(--r-lg); padding: 16px; min-width: 140px; flex-shrink: 0;
  transition: all .18s cubic-bezier(.2,.8,.2,1); cursor: pointer;
}
.skill-mini:hover { border-color: var(--border-light); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.skill-mini .emoji { font-size: 22px; margin-bottom: 8px; }
.skill-mini .name { font-family: var(--sans); font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.skill-mini .prog { font-family: var(--mono); color: var(--text-muted); font-size: 10px; }

/* Habits grid */
.habits-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.habit-mini {
  background: var(--glass-fill); border: 1px solid var(--glass-border);
  border-radius: var(--r-lg); padding: 16px 12px;
  text-align: center; cursor: pointer;
  transition: all .18s cubic-bezier(.2,.8,.2,1);
}
.habit-mini:hover { border-color: var(--border-light); transform: translateY(-1px); }
.habit-mini.done { background: var(--accent-bg); border-color: var(--border-accent); }
.habit-mini .ic { font-size: 24px; margin-bottom: 6px; }
.habit-mini .lbl { font-family: var(--sans); font-weight: 600; color: var(--text-muted); font-size: 11.5px; }
.habit-mini.done .lbl { color: var(--accent); }

/* ════════════════ LEARN ════════════════ */

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.chip {
  padding: 7px 15px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--border);
  font-family: var(--sans); font-weight: 600; font-size: 13px;
  color: var(--text-muted); white-space: nowrap;
  cursor: pointer; transition: all .15s;
}
.chip:hover { border-color: var(--border-light); color: var(--text-primary); }
.chip.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.skill-card {
  background: var(--glass-fill); border: 1px solid;
  border-radius: var(--r-lg); padding: 20px;
  cursor: pointer; transition: all .22s cubic-bezier(.2,.8,.2,1);
}
.skill-card:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(0,0,0,.3); }
.skill-card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.emoji-box { width: 38px; height: 38px; border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.xp-badge { padding: 4px 8px; border-radius: var(--r-sm); font-family: var(--mono); font-weight: 700; font-size: 10px; }
.skill-card .name { font-family: var(--sans); font-weight: 600; font-size: 16px; margin-bottom: 4px; line-height: 1.3; }
.skill-card .cat { font-family: var(--mono); font-weight: 700; font-size: 9px; letter-spacing: 1.5px; margin-bottom: 14px; }
.prog-track { height: 4px; background: rgba(255,255,255,0.05); border-radius: 2px; overflow: hidden; margin-bottom: 12px; }
.prog-fill { height: 100%; border-radius: 2px; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.skill-card-foot { display: flex; justify-content: space-between; align-items: center; }
.skill-card-foot .lessons { font-family: var(--mono); font-size: 11px; color: var(--text-muted); }
.skill-card-foot .pct { font-family: var(--mono); font-weight: 700; font-size: 12px; }

/* ════════════════ TRACK ════════════════ */

.stats-row { display: flex; gap: 14px; margin-bottom: 28px; }
.stat-card {
  flex: 1; background: var(--glass-fill); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 20px; text-align: center;
  transition: all .18s cubic-bezier(.2,.8,.2,1);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.stat-card.amber { border-color: rgba(255,181,71,0.22); }
.stat-card.green { border-color: rgba(0,255,135,0.18); }
.stat-card.blue { border-color: rgba(123,143,255,0.22); }
.stat-card .em { font-size: 26px; margin-bottom: 10px; }
.stat-card .val { font-family: var(--display); font-size: 26px; margin-bottom: 5px; }
.stat-card .lbl { font-family: var(--mono); font-weight: 700; font-size: 9px; color: var(--text-muted); letter-spacing: 1.5px; }

.track-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }

.calendar-card { background: var(--glass-fill); border: 1px solid var(--glass-border); border-radius: var(--r-lg); padding: 18px 20px; overflow-x: auto; }
.calendar-card-title { font-family: var(--mono); font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 14px; }
.cal-row { display: flex; align-items: center; }
.cal-day-label { font-family: var(--mono); color: var(--text-muted); font-size: 8px; width: 14px; text-align: center; margin-right: 5px; flex-shrink: 0; }
.cal-cell { width: 14px; height: 14px; border-radius: 3px; margin: 2px; flex-shrink: 0; transition: transform .1s; cursor: default; }
.cal-cell:hover { transform: scale(1.4); }
.legend-row { display: flex; align-items: center; justify-content: flex-end; margin-top: 10px; gap: 4px; }
.legend-text { font-family: var(--mono); color: var(--text-muted); font-size: 8px; margin: 0 2px; }
.legend-cell { width: 10px; height: 10px; border-radius: 2px; }

.week-card { background: var(--glass-fill); border: 1px solid var(--glass-border); border-radius: var(--r-lg); padding: 18px 20px; }
.week-card-title { font-family: var(--mono); font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 16px; }
.bars-row { display: flex; justify-content: space-around; align-items: flex-end; height: 120px; }
.bar-col { display: flex; flex-direction: column; align-items: center; flex: 1; }
.bar-track { width: 28px; height: 90px; display: flex; align-items: flex-end; border-radius: 5px; overflow: hidden; background: rgba(255,181,71,0.05); }
.bar-fill { width: 28px; border-top-left-radius: 5px; border-top-right-radius: 5px; transition: height .7s cubic-bezier(.2,.8,.2,1); }
.bar-label { font-family: var(--mono); font-weight: 700; color: var(--text-muted); font-size: 9px; margin-top: 7px; }
.bar-label.active { color: var(--accent); }
.bar-dot { width: 4px; height: 4px; border-radius: 2px; background: var(--accent); margin-top: 4px; }

.habits-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }

.habit-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--glass-fill); border: 1px solid var(--glass-border);
  border-radius: var(--r-lg); padding: 14px 16px; margin-bottom: 10px;
  cursor: pointer; transition: all .18s cubic-bezier(.2,.8,.2,1);
}
.habit-row:hover { border-color: var(--border-light); transform: translateX(3px); }
.habit-row.done { border-color: rgba(255,181,71,0.32); background: rgba(255,181,71,0.04); }
.habit-left { display: flex; align-items: center; gap: 12px; }
.habit-emoji { font-size: 20px; }
.habit-name { font-family: var(--sans); font-weight: 600; font-size: 14px; }
.habit-streak { font-family: var(--mono); font-weight: 700; font-size: 10.5px; color: var(--amber); margin-top: 2px; }
.habit-check { width: 24px; height: 24px; border-radius: 7px; border: 1.5px solid var(--border-light); display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .15s; }
.habit-check.done { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 800; font-size: 13px; }

.track-empty { background: rgba(255,255,255,0.02); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 28px; text-align: center; margin-bottom: 10px; }
.track-empty .t { font-family: var(--sans); font-weight: 600; color: var(--text-secondary); font-size: 14px; }
.track-empty .s { font-family: var(--sans); color: var(--text-muted); font-size: 12px; margin-top: 4px; }

/* ════════════════ NOTES ════════════════ */

.notes-layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  flex: 1; min-height: 0;
  gap: 0;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 0;
}

.notes-list-panel {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.notes-list-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}

.notes-list-title {
  font-family: var(--mono); font-size: 9.5px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-muted);
}

.note-list-add {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-dim); border: 1px solid var(--border-accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1; font-weight: 400; color: var(--accent);
  cursor: pointer; transition: all .15s;
}
.note-list-add:hover { background: var(--accent); color: var(--bg); }

.notes-list-scroll {
  flex: 1; overflow-y: auto;
}

.note-card {
  background: transparent; border-bottom: 1px solid var(--border);
  padding: 14px 16px; cursor: pointer; transition: background .12s;
}
.note-card:hover { background: var(--surface-hover); }
.note-card.active { background: var(--accent-dim); border-left: 2px solid var(--accent); }
.note-card .t { font-family: var(--sans); font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.note-card .p {
  font-family: var(--sans); font-size: 11.5px; color: var(--text-muted);
  line-height: 16px; margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.note-card .foot { display: flex; align-items: center; justify-content: space-between; }
.note-card .date { font-family: var(--mono); font-size: 9px; color: var(--text-dim); }
.tag-pill { padding: 2px 7px; border-radius: var(--r-pill); font-family: var(--mono); font-weight: 700; font-size: 9px; }

.notes-editor-panel {
  background: var(--glass-fill);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.editor {
  display: flex; flex-direction: column; height: 100%;
  padding: 24px 28px;
}
.editor-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; flex-shrink: 0;
}
.editor-meta { font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); }
.editor-delete { font-family: var(--sans); font-weight: 600; font-size: 13px; color: var(--red); cursor: pointer; transition: opacity .15s; }
.editor-delete:hover { opacity: .7; }
.editor-back { font-family: var(--mono); font-weight: 700; font-size: 10px; color: var(--accent); letter-spacing: 1px; cursor: pointer; transition: opacity .15s; display: none; }
.editor-back:hover { opacity: .7; }
@media (max-width: 649px) { .editor-back { display: inline-block; } }
.editor-title {
  font-family: var(--display); font-size: 26px; color: var(--text-primary);
  background: none; border: none; outline: none;
  margin-bottom: 16px; width: 100%;
}
.editor-title::placeholder { color: var(--text-dim); }
.editor-body {
  flex: 1; font-family: var(--sans); font-size: 15px; color: var(--text-primary);
  line-height: 26px; background: none; border: none; outline: none;
  resize: none; width: 100%;
}
.editor-body::placeholder { color: var(--text-muted); }
.editor-foot { padding: 14px 0 0; border-top: 1px solid var(--border); flex-shrink: 0; }
.last-edited { font-family: var(--mono); font-size: 9.5px; color: var(--text-dim); }

.notes-empty-editor {
  display: flex; align-items: center; justify-content: center;
  flex: 1; flex-direction: column; gap: 10px;
  color: var(--text-muted); font-family: var(--sans);
}
.notes-empty-editor .icon { font-size: 38px; opacity: .4; }
.notes-empty-editor .txt { font-size: 14px; font-style: italic; opacity: .6; }

/* ════════════════ PROFILE ════════════════ */

.profile-layout { max-width: 680px; }
.back-link { font-family: var(--mono); font-weight: 700; color: var(--accent); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 24px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; transition: opacity .15s; }
.back-link:hover { opacity: .7; }

.user-section { display: flex; align-items: center; gap: 18px; margin-bottom: 28px; }
.user-name { font-family: var(--display); font-size: 26px; margin-bottom: 4px; }
.user-email { font-family: var(--mono); color: var(--text-muted); font-size: 12px; }

.rank-card { background: rgba(0,255,135,0.03); border: 1px solid var(--border-accent); border-radius: var(--r-xl); padding: 24px; margin-bottom: 28px; }
.rank-emoji { font-size: 34px; margin-bottom: 8px; }
.rank-name { font-family: var(--display); color: var(--accent); font-size: 28px; margin-bottom: 4px; }
.rank-xp { font-family: var(--mono); font-weight: 700; color: var(--text-secondary); font-size: 13px; letter-spacing: 1px; margin-bottom: 18px; }
.rank-sub { font-family: var(--mono); color: var(--accent); font-size: 10.5px; opacity: .75; margin-top: 10px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 28px; }
.stat-box { background: var(--glass-fill); border: 1px solid var(--glass-border); border-radius: var(--r-lg); padding: 18px; }
.stat-box .val { font-family: var(--display); font-size: 28px; margin-bottom: 6px; }
.stat-box .lbl { font-family: var(--mono); font-weight: 700; color: var(--text-muted); font-size: 9px; letter-spacing: 1px; }

.achieve-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.achieve-count { font-family: var(--mono); font-weight: 700; color: var(--accent); font-size: 11px; letter-spacing: 1px; }
.achieve-scroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 28px; scrollbar-width: none; }
.achieve-scroll::-webkit-scrollbar { display: none; }
.achieve-card { background: var(--glass-fill); border: 1px solid var(--border-accent); border-radius: var(--r-lg); padding: 16px 14px; min-width: 108px; text-align: center; transition: all .18s cubic-bezier(.2,.8,.2,1); flex-shrink: 0; }
.achieve-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0,0,0,.2); }
.achieve-card.locked { border-color: var(--glass-border); opacity: .5; }
.achieve-card .em { font-size: 28px; margin-bottom: 8px; }
.achieve-card .nm { font-family: var(--sans); font-weight: 600; font-size: 11px; }
.achieve-card.locked .nm { color: var(--text-muted); }
.achieve-card .hint { font-family: var(--mono); color: var(--text-muted); font-size: 9px; margin-top: 4px; }

.ranks-list { background: var(--glass-fill); border: 1px solid var(--glass-border); border-radius: var(--r-lg); padding: 12px 20px; margin-bottom: 28px; }
.rank-item { display: flex; align-items: center; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--border-light); }
.rank-item:last-child { border-bottom: none; }
.rank-item.locked { opacity: .4; }
.rank-item-left { display: flex; align-items: center; }
.rank-item-emoji { font-size: 20px; margin-right: 14px; }
.rank-item-title { font-family: var(--sans); font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.rank-item-xp { font-family: var(--mono); color: var(--text-muted); font-size: 11px; }
.rank-unlocked { color: var(--accent); font-weight: 800; font-size: 16px; }

.signout-btn { width: 100%; border: 1px solid rgba(240,122,122,0.28); border-radius: var(--r-lg); padding: 16px; text-align: center; background: rgba(240,122,122,0.04); font-family: var(--sans); font-weight: 600; color: var(--red); font-size: 15px; cursor: pointer; transition: all .15s; }
.signout-btn:hover { background: rgba(240,122,122,0.1); }

/* ════════════════ MODALS ════════════════ */

.modal-overlay { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.72); backdrop-filter: blur(14px); animation: fadeIn .2s ease; }
.modal-center {
  position: relative; z-index: 1;
  width: 460px; max-width: calc(100vw - 48px);
  background: var(--surface); border-radius: var(--r-xl);
  border: 1px solid var(--border-light);
  padding: 28px;
  animation: fadeInUp .28s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 30px 70px rgba(0,0,0,.6);
}
.modal-sheet {
  position: relative; z-index: 1;
  width: 500px; max-width: calc(100vw - 48px);
  background: var(--surface); border-radius: var(--r-xl);
  border: 1px solid var(--border-light);
  padding: 28px;
  animation: fadeInUp .28s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 30px 70px rgba(0,0,0,.6);
  max-height: 85vh; overflow-y: auto;
}
.roadmap-modal {
  position: relative; z-index: 1;
  width: 580px; max-width: calc(100vw - 48px);
  max-height: 80vh;
  background: var(--surface); border-radius: var(--r-xl);
  border: 1px solid var(--border-light);
  padding: 26px;
  animation: fadeInUp .28s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 30px 70px rgba(0,0,0,.6);
  display: flex; flex-direction: column; overflow: hidden;
}

.modal-title { font-family: var(--display); font-size: 22px; margin-bottom: 22px; }
.modal-title.center { text-align: center; }
.text-input {
  width: 100%; font-family: var(--sans);
  background: rgba(255,255,255,0.04); border: 1px solid var(--border-light);
  border-radius: var(--r-md); padding: 12px 16px;
  color: var(--text-primary); font-size: 15px; outline: none;
  margin-bottom: 16px; transition: border-color .15s;
}
.text-input:focus { border-color: var(--accent); }
.cat-select-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.cat-select-chip {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.02); border: 1px solid var(--border);
  border-radius: var(--r-pill); padding: 8px 14px;
  cursor: pointer; white-space: nowrap; transition: all .15s;
}
.cat-select-chip .lbl { font-family: var(--sans); font-weight: 600; color: var(--text-muted); font-size: 13px; }
.modal-actions { display: flex; gap: 12px; }
.modal-cancel {
  flex: 1; padding: 12px; border-radius: var(--r-md);
  border: 1px solid var(--border); text-align: center;
  font-family: var(--sans); font-weight: 600; color: var(--text-muted); font-size: 14px;
  cursor: pointer; transition: all .15s;
}
.modal-cancel:hover { background: var(--surface-hover); }
.modal-submit {
  flex: 1; padding: 12px; border-radius: var(--r-md);
  background: var(--accent); color: var(--bg); text-align: center;
  font-family: var(--sans); font-weight: 600; font-size: 14px;
  cursor: pointer; transition: all .15s;
}
.modal-submit:hover { background: var(--accent-bright); }
.modal-submit.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.roadmap-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.roadmap-title { font-family: var(--display); font-size: 24px; flex: 1; padding-right: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roadmap-close { font-size: 18px; color: var(--text-muted); cursor: pointer; font-family: var(--mono); transition: color .15s; }
.roadmap-close:hover { color: var(--text-primary); }
.roadmap-subtitle { font-family: var(--mono); font-size: 11px; color: var(--accent); margin-bottom: 20px; }
.roadmap-scroll { flex: 1; overflow-y: auto; scrollbar-width: thin; }
.roadmap-item { display: flex; align-items: flex-start; padding: 13px 0; border-bottom: 1px solid var(--border); gap: 14px; }
.roadmap-item.done { opacity: .55; }
.roadmap-index { width: 26px; height: 26px; border-radius: 13px; background: rgba(255,255,255,0.04); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: var(--mono); font-weight: 700; font-size: 10px; color: var(--text-muted); }
.roadmap-index.done { background: var(--accent); color: var(--bg); font-weight: 800; }
.roadmap-index.next { border: 1px solid var(--accent); background: transparent; }
.roadmap-body { flex: 1; padding-right: 8px; }
.roadmap-text { font-family: var(--sans); font-size: 14px; color: var(--text-primary); line-height: 1.5; }
.roadmap-text.done { text-decoration: line-through; color: var(--text-muted); }
.resource-row { margin-top: 8px; display: block; }
.resource-title { font-family: var(--mono); font-weight: 700; font-size: 10.5px; color: var(--teal); transition: opacity .15s; }
.resource-title:hover { opacity: .7; }
.resource-why { font-family: var(--sans); font-size: 11px; color: var(--text-muted); margin-top: 2px; line-height: 15px; }
.complete-btn {
  background: var(--accent-dim); border: 1px solid var(--accent);
  padding: 7px 14px; border-radius: var(--r-pill);
  font-family: var(--mono); font-weight: 700; color: var(--accent); font-size: 10px; letter-spacing: 1px;
  flex-shrink: 0; align-self: center; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.complete-btn:hover { background: var(--accent); color: var(--bg); }

/* Habit add modal */
.modal-subtitle { font-family: var(--mono); font-weight: 700; color: var(--text-muted); font-size: 11px; letter-spacing: 1px; margin-bottom: 12px; }
.sugg-scroll { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 22px; }
.sugg-chip {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border);
  border-radius: var(--r-pill); padding: 9px 16px;
  cursor: pointer; font-family: var(--sans); font-weight: 600;
  color: var(--text-secondary); font-size: 13px; transition: all .15s;
}
.sugg-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.custom-input-row { display: flex; gap: 12px; margin-bottom: 22px; }
.emoji-input { width: 60px; text-align: center; font-size: 22px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: var(--r-md); color: var(--text-primary); outline: none; padding: 12px 6px; }
.title-input { flex: 1; background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: var(--r-md); color: var(--text-primary); font-size: 15px; padding: 12px 16px; outline: none; font-family: var(--sans); transition: border-color .15s; }
.title-input:focus { border-color: var(--accent); }
.reminder-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.reminder-chip { background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: var(--r-pill); padding: 7px 14px; font-family: var(--mono); font-weight: 700; color: var(--text-muted); font-size: 11px; cursor: pointer; transition: all .15s; }
.reminder-chip.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* ════════════════ AUTH ════════════════ */
.auth-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; overflow-y: auto; }
.auth-header { text-align: center; margin-bottom: 32px; }
.logo-row { display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.logo { font-size: 36px; font-family: var(--display); font-weight: 700; letter-spacing: .5px; }
.logo .os { color: var(--accent); }
.logo-dot { width: 8px; height: 8px; border-radius: 4px; background: var(--accent); margin-left: 14px; animation: pulse 1.2s ease-in-out infinite alternate; }
.tagline { font-size: 15px; color: var(--text-muted); letter-spacing: 1px; font-family: var(--display); font-style: italic; }
.auth-card { width: 100%; max-width: 440px; background: rgba(12,18,36,0.85); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 30px; box-shadow: 0 16px 40px rgba(0,0,0,.5); animation: fadeIn .35s ease; }
.auth-card-title { font-size: 24px; font-family: var(--display); margin-bottom: 8px; }
.auth-card-sub { font-size: 10px; font-family: var(--mono); color: var(--accent); margin-bottom: 28px; letter-spacing: 1.5px; text-transform: uppercase; }
.input-label { font-size: 10px; font-family: var(--mono); font-weight: 700; color: var(--text-muted); letter-spacing: 2.5px; margin: 0 0 10px 4px; display: block; }
.auth-input { width: 100%; background: rgba(255,255,255,0.03); border: 1px solid var(--border-light); border-radius: var(--r-lg); padding: 16px 20px; color: var(--text-primary); font-size: 16px; font-family: var(--sans); outline: none; margin-bottom: 20px; transition: border-color .15s; }
.auth-input:focus { border-color: var(--accent); }
.auth-btn { width: 100%; background: var(--accent); color: var(--bg); border-radius: var(--r-lg); padding: 18px; text-align: center; font-family: var(--sans); font-weight: 600; font-size: 15px; letter-spacing: 2px; margin-top: 8px; box-shadow: 0 4px 14px rgba(0,255,135,.22); cursor: pointer; transition: all .15s; }
.auth-btn:hover { background: var(--accent-bright); }
.auth-btn.disabled { opacity: .5; box-shadow: none; cursor: not-allowed; }
.toggle-row { display: flex; justify-content: center; align-items: center; margin-top: 24px; gap: 4px; cursor: pointer; }
.toggle-text { color: var(--text-secondary); font-size: 14px; }
.toggle-action { color: var(--accent); font-size: 14px; font-weight: 600; }
.options-grid { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.option-chip { background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 18px; color: var(--text-secondary); font-size: 14px; font-family: var(--sans); font-weight: 600; text-align: left; cursor: pointer; transition: all .15s; }
.option-chip:hover { border-color: var(--border-light); }
.option-chip.selected { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.options-grid-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; max-height: 280px; overflow-y: auto; }
.domain-chip { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: var(--r-pill); padding: 10px 16px; color: var(--text-secondary); font-size: 13px; font-family: var(--sans); font-weight: 600; cursor: pointer; transition: all .15s; }
.auth-back { color: var(--text-muted); font-family: var(--mono); font-weight: 700; font-size: 10.5px; letter-spacing: 1px; margin-bottom: 18px; display: inline-block; cursor: pointer; }
.loader-dot { width: 16px; height: 16px; border-radius: 8px; background: var(--accent); margin: 0 auto 20px; animation: pulse 1.2s ease-in-out infinite alternate; }

/* ════════════════ TOAST + SPINNER ════════════════ */
.spinner { width: 28px; height: 28px; border: 3px solid var(--accent-dim); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.spinner-center { display: flex; align-items: center; justify-content: center; height: 100%; min-height: 200px; }

#toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 300;
  background: var(--glass-fill-heavy); border: 1px solid var(--glass-border-bright);
  backdrop-filter: blur(18px);
  color: var(--text-primary); font-family: var(--sans); font-size: 13px;
  padding: 12px 22px; border-radius: var(--r-pill);
  box-shadow: 0 10px 28px rgba(0,0,0,.4);
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
  max-width: 480px; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }

@media (prefers-reduced-motion: reduce) {
  *, *::after, *::before { animation-duration: .001s !important; transition-duration: .001s !important; }
}

/* ────────────────────────────────────────────────────────────
   RESPONSIVE
   ──────────────────────────────────────────────────────────── */

/* Ultra-wide: cap content so it doesn't stretch absurdly */
@media (min-width: 1800px) {
  .screen { max-width: 1440px; margin: 0 auto; }
  .screen.notes-active { max-width: none; }
}

/* Large → medium: collapse home right column */
@media (max-width: 1199px) {
  .home-grid {
    grid-template-columns: 1fr;
  }
  .habits-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

/* Medium → tablet: icon-only sidebar, collapse 2-col grids */
@media (max-width: 899px) {
  :root { --sidebar-w: 56px; }

  .sidebar { padding: 18px 0; overflow: visible; }
  .sidebar-label { display: none; }
  .sidebar-item { justify-content: center; padding: 11px 8px; border-radius: var(--r-md); }
  .sidebar-item span:not(.sidebar-icon) { display: none; }
  .sidebar-icon { width: auto; margin: 0; }

  .topbar-date { display: none; }

  .track-2col { grid-template-columns: 1fr; }
  .habits-2col { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .notes-layout { grid-template-columns: 200px 1fr; }
  .screen.notes-active { padding: 16px 16px 0; }
}

/* Small: hide sidebar, minimal topbar, single-column everything */
@media (max-width: 649px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }

  .topbar-search { max-width: 200px; }
  .screen { padding: 16px 14px 28px; }
  .screen.notes-active { padding: 12px 12px 0; }

  .home-grid { gap: 14px; }
  .stats-row { flex-wrap: wrap; }
  .stats-row .stat-card { min-width: calc(50% - 7px); flex: 0 0 auto; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .skills-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .xp-points { font-size: 36px; }
  .page-title { font-size: 22px; }

  /* Notes: stack panels, toggle via class */
  .notes-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }
  .notes-layout .notes-editor-panel { display: none; }
  .notes-layout.show-editor .notes-list-panel { display: none; }
  .notes-layout.show-editor .notes-editor-panel { display: flex; }
}
