/* CYBERPATH styles. Mobile first; the nav becomes a side rail on wide screens. */
:root {
  --bg: #050607;
  --surface: #0a0d0f;
  --surface2: #0f1417;
  --line: #1a2125;
  --line2: #263036;
  --text: #e8eef0;
  --muted: #8493a0;
  --accent: #00ff88;
  --accent-ink: #02150b;
  --accent-soft: rgba(0, 255, 136, .10);
  --accent-mid: rgba(0, 255, 136, .32);
  --blue: #4d9bff;
  --blue-soft: rgba(77, 155, 255, .12);
  --warn: #ffb020;
  --danger: #ff5468;
  --radius: 6px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --navh: 58px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f6f5;
  --surface: #ffffff;
  --surface2: #eaf0ee;
  --line: #d9e2df;
  --line2: #c3cfcb;
  --text: #0b1417;
  --muted: #566771;
  --accent: #00a35c;
  --accent-ink: #ffffff;
  --accent-soft: rgba(0, 163, 92, .10);
  --accent-mid: rgba(0, 163, 92, .34);
  --blue: #1c6fe0;
  --blue-soft: rgba(28, 111, 224, .10);
  --warn: #b36b00;
  --danger: #d6203a;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; min-width: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden; overscroll-behavior-y: none;
  -webkit-touch-callout: none;
}
p, h1, h2, h3, li, a, span, code, label { overflow-wrap: anywhere; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
input, textarea, select { font: inherit; font-size: 16px; color: var(--text); }
code { font-family: var(--mono); font-size: .86em; background: var(--surface2); border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Layout ---------- */
#view {
  max-width: 720px; margin: 0 auto; outline: none;
  padding: calc(var(--sat) + 16px) max(16px, var(--sal)) calc(var(--navh) + var(--sab) + 28px) max(16px, var(--sar));
  animation: fadein .18s ease-out;
}
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 0 var(--sal) var(--sab) var(--sar);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.nav a {
  position: relative; min-height: var(--navh);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 10.5px; letter-spacing: .02em; transition: color .15s;
}
.nav a svg { width: 23px; height: 23px; }
.nav a.on { color: var(--accent); }
.nav a.on::before { content: ""; position: absolute; top: -1px; left: 28%; right: 28%; height: 2px; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
body.kb .nav { display: none; }

@media (min-width: 900px) {
  #view { max-width: 860px; margin-left: calc(92px + max(0px, (100vw - 92px - 860px) / 2)); margin-right: auto; padding: 36px 32px 60px; }
  .nav {
    top: 0; right: auto; bottom: 0; width: 92px; grid-template-columns: 1fr; grid-template-rows: repeat(5, 76px);
    align-content: start; padding-top: 24px; border-top: 0; border-right: 1px solid var(--line);
  }
  .nav a { min-height: 76px; }
  .nav a.on::before { top: 20%; bottom: 20%; left: -1px; right: auto; width: 2px; height: auto; }
  body.kb .nav { display: grid; }
}

/* ---------- Type & primitives ---------- */
.label { font: 600 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.label b { color: var(--accent); font-weight: 600; }
h1.title { font-size: 28px; line-height: 1.12; letter-spacing: -.02em; font-weight: 750; }
h2.sec { font: 600 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 28px 0 10px; display: flex; align-items: center; gap: 10px; }
h2.sec::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.muted { color: var(--muted); }
.sm { font-size: 13px; }
.mono { font-family: var(--mono); }

.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.top .grow { flex: 1; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--muted); flex: none; transition: color .15s, border-color .15s; }
.icon-btn:active { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 21px; height: 21px; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--muted); font-size: 14px; margin: -6px 0 6px -4px; padding: 0 4px; }
.back svg { width: 18px; height: 18px; }

.card {
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 4%, var(--surface)) 0%, var(--surface) 42%);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
}
.card + .card, .stack > * + * { margin-top: 10px; }
a.card, button.card { display: block; width: 100%; text-align: left; transition: border-color .15s, background .15s; }
a.card:active, button.card:active { border-color: var(--accent-mid); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: var(--radius);
  border: 1px solid var(--line2); background: var(--surface2); font-weight: 600; font-size: 15px;
  transition: transform .1s, border-color .15s, background .15s; text-align: center;
}
.btn:active { transform: scale(.985); }
.btn svg { width: 19px; height: 19px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 0 24px -6px var(--accent); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); background: transparent; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.pill { display: inline-flex; align-items: center; font: 600 10.5px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 5px 7px; border-radius: 3px; border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; }
.pill.green { color: var(--accent); border-color: var(--accent-mid); background: var(--accent-soft); }
.pill.blue { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 40%, transparent); background: var(--blue-soft); }
.pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }

.bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--blue)); transition: width .35s ease; }
.segs { display: flex; gap: 3px; }
.segs i { flex: 1; height: 4px; border-radius: 1px; background: var(--line); }
.segs i.on { background: var(--accent); }

/* ---------- Home ---------- */
.hero { display: grid; grid-template-columns: 124px 1fr; gap: 16px; align-items: center; }
.ring { position: relative; width: 124px; height: 124px; }
.ring svg { width: 124px; height: 124px; transform: rotate(-90deg); stroke-width: 9; stroke-linecap: butt; }
.ring .track { stroke: var(--line); }
.ring .val { transition: stroke-dashoffset .6s ease; }
.ring .num { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font: 700 26px/1 var(--mono); letter-spacing: -.03em; }
.ring .num small { display: block; font-size: 10px; letter-spacing: .12em; color: var(--muted); margin-top: 4px; font-weight: 600; }
.hero h2 { font-size: 22px; line-height: 1.15; letter-spacing: -.02em; margin: 6px 0 4px; }
.hero .topic { font-size: 14px; color: var(--muted); }
.cta { margin-top: 12px; }
.cta .btn { width: 100%; min-height: 56px; justify-content: space-between; padding: 0 18px; font-size: 16px; }
.cta .btn small { display: block; font-weight: 500; font-size: 12px; opacity: .75; margin-top: 1px; text-align: left; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px; }
.stat .v { font: 700 24px/1.1 var(--mono); letter-spacing: -.03em; margin-top: 8px; }
.stat .v small { font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 3px; }

.map { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.map a { aspect-ratio: 1; display: grid; place-items: center; font: 600 10px/1 var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 3px; background: var(--surface); transition: transform .1s; }
.map a:active { transform: scale(.92); }
.map a.part { background: var(--accent-soft); border-color: var(--accent-mid); color: var(--accent); }
.map a.full { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.map a.now { outline: 2px solid var(--blue); outline-offset: 1px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; border: 1px solid var(--line2); display: inline-block; }
.legend i.part { background: var(--accent-soft); border-color: var(--accent-mid); }
.legend i.full { background: var(--accent); border-color: var(--accent); }
.legend i.now { border: 2px solid var(--blue); }

.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head b { font: 600 13px var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { font: 600 10px/1 var(--mono); color: var(--muted); text-align: center; padding: 4px 0 6px; }
.cal button, .cal span.e { aspect-ratio: 1; border-radius: 3px; display: grid; place-items: center; font: 500 12px/1 var(--mono); color: var(--muted); border: 1px solid var(--line); background: var(--surface); }
.cal span.e { visibility: hidden; }
.cal button.l1 { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--text); }
.cal button.l2 { background: color-mix(in srgb, var(--accent) 36%, var(--surface)); color: var(--text); }
.cal button.l3 { background: color-mix(in srgb, var(--accent) 62%, var(--surface)); color: var(--accent-ink); }
.cal button.l4 { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.cal button.today { outline: 2px solid var(--blue); outline-offset: 1px; }
.cal-note { min-height: 20px; margin-top: 10px; font-size: 13px; color: var(--muted); }

.badges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.badge { text-align: center; padding: 10px 2px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); opacity: .5; }
.badge.on { opacity: 1; border-color: var(--accent-mid); background: var(--accent-soft); }
.badge .hex { width: 40px; height: 44px; margin: 0 auto 6px; display: grid; place-items: center; font: 700 12px var(--mono); color: var(--muted); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: var(--line2); }
.badge.on .hex { background: var(--accent); color: var(--accent-ink); }
.badge .n { font-size: 10.5px; line-height: 1.2; color: var(--text); padding: 0 2px; }
@media (min-width: 560px) { .badges { grid-template-columns: repeat(8, 1fr); } }

.banner { display: flex; gap: 12px; align-items: flex-start; border: 1px solid color-mix(in srgb, var(--blue) 45%, var(--line)); background: var(--blue-soft); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; font-size: 14px; }
.banner button { margin-left: auto; color: var(--muted); min-width: 44px; min-height: 36px; font-size: 13px; }
.banner.warn { border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); background: color-mix(in srgb, var(--warn) 10%, transparent); }

/* ---------- Roadmap / lists ---------- */
.month-h { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 10px; }
.month-h:first-of-type { margin-top: 6px; }
.month-h h2 { font-size: 17px; letter-spacing: -.01em; }
.wk { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; }
.wk .n { font: 700 18px var(--mono); color: var(--accent); }
.wk h3 { font-size: 16px; }
.wk p { font-size: 13px; color: var(--muted); margin: 2px 0 8px; }
.wk .pc { font: 700 15px var(--mono); }
.wk.done .n::after { content: ""; }
.dayrow { display: grid; grid-template-columns: 40px 1fr 44px; gap: 10px; align-items: center; padding: 12px 14px; }
.dayrow .dn { font: 700 14px var(--mono); color: var(--muted); }
.dayrow.now .dn { color: var(--accent); }
.dayrow h3 { font-size: 15px; font-weight: 600; margin-bottom: 7px; }
.dayrow .pc { font: 600 13px var(--mono); text-align: right; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; padding: 7px 11px; min-height: 36px; border: 1px solid var(--line2); border-radius: 3px; color: var(--muted); background: var(--surface); }
.chip.on { color: var(--accent); border-color: var(--accent-mid); background: var(--accent-soft); }
.topics { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.topics li { margin: 3px 0; }

/* ---------- Day page ---------- */
.dayhead .row { margin-top: 12px; }
.task { display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); border-left: 3px solid var(--line2); }
.task.done { border-left-color: var(--accent); background: linear-gradient(90deg, var(--accent-soft), var(--surface) 55%); }
.check { width: 44px; height: 44px; border-radius: var(--radius); border: 1.5px solid var(--line2); display: grid; place-items: center; color: transparent; background: var(--bg); transition: all .15s; }
.check svg { width: 22px; height: 22px; stroke-width: 2.6; }
.task.done .check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.task h3 { font-size: 16px; }
.task p.d { font-size: 14.5px; color: var(--muted); margin: 8px 0 12px; line-height: 1.55; }
.task .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.task textarea { margin-bottom: 12px; }
.field, textarea, select {
  width: 100%; background: var(--bg); border: 1px solid var(--line2); border-radius: var(--radius); padding: 12px 13px; outline: none; transition: border-color .15s;
}
textarea { resize: vertical; min-height: 110px; line-height: 1.5; display: block; }
.field:focus, textarea:focus, select:focus { border-color: var(--accent); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.done-banner { text-align: center; padding: 20px 16px; border: 1px solid var(--accent-mid); background: var(--accent-soft); border-radius: var(--radius); margin-top: 12px; }
.done-banner h3 { color: var(--accent); margin-bottom: 4px; }

/* ---------- Projects / resources ---------- */
.proj { display: block; }
.proj h3 { font-size: 16px; margin: 8px 0 4px; }
.proj p { font-size: 13.5px; color: var(--muted); margin-bottom: 12px; }
.proj .meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; font: 600 12px var(--mono); }
.checkitem { display: grid; grid-template-columns: 44px 1fr; gap: 6px; align-items: center; width: 100%; text-align: left; min-height: 48px; border-bottom: 1px solid var(--line); padding: 4px 0; }
.checkitem:last-child { border-bottom: 0; }
.checkitem .check { width: 30px; height: 30px; margin: 0 7px; border-radius: 4px; }
.checkitem .check svg { width: 17px; height: 17px; }
.checkitem.done .check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.checkitem.done span.t { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line2); }
.res h3 { font-size: 17px; margin: 10px 0 6px; }
.res p { font-size: 14px; color: var(--muted); }
.res .cost { font-size: 12.5px; margin: 10px 0 14px; padding-left: 10px; border-left: 2px solid var(--line2); color: var(--muted); }
.res a.btn { width: 100%; }

/* ---------- Notes ---------- */
.search { position: relative; margin-bottom: 10px; }
.search input { padding-left: 40px; }
.search svg { position: absolute; left: 12px; top: 13px; width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.note h3 { font-size: 16px; margin-bottom: 4px; }
.note p { font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note .meta { margin-top: 10px; display: flex; justify-content: space-between; align-items: center; font: 500 11.5px var(--mono); color: var(--muted); }
.editor .title-in { font-size: 22px; font-weight: 700; letter-spacing: -.01em; background: transparent; border: 0; border-bottom: 1px solid var(--line2); border-radius: 0; padding: 10px 0; margin-bottom: 14px; }
.editor .title-in:focus { border-bottom-color: var(--accent); }
.editor textarea { min-height: 46vh; }
.saved { font: 500 12px var(--mono); color: var(--muted); }
.saved.ok { color: var(--accent); }
.empty { text-align: center; padding: 38px 16px; color: var(--muted); border: 1px dashed var(--line2); border-radius: var(--radius); }
.empty h3 { color: var(--text); margin-bottom: 6px; font-size: 16px; }
.fab { position: fixed; z-index: 15; right: max(18px, var(--sar)); bottom: calc(var(--navh) + var(--sab) + 16px); width: 56px; height: 56px; border-radius: var(--radius); background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 8px 28px -8px var(--accent); }
.fab svg { width: 26px; height: 26px; stroke-width: 2.4; }
body.kb .fab { display: none; }
@media (min-width: 900px) { .fab { right: 40px; bottom: 40px; } }

/* ---------- Settings ---------- */
.set { padding: 0; overflow: hidden; }
.set > * { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.set > *:last-child { border-bottom: 0; }
.set h3 { font-size: 15px; }
.set p { font-size: 13px; color: var(--muted); margin-top: 3px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line2); border-radius: var(--radius); overflow: hidden; margin-top: 10px; }
.seg button { min-height: 44px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.switch { position: relative; width: 52px; height: 32px; border-radius: 16px; background: var(--line2); flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.tog { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; text-align: left; min-height: 56px; }
.setbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
input[type="time"] { width: auto; }

/* ---------- Overlays ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--navh) + var(--sab) + 18px); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 40; max-width: min(92vw, 420px); padding: 12px 16px; background: var(--surface2); border: 1px solid var(--accent-mid); border-radius: var(--radius); font-size: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.45); transition: opacity .2s, transform .2s; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: var(--danger); }
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: end center; padding: 16px max(16px, var(--sar)) calc(16px + var(--sab)) max(16px, var(--sal)); background: rgba(0, 0, 0, .66); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fadein .15s ease-out; }
.modal[hidden] { display: none; }
.modal .box { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line2); border-radius: var(--radius); padding: 20px; }
.modal h3 { font-size: 18px; margin-bottom: 6px; }
.modal p { color: var(--muted); font-size: 14.5px; margin-bottom: 18px; }
.modal .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 900px) { .modal { place-items: center; } }

@media (max-width: 360px) {
  .hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  h1.title { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Additions ---------- */
@font-face { font-family: "Bricolage"; src: url("../fonts/bricolage.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
h1.title, .hero h2, .month-h h2, .modal h3 { font-family: "Bricolage", var(--sans); }
button.badge { width: 100%; font: inherit; color: inherit; }
.set .tog { padding: 0; border: 0; }
.set .tog h3 { margin: 0; }
.set > div:has(> .tog) { padding: 14px 16px; }
ol.topics li { margin: 5px 0; }
a.back:active { color: var(--accent); }
