* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #e8eee6;
  background: linear-gradient(#0d1b2a 0%, #16324a 38%, #1d4d3f 72%, #2a5d3a 100%);
  min-height: 100vh;
  padding: max(env(safe-area-inset-top), 14px) 12px calc(env(safe-area-inset-bottom) + 24px);
}

header { text-align: center; margin: 6px 0 14px; }
header h1 { font-size: 21px; margin: 0; font-weight: 600; letter-spacing: .5px; }
header .sub { font-size: 12.5px; opacity: .6; margin-top: 3px; }

/* участок */
.plot {
  margin: 14px 0;
  padding: 10px 8px 4px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 16px;
  background: rgba(255,255,255,.035);
}
.plot > h2 {
  font-size: 13px; font-weight: 600; margin: 2px 0 6px 6px;
  opacity: .75; letter-spacing: .4px;
}

/* поляна с деревьями */
.grove {
  display: flex; flex-wrap: wrap; justify-content: center;
  align-items: flex-end; gap: 4px 0;
}

/* дерево */
.tree {
  width: 25%;            /* 4 в ряд на телефоне */
  min-width: 84px;
  display: flex; flex-direction: column; align-items: center;
  cursor: pointer;
  padding-bottom: 4px;
}
.tree-canvas {
  width: 100%; height: 96px;
  display: flex; align-items: flex-end; justify-content: center;
  transition: filter .8s ease, transform .8s cubic-bezier(.34,1.56,.64,1);
  transform-origin: bottom center;
}
.tree-svg {
  width: 100%; height: 100%;
  transform-origin: bottom center;
  animation: sway 4.5s ease-in-out infinite;
}
.tree:nth-child(even) .tree-svg { animation-delay: -2.2s; animation-duration: 5.2s; }
.tree-name { font-size: 11px; text-align: center; margin-top: 2px; line-height: 1.15; opacity: .92; }
.tree-meta { font-size: 9.5px; opacity: .5; margin-top: 1px; height: 12px; }
.tree.watered .tree-meta { opacity: .85; color: #9fe6b0; }

/* свежесть применяется inline (filter) на .tree-canvas */
@keyframes sway {
  0%,100% { transform: rotate(-1.6deg); }
  50%     { transform: rotate(1.6deg); }
}

/* всплеск при поливе */
.tree.just-watered .tree-canvas { animation: pop .8s cubic-bezier(.34,1.56,.64,1); }
@keyframes pop {
  0% { transform: scale(.9); }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
.drop {
  position: absolute; font-size: 18px; pointer-events: none;
  animation: drop .7s ease-out forwards;
}
@keyframes drop { 0%{opacity:1; transform: translateY(-14px);} 100%{opacity:0; transform: translateY(10px);} }

/* модалка заметки */
#overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 10;
}
#overlay.hidden { display: none; }
#note-box {
  background: #14302a; border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px; padding: 18px; width: 100%; max-width: 340px;
}
#note-box h3 { margin: 0 0 4px; font-size: 16px; }
#note-box .hint { font-size: 12px; opacity: .6; margin-bottom: 10px; }
#note-box textarea {
  width: 100%; min-height: 64px; border-radius: 10px; border: 1px solid rgba(255,255,255,.15);
  background: rgba(0,0,0,.25); color: #e8eee6; padding: 9px; font-size: 14px; resize: vertical;
  font-family: inherit;
}
#note-box .row { display: flex; gap: 8px; margin-top: 12px; }
#note-box button {
  flex: 1; padding: 11px; border-radius: 10px; border: none; font-size: 14px; font-weight: 600;
  cursor: pointer;
}
#note-cancel { background: rgba(255,255,255,.10); color: #e8eee6; }
#note-save   { background: #3fae6b; color: #06210f; }

/* тост */
#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 18px);
  transform: translateX(-50%); background: rgba(0,0,0,.78); color: #fff;
  padding: 10px 16px; border-radius: 20px; font-size: 13px; z-index: 20;
  opacity: 0; transition: opacity .3s; pointer-events: none; max-width: 90%; text-align: center;
}
#toast.show { opacity: 1; }

#err { text-align: center; padding: 40px 20px; opacity: .8; font-size: 14px; line-height: 1.5; }
