/* ============================================================
   Melo — calm focus & mood. Soft dark, aurora, frosted glass.
   ============================================================ */

:root {
  --bg: #0b0d17;
  --bg-2: #0e1120;
  --ink: #eef1fb;
  --ink-soft: #b9c0d8;
  --muted: #9aa3c0;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --glass: rgba(22, 26, 44, 0.55);
  --glass-2: rgba(28, 33, 56, 0.6);

  --violet: #a78bfa;
  --teal: #7dd3c8;
  --pink: #f9a8d4;
  --amber: #fbbf72;

  --accent: var(--violet);
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.7);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --sans: 'Outfit', system-ui, sans-serif;
  --display: 'Fraunces', Georgia, serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.01em;
}

button { font-family: inherit; cursor: pointer; color: inherit; border: none; background: none; }
input { font-family: inherit; }
::selection { background: rgba(167, 139, 250, 0.35); }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 10px; left: 10px; z-index: 1000; padding: 10px 14px; border-radius: 10px; background: var(--ink); color: var(--bg); text-decoration: none; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
:where(button, a, input, select, textarea, [tabindex]):focus-visible { outline: 3px solid #d2c7ff; outline-offset: 3px; }
:where(button, input, select, textarea):disabled { cursor: not-allowed; opacity: 0.55; }
.empty-message { padding: 24px 4px; line-height: 1.55; }
.empty-message.compact { padding: 6px 2px; font-size: 0.82rem; }
.access-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.access-card { width: min(460px, 100%); padding: 38px 34px; text-align: center; }
.access-card h1 { font-family: var(--display); font-weight: 400; font-size: 2rem; margin-bottom: 12px; }
.access-card p:not(.eyebrow) { color: var(--ink-soft); line-height: 1.55; margin-bottom: 22px; }
.access-card .ctl, .access-card .btn-soft { width: 100%; margin-top: 10px; }
.access-card .btn-soft { display: inline-block; text-decoration: none; }

/* ---------- Aurora background ---------- */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(125, 211, 200, 0.10), transparent 60%),
    radial-gradient(900px 500px at 0% 100%, rgba(167, 139, 250, 0.12), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  mix-blend-mode: screen;
  animation: drift 26s var(--ease) infinite alternate;
}
.blob-1 { width: 46vw; height: 46vw; left: -8vw; top: -10vw; background: radial-gradient(circle, #6d5cff, transparent 70%); }
.blob-2 { width: 42vw; height: 42vw; right: -6vw; top: 18vh; background: radial-gradient(circle, #1f8d7f, transparent 70%); animation-delay: -8s; animation-duration: 32s; }
.blob-3 { width: 38vw; height: 38vw; left: 30vw; bottom: -16vw; background: radial-gradient(circle, #b25fd1, transparent 70%); animation-delay: -14s; animation-duration: 30s; opacity: 0.4; }
@keyframes drift {
  0%   { transform: translate(0,0) scale(1); }
  50%  { transform: translate(4vw, 3vh) scale(1.12); }
  100% { transform: translate(-3vw, -4vh) scale(0.96); }
}
.grain {
  position: absolute; inset: 0;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Shell / layout ---------- */
.shell {
  display: grid;
  grid-template-columns: 252px 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  border-right: 1px solid var(--line);
  backdrop-filter: blur(14px);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px; }
.brand-mark { display: grid; place-items: center; filter: drop-shadow(0 4px 14px rgba(167,139,250,0.4)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--display); font-size: 1.5rem; font-weight: 500; letter-spacing: -0.02em; }
.brand-sub { font-size: 0.7rem; color: var(--muted); letter-spacing: 0.16em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: 0.95rem; font-weight: 400;
  transition: all 0.3s var(--ease);
  position: relative;
}
.nav-item .ico { width: 19px; height: 19px; opacity: 0.8; transition: all 0.3s var(--ease); }
.nav-item:hover { color: var(--ink); background: rgba(255,255,255,0.04); }
.nav-item:hover .ico { opacity: 1; }
.nav-item.is-active {
  color: var(--ink);
  background: linear-gradient(100deg, rgba(167,139,250,0.18), rgba(125,211,200,0.10));
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.nav-item.is-active .ico { color: var(--violet); opacity: 1; }
.nav-item.is-active::before {
  content: ''; position: absolute; left: -20px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 3px; background: linear-gradient(var(--violet), var(--teal));
}

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.nav-item.subtle { font-size: 0.88rem; color: var(--muted); }
.streak-pill {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  background: rgba(251,191,114,0.08);
  border: 1px solid rgba(251,191,114,0.16);
  font-size: 0.85rem; color: var(--ink-soft);
}
.streak-pill .flame { color: var(--amber); font-size: 1.05rem; }
.streak-pill b { color: var(--ink); }

/* ---------- Topbar (mobile) ---------- */
.topbar { display: none; }

/* ---------- Main ---------- */
.main { padding: 44px 48px 80px; max-width: 1180px; width: 100%; }

.view { display: none; animation: viewIn 0.5s var(--ease); }
.view.is-active { display: block; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.view-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 34px; flex-wrap: wrap;
}
.eyebrow { font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.view-title {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -0.02em;
  line-height: 1; color: var(--ink);
}

/* ---------- Glass cards ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.card-head h3 { font-family: var(--display); font-weight: 400; font-size: 1.18rem; }
.muted { color: var(--muted); font-size: 0.82rem; }

/* ============================================================
   FOCUS / TIMER
   ============================================================ */
.mode-switch {
  display: inline-flex; gap: 4px; padding: 5px;
  border-radius: 999px; background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
}
.mode {
  padding: 9px 18px; border-radius: 999px; font-size: 0.86rem;
  color: var(--ink-soft); transition: all 0.3s var(--ease); white-space: nowrap;
}
.mode.is-active { background: var(--ink); color: var(--bg); font-weight: 500; }
.mode:not(.is-active):hover { color: var(--ink); }

.timer-stage {
  display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: start;
}
.timer-glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
  padding: 40px; display: flex; flex-direction: column; align-items: center; gap: 30px;
}

.ring-wrap { position: relative; width: min(340px, 70vw); aspect-ratio: 1; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring-track { fill: none; stroke: rgba(255,255,255,0.06); stroke-width: 8; }
.ring-prog {
  fill: none; stroke: url(#g); stroke-width: 8; stroke-linecap: round;
  stroke: var(--accent);
  filter: drop-shadow(0 0 12px rgba(167,139,250,0.55));
  transition: stroke-dashoffset 0.45s linear, stroke 0.6s var(--ease);
}
.ring-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
}
.ring-mode { font-size: 0.74rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted); }
.ring-time {
  font-family: var(--display); font-weight: 300;
  font-size: clamp(3.4rem, 9vw, 5rem); line-height: 1; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.ring-task { font-size: 0.82rem; color: var(--ink-soft); max-width: 80%; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.is-running .ring-prog { filter: drop-shadow(0 0 18px rgba(167,139,250,0.7)); }
.is-running .ring-time { animation: breathe 4s var(--ease) infinite; }
@keyframes breathe { 0%,100% { opacity: 1; } 50% { opacity: 0.78; } }

.timer-controls { display: flex; align-items: center; gap: 18px; }
.ctl {
  display: grid; place-items: center; transition: all 0.3s var(--ease);
}
.ctl .ico { width: 22px; height: 22px; }
.ctl.ghost {
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255,255,255,0.05); border: 1px solid var(--line); color: var(--ink-soft);
}
.ctl.ghost:hover { background: rgba(255,255,255,0.1); color: var(--ink); transform: scale(1.05); }
.ctl.primary {
  height: 56px; padding: 0 46px; border-radius: 999px;
  font-size: 1.05rem; font-weight: 500; letter-spacing: 0.03em;
  color: var(--bg);
  background: linear-gradient(110deg, var(--violet), var(--teal));
  box-shadow: 0 14px 40px -10px rgba(167,139,250,0.7);
}
.ctl.primary:hover { transform: translateY(-2px); box-shadow: 0 20px 50px -12px rgba(167,139,250,0.85); }
.ctl.primary:active { transform: translateY(0); }

.session-dots { display: flex; gap: 9px; }
.session-dots i {
  width: 9px; height: 9px; border-radius: 50%;
  background: rgba(255,255,255,0.12); transition: all 0.4s var(--ease);
}
.session-dots i.done { background: var(--teal); box-shadow: 0 0 10px rgba(125,211,200,0.6); }

/* Focus side column */
.focus-side { display: flex; flex-direction: column; gap: 22px; }
.tasklink { padding: 22px; }
.tasklink-list { display: flex; flex-direction: column; gap: 8px; max-height: 230px; overflow-y: auto; margin-bottom: 14px; }
.tasklink-list:empty::after {
  content: 'No tasks yet — add one to focus on.'; color: var(--muted); font-size: 0.85rem;
  display: block; padding: 8px 2px;
}
.t-row {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px;
  border-radius: 12px; background: rgba(255,255,255,0.03);
  border: 1px solid transparent; transition: all 0.25s var(--ease);
}
.t-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 11px; text-align: left; border-radius: 9px; }
.t-row:hover { background: rgba(255,255,255,0.06); }
.t-row.done .t-label { color: var(--muted); text-decoration: line-through; }
.t-check {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--line-strong); display: grid; place-items: center;
  transition: all 0.25s var(--ease);
}
.t-check { color: transparent; font-size: 0.75rem; }
.t-row.done .t-check { background: var(--teal); border-color: var(--teal); }
.t-row.done .t-check { color: var(--bg); }
.t-label { flex: 1; font-size: 0.9rem; }
.t-del { color: var(--muted); opacity: 0.7; font-size: 1.2rem; line-height: 1; transition: all 0.2s; width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0; }
.t-row:hover .t-del, .t-del:focus-visible { opacity: 1; }
.t-del:hover { opacity: 1; color: var(--pink); }

.quick-add { display: flex; gap: 8px; }
.quick-add input {
  flex: 1; padding: 11px 14px; border-radius: 12px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--line);
  color: var(--ink); font-size: 0.88rem; transition: all 0.25s var(--ease);
}
.quick-add input::placeholder { color: var(--muted); }
.quick-add input:focus { outline: none; border-color: rgba(167,139,250,0.5); background: rgba(255,255,255,0.07); }
.quick-add button {
  width: 42px; border-radius: 12px; font-size: 1.3rem; color: var(--bg); flex-shrink: 0;
  background: linear-gradient(135deg, var(--violet), var(--teal)); transition: transform 0.2s var(--ease);
}
.quick-add button:hover { transform: scale(1.06); }
.quick-add.big { margin-bottom: 18px; }
.quick-add.big input { padding: 14px 18px; font-size: 0.95rem; }
.quick-add.big button { width: auto; padding: 0 24px; font-size: 0.95rem; font-weight: 500; }

.mini-stats { display: grid; grid-template-columns: repeat(3,1fr); padding: 22px; }
.mini { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.mini + .mini { border-left: 1px solid var(--line); }
.mini-num { font-family: var(--display); font-size: 1.7rem; font-weight: 400; }
.mini-lbl { font-size: 0.7rem; color: var(--muted); letter-spacing: 0.06em; }

/* ============================================================
   SOUNDS
   ============================================================ */
.sound-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 20px; }
.sound-card {
  position: relative; overflow: hidden;
  padding: 24px; border-radius: var(--radius);
  background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(22px); transition: all 0.4s var(--ease);
}
.sound-card .s-glow {
  position: absolute; inset: 0; opacity: 0; transition: opacity 0.5s var(--ease);
  background: radial-gradient(120% 90% at 30% 0%, var(--sc), transparent 70%);
}
.sound-card.on { border-color: var(--scb); box-shadow: 0 0 0 1px var(--scb), 0 20px 50px -20px var(--sc); }
.sound-card.on .s-glow { opacity: 0.25; }
.sound-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; position: relative; }
.sound-icon { font-size: 1.7rem; }
.sound-name { font-family: var(--display); font-size: 1.2rem; }
.sound-state {
  width: 52px; height: 44px; border-radius: 12px; background: transparent;
  position: relative; transition: background 0.3s var(--ease); flex-shrink: 0;
}
.sound-state::before { content: ''; position: absolute; width: 46px; height: 26px; border-radius: 999px; background: rgba(255,255,255,0.14); left: 3px; top: 9px; }
.sound-state::after {
  content: ''; position: absolute; top: 12px; left: 6px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--ink); transition: all 0.3s var(--ease);
}
.sound-card.on .sound-state::before { background: var(--scb); }
.sound-card.on .sound-state::after { left: 26px; }
.sound-card .s-sub { color: var(--muted); font-size: 0.8rem; position: relative; margin-bottom: 16px; }
.vol-row { display: flex; align-items: center; gap: 10px; position: relative; }
.volume-icon { color: var(--muted); width: 16px; flex-shrink: 0; }
.vol-row svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.vol {
  -webkit-appearance: none; appearance: none; flex: 1; height: 5px; border-radius: 4px;
  background: rgba(255,255,255,0.12); outline: none;
}
.vol::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--scb); box-shadow: 0 0 0 4px rgba(255,255,255,0.06); cursor: pointer; transition: transform 0.2s;
}
.vol::-webkit-slider-thumb:hover { transform: scale(1.2); }
.vol::-moz-range-thumb { width: 16px; height: 16px; border: none; border-radius: 50%; background: var(--scb); cursor: pointer; }
.sound-note { color: var(--muted); font-size: 0.85rem; margin-top: 26px; max-width: 540px; line-height: 1.6; }

/* ============================================================
   MOOD
   ============================================================ */
.mood-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; }
.chart-card { padding: 26px; }
.moodchart-wrap { height: 280px; position: relative; }
.moodchart-wrap.small { height: 200px; }
.moodchart-wrap[data-chart-error]::after { content: attr(data-chart-error); position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.timeline-card { padding: 26px; }
.timeline { display: flex; flex-direction: column; gap: 2px; max-height: 360px; overflow-y: auto; padding-right: 6px; }
.tl-item {
  display: flex; gap: 14px; padding: 14px 6px; position: relative;
  border-bottom: 1px solid var(--line);
}
.tl-item:last-child { border-bottom: none; }
.tl-emoji {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  font-size: 1.4rem; flex-shrink: 0; border: 1px solid var(--line);
}
.tl-body { flex: 1; min-width: 0; }
.tl-note { font-size: 0.92rem; margin-bottom: 3px; }
.tl-note.empty { color: var(--muted); font-style: italic; }
.tl-meta { font-size: 0.74rem; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.tl-dot { width: 6px; height: 6px; border-radius: 50%; }

/* ============================================================
   TASKS
   ============================================================ */
.task-filter { display: inline-flex; gap: 6px; }
.chip {
  padding: 8px 16px; border-radius: 999px; font-size: 0.84rem; color: var(--ink-soft);
  border: 1px solid var(--line); background: rgba(255,255,255,0.03); transition: all 0.25s var(--ease);
}
.chip:hover { color: var(--ink); }
.chip.is-active { background: var(--ink); color: var(--bg); border-color: transparent; font-weight: 500; }

.tasks-panel { padding: 28px; }
.tasks-list { display: flex; flex-direction: column; gap: 8px; min-height: 80px; }
.tasks-list:empty::after { content: 'All clear. Add something to focus on.'; color: var(--muted); display: block; padding: 30px; text-align: center; }
.tasks-list .t-row { padding: 13px 15px; }
.tasks-list .t-label { font-size: 0.96rem; }
.t-meta { font-size: 0.72rem; color: var(--muted); margin-left: auto; padding-right: 8px; white-space: nowrap; }
.tasks-foot { display: flex; align-items: center; gap: 16px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.tasks-foot span { font-size: 0.85rem; color: var(--ink-soft); white-space: nowrap; }
.task-bar { flex: 1; height: 7px; border-radius: 7px; background: rgba(255,255,255,0.08); overflow: hidden; }
.task-bar span { display: block; height: 100%; width: 0; border-radius: 7px; background: linear-gradient(90deg, var(--violet), var(--teal)); }

/* ============================================================
   DASHBOARD
   ============================================================ */
.stat-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 18px; margin-bottom: 24px; }
.stat { padding: 24px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.stat-ico { font-size: 1.2rem; color: var(--c); width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, transparent); margin-bottom: 6px; }
.stat-num { font-family: var(--display); font-size: 2.2rem; font-weight: 400; line-height: 1; }
.stat-num small { font-size: 1.1rem; color: var(--muted); font-family: var(--sans); }
.stat-lbl { font-size: 0.8rem; color: var(--muted); }

.dash-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 24px; margin-bottom: 24px; }
.chart-card.wide { grid-column: auto; }
.bars { display: flex; align-items: flex-end; gap: 14px; height: 230px; padding-top: 12px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; height: 100%; justify-content: flex-end; }
.bar {
  width: 100%; max-width: 46px; border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, var(--violet), rgba(125,211,200,0.5));
  position: relative; min-height: 4px;
}
.bar.today { background: linear-gradient(180deg, var(--teal), var(--violet)); box-shadow: 0 0 18px rgba(125,211,200,0.4); }
.bar-val { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); font-size: 0.72rem; color: var(--ink-soft); white-space: nowrap; }
.bar-lbl { font-size: 0.74rem; color: var(--muted); }

.log-card { padding: 26px; }
.log-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.log-row { display: flex; align-items: center; gap: 14px; padding: 13px 4px; border-bottom: 1px solid var(--line); }
.log-row:last-child { border-bottom: none; }
.log-row:empty { display: none; }
.log-badge { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-size: 0.9rem; flex-shrink: 0; }
.log-main { flex: 1; min-width: 0; }
.log-title { font-size: 0.92rem; }
.log-sub { font-size: 0.74rem; color: var(--muted); }
.log-right { text-align: right; }
.log-dur { font-family: var(--display); font-size: 1.05rem; }
.log-when { font-size: 0.72rem; color: var(--muted); }

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-panel { padding: 12px 28px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: none; }
.set-row h4 { font-size: 1rem; font-weight: 500; margin-bottom: 3px; }
.set-row p { font-size: 0.82rem; color: var(--muted); }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: rgba(255,255,255,0.04); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.stepper button { width: 34px; height: 34px; border-radius: 9px; font-size: 1.2rem; color: var(--ink-soft); transition: all 0.2s; }
.stepper button:hover { background: rgba(255,255,255,0.1); color: var(--ink); }
.stepper span { min-width: 38px; text-align: center; font-family: var(--display); font-size: 1.15rem; }
.toggle { width: 54px; height: 44px; border-radius: 12px; background: transparent; position: relative; transition: background 0.3s var(--ease); flex-shrink: 0; }
.toggle::before { content: ''; position: absolute; left: 2px; top: 8px; width: 50px; height: 28px; border-radius: 999px; background: rgba(255,255,255,0.14); }
.toggle span { position: absolute; top: 11px; left: 5px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); transition: all 0.3s var(--ease); }
.toggle.is-on::before { background: linear-gradient(110deg, var(--violet), var(--teal)); }
.toggle.is-on span { left: 27px; }
.set-row.danger h4 { color: var(--pink); }
.btn-danger { padding: 11px 22px; border-radius: 12px; color: var(--pink); border: 1px solid rgba(249,168,212,0.3); background: rgba(249,168,212,0.06); font-size: 0.9rem; transition: all 0.25s; }
.btn-danger:hover { background: rgba(249,168,212,0.16); }

/* ---------- Buttons ---------- */
.btn-soft { padding: 11px 22px; border-radius: 999px; font-size: 0.9rem; color: var(--ink-soft); border: 1px solid var(--line); background: rgba(255,255,255,0.04); transition: all 0.25s var(--ease); }
.btn-soft:hover { color: var(--ink); background: rgba(255,255,255,0.08); }
.btn-soft.accent { color: var(--bg); background: linear-gradient(110deg, var(--violet), var(--teal)); border-color: transparent; font-weight: 500; box-shadow: 0 10px 30px -10px rgba(167,139,250,0.6); }
.btn-soft.accent:hover { transform: translateY(-1px); }
.btn-soft.accent:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-scrim {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: rgba(6,8,16,0.6); backdrop-filter: blur(10px);
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.35s var(--ease), visibility 0s linear 0.35s; padding: 20px;
}
.modal-scrim.open { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
.modal {
  width: min(460px, 100%); padding: 36px; position: relative; text-align: center;
  transform: scale(0.94) translateY(10px); transition: transform 0.4s var(--ease);
}
.modal-scrim.open .modal { transform: scale(1) translateY(0); }
.modal h2 { font-family: var(--display); font-weight: 400; font-size: 1.7rem; margin-bottom: 24px; }
.modal-x { position: absolute; top: 18px; right: 20px; font-size: 1.6rem; color: var(--muted); line-height: 1; transition: color 0.2s; }
.modal-x:hover { color: var(--ink); }
.emoji-scale { display: flex; justify-content: center; gap: 8px; margin-bottom: 22px; }
.emoji-scale button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 4px; border-radius: 16px; border: 1px solid transparent;
  transition: all 0.25s var(--ease);
}
.emoji-scale button span { font-size: 1.9rem; filter: grayscale(0.3); transition: all 0.25s var(--ease); }
.emoji-scale button small { font-size: 0.68rem; color: var(--muted); }
.emoji-scale button:hover { background: rgba(255,255,255,0.05); }
.emoji-scale button:hover span { transform: scale(1.12); filter: grayscale(0); }
.emoji-scale button.sel { background: rgba(167,139,250,0.14); border-color: rgba(167,139,250,0.4); }
.emoji-scale button.sel span { filter: grayscale(0); transform: scale(1.15); }
.emoji-scale button.sel small { color: var(--ink); }
.mood-note-input {
  width: 100%; padding: 14px 16px; border-radius: 14px; margin-bottom: 24px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--line); color: var(--ink); font-size: 0.95rem; text-align: center;
}
.mood-note-input::placeholder { color: var(--muted); }
.mood-note-input:focus { outline: none; border-color: rgba(167,139,250,0.5); }
.modal-actions { display: flex; gap: 12px; justify-content: center; }

/* ---------- Toasts ---------- */
.toast-host { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast {
  padding: 13px 22px; border-radius: 14px; font-size: 0.9rem;
  background: rgba(22,26,44,0.9); border: 1px solid var(--line-strong);
  backdrop-filter: blur(18px); box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px;
  animation: toastIn 0.4s var(--ease); max-width: 90vw;
}
.toast .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); flex-shrink: 0; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.toast.out { animation: toastOut 0.35s var(--ease) forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

/* ---------- Mobile nav ---------- */
.mobnav { display: none; }

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1080px) {
  .timer-stage { grid-template-columns: 1fr; }
  .mood-grid, .dash-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; position: sticky; top: 0; z-index: 50;
    backdrop-filter: blur(16px); background: rgba(11,13,23,0.7);
    border-bottom: 1px solid var(--line);
  }
  .brand.small .brand-name { font-family: var(--display); font-size: 1.25rem; }
  .brand.small { gap: 9px; }
  .topbar-mini { font-size: 0.85rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
  .main { padding: 24px 20px 110px; }
  .mobnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 80;
    padding: 10px 8px calc(10px + env(safe-area-inset-bottom)); justify-content: space-around;
    backdrop-filter: blur(18px); background: rgba(11,13,23,0.82); border-top: 1px solid var(--line);
  }
  .mob { flex: 1 1 44px; max-width: 52px; min-width: 44px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: var(--muted); transition: all 0.3s var(--ease); }
  .mob .ico { width: 22px; height: 22px; }
  .mob.is-active { color: var(--violet); background: rgba(167,139,250,0.12); }
  .timer-glass { padding: 28px 18px; }
}

@media (max-width: 460px) {
  .stat-row { grid-template-columns: repeat(2,1fr); gap: 12px; }
  .stat { padding: 18px; }
  .mode-switch { width: 100%; justify-content: center; }
  .view-head { gap: 16px; }
  .emoji-scale button span { font-size: 1.5rem; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .blob { animation: none; }
  html { scroll-behavior: auto; }
}

/* SVG icon defaults */
.ico { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ============================================================
   PRESETS (focus side)
   ============================================================ */
.preset-card { padding: 22px; }
.preset-list { display: flex; flex-direction: column; gap: 8px; }
.preset {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  padding: 12px 14px; border-radius: 12px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--line);
  transition: all 0.25s var(--ease);
}
.preset:hover { background: rgba(255,255,255,0.06); border-color: var(--line-strong); }
.preset.is-active { border-color: rgba(167,139,250,0.5); background: linear-gradient(100deg, rgba(167,139,250,0.14), rgba(125,211,200,0.08)); }
.preset-name { font-size: 0.94rem; font-weight: 500; }
.preset-meta { font-size: 0.74rem; color: var(--muted); }

/* ============================================================
   GOAL CARD (dashboard home)
   ============================================================ */
.goal-card { padding: 24px 28px; display: flex; align-items: center; gap: 28px; margin-bottom: 24px; }
.goal-info { flex: 1; min-width: 0; }
.goal-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.goal-head h3 { font-family: var(--display); font-weight: 400; font-size: 1.18rem; }
.goal-pct { font-family: var(--display); font-size: 1.6rem; color: var(--teal); }
.goal-bar { height: 10px; border-radius: 8px; background: rgba(255,255,255,0.08); overflow: hidden; }
.goal-bar span { display: block; height: 100%; width: 0; border-radius: 8px; background: linear-gradient(90deg, var(--violet), var(--teal)); }
.goal-sub { font-size: 0.84rem; color: var(--ink-soft); margin-top: 12px; }
.goal-card.done .goal-pct { color: var(--violet); }
.goal-ring-wrap { position: relative; width: 96px; height: 96px; flex-shrink: 0; }
.goal-ring { width: 96px; height: 96px; transform: rotate(-90deg); }
.goal-ring-track { fill: none; stroke: rgba(255,255,255,0.08); stroke-width: 7; }
.goal-ring-prog { fill: none; stroke: var(--teal); stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset 0.7s var(--ease); filter: drop-shadow(0 0 8px rgba(125,211,200,0.5)); }
.goal-ring-emoji { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.5rem; color: var(--teal); }
.goal-card.done .goal-ring-prog { stroke: var(--violet); }
.goal-card.done .goal-ring-emoji { color: var(--violet); }

/* settings text input */
.set-input {
  padding: 11px 14px; border-radius: 12px; min-width: 200px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--line);
  color: var(--ink); font-size: 0.9rem; transition: all 0.25s var(--ease);
}
.set-input::placeholder { color: var(--muted); }
.set-input:focus { outline: none; border-color: rgba(167,139,250,0.5); background: rgba(255,255,255,0.07); }
a.btn-soft { text-decoration: none; display: inline-block; }

/* ============================================================
   ONBOARDING
   ============================================================ */
body.onb-lock { overflow: hidden; }
.onb {
  position: fixed; inset: 0; z-index: 300;
  background-color: var(--bg);
  background-image: linear-gradient(180deg, var(--bg), var(--bg-2));
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.4s var(--ease), visibility 0s linear 0.4s;
  overflow-y: auto;
}
.onb.open { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
.onb-aurora { position: fixed; inset: 0; overflow: hidden; z-index: 0; }
.onb-aurora .blob-1 { width: 50vw; height: 50vw; left: -10vw; top: -12vw; background: radial-gradient(circle, #6d5cff, transparent 70%); }
.onb-aurora .blob-2 { width: 46vw; height: 46vw; right: -8vw; bottom: -12vw; background: radial-gradient(circle, #1f8d7f, transparent 70%); animation-delay: -8s; }
.onb-shell {
  position: relative; z-index: 1;
  max-width: 720px; margin: 0 auto; min-height: 100vh;
  display: flex; flex-direction: column; padding: 28px 28px 48px;
}
.onb-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 30px; }
.onb-top .brand-name { font-family: var(--display); font-size: 1.4rem; }
.onb-skip { font-size: 0.86rem; color: var(--muted); padding: 8px 14px; border-radius: 999px; transition: all 0.25s; }
.onb-skip:hover { color: var(--ink); background: rgba(255,255,255,0.05); }
.onb-progress { display: flex; gap: 7px; margin-bottom: 38px; }
.onb-progress i { height: 4px; flex: 1; border-radius: 4px; background: rgba(255,255,255,0.1); transition: background 0.4s var(--ease); }
.onb-progress i.done { background: linear-gradient(90deg, var(--violet), var(--teal)); }
.onb-stage { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.onb-step { display: none; animation: viewIn 0.5s var(--ease); }
.onb-step.is-active { display: block; }
.onb-title { font-family: var(--display); font-weight: 400; font-size: clamp(1.9rem, 5vw, 2.8rem); letter-spacing: -0.02em; line-height: 1.05; margin: 6px 0 14px; color: var(--ink); }
.onb-lede { font-size: 1rem; color: var(--ink-soft); line-height: 1.6; max-width: 540px; margin-bottom: 30px; }
.onb-actions { display: flex; gap: 14px; align-items: center; margin-top: 36px; }
.onb-actions .ctl.primary { height: 52px; padding: 0 38px; }
.onb-input {
  width: 100%; max-width: 420px; padding: 16px 20px; border-radius: 16px; font-size: 1.05rem;
  background: rgba(255,255,255,0.05); border: 1px solid var(--line-strong); color: var(--ink);
}
.onb-input::placeholder { color: var(--muted); }
.onb-input:focus { outline: none; border-color: rgba(167,139,250,0.6); background: rgba(255,255,255,0.08); }

.onb-features { display: flex; flex-direction: column; gap: 16px; max-width: 540px; }
.onb-feat { display: flex; gap: 16px; align-items: flex-start; }
.onb-feat > span { font-size: 1.3rem; width: 46px; height: 46px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: 13px; background: rgba(167,139,250,0.12); color: var(--violet); border: 1px solid var(--line); }
.onb-feat b { font-size: 0.98rem; display: block; margin-bottom: 2px; }
.onb-feat p { font-size: 0.85rem; color: var(--muted); line-height: 1.5; }

.onb-goal-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; max-width: 480px; }
.onb-goal-grid button {
  padding: 22px 8px; border-radius: 16px; font-family: var(--display); font-size: 1.7rem;
  background: rgba(255,255,255,0.04); border: 1px solid var(--line); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 2px; transition: all 0.25s var(--ease);
}
.onb-goal-grid button small { font-size: 0.7rem; color: var(--muted); font-family: var(--sans); }
.onb-goal-grid button:hover { background: rgba(255,255,255,0.07); }
.onb-goal-grid button.sel { border-color: rgba(167,139,250,0.6); background: linear-gradient(120deg, rgba(167,139,250,0.18), rgba(125,211,200,0.1)); }
.onb-hint { font-size: 0.85rem; color: var(--muted); margin-top: 16px; }

.onb-sound-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 14px; max-width: 560px; }
.onb-sound {
  position: relative; padding: 20px 16px; border-radius: 18px; text-align: left;
  background: rgba(255,255,255,0.04); border: 1px solid var(--line); transition: all 0.25s var(--ease);
  display: flex; flex-direction: column; gap: 4px;
}
.onb-sound:hover { background: rgba(255,255,255,0.07); }
.onb-sound.sel { border-color: var(--scb); box-shadow: 0 0 0 1px var(--scb); background: rgba(255,255,255,0.06); }
.onb-sound-ico { font-size: 1.6rem; }
.onb-sound-name { font-family: var(--display); font-size: 1.1rem; }
.onb-sound-sub { font-size: 0.76rem; color: var(--muted); }
.onb-check { position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--scb, var(--teal)); color: var(--bg); display: grid; place-items: center; font-size: 0.8rem; opacity: 0; transform: scale(0.5); transition: all 0.25s var(--ease); }
.onb-sound.sel .onb-check { opacity: 1; transform: scale(1); }

.onb-preset-grid { display: flex; flex-direction: column; gap: 12px; max-width: 540px; }
.onb-preset {
  position: relative; padding: 18px 20px; border-radius: 16px; text-align: left;
  background: rgba(255,255,255,0.04); border: 1px solid var(--line); transition: all 0.25s var(--ease);
  display: flex; flex-direction: column; gap: 4px;
}
.onb-preset:hover { background: rgba(255,255,255,0.07); }
.onb-preset b { font-size: 1.02rem; }
.onb-preset span:not(.onb-check) { font-size: 0.82rem; color: var(--muted); }
.onb-preset.sel { border-color: rgba(167,139,250,0.6); background: linear-gradient(100deg, rgba(167,139,250,0.16), rgba(125,211,200,0.08)); }
.onb-preset .onb-check { background: var(--violet); }
.onb-preset.sel .onb-check { opacity: 1; transform: scale(1); }

@media (max-width: 540px) {
  .onb-goal-grid { grid-template-columns: repeat(2,1fr); }
  .onb-shell { padding: 20px 18px 40px; }
  .onb-actions { flex-direction: column-reverse; align-items: stretch; }
  .onb-actions .ctl.primary, .onb-actions .btn-soft { width: 100%; }
  .goal-card { flex-direction: column-reverse; align-items: stretch; gap: 18px; }
  .goal-ring-wrap { margin: 0 auto; }
}

/* ============================================================
   AI focus tip card (Focus view side panel)
   ============================================================ */
.tip-card { padding: 22px; }
.tip-card .card-head { margin-bottom: 12px; }
.tip-text {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink-soft);
  font-family: var(--display);
  font-weight: 300;
  letter-spacing: 0.1px;
}
.tip-refresh {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.25s var(--ease);
}
.tip-refresh:hover { color: var(--ink); background: rgba(255, 255, 255, 0.08); transform: rotate(-30deg); }
.tip-refresh .ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tip-card.loading .tip-text { opacity: 0.55; animation: tipPulse 1.3s ease-in-out infinite; }
.tip-card.loading .tip-refresh { pointer-events: none; opacity: 0.5; }
/* Honest error state — the real AI tip is unavailable; no canned text. */
.tip-card.tip-error .tip-text { color: #f6b2b2; opacity: 1; font-style: italic; }
@keyframes tipPulse { 0%,100% { opacity: 0.35; } 50% { opacity: 0.7; } }

/* ============================================================
   Mood reflection (inside the check-in modal)
   ============================================================ */
.mood-reflection {
  margin-top: 6px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  animation: reflFade 0.4s var(--ease);
}
.mood-reflection .eyebrow { margin-bottom: 8px; }
.reflection-text {
  font-family: var(--display);
  font-weight: 300;
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--ink);
  margin-bottom: 16px;
}
.mood-reflection.loading .reflection-text { opacity: 0.55; animation: tipPulse 1.3s ease-in-out infinite; }
/* Honest error state — reflection unavailable; check-in still saved. No canned text. */
.mood-reflection.reflection-error .reflection-text { color: #f6b2b2; font-style: italic; }
@keyframes reflFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
