:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --fg: #14181f;
  --muted: #5f6878;
  --line: #e2e5eb;
  --accent: #2f6bff;
  --tl: 46%;
  --accent-fg: #ffffff;
  --ok: #12a150;
  --danger: #d93a3a;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .14);
  --r: 14px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1016; --surface: #151a22; --surface-2: #1c222c; --fg: #e8ebf0; --muted: #98a2b3;
    --line: #262d39; --accent: #6d97ff; --accent-fg: #0d1016; --tl: 64%; --ok: #3ccf7f; --danger: #ff6b6b;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1016; --surface: #151a22; --surface-2: #1c222c; --fg: #e8ebf0; --muted: #98a2b3;
  --line: #262d39; --accent: #6d97ff; --accent-fg: #0d1016; --tl: 64%; --ok: #3ccf7f; --danger: #ff6b6b;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.5 var(--font); min-height: 100vh;
  transition: background-color .35s var(--ease), color .35s var(--ease);
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* page enter / leave */
.page { animation: pageIn .5s var(--ease) both; }
body.leaving .page { animation: pageOut .2s var(--ease) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes pageOut { to { opacity: 0; transform: translateY(-6px); } }

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }

/* top bar */
.bar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.bar .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.logo {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-fg); font-size: 14px; font-weight: 800;
  transition: transform .4s var(--spring);
}
.brand:hover .logo { transform: rotate(-12deg) scale(1.08); }
.nav { display: flex; gap: 4px; margin-left: auto; position: relative; }
.nav a {
  position: relative; padding: 8px 12px; border-radius: 10px; color: var(--muted); font-weight: 550; font-size: 14px;
  transition: color .2s, background-color .2s;
}
.nav a:hover { color: var(--fg); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--fg); }
.nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; border-radius: 2px;
  background: var(--accent); animation: grow .4s var(--ease) both;
}
@keyframes grow { from { transform: scaleX(0); } }

/* buttons */
.btn {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: transform .15s var(--ease), border-color .2s, background-color .2s, box-shadow .2s;
}
.btn:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: var(--shadow); }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.danger { color: var(--danger); }
.btn.icon { width: 38px; padding: 0; }
.btn svg { width: 18px; height: 18px; }
.ripple {
  position: absolute; border-radius: 50%; pointer-events: none; transform: scale(0);
  background: currentColor; opacity: .25; animation: ripple .6s var(--ease) forwards;
}
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }

.theme-ico { transition: transform .5s var(--spring); }
.btn.spin .theme-ico { transform: rotate(180deg); }

/* headings */
.hero { padding: 36px 0 20px; }
.hero h1 { font-size: clamp(26px, 4.2vw, 38px); line-height: 1.1; letter-spacing: -.02em; margin: 0; }
.hero p { color: var(--muted); margin: 8px 0 0; }

/* cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
}

/* dashboard summary */
.summary { display: grid; grid-template-columns: auto 1fr; gap: 24px; padding: 22px; align-items: center; }
.ring { position: relative; width: 132px; height: 132px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .track { stroke: var(--surface-2); }
.ring .val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1.1s var(--ease); }
.ring .num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 28px; font-weight: 750; letter-spacing: -.02em; }
.ring .num small { font-size: 14px; color: var(--muted); font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-size: 22px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }

.next {
  margin-top: 16px; display: flex; align-items: center; gap: 16px; padding: 16px 18px;
  border-left: 4px solid var(--accent);
}
.next .label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.next .t { font-weight: 650; margin-top: 2px; }
.next .p { color: var(--muted); font-size: 13px; }
.next .btn { margin-left: auto; }

/* path grid */
.section-h { display: flex; align-items: baseline; justify-content: space-between; margin: 30px 0 12px; }
.section-h h2 { font-size: 18px; margin: 0; letter-spacing: -.01em; }
.section-h span { color: var(--muted); font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.tcard {
  --c: hsl(var(--h) 72% var(--tl));
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 16px; overflow: hidden;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s;
  animation: rise .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms);
}
.tcard::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--c);
  transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform .9s var(--ease);
}
.tcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--c) 45%, var(--line)); }
.tcard .top { display: flex; align-items: center; gap: 10px; }
.step {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); font-weight: 800; font-size: 13px;
}
.tcard h3 { margin: 0; font-size: 16px; letter-spacing: -.01em; }
.tcard .meta { display: flex; gap: 8px; color: var(--muted); font-size: 13px; }
.chip {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 99px;
  font-size: 12px; font-weight: 650; background: var(--surface-2); color: var(--muted); margin-left: auto; white-space: nowrap; flex: none;
  transition: background-color .3s, color .3s;
}
.chip.doing { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.chip.done { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.pbar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.pbar i {
  display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--c, var(--accent));
  transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform .8s var(--ease);
}
.tcard .foot { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* data actions */
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 30px 0 48px; }

/* tracker layout */
.layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 22px; padding: 22px 0 60px; }
.layout > * { min-width: 0; }
.side { position: sticky; top: 76px; align-self: start; display: flex; flex-direction: column; gap: 4px; max-height: calc(100vh - 92px); overflow: auto; padding: 2px; }
.side a {
  --c: hsl(var(--h) 72% var(--tl));
  position: relative; display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 11px; font-size: 14px; font-weight: 550; color: var(--muted);
  transition: background-color .2s, color .2s, transform .2s var(--ease);
  animation: slideIn .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms);
}
.side a:hover { background: var(--surface); color: var(--fg); transform: translateX(2px); }
.side a.on { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
.side a.on::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--c); animation: growY .3s var(--ease) both; }
@keyframes growY { from { transform: scaleY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } }
.side .step { width: 26px; height: 26px; font-size: 12px; border-radius: 8px; }
.side .pct { font-size: 12px; font-variant-numeric: tabular-nums; }
.side .pct.full { color: var(--ok); font-weight: 700; }

.thead { --c: hsl(var(--h) 72% var(--tl)); padding: 20px; margin-bottom: 14px; animation: rise .45s var(--ease) both; }
.thead .row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.thead h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.thead .goal { color: var(--muted); margin: 6px 0 14px; }
.thead .pbar { height: 8px; }
.thead .nums { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 8px; font-variant-numeric: tabular-nums; }
.links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.links a {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 8px;
  background: var(--surface-2); font-size: 13px; font-weight: 550; transition: transform .2s var(--ease), background-color .2s;
}
.links a:hover { transform: translateY(-2px); background: color-mix(in srgb, var(--c) 14%, var(--surface-2)); }
.links a em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--c); }

.tools { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.search { position: relative; flex: 1 1 220px; }
.search input {
  width: 100%; height: 38px; padding: 0 12px 0 36px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); transition: border-color .2s, box-shadow .2s;
}
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.search svg { position: absolute; left: 11px; top: 10px; width: 18px; height: 18px; color: var(--muted); }
.seg { display: inline-flex; position: relative; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button { position: relative; z-index: 1; border: 0; background: none; height: 30px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); transition: color .2s; }
.seg button.on { color: var(--fg); }
.seg .pill { position: absolute; top: 3px; bottom: 3px; border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); transition: left .3s var(--ease), width .3s var(--ease); }

/* modules */
.mod { margin-bottom: 10px; overflow: hidden; animation: rise .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms); }
.mod.hidden { display: none; }
.mhead {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 0; background: none; text-align: left;
}
.mhead h3 { margin: 0; font-size: 15px; font-weight: 650; flex: 1; }
.mcount { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; transition: color .3s; }
.mod.complete .mcount { color: var(--ok); }
.mini { width: 22px; height: 22px; flex: none; }
.mini svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.mini circle { fill: none; stroke-width: 4; }
.mini .track { stroke: var(--surface-2); }
.mini .val { stroke: var(--c, var(--accent)); stroke-linecap: round; transition: stroke-dashoffset .6s var(--ease), stroke .3s; }
.mod.complete .mini .val { stroke: var(--ok); }
.chev { width: 18px; height: 18px; color: var(--muted); transition: transform .35s var(--ease); }
.mod.open .chev { transform: rotate(180deg); }
.mbody { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .4s var(--ease); }
.mod.open .mbody { grid-template-rows: 1fr; }
.mbody > div { overflow: hidden; }
.mbody ul { list-style: none; margin: 0; padding: 0 8px 10px; }

.item { animation: none; }
.mod.open .item { animation: fadeUp .35s var(--ease) both; animation-delay: calc(var(--j, 0) * 25ms); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } }
.item.hidden { display: none; }
.item label {
  display: flex; align-items: flex-start; gap: 12px; padding: 9px 10px; border-radius: 10px; cursor: pointer;
  transition: background-color .2s;
}
.item label:hover { background: var(--surface-2); }
.item input { position: absolute; opacity: 0; pointer-events: none; }
.box {
  flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 6px; border: 2px solid color-mix(in srgb, var(--muted) 55%, transparent);
  display: grid; place-items: center; transition: background-color .25s, border-color .25s, transform .3s var(--spring);
}
.box svg { width: 13px; height: 13px; stroke: #fff; stroke-width: 3.2; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 20; stroke-dashoffset: 20; transition: stroke-dashoffset .3s var(--ease) .05s; }
.item input:checked + .box { background: var(--ok); border-color: var(--ok); transform: scale(1.08); }
.item input:checked + .box svg { stroke-dashoffset: 0; }
.item input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.item .txt { position: relative; transition: color .3s; }
.item .txt::after {
  content: ""; position: absolute; left: 0; right: 0; top: 52%; height: 1.5px; background: currentColor;
  transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease);
}
.item input:checked ~ .txt { color: var(--muted); }
.item input:checked ~ .txt::after { transform: scaleX(1); }
.item.pop .box { animation: pop .45s var(--spring); }
@keyframes pop { 40% { transform: scale(1.35); } }
mark { background: color-mix(in srgb, var(--accent) 25%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; animation: rise .4s var(--ease) both; }

/* burst */
.burst { position: fixed; pointer-events: none; z-index: 60; }
.burst i {
  position: absolute; width: 7px; height: 7px; border-radius: 2px; left: 0; top: 0;
  animation: fly .8s var(--ease) forwards;
}
@keyframes fly { to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; } }

/* toast */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 12px;
  background: var(--fg); color: var(--bg); font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg);
  animation: toastIn .45s var(--spring) both;
}
.toast.out { animation: toastOut .3s var(--ease) both; }
.toast .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.toast.warn .dot { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.92); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.96); } }

/* modal */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(8, 12, 20, .45); animation: fade .25s var(--ease) both; }
.modal.out { animation: fade .2s var(--ease) reverse both; }
.modal .card { width: min(380px, 100%); padding: 22px; animation: modalIn .35s var(--spring) both; }
.modal h3 { margin: 0 0 6px; }
.modal p { margin: 0 0 18px; color: var(--muted); }
.modal .row { display: flex; gap: 8px; justify-content: flex-end; }
@keyframes fade { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: scale(.9) translateY(8px); } }

/* beyond */
.bgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; padding-bottom: 60px; }
.bgrid .mod { margin: 0; --c: hsl(var(--h) 72% var(--tl)); }
.bgrid .mod .goal { color: var(--muted); font-size: 13px; font-weight: 400; display: block; margin-top: 2px; }

.foot-note { color: var(--muted); font-size: 13px; text-align: center; padding: 24px 0 40px; }

/* responsive */
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 14px; padding-top: 12px; }
  .side { position: sticky; top: 60px; z-index: 10; flex-direction: row; overflow-x: auto; max-height: none; padding: 10px 16px; margin: 0 -16px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); scrollbar-width: none; }
  .side::-webkit-scrollbar { display: none; }
  .side a { grid-template-columns: 22px auto auto; white-space: nowrap; flex: none; }
  .side a.on::before { left: 10px; right: 10px; top: auto; bottom: 2px; width: auto; height: 3px; }
  .side .step { width: 22px; height: 22px; font-size: 11px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .summary { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .stats { width: 100%; }
  .next { flex-wrap: wrap; }
  .next .btn { margin-left: 0; width: 100%; }
  .brand span { display: none; }
  .nav a { padding: 8px 10px; }
  .bgrid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
