:root {
  --paper: #FBF5EB;
  --ink: #221E1A;
  --card: #FFFCF6;
  --muted: #6E6459;
  --faint: #A79C8C;
  --line: #EDE5D8;
  --coral: #F2653F;
  --mint: #B7E4C7;
  --lilac: #D8CBF7;
  --butter: #FBE08A;
  --peach: #FFC1A8;
  --sky: #B6DCF2;
  --soft: #F7F1E6;
  --softmint: #EFF8F1;
  --shell: 430px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
@media (min-width: 700px) { body { background: #E8E0D4; } }

#app {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  position: relative;
}
@media (min-width: 700px) {
  #app { border-left: 2.5px solid var(--ink); border-right: 2.5px solid var(--ink); }
}

.dsp { font-family: "Baloo 2", "Nunito Sans", system-ui, sans-serif; font-weight: 800; letter-spacing: -0.015em; }
.body { flex: 1; overflow-y: auto; padding: calc(28px + env(safe-area-inset-top)) 20px 24px; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; }
.meta { font-size: 13px; font-weight: 700; color: var(--muted); }
.lbl { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.center { text-align: center; }

.nav {
  height: calc(82px + env(safe-area-inset-bottom));
  padding: 12px 22px env(safe-area-inset-bottom);
  flex-shrink: 0; border-top: 2.5px solid var(--ink); background: var(--card);
  display: flex; align-items: flex-start; justify-content: space-between;
}
.navitem { width: 52px; display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; opacity: .45; background: none; border: 0; font-family: inherit; color: inherit; padding: 0; }
.navitem.on { opacity: 1; }
.navitem span { font-size: 11px; font-weight: 800; }
.navplus { width: 54px; height: 54px; border-radius: 50%; background: var(--coral); border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink); margin-top: -28px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.navplus:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }

.card { border: 2.5px solid var(--ink); border-radius: 24px; background: var(--card); box-shadow: 0 5px 0 var(--ink); padding: 16px; }
.btn { border: 2.5px solid var(--ink); border-radius: 20px; background: var(--coral); box-shadow: 0 5px 0 var(--ink); min-height: 56px; display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 18px; color: var(--card); width: 100%; padding: 0 16px; }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.btn.ghost { background: var(--card); color: var(--ink); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.dashed { border: 2.5px dashed var(--ink); border-radius: 20px; min-height: 60px; display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 17px; }
.iconbtn { min-width: 44px; height: 44px; border-radius: 15px; background: var(--card); border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink); display: flex; align-items: center; justify-content: center; gap: 8px; flex-shrink: 0; cursor: pointer; padding: 0 10px; }
.iconbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

.habit { min-height: 54px; border-radius: 16px; background: var(--soft); display: flex; align-items: center; gap: 12px; padding: 8px 12px; cursor: pointer; user-select: none; }
.habit.done { background: var(--softmint); }
.box { width: 28px; height: 28px; border-radius: 10px; background: var(--card); border: 2.5px solid var(--ink); flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.habit.done .box { background: var(--mint); }
.habit .name { font-size: 15px; font-weight: 700; }
.habit.done .name { color: var(--muted); text-decoration: line-through; }

.bar { height: 14px; border-radius: 8px; border: 2.5px solid var(--ink); background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--mint); transition: width .25s ease; }
.dot { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--ink); }
.chip { height: 24px; border-radius: 8px; border: 2px solid var(--ink); display: inline-flex; align-items: center; gap: 5px; padding: 0 8px; font-size: 11px; font-weight: 800; }
.pill { height: 28px; border-radius: 10px; background: var(--card); border: 2px solid var(--ink); display: inline-flex; align-items: center; padding: 0 10px; font-size: 12px; font-weight: 700; }
.listcard { border: 2.5px solid var(--ink); border-radius: 20px; background: var(--card); box-shadow: 0 4px 0 var(--ink); display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; }
.listcard:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.badge { width: 38px; height: 38px; border-radius: 13px; border: 2.5px solid var(--ink); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: "Baloo 2", sans-serif; font-weight: 800; }

.field { min-height: 56px; border: 2.5px solid var(--ink); border-radius: 18px; background: var(--paper); display: flex; align-items: center; padding: 0 14px; }
.field input { border: 0; background: none; outline: none; font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 20px; color: var(--ink); width: 100%; letter-spacing: -.015em; min-width: 0; }
.field input::placeholder { color: var(--faint); }
.stepper { height: 52px; border: 2.5px solid var(--ink); border-radius: 16px; background: var(--paper); display: flex; align-items: center; justify-content: space-between; padding: 0 6px; }
.stepper button { border: 0; background: none; cursor: pointer; padding: 8px; display: flex; }
.stepper .val { text-align: center; font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 17px; line-height: 1; }
.stepper .cap { font-size: 10px; font-weight: 800; color: var(--faint); letter-spacing: .04em; }

.scrim { position: fixed; inset: 0; background: rgba(34,30,26,.55); display: none; z-index: 8; }
.scrim.on { display: block; }
.sheet {
  position: fixed; left: 50%; transform: translate(-50%, 110%); bottom: 0;
  width: 100%; max-width: var(--shell); z-index: 9;
  background: var(--card); border: 2.5px solid var(--ink); border-bottom: 0;
  border-radius: 30px 30px 0 0; padding: 12px 20px calc(24px + env(safe-area-inset-bottom));
  transition: transform .28s cubic-bezier(.2,.9,.3,1); max-height: 92dvh; overflow-y: auto;
}
.sheet.on { transform: translate(-50%, 0); }
.grab { width: 48px; height: 6px; border-radius: 3px; background: #DDD3C3; margin: 0 auto 14px; }

.toast {
  position: fixed; left: 50%; transform: translate(-50%, -8px); top: calc(12px + env(safe-area-inset-top));
  width: calc(100% - 40px); max-width: calc(var(--shell) - 40px); z-index: 20;
  background: var(--ink); color: var(--paper); border-radius: 18px; padding: 14px 16px;
  font-size: 14px; font-weight: 700; opacity: 0; transition: all .2s ease; pointer-events: none;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

.banner { border: 2.5px dashed var(--ink); border-radius: 18px; padding: 12px 14px; font-size: 13px; font-weight: 700; color: var(--muted); line-height: 1.45; }
.linkish { color: var(--coral); font-weight: 800; cursor: pointer; text-decoration: none; }
.spin { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--coral); border-radius: 50%; animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
