:root {
  --ink: #1c2f28;
  --ink-soft: #3d5249;
  --jade: #3f6f5c;
  --jade-deep: #2c5344;
  --mist: #c9ddd4;
  --water: #7fa8a0;
  --paper: #eef5f0;
  --foam: rgba(255, 255, 255, 0.55);
  --danger: #9b4d4d;
  --soon: #b07a3a;
  --ok: #3f6f5c;
  --shadow: 0 12px 40px rgba(28, 47, 40, 0.1);
  --radius: 18px;
  --font-brand: "Ma Shan Zheng", "Noto Serif SC", serif;
  --font-serif: "Noto Serif SC", "Songti SC", serif;
  --font-sans: "Noto Sans SC", "PingFang SC", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #d7ebe3 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #b9d2cb 0%, transparent 50%),
    linear-gradient(165deg, #dcece5 0%, #c2d8cf 42%, #aec9c0 100%);
  background-attachment: fixed;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.mist {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 28%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cpath fill='%233f6f5c' fill-opacity='0.035' d='M0 120c20-10 40 10 60 0s40-10 60 0 40 10 60 0v40H0z'/%3E%3C/svg%3E");
  opacity: 0.9;
  z-index: 0;
}

.ripple {
  pointer-events: none;
  position: fixed;
  width: 280px;
  height: 280px;
  right: -40px;
  bottom: 12vh;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.35) 0%, transparent 68%);
  animation: drift 12s ease-in-out infinite alternate;
  z-index: 0;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-30px, -24px, 0) scale(1.08); }
}

.top,
.shell,
.sheet {
  position: relative;
  z-index: 1;
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.4rem 1.25rem 0.6rem;
  max-width: 920px;
  margin: 0 auto;
  animation: rise 0.7s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.brand-mark {
  margin: 0;
  font-family: var(--font-brand);
  font-size: clamp(2.4rem, 8vw, 3.2rem);
  line-height: 1;
  color: var(--jade-deep);
  letter-spacing: 0.04em;
}

.brand-sub {
  margin: 0.35rem 0 0;
  font-family: var(--font-serif);
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 0.5rem 1.1rem 5rem;
  animation: rise 0.85s ease 0.08s both;
}

.panel.today {
  padding: 1.1rem 1.15rem 1.2rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.62), rgba(239, 247, 243, 0.45));
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.panel-title,
.view-head h2,
.cal-head h2,
.ai-intro h2,
.sheet-head h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--jade-deep);
}

.panel-desc {
  margin: 0.4rem 0 0.8rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  border: 0;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font: inherit;
  font-size: 0.88rem;
  background: rgba(63, 111, 92, 0.12);
  color: var(--jade-deep);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.chip:hover,
.chip:focus-visible {
  transform: translateY(-1px);
  background: rgba(63, 111, 92, 0.2);
  outline: none;
}

.chip.overdue { background: rgba(155, 77, 77, 0.16); color: var(--danger); }
.chip.today { background: rgba(63, 111, 92, 0.22); }
.chip.soon { background: rgba(176, 122, 58, 0.18); color: #7a5224; }

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin: 1rem 0 1.1rem;
  padding: 0.3rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.35);
}

.tab {
  border: 0;
  border-radius: 11px;
  padding: 0.65rem 0.4rem;
  font: inherit;
  font-family: var(--font-serif);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}

.tab.active {
  background: rgba(255, 255, 255, 0.78);
  color: var(--jade-deep);
  box-shadow: 0 4px 14px rgba(28, 47, 40, 0.08);
}

.view { display: none; }
.view.active { display: block; }

.view-head,
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.plant-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

@media (min-width: 700px) {
  .plant-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.plant-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 0.85rem;
  padding: 0.85rem;
  border-radius: var(--radius);
  background: var(--foam);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 8px 24px rgba(28, 47, 40, 0.06);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: rise 0.5s ease both;
}

.plant-card:hover,
.plant-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(28, 47, 40, 0.12);
  outline: none;
}

.cover {
  width: 88px;
  height: 88px;
  border-radius: 14px;
  object-fit: cover;
  background:
    linear-gradient(145deg, #9bb8ad, #6f9485);
}

.cover.placeholder {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-brand);
  font-size: 1.8rem;
}

.plant-meta h3 {
  margin: 0 0 0.2rem;
  font-family: var(--font-serif);
  font-size: 1.08rem;
}

.plant-meta p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.status {
  display: inline-block;
  margin-top: 0.45rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  background: rgba(63, 111, 92, 0.12);
  color: var(--ok);
}

.status.overdue { background: rgba(155, 77, 77, 0.14); color: var(--danger); }
.status.today { background: rgba(63, 111, 92, 0.2); }
.status.soon { background: rgba(176, 122, 58, 0.16); color: var(--soon); }

.empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 2rem 1rem;
  font-family: var(--font-serif);
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:active { transform: scale(0.97); }
.btn.primary {
  background: linear-gradient(135deg, var(--jade), var(--jade-deep));
  color: #f4faf7;
}
.btn.soft {
  background: rgba(63, 111, 92, 0.14);
  color: var(--jade-deep);
}
.btn.ghost {
  background: rgba(255, 255, 255, 0.45);
  color: var(--jade-deep);
  min-width: 2.4rem;
}
.btn.danger {
  background: rgba(155, 77, 77, 0.12);
  color: var(--danger);
}

.cal-weekdays,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.35rem;
}

.cal-weekdays {
  margin-bottom: 0.4rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-family: var(--font-serif);
}

.cal-cell {
  aspect-ratio: 1;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.35);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  position: relative;
}

.cal-cell.muted { opacity: 0.35; cursor: default; }
.cal-cell.is-today {
  box-shadow: inset 0 0 0 2px rgba(63, 111, 92, 0.55);
}
.cal-cell.has-event {
  background: rgba(63, 111, 92, 0.16);
  font-weight: 600;
}
.cal-cell.selected {
  background: var(--jade);
  color: #f4faf7;
}

.cal-cell .mark {
  position: absolute;
  bottom: 6px;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--jade-deep);
  transform: translateX(-50%);
}

.cal-cell.selected .mark { background: #e7f4ee; }

.cal-legend {
  display: flex;
  gap: 1rem;
  margin: 0.85rem 0 0.4rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.3rem;
  vertical-align: middle;
}
.dot.due { background: var(--jade); }
.dot.today { box-shadow: inset 0 0 0 2px var(--jade); background: transparent; }

.cal-events {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.cal-events li {
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  font-size: 0.92rem;
}

.ai-intro {
  margin-bottom: 0.9rem;
}

.ai-intro h2 {
  margin-bottom: 0.65rem;
}

.ai-intro select,
.sheet input,
.sheet textarea {
  width: 100%;
  margin-top: 0.35rem;
  border: 1px solid rgba(63, 111, 92, 0.22);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  font: inherit;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.ai-chat {
  min-height: 220px;
  max-height: 42vh;
  overflow: auto;
  display: grid;
  gap: 0.65rem;
  padding: 0.85rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.42);
  margin-bottom: 0.75rem;
}

.bubble {
  max-width: 92%;
  padding: 0.7rem 0.9rem;
  border-radius: 14px;
  white-space: pre-wrap;
  font-size: 0.92rem;
}

.bubble.bot {
  justify-self: start;
  background: rgba(63, 111, 92, 0.12);
  border-top-left-radius: 4px;
}

.bubble.user {
  justify-self: end;
  background: rgba(255, 255, 255, 0.75);
  border-top-right-radius: 4px;
}

.ai-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
}

.sheet {
  border: 0;
  border-radius: 22px 22px 0 0;
  padding: 0;
  width: min(100vw, 520px);
  max-height: 92vh;
  margin: auto auto 0;
  background: linear-gradient(180deg, #f4faf7, #e5f0ea);
  box-shadow: 0 -10px 40px rgba(28, 47, 40, 0.18);
}

.sheet::backdrop {
  background: rgba(28, 47, 40, 0.35);
  backdrop-filter: blur(3px);
}

.sheet-inner {
  padding: 1rem 1.1rem 1.4rem;
  display: grid;
  gap: 0.75rem;
  overflow: auto;
  max-height: 92vh;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet label {
  display: grid;
  gap: 0.15rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.3rem;
}

.photo-label {
  margin: 0 0 0.45rem;
  font-family: var(--font-serif);
  color: var(--jade-deep);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.photo-grid figure {
  margin: 0;
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
}

.photo-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-grid button {
  position: absolute;
  top: 4px;
  right: 4px;
  border: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: rgba(28, 47, 40, 0.55);
  color: #fff;
  cursor: pointer;
}

.upload-btn {
  display: inline-flex !important;
  justify-content: center;
  align-items: center;
  padding: 0.7rem;
  border-radius: 12px;
  border: 1px dashed rgba(63, 111, 92, 0.4);
  background: rgba(255, 255, 255, 0.45);
  color: var(--jade-deep);
  cursor: pointer;
}

@media (min-width: 640px) {
  .sheet {
    border-radius: 22px;
    margin: auto;
  }
}

/* —— 详情页 —— */
.page-detail {
  position: relative;
  z-index: 2;
  max-width: 920px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 2.5rem;
  animation: rise 0.45s ease both;
  touch-action: pan-y;
}

.detail-top {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1rem 1.1rem 0.75rem;
}

.detail-top-text {
  flex: 1;
  min-width: 0;
}

.detail-top-text h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--jade-deep);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-top-text p {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.album-wrap {
  margin: 0 1.1rem;
}

.album-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.album-hint {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
  font-family: var(--font-serif);
}

.btn-add-photo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.album {
  display: grid;
  gap: 1rem;
}

.album-empty {
  padding: 2.2rem 1rem;
  text-align: center;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.42);
  color: var(--ink-soft);
  font-family: var(--font-serif);
}

.album-day {
  padding: 0.85rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.album-day-title {
  margin: 0 0 0.65rem;
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--jade-deep);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.album-day-title span {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-weight: 400;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
}

.album-thumb {
  position: relative;
  aspect-ratio: 1;
  border: 0;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: linear-gradient(145deg, #9bb8ad, #6f9485);
}

.album-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.album-thumb:hover img,
.album-thumb:focus-visible img {
  transform: scale(1.04);
}

.lightbox {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #0f1a16;
}

.lightbox[open] {
  display: grid;
  grid-template-rows: 1fr auto;
  padding-top: env(safe-area-inset-top, 0px);
  /* 预留手机浏览器底栏，避免日期/页码被挡住 */
  padding-bottom: max(4.5rem, calc(1.2rem + env(safe-area-inset-bottom, 0px)));
}

.lightbox::backdrop {
  background: #0f1a16;
}

.lightbox-close {
  position: fixed;
  top: calc(0.75rem + env(safe-area-inset-top, 0px));
  right: calc(0.75rem + env(safe-area-inset-right, 0px));
  z-index: 3;
  border: 0;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  color: var(--jade-deep);
  font-size: 1.35rem;
  cursor: pointer;
}

.lightbox-stage {
  touch-action: none;
  overflow: hidden;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #0f1a16;
  display: grid;
  place-items: center;
}

.lightbox-stage img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: 0 0;
  will-change: transform;
  transition: none;
}

.lightbox-cap {
  margin: 0;
  padding: 0.7rem 1rem 0.85rem;
  text-align: center;
  color: rgba(232, 243, 238, 0.95);
  font-size: 0.95rem;
  line-height: 1.4;
  background: #0f1a16;
}

.detail-body {
  padding: 1.1rem 1.25rem 0;
}

.detail-status {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.86rem;
  background: rgba(63, 111, 92, 0.14);
  color: var(--ok);
  margin-bottom: 0.85rem;
}

.detail-status.overdue { background: rgba(155, 77, 77, 0.14); color: var(--danger); }
.detail-status.today { background: rgba(63, 111, 92, 0.22); }
.detail-status.soon { background: rgba(176, 122, 58, 0.16); color: var(--soon); }

.detail-facts {
  margin: 0;
  display: grid;
  gap: 0.55rem;
  padding: 0.95rem 1rem;
  border-radius: var(--radius);
  background: var(--foam);
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.detail-facts div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.92rem;
}

.detail-facts dt {
  margin: 0;
  color: var(--ink-soft);
}

.detail-facts dd {
  margin: 0;
  font-family: var(--font-serif);
  color: var(--jade-deep);
  text-align: right;
}

.detail-notes {
  margin: 0.85rem 0 0;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.4);
  color: var(--ink-soft);
  font-size: 0.92rem;
  white-space: pre-wrap;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 1.15rem;
}

.detail-actions .btn {
  padding: 0.75rem 1rem;
}

