:root {
  --void: #07090C;
  --deep: #0D1117;
  --card: #151B23;
  --elevated: #1F2633;
  --stroke: rgba(255, 255, 255, 0.08);
  --text: #F1F5F9;
  --muted: #94A3B8;
  --faint: #64748B;
  --violet-300: #E0AAFF;
  --violet-400: #C77DFF;
  --violet-500: #9D4EDD;
  --violet-600: #7B2CBF;
  --amethyst: #3C096C;
  --cyan-300: #5DF5C6;
  --cyan-400: #00E5A3;
  --cyan-500: #00C48C;
  --danger: #F87171;
  --radius: 16px;
  --display: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
  --sans: Inter, system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(120% 60% at 50% 0%, #140c22 0%, var(--void) 55%) fixed, var(--void);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--cyan-400); outline-offset: 2px; }

.shell {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
}

/* Header */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px 10px;
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  background: linear-gradient(var(--void) 70%, rgba(7, 9, 12, 0));
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 32px; height: 32px; flex: none; border-radius: 10px;
  background: linear-gradient(135deg, var(--violet-300), var(--violet-600));
  padding: 1.5px;
}
.brand-mark span {
  display: flex; width: 100%; height: 100%; border-radius: 9px;
  background: var(--deep); align-items: center; justify-content: center;
  color: var(--violet-400); font-weight: 800; font-size: 15px;
}
.brand-name { font-family: var(--display); font-weight: 800; letter-spacing: 0.06em; font-size: 13px; white-space: nowrap; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; flex: none; padding: 0 !important;
  display: inline-flex; align-items: center; justify-content: center;
}

/* Main */
main.view { flex: 1; padding: 4px 16px calc(96px + var(--safe-bottom)); }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.eyebrow.cyan { color: var(--cyan-400); }
.eyebrow.violet { color: var(--violet-400); }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 26px; line-height: 1.2; font-weight: 800; }
h2 { font-size: 18px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 20px; }
.row { display: flex; align-items: center; gap: 8px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* Cards */
.card {
  background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 16px;
}
.card-violet {
  background: linear-gradient(135deg, rgba(199,125,255,0.14), rgba(13,17,23,0.8));
  border: 1px solid rgba(199,125,255,0.38);
  box-shadow: 0 12px 30px -14px rgba(157,78,221,0.45);
}
.card-cyan {
  background: linear-gradient(135deg, rgba(0,229,163,0.10), rgba(13,17,23,0.85));
  border: 1px solid rgba(0,229,163,0.45);
}

/* 3D buttons */
.btn {
  border-radius: 14px; padding: 12px 16px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: 15px; text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  border: 1px solid transparent;
}
.btn:active { transform: translateY(2px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-cyan {
  background: linear-gradient(180deg, var(--cyan-300), var(--cyan-500));
  border-color: #00A877; color: #04161B;
  box-shadow: inset 0 2px 2px rgba(255,255,255,.55), inset 0 -4px 4px rgba(0,120,80,.4), 0 6px 16px rgba(0,229,163,.28);
  font-weight: 800;
}
.btn-violet {
  background: linear-gradient(180deg, var(--violet-400), var(--violet-500));
  border-color: var(--violet-600); color: #fff;
  box-shadow: inset 0 2px 2px rgba(255,255,255,.35), inset 0 -4px 4px rgba(60,9,108,.6), 0 6px 16px rgba(157,78,221,.3);
}
.btn-obsidian {
  background: linear-gradient(180deg, #2A3342, var(--card));
  border-color: var(--deep); color: #CBD5E1;
  box-shadow: inset 0 2px 1px rgba(255,255,255,.12), inset 0 -3px 3px rgba(0,0,0,.8), 0 4px 10px rgba(0,0,0,.4);
  font-weight: 600;
}
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--stroke); font-weight: 600; }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(248,113,113,.4); font-weight: 600; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 13px; border-radius: 10px; }

/* Forms */
label.field { display: block; }
label.field > span { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.input, .textarea {
  width: 100%; background: rgba(7,9,12,.9); border: 1px solid var(--stroke); border-radius: 12px;
  padding: 12px 14px; font-size: 16px; color: var(--text);
  box-shadow: inset 0 2px 10px rgba(0,0,0,.45);
}
.input:focus, .textarea:focus { outline: none; border-color: rgba(0,229,163,.6); }
.textarea { resize: vertical; min-height: 140px; line-height: 1.55; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 600;
  background: var(--card); border: 1px solid var(--stroke); color: #CBD5E1;
}
.chip[aria-pressed="true"] { background: rgba(199,125,255,.18); border-color: var(--violet-400); color: var(--violet-300); }
.error { color: var(--danger); font-size: 14px; }

/* Done-state card */
.done-state h1 { margin-top: 6px; }
.badge {
  font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 8px; white-space: nowrap;
}
.badge-violet { background: var(--violet-500); color: #fff; }
.badge-cyan { background: linear-gradient(180deg, var(--cyan-300), var(--cyan-500)); color: #04161B; }
.badge-soft { background: rgba(0,229,163,.14); color: var(--cyan-400); border: 1px solid rgba(0,229,163,.3); }
.badge-muted { background: rgba(255,255,255,.06); color: var(--muted); }

/* Milestones */
.tree { list-style: none; margin: 0; padding: 0; position: relative; }
.tree::before {
  content: ""; position: absolute; left: 19px; top: 18px; bottom: 18px; width: 2px;
  background: linear-gradient(var(--violet-400), var(--cyan-400));
  opacity: .5;
}
.ms { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; }
.ms-dot {
  position: relative; z-index: 1; flex: none; width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-weight: 800;
  background: var(--card); border: 1px solid var(--stroke); color: var(--faint);
}
.ms.is-done .ms-dot { background: rgba(0,229,163,.16); border-color: rgba(0,229,163,.45); color: var(--cyan-400); }
.ms.kind-done .ms-dot { background: rgba(199,125,255,.2); border-color: var(--violet-400); color: var(--violet-300); }
.ms.kind-origin .ms-dot {
  background: linear-gradient(180deg, var(--cyan-300), var(--cyan-500)); color: #04161B; border-color: #00A877;
}
.ms-body { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.03); border: 1px solid var(--stroke); }
.ms.kind-origin .ms-body { border: 1.5px solid rgba(0,229,163,.55); background: linear-gradient(90deg, rgba(0,229,163,.08), transparent); }
.ms-title { font-weight: 600; font-size: 15px; word-wrap: break-word; }
.ms.is-done:not(.kind-done) .ms-title { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(148,163,184,.5); }
.ms-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 4px; }
.ms.kind-origin .ms-meta { color: var(--cyan-400); }
.ms-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.linkish { background: none; border: none; padding: 4px 0; color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }

/* Prompt */
.prompt { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 17px; line-height: 1.55; color: #F3E8FF; }

/* Timer */
.timer-face {
  font-family: var(--mono); font-weight: 600; font-size: clamp(64px, 22vw, 96px); letter-spacing: .02em;
  text-align: center; line-height: 1; margin: 12px 0 4px; font-variant-numeric: tabular-nums;
}
.ring-wrap { position: relative; width: min(280px, 76vw); aspect-ratio: 1; margin: 8px auto 0; }
.ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-center .timer-face { font-size: clamp(48px, 16vw, 68px); margin: 0; }

/* Lists */
.day-group > h3 { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; font-weight: 600; }
.item { display: flex; gap: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.03); border: 1px solid var(--stroke); }
.item + .item { margin-top: 8px; }
.item-icon { flex: none; width: 28px; height: 28px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 800; }
.item-icon.entry { background: rgba(199,125,255,.18); color: var(--violet-300); }
.item-icon.sprint { background: rgba(0,229,163,.16); color: var(--cyan-400); }
.item-icon.milestone { background: rgba(0,229,163,.16); color: var(--cyan-400); }
.item-text { white-space: pre-wrap; word-wrap: break-word; font-size: 15px; }
.item-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 4px; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 12px; border-radius: 14px; background: rgba(255,255,255,.03); border: 1px solid var(--stroke); text-align: center; }
.stat b { display: block; font-family: var(--display); font-size: 24px; }
.stat span { font-size: 12px; color: var(--muted); }

/* Horizon list */
.horizon-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--stroke); background: rgba(255,255,255,.03); text-align: left; width: 100%; }
.horizon-item + .horizon-item { margin-top: 8px; }
.horizon-item.active { border-color: var(--violet-400); background: rgba(199,125,255,.1); }
.horizon-item .title { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Bottom nav */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: rgba(13,17,23,.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--stroke);
  padding: 8px 12px calc(8px + var(--safe-bottom));
}
.tabbar-inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; min-height: 48px;
  border-radius: 12px; border: none; background: none; color: var(--faint);
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; text-decoration: none;
}
.tab svg { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--violet-300); background: rgba(199,125,255,.1); }
.tab.tab-sprint[aria-current="page"] { color: var(--cyan-400); background: rgba(0,229,163,.1); }
.tab .dot { width: 6px; height: 6px; border-radius: 99px; background: var(--cyan-400); box-shadow: 0 0 8px var(--cyan-400); }

/* Toast and modal */
.toast {
  position: fixed; left: 50%; bottom: calc(92px + var(--safe-bottom)); transform: translateX(-50%);
  max-width: calc(100% - 32px); z-index: 60;
  background: rgba(13,17,23,.97); border: 1px solid rgba(0,229,163,.5); border-radius: 12px;
  padding: 10px 14px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.7);
}
.modal { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.72); display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-card { width: 100%; max-width: 520px; background: var(--deep); border: 1px solid rgba(199,125,255,.35); border-radius: 20px; padding: 20px; margin-bottom: var(--safe-bottom); }
@media (min-width: 600px) { .modal { align-items: center; } }

.hero-orb {
  width: 88px; height: 88px; margin: 8px 0 4px; position: relative;
}
.hero-orb::before {
  content: ""; position: absolute; inset: 14px; transform: rotate(45deg); border-radius: 10px;
  background: rgba(21,27,35,.9); border: 1.5px solid rgba(199,125,255,.55);
}
.hero-orb::after {
  content: ""; position: absolute; inset: 32px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, var(--violet-300) 30%, var(--violet-500) 70%, var(--amethyst));
  box-shadow: 0 0 24px rgba(199,125,255,.6);
}
.hero-orb span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--cyan-400); border-left-color: var(--cyan-400); transform: rotate(-30deg); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Public pages: Reverse Journaling pillar content, readable at 390px. */
.article { max-width: 680px; margin: 0 auto; padding: calc(24px + var(--safe-top)) 16px calc(48px + var(--safe-bottom)); line-height: 1.65; }
.article h1 { font-family: var(--display); font-size: clamp(28px, 7vw, 40px); line-height: 1.15; margin: 8px 0 12px; }
.article h2 { font-family: var(--display); font-size: 21px; margin: 32px 0 8px; }
.article a { color: var(--cyan-300); }
.article .lede { font-size: 18px; color: var(--text); }
.article p, .article li { color: #CBD5E1; }
.article .crumbs { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.article .crumbs a { color: var(--violet-300); text-decoration: none; }
.article .steps { padding-left: 22px; }
.article .steps li { margin: 8px 0; }
.article .compare { width: 100%; border-collapse: collapse; font-size: 14px; margin: 12px 0; }
.article .compare th, .article .compare td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--stroke); vertical-align: top; }
.article .compare th { color: var(--violet-300); font-weight: 600; }
.article .faq { background: var(--card); border: 1px solid var(--stroke); border-radius: 12px; padding: 12px 14px; margin: 8px 0; }
.article .faq summary { cursor: pointer; font-weight: 600; color: var(--text); }
.article .faq p { margin: 8px 0 0; }
.article .cta { margin-top: 32px; }
.article .cta a { color: var(--void); text-decoration: none; }
.article .fine { font-size: 12px; color: var(--faint); margin-top: 16px; }

/* If-then plan: the obstacle step. Neutral quartz card with a violet edge so it reads as a plan, not a goal. */
.card.if-then { border: 1px solid rgba(199, 125, 255, 0.28); background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01)); }
.card.if-then p { margin: 0; }
.card.if-then strong { color: var(--violet-300); }

/* Future photo */
.card.future-photo { border: 1px solid rgba(199, 125, 255, 0.35); background: linear-gradient(160deg, rgba(157,78,221,0.16), rgba(13,17,23,0.85)); }
.future-img { display: block; width: 100%; height: auto; border-radius: 12px; margin-top: 10px; border: 1px solid rgba(255,255,255,0.08); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; color: var(--text); }
.check input { width: 20px; height: 20px; margin-top: 1px; flex: none; accent-color: var(--violet-500); }
.fp-example { display: flex; gap: 12px; align-items: center; }
.fp-example img { width: 72px; height: 96px; object-fit: cover; border-radius: 12px; border: 1px solid rgba(255,255,255,.12); flex: none; }
.fp-example p { font-size: 13px; margin: 0; }
