:root {
  --paper: #FBF6EA; --paper2: #F5EEDB; --card: #FFFDF6;
  --ink: #173404; --ink2: #27500A; --moss: #3B6D11; --leaf: #639922; --sprout: #97C459; --mint: #C0DD97; --mist: #EAF3DE;
  --line: #D9D0B8; --dash: #C0DD97;
  --feed: #FAEEDA; --feed-ink: #633806; --water: #E6F1FB; --water-ink: #185FA5;
  --hat: #C8453A; --soft: #888780;
  --serif: 'Fraunces', Georgia, serif; --sans: 'Nunito', system-ui, sans-serif;
  --r: 14px; --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink2); font: 400 16px/1.5 var(--sans);
  background-image: radial-gradient(rgba(59,109,17,.05) 1px, transparent 1px); background-size: 18px 18px;
  min-height: 100vh; min-height: 100svh;
}
main { max-width: 520px; margin: 0 auto; padding: 18px 16px calc(96px + var(--safe-b)); }
h1, h2, h3 { font-family: var(--serif); color: var(--ink); font-weight: 600; margin: 0; line-height: 1.15; }
h1 { font-size: 28px; } h2 { font-size: 21px; } h3 { font-size: 17px; }
p { margin: 0 0 10px; }
a { color: var(--moss); }
.muted { color: var(--soft); font-size: 14px; }
.small { font-size: 13px; }
.hand { font-family: var(--serif); font-style: italic; }
.boot { text-align: center; padding: 80px 0; font-family: var(--serif); font-style: italic; color: var(--moss); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- header ---- */
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.top .grow { flex: 1; min-width: 0; }
.top .kicker { font-size: 13px; color: var(--leaf); letter-spacing: .04em; }
.iconbtn { width: 42px; height: 42px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--card); color: var(--moss);
  display: grid; place-items: center; cursor: pointer; font-size: 20px; flex: none; }
.iconbtn svg { width: 22px; height: 22px; }
.back { border: 0; background: none; color: var(--moss); font: 600 15px var(--sans); padding: 8px 0; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }

/* ---- grandpa bubble ---- */
.gp { display: flex; gap: 10px; align-items: flex-end; margin: 6px 0 18px; }
.gp .grandpa { width: 80px; flex: none; }
.bubble { position: relative; background: var(--mist); border: 1.5px solid var(--sprout); border-radius: 16px 16px 16px 4px; padding: 10px 13px;
  font-family: var(--serif); color: var(--ink); font-size: 15.5px; line-height: 1.4; }

/* ---- cards & packets ---- */
.card { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 14px; }
.crew { border-color: var(--sprout); }
.crew.done { opacity: .9; }
.crew-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.crew-head h2 { font-size: 20px; }
.stamp { margin-left: auto; font: 600 12px var(--sans); color: var(--moss); border: 1.5px solid var(--moss); border-radius: 6px; padding: 1px 7px; transform: rotate(-4deg); text-transform: uppercase; letter-spacing: .06em; }
.room { font-size: 13px; color: var(--moss); margin: 12px 0 2px; display: flex; align-items: center; gap: 6px; font-weight: 700; }
.row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1.5px dashed var(--dash); min-height: 48px; }
.row:last-child { border-bottom: 0; }
.row .who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.row .who .name { font-weight: 700; color: var(--ink); }
.row .thumb { width: 38px; height: 38px; border-radius: 50%; background: var(--mint); overflow: hidden; flex: none; display: grid; place-items: center; }
.row .thumb img, .row .thumb svg { width: 100%; height: 100%; object-fit: cover; }
.tick { width: 34px; height: 34px; border-radius: 10px; border: 2px solid var(--leaf); background: var(--card); flex: none; cursor: pointer; display: grid; place-items: center; transition: transform .15s; }
.tick.on { background: var(--sprout); border-color: var(--moss); }
.tick.on::after { content: ''; width: 12px; height: 7px; border: 3px solid var(--ink); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -2px); }
.tick:active { transform: scale(.9); }
.row.skip { color: var(--soft); }
.row.skip .name { color: var(--soft); font-weight: 600; }
.row.done .name { text-decoration: line-through; color: var(--leaf); }
.tag { font: 700 12px var(--sans); border-radius: 6px; padding: 2px 8px; border: 0; cursor: pointer; white-space: nowrap; }
.tag.feed { background: var(--feed); color: var(--feed-ink); }
.tag.feed.on { background: #EF9F27; color: #412402; }
.tag.late { background: #FCEBEB; color: #791F1F; cursor: default; }
.tag.crewtag { background: var(--mist); color: var(--moss); cursor: default; }

.packets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.packet { background: var(--mist); border: 1.5px solid var(--sprout); border-radius: 8px; padding: 8px; cursor: pointer; text-align: center; color: inherit; font: inherit; display: block; width: 100%; }
.packet .inner { border: 1.5px dashed var(--leaf); border-radius: 5px; padding: 10px 6px 8px; }
.packet .no { font-size: 11px; letter-spacing: .12em; color: var(--moss); text-transform: uppercase; }
.packet .pic { width: 84px; height: 84px; margin: 6px auto; border-radius: 50%; background: var(--mint); overflow: hidden; display: grid; place-items: center; }
.packet .pic img { width: 100%; height: 100%; object-fit: cover; }
.packet .pic svg { width: 78px; height: 78px; }
.packet .nick { font-family: var(--serif); font-size: 18px; color: var(--ink); line-height: 1.1; overflow-wrap: anywhere; }
.packet .sp { font-size: 12px; font-style: italic; color: var(--moss); overflow-wrap: anywhere; }
.packet .due { margin-top: 6px; font-size: 12px; color: var(--moss); }

.bigpacket { background: var(--mist); border: 1.5px solid var(--sprout); border-radius: 10px; padding: 10px; margin-bottom: 14px; }
.bigpacket .inner { border: 1.5px dashed var(--leaf); border-radius: 7px; padding: 14px; text-align: center; }
.bigpacket .pic { width: 150px; height: 150px; margin: 8px auto; border-radius: 50%; background: var(--mint); overflow: hidden; display: grid; place-items: center; }
.bigpacket .pic img { width: 100%; height: 100%; object-fit: cover; }
.bigpacket .pic svg { width: 136px; height: 136px; }
.bigpacket h1 { font-size: 30px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; text-align: left; font-size: 14px; }
.facts div { display: flex; gap: 6px; align-items: flex-start; }
.facts b { display: block; color: var(--ink); }
.ico { width: 20px; height: 20px; flex: none; color: var(--moss); }
svg.drop { width: 22px; height: 22px; flex: none; }
a.who, a.who:visited, a.packet, a.packet:visited { text-decoration: none; color: inherit; }
.btn .ico { color: currentColor; }

/* ---- buttons & forms ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 12px;
  border: 1.5px solid var(--leaf); background: var(--card); color: var(--moss); font: 700 15px var(--sans); cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--moss); border-color: var(--moss); color: var(--mist); }
.btn.water { background: var(--water); border-color: #85B7EB; color: var(--water-ink); }
.btn.ghost { border-color: transparent; background: none; }
.btn.danger { border-color: #F09595; color: #A32D2D; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.btnrow .btn { flex: 1 1 0; min-width: 120px; }
label.f { display: block; margin: 12px 0 4px; font-weight: 700; color: var(--ink); font-size: 14px; }
label.f .muted { font-weight: 400; }
input, select, textarea { width: 100%; min-width: 0; font: 16px var(--sans); color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--sprout); outline-offset: 1px; border-color: var(--leaf); }
textarea { resize: vertical; min-height: 80px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.chip { border: 1.5px solid var(--sprout); background: var(--card); color: var(--moss); border-radius: 999px; padding: 7px 13px; font: 600 14px var(--sans); cursor: pointer; }
.chip.on { background: var(--moss); border-color: var(--moss); color: var(--mist); }
.err { color: #A32D2D; font-size: 14px; margin-top: 8px; }
.note { background: var(--paper2); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 10px 0; }
.choice { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 14px; margin-bottom: 10px; border-radius: var(--r); border: 1.5px solid var(--sprout); background: var(--card); font: inherit; color: inherit; cursor: pointer; }
.choice .ico { width: 30px; height: 30px; }
.choice b { display: block; color: var(--ink); font-size: 16px; }
.lib { max-height: 52vh; overflow: auto; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); margin-top: 8px; }
.lib button { display: flex; width: 100%; gap: 10px; align-items: center; text-align: left; padding: 9px 12px; border: 0; border-bottom: 1.5px dashed var(--dash); background: none; font: inherit; color: inherit; cursor: pointer; }
.lib button svg { width: 34px; height: 34px; flex: none; }
.preview { width: 100%; max-height: 280px; object-fit: cover; border-radius: 12px; border: 1.5px solid var(--line); display: block; }
.guess { border: 1.5px solid var(--sprout); background: var(--mist); border-radius: 12px; padding: 12px; margin: 12px 0; }
.conf { font: 700 12px var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--moss); }

/* ---- diary ---- */
.diary { list-style: none; padding: 0; margin: 0; }
.diary li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1.5px dashed var(--dash); font-size: 14px; align-items: flex-start; }
.diary li:last-child { border-bottom: 0; }
.diary .when { width: 82px; flex: none; color: var(--soft); }
.diary .what { flex: 1; min-width: 0; }
.diary .x { border: 0; background: none; color: var(--soft); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 4px; }

/* ---- schedule ---- */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; margin-bottom: 14px; }
.day { background: var(--card); border: 1.5px solid var(--line); border-radius: 10px; padding: 6px 3px; text-align: center; min-height: 82px; font-size: 11px; cursor: pointer; color: inherit; font-family: inherit; }
.day.today { border-color: var(--moss); background: var(--mist); }
.day.sel { outline: 2px solid var(--leaf); }
.day .d { font: 600 15px var(--serif); color: var(--ink); }
.dot { display: block; margin: 3px auto 0; width: 80%; border-radius: 4px; padding: 1px 0; font: 700 10px var(--sans); }
.c-thirsty { background: #B5D4F4; color: #0C447C; } .c-steady { background: var(--mint); color: var(--ink2); }
.c-easy { background: var(--feed); color: var(--feed-ink); } .c-desert { background: #F5C4B3; color: #712B13; }

/* ---- chat ---- */
.chat { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.msg { max-width: 86%; padding: 10px 13px; border-radius: 16px; font-size: 15.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--moss); color: var(--mist); border-radius: 16px 16px 4px 16px; }
.msg.gp { align-self: flex-start; background: var(--mist); border: 1.5px solid var(--sprout); color: var(--ink); font-family: var(--serif); border-radius: 16px 16px 16px 4px; display: block; margin: 0; }
.msg .ph { font-size: 12px; opacity: .8; display: block; margin-bottom: 4px; }
.thinking { align-self: flex-start; font-family: var(--serif); font-style: italic; color: var(--moss); }
.composer { position: sticky; bottom: calc(76px + var(--safe-b)); background: var(--paper); padding: 8px 0 4px; }
.composer .bar { display: flex; gap: 8px; align-items: flex-end; border: 1.5px solid var(--sprout); border-radius: 22px; background: #fff; padding: 5px 5px 5px 8px; }
.composer textarea { border: 0; min-height: 40px; max-height: 140px; padding: 9px 4px; resize: none; background: transparent; }
.composer textarea:focus { outline: none; }
.composer .iconbtn { width: 40px; height: 40px; border: 0; }
.composer .send { background: var(--moss); color: var(--mist); }
.attach { display: flex; gap: 8px; align-items: center; margin: 6px 4px; font-size: 13px; }
.attach img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }

/* ---- tab bar ---- */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: rgba(251,246,234,.97); border-top: 1.5px solid var(--line);
  padding: 6px 8px calc(6px + var(--safe-b)); display: flex; justify-content: center; }
#tabs .in { display: flex; width: 100%; max-width: 520px; justify-content: space-around; align-items: center; }
#tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--soft); text-decoration: none; font: 700 11px var(--sans); padding: 4px 0; }
#tabs a svg { width: 24px; height: 24px; }
#tabs a.on { color: var(--moss); }
#tabs a.add span.plus { width: 46px; height: 46px; border-radius: 50%; background: var(--moss); color: var(--mist); display: grid; place-items: center; margin-top: -18px; border: 3px solid var(--paper); }
#tabs a.add svg { width: 26px; height: 26px; }

#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + var(--safe-b)); z-index: 20; background: var(--ink); color: var(--mist);
  border-radius: 12px; padding: 10px 14px; display: flex; gap: 12px; align-items: center; font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(23,52,4,.25); }
#toast button { background: none; border: 0; color: var(--sprout); font: 700 14px var(--sans); cursor: pointer; padding: 4px; }

/* ---- splash when watering ---- */
.splash { position: fixed; pointer-events: none; z-index: 30; width: 0; height: 0; }
.splash i { position: absolute; width: 8px; height: 11px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: #85B7EB; animation: drip .7s ease-out forwards; }
@keyframes drip { from { transform: translate(0, 0) scale(1); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) scale(.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .splash { display: none; } }

/* ---- sign in ---- */
.welcome { text-align: center; padding-top: 10px; }
.welcome .mushroom { width: 220px; display: block; margin: 0 auto -10px; }
.welcome .grandpa { width: 92px; display: block; margin: 0 auto; }
.welcome h1 { font-size: 34px; margin-top: 8px; }
.welcome form { text-align: left; margin-top: 16px; }
.empty { text-align: center; padding: 18px 8px; }
.empty .mushroom { width: 180px; margin: 0 auto; }
.empty .grandpa { width: 96px; margin: 0 auto 6px; }
.art { display: block; }

/* ---- figurine art (Blender renders, see art/) ---- */
picture.grandpa, picture.mushroom { display: block; }
picture.grandpa img, picture.mushroom img { display: block; width: 100%; height: auto; }
.plantart { display: block; width: 100%; height: auto; transform-origin: 50% 90%; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.pic > .plantart { width: 92%; }
.packet .pic img.plantart, .bigpacket .pic img.plantart { width: 92%; height: 92%; object-fit: contain; margin-top: 5%; }
.lib button .plantart { width: 42px; height: 42px; flex: none; }
.plantart.sway { animation: sway .9s cubic-bezier(.3, .7, .4, 1); }
@keyframes sway { 0% { transform: rotate(0); } 20% { transform: rotate(-7deg); } 45% { transform: rotate(5deg); } 68% { transform: rotate(-2.5deg); } 85% { transform: rotate(1deg); } 100% { transform: rotate(0); } }
@media (prefers-reduced-motion: reduce) { .plantart.sway { animation: none; } }
.install li { margin-bottom: 6px; }
