:root {
  --void: #12100a;
  --panel: #1c180f;
  --ink: #fff4d6;
  --mute: #c9a86a;
  --line: #3a2e14;
  --yellow: #ffe566;
  --orange: #ff8a1f;
  --gold: #f0c14a;
  --feed: #ffb020;
  --diaper: #ff7a2f;
  --sleep: #e8c050;
  --safe: env(safe-area-inset-bottom, 0px);
  --top: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  height: 100%;
  height: 100svh;
  overflow: hidden;
}
body {
  font-family: "Trebuchet MS", "Segoe UI", Candara, sans-serif;
  background: var(--void);
  color: var(--ink);
}
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.hidden, [hidden] { display: none !important; }

#glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 40% at 90% -10%, rgba(255,138,31,0.28), transparent 55%),
    radial-gradient(50% 30% at 10% 0%, rgba(255,229,102,0.18), transparent 50%),
    radial-gradient(40% 28% at 50% 100%, rgba(240,193,74,0.12), transparent 60%);
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  height: 100%;
  height: 100svh;
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: var(--top) 0 0;
  background: linear-gradient(180deg, #1a160c 0%, var(--void) 42%);
}

.top, .rail { flex-shrink: 0; }
.top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 4px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand img {
  width: 44px;
  height: 44px;
  filter: drop-shadow(0 0 10px rgba(255,183,40,0.55));
}
.brand em {
  display: block;
  font-size: 11px;
  color: var(--gold);
  font-style: normal;
  text-transform: uppercase;
}
.brand strong { display: block; font-size: 20px; color: var(--yellow); }
.pill {
  border: 1.5px solid var(--gold);
  background: rgba(240,193,74,0.12);
  color: var(--yellow);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(255,138,31,0.25);
}

.rail {
  display: flex;
  gap: 6px;
  padding: 8px 10px 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail button {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 58px;
  padding: 6px 8px 8px;
  border: 1.5px solid var(--line);
  border-radius: 16px 16px 22px 10px;
  background: linear-gradient(160deg, #2a2212, var(--panel));
  color: var(--mute);
  cursor: pointer;
  transform: skewX(-4deg);
  box-shadow: 0 3px 0 #0a0804;
}
.rail button:nth-child(even) {
  border-radius: 10px 22px 14px 18px;
  transform: skewX(3deg) translateY(4px);
}
.rail button img { width: 28px; height: 28px; transform: skewX(4deg); }
.rail button:nth-child(even) img { transform: skewX(-3deg); }
.rail button span { font-size: 10px; transform: skewX(4deg); }
.rail button:nth-child(even) span { transform: skewX(-3deg); }
.rail button.on {
  border-color: var(--orange);
  color: var(--void);
  background: linear-gradient(160deg, var(--yellow), var(--orange));
  box-shadow: 0 0 16px rgba(255,138,31,0.45), 0 3px 0 #7a3a00;
}

#stage {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 16px calc(18px + var(--safe));
}
.view { padding-bottom: 12px; }
.kicker {
  font-size: 11px;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.kicker.mid { margin: 14px 0 8px; }
h1 {
  font-size: 26px;
  line-height: 1.15;
  margin-bottom: 8px;
  color: var(--yellow);
  text-shadow: 0 0 18px rgba(255,183,40,0.35);
}
.blurb {
  color: var(--mute);
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 14px;
}
.hero {
  width: 96px;
  height: 96px;
  margin: 4px 0 10px;
  filter: drop-shadow(0 0 12px rgba(255,138,31,0.4));
}
.hero.slim { width: 72px; height: 72px; }

.big3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 8px 0 14px;
}
.neon {
  border: 2px solid var(--gold);
  border-radius: 18px;
  background: radial-gradient(circle at 30% 20%, #3a2a12, #18140c 70%);
  padding: 12px 6px 10px;
  cursor: pointer;
  color: var(--ink);
  box-shadow: 0 0 14px rgba(255,183,40,0.2), inset 0 0 20px rgba(255,138,31,0.08);
}
.neon img { width: 44px; height: 44px; margin: 0 auto 6px; }
.neon b { display: block; font-size: 13px; text-align: center; }
.neon.feed { border-color: var(--feed); }
.neon.diaper { border-color: var(--diaper); }
.neon.sleep { border-color: var(--sleep); }
.neon:active { transform: scale(0.97); }

.sleep-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 14px;
  border: 1.5px solid var(--sleep);
  background: rgba(232,192,80,0.1);
  box-shadow: 0 0 16px rgba(240,193,74,0.2);
}
.sleep-banner img { width: 36px; height: 36px; }
.sleep-banner em { display: block; font-size: 11px; color: var(--mute); font-style: normal; }
.sleep-banner strong { font-size: 22px; color: var(--yellow); font-variant-numeric: tabular-nums; }
.sleep-banner .wake { margin-left: auto; padding: 8px 14px; font-size: 13px; }

.tape { display: flex; flex-direction: column; gap: 8px; }
.entry {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  width: 100%;
  padding: 12px 12px 12px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(28,24,15,0.9);
  cursor: pointer;
  color: inherit;
}
.entry .bar { align-self: stretch; border-radius: 6px; min-height: 36px; }
.entry.feed .bar { background: var(--feed); box-shadow: 0 0 10px rgba(255,176,32,0.55); }
.entry.diaper .bar { background: var(--diaper); box-shadow: 0 0 10px rgba(255,122,47,0.55); }
.entry.sleep .bar { background: var(--sleep); box-shadow: 0 0 10px rgba(232,192,80,0.55); }
.entry.mood .bar { background: #ffd36a; }
.entry.mile .bar { background: #ff9f1a; }
.entry b { display: block; font-size: 15px; }
.entry small { color: var(--mute); font-size: 12px; }
.entry time { font-size: 12px; color: var(--gold); font-variant-numeric: tabular-nums; }
.empty {
  color: var(--mute);
  font-size: 14px;
  padding: 18px 8px;
  text-align: center;
}

.row { display: flex; gap: 8px; margin-bottom: 10px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.choice {
  flex: 1;
  min-height: 52px;
  border-radius: 14px;
  border: 1.5px solid var(--gold);
  background: linear-gradient(180deg, #2e2412, #18140c);
  color: var(--yellow);
  cursor: pointer;
  box-shadow: 0 0 12px rgba(255,138,31,0.18);
}
.choice.tall { min-height: 64px; font-size: 17px; }
.choice.on, .choice:active {
  background: linear-gradient(180deg, var(--yellow), var(--orange));
  color: var(--void);
  border-color: var(--orange);
}
.choice.unit { flex: 0 0 calc(33.33% - 6px); min-width: 72px; }

.go {
  width: 100%;
  min-height: 52px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(90deg, var(--orange), var(--gold));
  color: var(--void);
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  box-shadow: 0 0 18px rgba(255,138,31,0.4);
}
.go.gold { background: linear-gradient(90deg, var(--yellow), var(--orange)); }
.go.wake {
  width: auto;
  min-height: 40px;
  margin: 0;
  background: linear-gradient(90deg, var(--sleep), var(--orange));
}
.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--mute);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  margin-bottom: 10px;
}
.ghost.small { font-size: 12px; margin-top: 4px; }
.ghost.danger { color: #ff8a6a; border-color: #5a2a1a; margin-top: 10px; width: 100%; min-height: 44px; }

label { display: block; margin-bottom: 12px; }
label span { display: block; font-size: 12px; color: var(--gold); margin-bottom: 6px; }
input, textarea, select {
  width: 100%;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #0e0c08;
  padding: 12px;
  outline: none;
}
input:focus, textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 2px rgba(255,138,31,0.2); }

.sleep-panel {
  text-align: center;
  padding: 24px 16px;
  border-radius: 18px;
  border: 1.5px solid var(--sleep);
  background: rgba(232,192,80,0.08);
}
.sleep-panel strong {
  display: block;
  font-size: 48px;
  color: var(--yellow);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 20px rgba(255,183,40,0.45);
}
.sleep-panel p { color: var(--mute); margin: 8px 0 16px; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(28,24,15,0.95);
}
.stat em { display: block; font-size: 11px; color: var(--mute); font-style: normal; margin-bottom: 4px; }
.stat b { font-size: 22px; color: var(--yellow); }
.stat.wide { grid-column: 1 / -1; }

.days { display: flex; flex-direction: column; gap: 14px; }
.day-block h2 {
  font-size: 14px;
  color: var(--gold);
  margin-bottom: 8px;
}

.checks { display: flex; flex-direction: column; gap: 8px; }
.check {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: #18140c;
  color: var(--ink);
  cursor: pointer;
}
.check.on {
  border-color: var(--orange);
  background: linear-gradient(90deg, rgba(255,138,31,0.2), rgba(240,193,74,0.08));
  box-shadow: 0 0 14px rgba(255,138,31,0.25);
}
.check .box {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--gold);
  flex-shrink: 0;
}
.check.on .box {
  background: var(--yellow);
  box-shadow: inset 0 0 0 3px var(--void);
}

.hint { color: var(--mute); font-size: 13px; margin-top: 10px; }

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 12px rgba(255,138,31,0.25); }
  50% { box-shadow: 0 0 22px rgba(255,229,102,0.55); }
}
.neon:active, .go:active { animation: pulseGlow 0.4s ease; }
.sleep-banner:not(.hidden) { animation: pulseGlow 2.4s ease-in-out infinite; }
