/* Midnight: fixed dark theme, neon pink accent. People: c00kie silver, Adella pink, Both lilac. */
:root {
  --bg: #0e0b14;
  --glow: #2a1838;
  --card: #1a1524;
  --line: #2b2338;
  --fg: #efe9f5;
  --muted: #9a90a8;
  --pink: #ff5fa2;
  --pink-ink: #1a0a12;
  --c00kie: #d4ccdd;
  --adella: #ff7fb5;
  --both: #c39bff;
  --red: #ff6b6b;
  --font: "Poppins", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(120% 50% at 85% 0%, var(--glow) 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--fg); font-family: var(--font); font-size: 16px; line-height: 1.4;
  padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) calc(110px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }
.muted { color: var(--muted); }

main, .setup { max-width: 560px; margin: 0 auto; }

/* Header */
.hdr { padding: 18px 2px 14px; }
.hdr-top { display: flex; align-items: center; justify-content: space-between; }
.date { font-size: 12px; text-transform: uppercase; letter-spacing: .09em; font-weight: 600; color: var(--muted); }
h1 { font-size: 34px; font-weight: 700; margin: 2px 0 0; line-height: 1.1; }
.prog { height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 12px; }
.prog span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--both), var(--pink)); transition: width .3s; }
.count { font-size: 12px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.icon-btn { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 50%; width: 42px; height: 42px; display: grid; place-items: center; color: var(--muted); }
.icon-btn.on { color: var(--pink); border-color: var(--pink); }
.dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--pink); }

/* Day strip */
.days { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 14px; scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.day { flex: 0 0 auto; width: 52px; padding: 8px 0; border-radius: 14px; background: var(--card); border: 1px solid var(--line); display: grid; justify-items: center; gap: 1px; }
.day small { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.day b { font-size: 17px; font-variant-numeric: tabular-nums; }
.day i { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.day.has i { background: var(--muted); }
.day.sel { background: var(--pink); border-color: var(--pink); color: var(--pink-ink); }
.day.sel small { color: var(--pink-ink); }
.day.sel.has i { background: var(--pink-ink); }

/* View switch + pager */
.views { margin: 0 0 14px; }
.views button { padding: 8px 6px; }
.pager { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.pager-label { flex: 1; background: none; border: 0; font-weight: 600; font-size: 15px; padding: 8px; }

/* Month grid */
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 18px; }
.mhead { text-align: center; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding-bottom: 4px; }
.mday { aspect-ratio: 1 / 1.05; max-width: 100%; border-radius: 12px; background: var(--card); border: 1px solid var(--line); padding: 5px 0 0; display: grid; grid-template-rows: auto 1fr; justify-items: center; font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 500; }
.mday.out { background: none; border-color: transparent; color: #574d66; }
.mday.today { border-color: var(--pink); }
.mday.sel { background: var(--pink); border-color: var(--pink); color: var(--pink-ink); }
.mdots { display: flex; gap: 3px; align-items: center; height: 10px; }
.mdots i { width: 6px; height: 6px; border-radius: 50%; }
.mdots i.c00kie { background: var(--c00kie); } .mdots i.adella { background: var(--adella); } .mdots i.both { background: var(--both); }
.mday.sel .mdots i { background: var(--pink-ink); }
.mdots b { font-size: 9px; font-weight: 700; line-height: 1; }

/* Week list */
.week { display: grid; gap: 18px; }
.wday { display: grid; gap: 8px; }
.wday-h { display: flex; align-items: baseline; gap: 8px; background: none; border: 0; padding: 0; text-align: left; font-weight: 700; font-size: 16px; }
.wday-h small { font-size: 12px; font-weight: 600; color: var(--pink); text-transform: uppercase; letter-spacing: .06em; }
.wday-h span { font-weight: 400; color: var(--muted); font-size: 13px; }
.agenda-h { margin: 0 0 10px; font-size: 16px; }

/* Plans */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.item { display: grid; grid-template-columns: 30px 1fr auto; grid-template-areas: "chk nl nl" "chk time tag" "chk ttl ttl" "chk note note"; column-gap: 10px; padding: 12px 14px 12px 10px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.chk { grid-area: chk; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #4a4058; background: none; padding: 0; display: grid; place-items: center; align-self: start; margin-top: 1px; }
.chk svg { opacity: 0; }
.done .chk { background: var(--pink); border-color: var(--pink); color: var(--pink-ink); }
.done .chk svg { opacity: 1; }
.body { display: contents; }
.nl { grid-area: nl; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--pink); margin-bottom: 2px; }
.time { grid-area: time; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; align-self: center; }
.tag { grid-area: tag; font-size: 11px; font-weight: 600; padding: 1px 9px; border-radius: 99px; border: 1px solid; align-self: center; white-space: nowrap; }
.tag.c00kie { color: var(--c00kie); } .tag.adella { color: var(--adella); } .tag.both { color: var(--both); }
.ttl { grid-area: ttl; font-weight: 600; margin-top: 1px; overflow-wrap: anywhere; }
.note { grid-area: note; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.open { grid-column: 2 / -1; grid-row: 1 / -1; background: none; border: 0; padding: 0; text-align: left; }
.item.next { border-color: var(--pink); box-shadow: 0 0 22px rgba(255, 95, 162, .28); }
.item.done { opacity: .5; }
.item.done .ttl { text-decoration: line-through; }
.bell-mini { color: var(--muted); margin-left: 6px; vertical-align: -2px; }

.empty { text-align: center; padding: 40px 0; color: var(--muted); display: grid; gap: 12px; justify-items: center; }
.empty p { margin: 0; }

.fab { position: fixed; right: max(20px, calc(env(safe-area-inset-right, 0px) + 12px)); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--pink); color: var(--pink-ink); display: grid; place-items: center; box-shadow: 0 8px 26px rgba(255, 95, 162, .45); }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom, 0px)); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 99px; font-size: 14px; font-weight: 500; max-width: calc(100% - 32px); }

/* Buttons + fields */
.primary, .ghost, .danger { border-radius: 14px; padding: 13px 18px; font-weight: 600; border: 1px solid transparent; }
.primary { background: var(--pink); color: var(--pink-ink); }
.ghost { background: none; border-color: var(--line); }
.danger { background: none; border-color: var(--red); color: var(--red); }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.field input, .field select { font: inherit; font-size: 16px; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; width: 100%; min-width: 0; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; font-size: 14px; font-weight: 500; }
.seg button.sel { background: var(--pink); border-color: var(--pink); color: var(--pink-ink); }
.seg.big button { padding: 16px; font-size: 17px; }
.error { color: var(--red); font-size: 14px; margin: 0; }

/* Setup */
.setup { display: grid; gap: 18px; padding-top: 18vh; }
.setup h1 { font-size: 40px; }
.setup p { margin: 0; }

/* Sheets */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 20; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; background: var(--card); border-top: 1px solid var(--line); border-radius: 24px 24px 0 0; padding: 10px max(18px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px)); display: grid; gap: 14px; max-height: 92vh; overflow-y: auto; max-width: 560px; margin: 0 auto; animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.grab { width: 40px; height: 5px; border-radius: 99px; background: var(--line); justify-self: center; }
.sheet h2 { margin: 0; font-size: 20px; }
.sheet p { margin: 0; }
.sheet hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.sheet-btns { display: flex; gap: 10px; }
.sheet-btns .primary { flex: 1; }
.sheet-btns.col { flex-direction: column; }

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

/* ---------- To do ---------- */
:root { --g-us: var(--both); --g-adella: var(--adella); --g-c00kie: var(--c00kie); --g-snowy: #ffc76b; --g-home: #ff9a7a; }
.g-us { --g: var(--g-us); } .g-adella { --g: var(--g-adella); } .g-c00kie { --g: var(--g-c00kie); }
.g-snowy { --g: var(--g-snowy); } .g-home { --g: var(--g-home); }

/* Bottom-left button on the planner */
/* Pink pill (icon + count) so it reads differently from the round + button */
.todo-btn { position: fixed; left: max(20px, calc(env(safe-area-inset-left, 0px) + 12px)); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); height: 60px; min-width: 60px; padding: 0 18px; border-radius: 99px; border: 0;
  background: linear-gradient(135deg, var(--both), var(--pink) 70%); color: var(--pink-ink);
  display: flex; align-items: center; justify-content: center; gap: 9px; box-shadow: 0 8px 26px rgba(255, 95, 162, .4); }
.todo-btn:active, .fab:active { transform: scale(.96); }
.badge { font-size: 18px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
body.locked { overflow: hidden; }

/* The page itself */
.tpage { position: fixed; inset: 0; z-index: 15; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: radial-gradient(120% 45% at 15% 0%, var(--glow) 0%, var(--bg) 60%), var(--bg);
  padding: calc(env(safe-area-inset-top, 0px) + 14px) max(16px, env(safe-area-inset-right, 0px)) calc(110px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  display: grid; align-content: start; gap: 16px; animation: slide .22s ease-out; }
@keyframes slide { from { transform: translateX(-24px); opacity: 0; } }
.tpage > :not(.fab) { width: 100%; max-width: 560px; justify-self: center; }
.thead { display: flex; align-items: center; gap: 14px; }
.thead h1 { font-size: 32px; margin: 0; }
.tpage .prog { margin-top: -6px; }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); font-size: 14px; font-weight: 500; }
.chip b { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: var(--line); font-size: 12px; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.chip[class*="g-"] span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--g); margin-right: 7px; vertical-align: 1px; }
.chip.sel { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.chip.sel b { background: var(--bg); color: var(--fg); }

.tgroups { display: grid; gap: 22px; }
.tgroup { display: grid; gap: 10px; }
.tgroup-h { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 2px 2px; text-align: left; font-size: 17px; font-weight: 600; }
.tgroup-h i { width: 10px; height: 10px; border-radius: 50%; background: var(--g); box-shadow: 0 0 10px var(--g); }
.tgroup-h b { font-size: 13px; font-weight: 500; color: var(--muted); }
.tgroup-h svg { margin-left: auto; color: var(--muted); transition: transform .2s; }
.tgroup.shut .tgroup-h svg { transform: rotate(-90deg); }
.tgroup.shut .list { display: none; }

.item.todo { grid-template-areas: "chk ttl" "chk note"; grid-template-columns: 30px 1fr; align-items: center; padding: 14px 14px 14px 12px; }
.item.todo .ttl { margin-top: 0; font-weight: 500; }
.item.todo .note { margin-top: 2px; }

.tdone-all { display: grid; justify-items: center; gap: 6px; padding: 50px 0 20px; color: var(--pink); }
.tdone-all p { margin: 0; font-size: 20px; font-weight: 600; color: var(--fg); }
.tdone { display: grid; gap: 10px; }
.tdone-h { justify-self: start; background: none; border: 0; padding: 6px 2px; color: var(--muted); font-size: 14px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.seg.wrap { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
