:root {
  color-scheme: light;
  --ink: #17233c;
  --muted: #626b7a;
  --paper: #f6f7f2;
  --surface: #ffffff;
  --line: #e7e8e2;
  --blue: #2f6fed;
  --blue-soft: #dce8ff;
  --coral: #ef765f;
  --coral-soft: #ffe2dc;
  --green: #3d9b7a;
  --green-soft: #d9f0e7;
  --gold: #dca83e;
  --gold-soft: #f8ebc9;
  font-family: Inter, ui-rounded, "SF Pro Rounded", "SF Pro Display", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); }

body { min-width: 280px; -webkit-tap-highlight-color: transparent; }

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.app-loading {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--paper);
}

.app-shell {
  width: min(100%, 560px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 20px calc(102px + env(safe-area-inset-bottom));
}

.topbar { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 18px; }
.title-lockup { display: flex; gap: 12px; align-items: center; }
.brand-mark {
  position: relative;
  display: grid;
  width: 43px;
  height: 43px;
  overflow: hidden;
  place-items: center;
  border-radius: 15px;
  background: var(--blue);
  box-shadow: 0 8px 18px rgba(47,111,237,.22);
}
.brand-mark::before, .brand-mark::after, .brand-mark i {
  position: absolute;
  height: 2px;
  border-radius: 3px;
  background: white;
  content: "";
  transform: rotate(-18deg);
}
.brand-mark::before { width: 23px; }
.brand-mark::after { width: 12px; margin: -10px 0 0 -8px; }
.brand-mark i { width: 9px; margin: 10px 0 0 11px; }

.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  line-height: 1.4;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin: 3px 0 0; font-size: 31px; line-height: 1.05; letter-spacing: -.04em; }
h2 { margin: 3px 0 0; font-size: 23px; letter-spacing: -.03em; }
h3 { margin-bottom: 5px; font-size: 16px; }

.avatar-button, .round-button, .close-button {
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.avatar-button {
  width: 46px;
  height: 46px;
  background: var(--ink);
  color: white;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
}

.screen { display: none; animation: rise .24s ease both; }
.screen.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.hero-card {
  position: relative;
  display: flex;
  min-height: 168px;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  padding: 25px;
  border-radius: 30px;
  background: var(--ink);
  color: white;
  box-shadow: 0 18px 38px rgba(23, 35, 60, .16);
}

.hero-card::after {
  position: absolute;
  width: 190px;
  height: 190px;
  top: -100px;
  right: -70px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  content: "";
}

.hero-route { position: absolute; right: 70px; bottom: 14px; left: 40px; height: 1px; border-top: 1px dashed rgba(255,255,255,.13); }
.hero-route i { position: absolute; width: 5px; height: 5px; top: -3px; border-radius: 50%; background: rgba(255,255,255,.24); }
.hero-route i:nth-child(1) { left: 0; }
.hero-route i:nth-child(2) { left: 48%; background: var(--coral); }
.hero-route i:nth-child(3) { right: 0; }

.hero-copy { position: relative; z-index: 1; max-width: 58%; }
.card-kicker { font-size: 12px; font-weight: 700; opacity: .64; }
.hero-copy strong { display: block; margin: 6px 0 2px; font-size: 48px; letter-spacing: -.06em; }
.hero-copy p { margin: 0; color: #bfc8da; font-size: 13px; line-height: 1.45; }

.progress-orbit {
  --progress: 0deg;
  display: grid;
  width: 90px;
  height: 90px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--coral) var(--progress), rgba(255,255,255,.13) 0);
}

.progress-orbit::before {
  position: absolute;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--ink);
  content: "";
}

.progress-orbit span { position: relative; z-index: 1; font-size: 14px; font-weight: 800; }

.section-heading { display: flex; align-items: end; justify-content: space-between; margin: 34px 2px 17px; }
.section-heading.compact { margin-top: 28px; }
.round-button {
  width: 44px;
  height: 44px;
  background: var(--blue);
  color: white;
  font-size: 28px;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(47,111,237,.25);
}

.habit-list, .library-list { display: grid; gap: 11px; }

.habit-card {
  position: relative;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 13px;
  align-items: center;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: var(--surface);
  box-shadow: 0 4px 18px rgba(23,35,60,.035);
  transition: transform .18s ease, box-shadow .18s ease;
}
.habit-card:active { transform: scale(.985); }

.habit-card.done { opacity: .7; }
.habit-card.done .habit-title { text-decoration: line-through; }

.habit-symbol {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 16px;
  font-size: 20px;
  font-weight: 800;
}

.tone-blue { background: var(--blue-soft); color: var(--blue); }
.tone-coral { background: var(--coral-soft); color: var(--coral); }
.tone-green { background: var(--green-soft); color: var(--green); }
.tone-gold { background: var(--gold-soft); color: #9b7116; }

.habit-copy { min-width: 0; padding: 3px 0; border: 0; background: transparent; color: inherit; cursor: pointer; text-align: left; }
.habit-title { display: block; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.habit-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; text-transform: capitalize; }
.habit-duration { display: inline-flex; align-items: center; margin-left: 7px; padding-left: 8px; border-left: 1px solid var(--line); color: #687181; text-transform: none; }

.check-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 2px solid #d9dce1;
  border-radius: 50%;
  background: transparent;
  color: white;
  cursor: pointer;
}

.done .check-button { border-color: var(--green); background: var(--green); }

.empty-card {
  padding: 34px 24px;
  border: 1px dashed #ccd0d8;
  border-radius: 24px;
  color: var(--muted);
  text-align: center;
}
.empty-card strong { display: block; margin-bottom: 5px; color: var(--ink); }

.text-button {
  display: block;
  margin: 15px auto 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}
.hidden { display: none !important; }

.takeoff-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 14px;
  align-items: center;
  margin-top: 22px;
  padding: 17px;
  overflow: hidden;
  border-radius: 23px;
  background: linear-gradient(125deg, #2f6fed, #2758c4);
  color: white;
  box-shadow: 0 15px 30px rgba(47,111,237,.2);
}
.takeoff-icon { display: grid; width: 48px; height: 48px; place-items: center; border: 1px solid rgba(255,255,255,.22); border-radius: 16px; background: rgba(255,255,255,.12); font-size: 22px; }
.takeoff-card .card-kicker { color: rgba(255,255,255,.65); }
.takeoff-card strong, .takeoff-card small { display: block; }
.takeoff-card strong { margin: 3px 0; font-size: 15px; }
.takeoff-card small { max-width: 210px; color: rgba(255,255,255,.7); font-size: 11px; line-height: 1.35; }
.takeoff-card > button { padding: 10px 12px; border: 0; border-radius: 13px; background: white; color: var(--blue); cursor: pointer; font-size: 12px; font-weight: 850; }
.takeoff-card.complete { background: linear-gradient(125deg, #399274, #28725b); }

.quote-card {
  position: relative;
  overflow: hidden;
  margin-top: 28px;
  padding: 25px 26px 20px 58px;
  border-radius: 24px;
  background: #e9ece3;
}
.quote-card p { margin: 0; font-size: 15px; font-weight: 650; line-height: 1.5; }
.quote-mark { position: absolute; top: 5px; left: 19px; color: var(--green); font-family: Georgia, serif; font-size: 55px; }

.page-intro { margin: 4px 2px 24px; }
.page-intro h2 { margin-top: 6px; font-size: 31px; }
.page-intro p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }

.panel, .settings-group {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 25px;
  background: var(--surface);
}

.week-chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; min-height: 190px; }
.day-column { display: grid; grid-template-rows: 1fr auto; gap: 9px; align-items: end; text-align: center; }
.day-track { display: flex; height: 145px; align-items: end; justify-content: center; border-radius: 14px; background: #f0f1ed; }
.day-bar { width: 100%; min-height: 0; border-radius: 14px; background: var(--blue); transition: height .3s ease; }
.day-column.today .day-track { outline: 2px solid var(--blue-soft); }
.day-column small { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }

.library-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 17px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: white;
}
.library-item > div { display: flex; gap: 12px; align-items: center; }
.library-dot { width: 11px; height: 11px; border-radius: 50%; }
.library-item strong { display: block; font-size: 14px; }
.library-item small { color: var(--muted); }
.library-actions { display: flex; gap: 4px; }
.icon-button { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 11px; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; }
.icon-button:active { background: #eef0ec; }

.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.metric-card { min-height: 156px; padding: 20px; border-radius: 25px; }
.metric-card span { display: block; font-size: 12px; font-weight: 800; }
.metric-card strong { display: block; margin: 18px 0 2px; font-size: 37px; letter-spacing: -.05em; }
.metric-card small { color: var(--muted); }
.metric-card.wide { grid-column: 1 / -1; min-height: 140px; }
.accent-blue { background: var(--blue-soft); }
.accent-coral { background: var(--coral-soft); }
.accent-green { background: var(--green-soft); }
.meter { height: 8px; margin-top: 17px; overflow: hidden; border-radius: 10px; background: rgba(255,255,255,.65); }
.meter i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--green); transition: width .3s ease; }

.insight-note { display: flex; gap: 15px; margin-top: 13px; }
.insight-note p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.insight-icon { display: grid; flex: 0 0 42px; height: 42px; place-items: center; border-radius: 14px; background: var(--ink); color: white; font-size: 20px; }

.settings-group { padding: 5px 18px; }
.settings-group + .settings-group { margin-top: 14px; }
.setting-row {
  display: flex;
  width: 100%;
  gap: 13px;
  align-items: center;
  padding: 15px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.setting-row:last-child { border-bottom: 0; }
.setting-row > div { flex: 1; }
.setting-row strong, .setting-row small { display: block; }
.setting-row small { margin-top: 2px; color: var(--muted); }
.setting-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 13px; background: #eef0ec; font-weight: 800; }
.button-row { cursor: pointer; }
.danger strong { color: #ba4337; }
.links a { display: flex; justify-content: space-between; padding: 16px 2px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.links a:last-child { border-bottom: 0; }
.version { margin-top: 25px; color: var(--muted); font-size: 11px; text-align: center; }

.bottom-nav {
  position: fixed;
  z-index: 10;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 560px);
  margin: auto;
  padding: 9px 13px max(9px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(23,35,60,.07);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(18px);
}

.nav-item {
  display: grid;
  gap: 2px;
  justify-items: center;
  border: 0;
  background: transparent;
  color: #697281;
  cursor: pointer;
}
.nav-item svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:first-child svg path { fill: none; }
.nav-item small { font-size: 10px; font-weight: 750; }
.nav-item.active { color: var(--blue); }

dialog {
  width: min(calc(100% - 28px), 500px);
  max-height: calc(100dvh - 24px);
  overflow: auto;
  padding: 0;
  border: 0;
  border-radius: 28px;
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(23,35,60,.28);
}
dialog::backdrop { background: rgba(16,25,43,.48); backdrop-filter: blur(3px); }
#habit-form { padding: 24px; }
.dialog-head { display: flex; justify-content: space-between; align-items: start; margin-bottom: 22px; }
.close-button { width: 38px; height: 38px; background: #eff0ec; color: var(--ink); font-size: 24px; }
#habit-form > label { display: block; margin-top: 15px; color: var(--muted); font-size: 12px; font-weight: 800; }
#habit-form input[type="text"], #habit-form input:not([type]), #habit-form select {
  width: 100%;
  margin-top: 7px;
  padding: 13px 14px;
  border: 1px solid #dfe1dc;
  border-radius: 14px;
  outline: none;
  background: #fafbf8;
  color: var(--ink);
}
#habit-form input:focus, #habit-form select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
fieldset { margin: 18px 0 0; padding: 0; border: 0; }
legend { color: var(--muted); font-size: 12px; font-weight: 800; }
.color-picker { display: flex; gap: 13px; margin-top: 10px; }
.color-picker label { cursor: pointer; }
.color-picker input { position: absolute; opacity: 0; }
.color-picker i { display: block; width: 32px; height: 32px; border: 4px solid white; border-radius: 50%; box-shadow: 0 0 0 1px #d8d9d5; pointer-events: none; }
.color-picker input:checked + i { box-shadow: 0 0 0 2px var(--ink); }
.color-picker input:focus-visible + i { outline: 3px solid var(--blue-soft); outline-offset: 3px; }
.color-picker .blue, .library-dot.blue { background: var(--blue); }
.color-picker .coral, .library-dot.coral { background: var(--coral); }
.color-picker .green, .library-dot.green { background: var(--green); }
.color-picker .gold, .library-dot.gold { background: var(--gold); }
.dialog-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 25px; }
.dialog-actions button { padding: 14px; border: 0; border-radius: 15px; cursor: pointer; font-weight: 800; }
.secondary-button { background: #eff0ec; color: var(--ink); }
.primary-button { background: var(--blue); color: white; }

.focus-dialog {
  width: min(calc(100% - 22px), 520px);
  border-radius: 34px;
  background: var(--ink);
  color: white;
}
.focus-dialog::backdrop { background: rgba(8,14,27,.72); backdrop-filter: blur(8px); }
.focus-surface {
  position: relative;
  overflow: hidden;
  min-height: min(610px, calc(100dvh - 24px));
  padding: 25px;
  background:
    radial-gradient(circle at 88% 18%, rgba(47,111,237,.32), transparent 27%),
    radial-gradient(circle at 8% 85%, rgba(61,155,122,.2), transparent 30%),
    var(--ink);
}
.focus-surface::before {
  position: absolute;
  width: 380px;
  height: 380px;
  top: 125px;
  left: calc(50% - 190px);
  border: 1px dashed rgba(255,255,255,.08);
  border-radius: 50%;
  content: "";
}
.focus-head { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; }
.focus-brand { display: flex; gap: 8px; align-items: center; font-size: 12px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.focus-brand i { width: 9px; height: 9px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 5px rgba(239,118,95,.15); }
.focus-dialog .close-button { background: rgba(255,255,255,.1); color: white; }
.focus-copy { position: relative; z-index: 1; margin-top: 30px; text-align: center; }
.focus-copy .eyebrow { color: #8594b2; }
.focus-copy h2 { margin-top: 6px; color: white; font-size: 27px; }
.focus-copy p { margin: 7px 0 0; color: #9eabc3; font-size: 13px; }
.timer-orbit {
  --timer-progress: 0deg;
  position: relative;
  z-index: 1;
  display: grid;
  width: 218px;
  height: 218px;
  margin: 28px auto 22px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--coral) var(--timer-progress), rgba(255,255,255,.09) 0);
  box-shadow: 0 0 70px rgba(47,111,237,.15);
}
.timer-orbit::before { position: absolute; width: 198px; height: 198px; border-radius: 50%; background: #192742; content: ""; }
.timer-orbit::after { position: absolute; width: 174px; height: 174px; border: 1px solid rgba(255,255,255,.07); border-radius: 50%; content: ""; }
.timer-orbit > div { position: relative; z-index: 1; text-align: center; }
.timer-orbit strong, .timer-orbit small { display: block; }
.timer-orbit strong { font-size: 45px; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.timer-orbit small { margin-top: 5px; color: #93a0b8; font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.timer-presets { position: relative; z-index: 1; display: flex; gap: 8px; justify-content: center; }
.timer-presets button { padding: 8px 13px; border: 1px solid rgba(255,255,255,.12); border-radius: 20px; background: transparent; color: #9eabc3; cursor: pointer; font-size: 11px; font-weight: 800; }
.timer-presets button.active { border-color: rgba(255,255,255,.35); background: rgba(255,255,255,.1); color: white; }
.focus-actions { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1.2fr; gap: 10px; margin-top: 24px; }
.focus-actions button { padding: 14px 10px; border: 0; border-radius: 15px; cursor: pointer; font-weight: 800; }
.focus-actions .secondary-button { background: rgba(255,255,255,.1); color: white; }

.confirm-dialog { width: min(calc(100% - 34px), 430px); padding: 28px; text-align: center; }
.confirm-icon { display: grid; width: 52px; height: 52px; margin: 0 auto 17px; place-items: center; border-radius: 18px; background: var(--coral-soft); color: #b84e3b; font-size: 22px; font-weight: 900; }
.confirm-dialog h2 { margin-top: 6px; }
.confirm-dialog p { margin: 9px auto 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.danger-button { background: #bd4e40; color: white; }

.toast {
  position: fixed;
  z-index: 30;
  right: 20px;
  bottom: 100px;
  left: 20px;
  max-width: 420px;
  margin: auto;
  padding: 13px 17px;
  border-radius: 14px;
  background: var(--ink);
  color: white;
  font-size: 13px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: .22s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (min-width: 700px) {
  body { padding: 18px 0; }
  .app-shell { min-height: calc(100vh - 36px); border-radius: 32px; background: var(--paper); box-shadow: 0 24px 70px rgba(23,35,60,.12); }
  .bottom-nav { bottom: 18px; border-radius: 0 0 32px 32px; }
}


.static-page{width:min(calc(100% - 36px),720px);margin:32px auto;padding:30px;border:1px solid var(--line);border-radius:28px;background:#fff;box-shadow:0 18px 50px rgba(23,35,60,.08)}
.static-page .brand{display:inline-flex;align-items:center;gap:10px;margin-bottom:28px;color:var(--ink);font-size:20px;font-weight:850;text-decoration:none}
.static-page .brand::before{display:block;width:36px;height:36px;border-radius:12px;background:var(--blue);content:"↗";color:white;text-align:center;line-height:36px}
.static-page h1{font-size:38px}.static-page h2{margin-top:28px;font-size:20px}.static-page p,.static-page li{color:var(--muted);line-height:1.65}.static-page .button{display:inline-block;margin-top:18px;padding:12px 17px;border-radius:14px;background:var(--blue);color:white;font-weight:800;text-decoration:none}
@media(max-width:560px){.static-page{margin:0;min-height:100vh;width:100%;padding:28px 22px;border:0;border-radius:0;box-shadow:none}.static-page h1{font-size:32px}}
